Skip to content

Commit

Permalink
Added an Utility that insert data from Lalon.js file into a MySql Dat…
Browse files Browse the repository at this point in the history
…abase.

Added a CredentialRequired form for MySql database credential in which you can select your database in which store info. MySqlDataSource is under checking for all functions..
  • Loading branch information
pillastefano committed Mar 21, 2010
1 parent 052bd64 commit a3da2e2
Show file tree
Hide file tree
Showing 18 changed files with 2,651 additions and 419 deletions.
29 changes: 17 additions & 12 deletions src/freimapgsoc/CheckActiveDataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,12 @@
*/
package freimapgsoc;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.ResultSet;
import com.mysql.jdbc.Statement;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URL;
import java.net.URLConnection;
import java.net.UnknownHostException;
import java.sql.DriverManager;

/**
*
Expand All @@ -39,10 +30,24 @@ public CheckActiveDataSource() {
}

public boolean check_mysql() {
try {
InetAddress addr = InetAddress.getByName("localhost");
int port = 3306;

// This constructor will block until the connection succeeds
Socket socket = new Socket(addr, port);
if (socket.isConnected()){
return true;
}else if (!socket.isConnected()){
return false;
}

} catch (UnknownHostException e) {
} catch (IOException io){

return true;
}
return false;
}

public boolean check_olsr() {

Expand Down Expand Up @@ -90,12 +95,12 @@ public String[] getActiveDataSource(){
}

public String[] ActiveDataSources;

/*
public static void main(String arg[]) {
CheckActiveDataSource check = new CheckActiveDataSource();
System.out.println(check.check_olsr());
System.out.println(check.check_nameservice());
}

*/
}

302 changes: 302 additions & 0 deletions src/freimapgsoc/CredentialRequired.form

Large diffs are not rendered by default.

372 changes: 372 additions & 0 deletions src/freimapgsoc/CredentialRequired.java

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/freimapgsoc/DataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public interface DataSource {
@param time ignored in current implementations.
@return A Hashtable mapping Node IDs to a float value between 0 and 1.
*/
public Hashtable<String, Float> getNodeAvailability(long time);// {
public HashMap<String, Float> getNodeAvailability(long time);// {
// return null;
// }

Expand Down
4 changes: 2 additions & 2 deletions src/freimapgsoc/LatLonJsDataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ public void getLinkProfile(Link link, LinkInfo info) {
info.setLinkProfile(new LinkedList<LinkData>());
}

public Hashtable<String, Float> getNodeAvailability(long time) {
public HashMap<String, Float> getNodeAvailability(long time) {
// TODO: Implement me.
return new Hashtable<String, Float>();
return new HashMap<String, Float>();
}

public Vector<Link> getLinksFromSource(String sourceid) {
Expand Down
422 changes: 422 additions & 0 deletions src/freimapgsoc/LatLonJsToMySQL.form

Large diffs are not rendered by default.

921 changes: 921 additions & 0 deletions src/freimapgsoc/LatLonJsToMySQL.java

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion src/freimapgsoc/Link.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ public class Link {
public Link() {
}

public Link(String sourceIP, String destIP, float lq, float nlq) {
this.sourceIP = sourceIP;
this.destIP = destIP;
this.lq = lq;
this.nlq = nlq;
}

public Link(MapNode source, MapNode dest, float lq, float nlq, boolean HNA) {
this.source = source;
this.dest = dest;
this.lq = lq;
this.nlq = nlq;
this.HNA = HNA;

}

public Link(MapNode source, MapNode dest){
Expand Down Expand Up @@ -70,6 +76,9 @@ public boolean equals(Object o) {
public String toString() {
return source + " -> " + dest;
}

public String sourceIP;
public String destIP;
public MapNode source;
public MapNode dest;
public boolean HNA;
Expand Down
27 changes: 19 additions & 8 deletions src/freimapgsoc/MainLayer.form
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,6 @@
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[1252, 700]"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
Expand Down Expand Up @@ -881,7 +878,7 @@
</Component>
<Component class="javax.swing.JComboBox" name="ipComboBox">
<Properties>
<Property name="font" type="java.awt.Font" noResource="true" editor="org.netbeans.beaninfo.editors.FontEditor">
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="12" style="0"/>
</Property>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
Expand Down Expand Up @@ -961,7 +958,7 @@
</Component>
<Component class="javax.swing.JLabel" name="rtxPos">
<Properties>
<Property name="font" type="java.awt.Font" noResource="true" editor="org.netbeans.beaninfo.editors.FontEditor">
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="10" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="X:"/>
Expand Down Expand Up @@ -997,7 +994,7 @@
</Component>
<Component class="javax.swing.JLabel" name="rtLatValue">
<Properties>
<Property name="font" type="java.awt.Font" noResource="true" editor="org.netbeans.beaninfo.editors.FontEditor">
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="10" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="V"/>
Expand Down Expand Up @@ -1053,7 +1050,7 @@
<LineBorder/>
</Border>
</Property>
<Property name="font" type="java.awt.Font" noResource="true" editor="org.netbeans.beaninfo.editors.FontEditor">
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="10" style="0"/>
</Property>
<Property name="name" type="java.lang.String" value="mainMap" noResource="true"/>
Expand All @@ -1077,7 +1074,7 @@
<LineBorder/>
</Border>
</Property>
<Property name="font" type="java.awt.Font" noResource="true" editor="org.netbeans.beaninfo.editors.FontEditor">
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="10" style="0"/>
</Property>
<Property name="name" type="java.lang.String" value="miniMap" noResource="true"/>
Expand Down Expand Up @@ -1157,6 +1154,20 @@
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="hoverLabel">
<Properties>
<Property name="font" type="java.awt.Font" noResource="true" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Lucida Grande" size="12" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value=" "/>
<Property name="name" type="java.lang.String" value="hoverLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="150" y="140" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</SubComponents>
Expand Down
Loading

0 comments on commit a3da2e2

Please sign in to comment.