Author: tullyvey
Date: 2007-06-12 02:14:54 +0000 (Tue, 12 Jun 2007)
New Revision: 13527
Modified:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/FcpConnection.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/FreenetClient.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeAddress.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeInfo.java
Log:
Updated comments. Fixed DEFAULT_PORT in NodeAddress.
Modified: trunk/apps/jfcp/src/org/freenet/contrib/fcp/FcpConnection.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/FcpConnection.java
2007-06-12 01:56:18 UTC (rev 13526)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/FcpConnection.java
2007-06-12 02:14:54 UTC (rev 13527)
@@ -24,7 +24,8 @@
/**
* Responsible for sending data to the node.
- * @author res
+ *
+ * @author Ralph Smithen
*/
public class FcpConnection {
private static Logger logger =
Logger.getLogger(FcpConnection.class.getName());
Modified: trunk/apps/jfcp/src/org/freenet/contrib/fcp/FreenetClient.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/FreenetClient.java
2007-06-12 01:56:18 UTC (rev 13526)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/FreenetClient.java
2007-06-12 02:14:54 UTC (rev 13527)
@@ -14,8 +14,9 @@
import org.freenet.contrib.fcp.message.client.ListPeers;
/**
- *
- * @author res
+ * The main class of the library, start here!
+ * Note that the api may be subject to change.
+ * @author Ralph Smithen
*/
public class FreenetClient{
private static String DEFAULT_CLIENT_NAME = "FreenetClient";
@@ -23,34 +24,63 @@
private FcpEventSource _eventSource;
private FcpConnection _conn;
+ /**
+ * Creates a new client called "FreenetClient" that will attempt to
connect
+ * to 127.0.0.1:9481.
+ */
public FreenetClient(){
this(new NodeAddress(), DEFAULT_CLIENT_NAME);
}
+ /**
+ * Creates a named client that attempts to connect to 127.0.0.1:9481.
+ * @param name the name of the client
+ */
public FreenetClient(String name){
this(new NodeAddress(), name);
}
- /** Creates a new instance of FreenetClient */
+ /**
+ * Creates a new instance of FreenetClient
+ * @param na where to connect
+ * @param name how the client's identified by the node
+ */
public FreenetClient(NodeAddress na, String name) {
_eventSupport = new FcpEventSupportRepository();
_eventSource = new FcpEventSource(_eventSupport);
_conn = new FcpConnection(na, _eventSupport, name);
}
+ /**
+ * Returns an object by which interested classes can register to listen
+ * for incoming message events.
+ * @return teh event source
+ */
public FcpEventSource getEventSource(){
return _eventSource;
}
+ /**
+ * Get the client's connection to manipulate.
+ * @return the conn
+ */
public FcpConnection getConnection() {
return _conn;
}
+ /**
+ * Request the peer data from node.
+ */
public void refreshPeerList(){
_conn.sendMessage(new ListPeers(true, true));
}
+ /**
+ * Request data from node.
+ * @param uri the key, e.g. CHK at blah
+ * @param id an identifier for use in your app
+ */
public void get(String uri, String id){
ClientGet message = new ClientGet(uri, id);
message.setVerbosity(1);
@@ -58,6 +88,10 @@
_conn.sendMessage(message);
}
+ /**
+ * Will probably change
+ * @param id an id for your convenience
+ */
public void generateSSK(String id){
_conn.sendMessage(new GenerateSSK(id));
}
Modified: trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeAddress.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeAddress.java
2007-06-12 01:56:18 UTC (rev 13526)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeAddress.java
2007-06-12 02:14:54 UTC (rev 13527)
@@ -8,10 +8,10 @@
/**
*
- * @author res
+ * @author Ralph Smithen
*/
public class NodeAddress extends InetSocketAddress{
- public static int DEFAULT_PORT = 9482;
+ public static int DEFAULT_PORT = 9481;
public static String DEFAULT_HOST = "127.0.0.1";
/** Creates a new instance of NodeAddress */
Modified: trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeInfo.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeInfo.java 2007-06-12
01:56:18 UTC (rev 13526)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeInfo.java 2007-06-12
02:14:54 UTC (rev 13527)
@@ -7,8 +7,8 @@
import org.freenet.contrib.fcp.message.node.Peer;
/**
- *
- * @author res
+ * Holds data associated with a node or peer.
+ * @author Ralph Smithen
*/
public class NodeInfo {
private String _fcpVersion;
@@ -38,6 +38,10 @@
public NodeInfo() {
}
+ /**
+ * Instantiates NodeInfo from Peer.
+ * @param p the peer
+ */
public NodeInfo(Peer p){
_lastGoodVersion=p.getLastGoodVersion();
_physicalUdp=p.getPhysicalUdp();
@@ -54,14 +58,26 @@
_testNet=p.isTestnet();
}
+ /**
+ * Get the version of FCP for this node.
+ * @return the FCP version
+ */
public String getFcpVersion() {
return _fcpVersion;
}
+ /**
+ * Sets teh FCP version
+ * @param fcpVersion the FCP version, e.g. "2.0"
+ */
public void setFcpVersion(String fcpVersion) {
this._fcpVersion = fcpVersion;
}
+ /**
+ * Get Fred version
+ * @return the version of Fred
+ */
public String getVersion() {
return _version;
}