Author: tullyvey
Date: 2007-06-12 01:56:18 +0000 (Tue, 12 Jun 2007)
New Revision: 13526
Added:
trunk/apps/jfcp/build.xml
trunk/apps/jfcp/nbproject/
trunk/apps/jfcp/nbproject/build-impl.xml
trunk/apps/jfcp/nbproject/genfiles.properties
trunk/apps/jfcp/nbproject/project.properties
trunk/apps/jfcp/nbproject/project.xml
trunk/apps/jfcp/src/
trunk/apps/jfcp/src/org/
trunk/apps/jfcp/src/org/freenet/
trunk/apps/jfcp/src/org/freenet/contrib/
trunk/apps/jfcp/src/org/freenet/contrib/fcp/
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
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/AllDataEvent.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/DataFoundEvent.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpConnectEvent.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpDisconnectEvent.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpEvent.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpKeyRequestedEvent.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpPeerListUpdatedEvent.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpSimpleProgressEvent.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/GetFailedEvent.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/SSKKeypairEvent.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/AbstractFcpEventSupport.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpConnectionEventSupport.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpEventSource.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpEventSupportRepository.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpPeerListEventSupport.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpQueueEventSupport.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpConnectionListener.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpPeerListListener.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpQueueListener.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpSSKKeypairListener.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/FcpMessage.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/MessageBuilderException.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ClientGet.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ClientHello.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ClientMessage.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/GenerateSSK.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ListPeers.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ShutDown.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/AllData.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/DataFound.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/DataHoldingMessage.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/EndListPeers.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/GetFailed.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/IdentifierCollision.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/NodeHello.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/NodeMessage.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/NodeMessageBuilder.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/Peer.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/PeerMetaData.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/PeerVolatileData.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/SSKKeypair.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/SimpleProgress.java
trunk/apps/jfcp/src/org/freenet/contrib/fcp/package.html
trunk/apps/jfcp/test/
Modified:
trunk/apps/jfcp/
Log:
first import
Property changes on: trunk/apps/jfcp
___________________________________________________________________
Name: svn:ignore
+ dist
build
Added: trunk/apps/jfcp/build.xml
===================================================================
--- trunk/apps/jfcp/build.xml (rev 0)
+++ trunk/apps/jfcp/build.xml 2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<project name="FreenetClient" default="default" basedir=".">
+ <description>Builds, tests, and runs the project
FreenetClient.</description>
+ <import file="nbproject/build-impl.xml"/>
+ <!--
+
+ There exist several targets which are by default empty and which can be
+ used for execution of your tasks. These targets are usually executed
+ before and after some main targets. They are:
+
+ -pre-init: called before initialization of project
properties
+ -post-init: called after initialization of project
properties
+ -pre-compile: called before javac compilation
+ -post-compile: called after javac compilation
+ -pre-compile-single: called before javac compilation of single file
+ -post-compile-single: called after javac compilation of single file
+ -pre-compile-test: called before javac compilation of JUnit tests
+ -post-compile-test: called after javac compilation of JUnit tests
+ -pre-compile-test-single: called before javac compilation of single
JUnit test
+ -post-compile-test-single: called after javac compilation of single
JUunit test
+ -pre-jar: called before JAR building
+ -post-jar: called after JAR building
+ -post-clean: called after cleaning build products
+
+ (Targets beginning with '-' are not intended to be called on their own.)
+
+ Example of inserting an obfuscator after compilation could look like this:
+
+ <target name="-post-compile">
+ <obfuscate>
+ <fileset dir="${build.classes.dir}"/>
+ </obfuscate>
+ </target>
+
+ For list of available properties check the imported
+ nbproject/build-impl.xml file.
+
+
+ Another way to customize the build is by overriding existing main targets.
+ The targets of interest are:
+
+ -init-macrodef-javac: defines macro for javac compilation
+ -init-macrodef-junit: defines macro for junit execution
+ -init-macrodef-debug: defines macro for class debugging
+ -init-macrodef-java: defines macro for class execution
+ -do-jar-with-manifest: JAR building (if you are using a manifest)
+ -do-jar-without-manifest: JAR building (if you are not using a manifest)
+ run: execution of project
+ -javadoc-build: Javadoc generation
+ test-report: JUnit report generation
+
+ An example of overriding the target for project execution could look like
this:
+
+ <target name="run" depends="FreenetClient-impl.jar">
+ <exec dir="bin" executable="launcher.exe">
+ <arg file="${dist.jar}"/>
+ </exec>
+ </target>
+
+ Notice that the overridden target depends on the jar target and not only
on
+ the compile target as the regular run target does. Again, for a list of
available
+ properties which you can use, check the target you are overriding in the
+ nbproject/build-impl.xml file.
+
+ -->
+</project>
Added: trunk/apps/jfcp/nbproject/build-impl.xml
===================================================================
--- trunk/apps/jfcp/nbproject/build-impl.xml (rev 0)
+++ trunk/apps/jfcp/nbproject/build-impl.xml 2007-06-12 01:56:18 UTC (rev
13526)
@@ -0,0 +1,541 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT ***
+*** EDIT ../build.xml INSTEAD ***
+
+For the purpose of easier reading the script
+is divided into following sections:
+
+ - initialization
+ - compilation
+ - jar
+ - execution
+ - debugging
+ - javadoc
+ - junit compilation
+ - junit execution
+ - junit debugging
+ - applet
+ - cleanup
+
+-->
+<project name="FreenetClient-impl" default="default" basedir=".."
xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3"
xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2"
xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1"
xmlns:jaxws="http://www.netbeans.org/ns/jax-ws/1">
+ <target name="default" depends="test,jar,javadoc" description="Build and
test whole project."/>
+ <!--
+ ======================
+ INITIALIZATION SECTION
+ ======================
+ -->
+ <target name="-pre-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-init-private" depends="-pre-init">
+ <property file="nbproject/private/private.properties"/>
+ </target>
+ <target name="-init-user" depends="-pre-init,-init-private">
+ <property file="${user.properties.file}"/>
+ <!-- The two properties below are usually overridden -->
+ <!-- by the active platform. Just a fallback. -->
+ <property name="default.javac.source" value="1.4"/>
+ <property name="default.javac.target" value="1.4"/>
+ </target>
+ <target name="-init-project" depends="-pre-init,-init-private,-init-user">
+ <property file="nbproject/project.properties"/>
+ </target>
+ <target name="-do-init"
depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
+ <available file="${manifest.file}" property="manifest.available"/>
+ <condition property="manifest.available+main.class">
+ <and>
+ <isset property="manifest.available"/>
+ <isset property="main.class"/>
+ <not>
+ <equals arg1="${main.class}" arg2="" trim="true"/>
+ </not>
+ </and>
+ </condition>
+ <condition property="manifest.available+main.class+mkdist.available">
+ <and>
+ <istrue value="${manifest.available+main.class}"/>
+ <isset property="libs.CopyLibs.classpath"/>
+ </and>
+ </condition>
+ <condition property="have.tests">
+ <or>
+ <available file="${test.src.dir}"/>
+ </or>
+ </condition>
+ <condition property="have.sources">
+ <or>
+ <available file="${src.dir}"/>
+ </or>
+ </condition>
+ <condition property="netbeans.home+have.tests">
+ <and>
+ <isset property="netbeans.home"/>
+ <isset property="have.tests"/>
+ </and>
+ </condition>
+ <condition property="no.javadoc.preview">
+ <isfalse value="${javadoc.preview}"/>
+ </condition>
+ <property name="run.jvmargs" value=""/>
+ <property name="javac.compilerargs" value=""/>
+ <property name="work.dir" value="${basedir}"/>
+ <condition property="no.deps">
+ <and>
+ <istrue value="${no.dependencies}"/>
+ </and>
+ </condition>
+ <property name="javac.debug" value="true"/>
+ <property name="javadoc.preview" value="true"/>
+ </target>
+ <target name="-post-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-init-check"
depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
+ <fail unless="src.dir">Must set src.dir</fail>
+ <fail unless="test.src.dir">Must set test.src.dir</fail>
+ <fail unless="build.dir">Must set build.dir</fail>
+ <fail unless="dist.dir">Must set dist.dir</fail>
+ <fail unless="build.classes.dir">Must set build.classes.dir</fail>
+ <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
+ <fail unless="build.test.classes.dir">Must set
build.test.classes.dir</fail>
+ <fail unless="build.test.results.dir">Must set
build.test.results.dir</fail>
+ <fail unless="build.classes.excludes">Must set
build.classes.excludes</fail>
+ <fail unless="dist.jar">Must set dist.jar</fail>
+ </target>
+ <target name="-init-macrodef-property">
+ <macrodef name="property"
uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute name="name"/>
+ <attribute name="value"/>
+ <sequential>
+ <property name="@{name}" value="${@{value}}"/>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-javac">
+ <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute name="srcdir" default="${src.dir}"/>
+ <attribute name="destdir" default="${build.classes.dir}"/>
+ <attribute name="classpath" default="${javac.classpath}"/>
+ <attribute name="debug" default="${javac.debug}"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <javac srcdir="@{srcdir}" destdir="@{destdir}"
debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}"
target="${javac.target}" includeantruntime="false">
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <compilerarg line="${javac.compilerargs}"/>
+ <customize/>
+ </javac>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-junit">
+ <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute name="includes" default="**/*Test.java"/>
+ <sequential>
+ <junit showoutput="true" fork="true" dir="${basedir}"
failureproperty="tests.failed" errorproperty="tests.failed">
+ <batchtest todir="${build.test.results.dir}">
+ <fileset dir="${test.src.dir}" includes="@{includes}"/>
+ </batchtest>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper type="glob" from="test-sys-prop.*" to="*"/>
+ </syspropertyset>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ <jvmarg line="${run.jvmargs}"/>
+ </junit>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-nbjpda">
+ <macrodef name="nbjpdastart"
uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute name="name" default="${main.class}"/>
+ <attribute name="classpath" default="${debug.classpath}"/>
+ <attribute name="stopclassname" default=""/>
+ <sequential>
+ <nbjpdastart transport="dt_socket"
addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ </nbjpdastart>
+ </sequential>
+ </macrodef>
+ <macrodef name="nbjpdareload"
uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute name="dir" default="${build.classes.dir}"/>
+ <sequential>
+ <nbjpdareload>
+ <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
+ </nbjpdareload>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-debug">
+ <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute name="classname" default="${main.class}"/>
+ <attribute name="classpath" default="${debug.classpath}"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <java fork="true" classname="@{classname}" dir="${work.dir}">
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/>
+ <jvmarg value="-Djava.compiler=none"/>
+ <jvmarg
value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
+ <jvmarg line="${run.jvmargs}"/>
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="run-sys-prop."/>
+ <mapper type="glob" from="run-sys-prop.*" to="*"/>
+ </syspropertyset>
+ <customize/>
+ </java>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-java">
+ <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute name="classname" default="${main.class}"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <java fork="true" classname="@{classname}" dir="${work.dir}">
+ <jvmarg line="${run.jvmargs}"/>
+ <classpath>
+ <path path="${run.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="run-sys-prop."/>
+ <mapper type="glob" from="run-sys-prop.*" to="*"/>
+ </syspropertyset>
+ <customize/>
+ </java>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-presetdef-jar">
+ <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <jar jarfile="${dist.jar}" compress="${jar.compress}">
+ <j2seproject1:fileset dir="${build.classes.dir}"/>
+ </jar>
+ </presetdef>
+ </target>
+ <target name="init"
depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar"/>
+ <!--
+ ===================
+ COMPILATION SECTION
+ ===================
+ -->
+ <target name="deps-jar" depends="init" unless="no.deps"/>
+ <target name="-pre-pre-compile" depends="init,deps-jar">
+ <mkdir dir="${build.classes.dir}"/>
+ </target>
+ <target name="-pre-compile">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-do-compile"
depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
+ <j2seproject3:javac/>
+ <copy todir="${build.classes.dir}">
+ <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
+ </copy>
+ </target>
+ <target name="-post-compile">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="compile"
depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile"
description="Compile project."/>
+ <target name="-pre-compile-single">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
+ <fail unless="javac.includes">Must select some files in the IDE or set
javac.includes</fail>
+ <j2seproject3:javac>
+ <customize>
+ <patternset includes="${javac.includes}"/>
+ </customize>
+ </j2seproject3:javac>
+ </target>
+ <target name="-post-compile-single">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="compile-single"
depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
+ <!--
+ ====================
+ JAR BUILDING SECTION
+ ====================
+ -->
+ <target name="-pre-pre-jar" depends="init">
+ <dirname property="dist.jar.dir" file="${dist.jar}"/>
+ <mkdir dir="${dist.jar.dir}"/>
+ </target>
+ <target name="-pre-jar">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-do-jar-without-manifest"
depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
+ <j2seproject1:jar/>
+ </target>
+ <target name="-do-jar-with-manifest"
depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available"
unless="manifest.available+main.class">
+ <j2seproject1:jar manifest="${manifest.file}"/>
+ </target>
+ <target name="-do-jar-with-mainclass"
depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class"
unless="manifest.available+main.class+mkdist.available">
+ <j2seproject1:jar manifest="${manifest.file}">
+ <j2seproject1:manifest>
+ <j2seproject1:attribute name="Main-Class"
value="${main.class}"/>
+ </j2seproject1:manifest>
+ </j2seproject1:jar>
+ <echo>To run this application from the command line without Ant,
try:</echo>
+ <property name="build.classes.dir.resolved"
location="${build.classes.dir}"/>
+ <property name="dist.jar.resolved" location="${dist.jar}"/>
+ <pathconvert property="run.classpath.with.dist.jar">
+ <path path="${run.classpath}"/>
+ <map from="${build.classes.dir.resolved}"
to="${dist.jar.resolved}"/>
+ </pathconvert>
+ <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
+ </target>
+ <target name="-do-jar-with-libraries"
depends="init,compile,-pre-pre-jar,-pre-jar"
if="manifest.available+main.class+mkdist.available">
+ <property name="build.classes.dir.resolved"
location="${build.classes.dir}"/>
+ <pathconvert property="run.classpath.without.build.classes.dir">
+ <path path="${run.classpath}"/>
+ <map from="${build.classes.dir.resolved}" to=""/>
+ </pathconvert>
+ <pathconvert property="jar.classpath" pathsep=" ">
+ <path path="${run.classpath.without.build.classes.dir}"/>
+ <chainedmapper>
+ <flattenmapper/>
+ <globmapper from="*" to="lib/*"/>
+ </chainedmapper>
+ </pathconvert>
+ <taskdef
classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs"
name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
+ <copylibs manifest="${manifest.file}"
runtimeclasspath="${run.classpath.without.build.classes.dir}"
jarfile="${dist.jar}" compress="${jar.compress}">
+ <fileset dir="${build.classes.dir}"/>
+ <manifest>
+ <attribute name="Main-Class" value="${main.class}"/>
+ <attribute name="Class-Path" value="${jar.classpath}"/>
+ </manifest>
+ </copylibs>
+ <echo>To run this application from the command line without Ant,
try:</echo>
+ <property name="dist.jar.resolved" location="${dist.jar}"/>
+ <echo>java -jar "${dist.jar.resolved}"</echo>
+ </target>
+ <target name="-post-jar">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="jar"
depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar"
description="Build JAR."/>
+ <!--
+ =================
+ EXECUTION SECTION
+ =================
+ -->
+ <target name="run" depends="init,compile" description="Run a main class.">
+ <j2seproject1:java>
+ <customize>
+ <arg line="${application.args}"/>
+ </customize>
+ </j2seproject1:java>
+ </target>
+ <target name="run-single" depends="init,compile-single">
+ <fail unless="run.class">Must select one file in the IDE or set
run.class</fail>
+ <j2seproject1:java classname="${run.class}"/>
+ </target>
+ <!--
+ =================
+ DEBUGGING SECTION
+ =================
+ -->
+ <target name="-debug-start-debugger" if="netbeans.home" depends="init">
+ <j2seproject1:nbjpdastart name="${debug.class}"/>
+ </target>
+ <target name="-debug-start-debuggee" depends="init,compile">
+ <j2seproject3:debug>
+ <customize>
+ <arg line="${application.args}"/>
+ </customize>
+ </j2seproject3:debug>
+ </target>
+ <target name="debug" if="netbeans.home"
depends="init,compile,-debug-start-debugger,-debug-start-debuggee"
description="Debug project in IDE."/>
+ <target name="-debug-start-debugger-stepinto" if="netbeans.home"
depends="init">
+ <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
+ </target>
+ <target name="debug-stepinto" if="netbeans.home"
depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
+ <target name="-debug-start-debuggee-single" if="netbeans.home"
depends="init,compile-single">
+ <fail unless="debug.class">Must select one file in the IDE or set
debug.class</fail>
+ <j2seproject3:debug classname="${debug.class}"/>
+ </target>
+ <target name="debug-single" if="netbeans.home"
depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
+ <target name="-pre-debug-fix" depends="init">
+ <fail unless="fix.includes">Must set fix.includes</fail>
+ <property name="javac.includes" value="${fix.includes}.java"/>
+ </target>
+ <target name="-do-debug-fix" if="netbeans.home"
depends="init,-pre-debug-fix,compile-single">
+ <j2seproject1:nbjpdareload/>
+ </target>
+ <target name="debug-fix" if="netbeans.home"
depends="init,-pre-debug-fix,-do-debug-fix"/>
+ <!--
+ ===============
+ JAVADOC SECTION
+ ===============
+ -->
+ <target name="-javadoc-build" depends="init">
+ <mkdir dir="${dist.javadoc.dir}"/>
+ <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}"
notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}"
noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}"
author="${javadoc.author}" version="${javadoc.version}"
windowtitle="${javadoc.windowtitle}" private="${javadoc.private}"
additionalparam="${javadoc.additionalparam}" failonerror="true"
useexternalfile="true">
+ <classpath>
+ <path path="${javac.classpath}"/>
+ </classpath>
+ <sourcepath>
+ <pathelement location="${src.dir}"/>
+ </sourcepath>
+ <packageset dir="${src.dir}" includes="*/**"/>
+ <fileset dir="${src.dir}" includes="*.java"/>
+ </javadoc>
+ </target>
+ <target name="-javadoc-browse" if="netbeans.home"
unless="no.javadoc.preview" depends="init,-javadoc-build">
+ <nbbrowse file="${dist.javadoc.dir}/index.html"/>
+ </target>
+ <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse"
description="Build Javadoc."/>
+ <!--
+ =========================
+ JUNIT COMPILATION SECTION
+ =========================
+ -->
+ <target name="-pre-pre-compile-test" if="have.tests"
depends="init,compile">
+ <mkdir dir="${build.test.classes.dir}"/>
+ </target>
+ <target name="-pre-compile-test">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-do-compile-test" if="have.tests"
depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
+ <j2seproject3:javac srcdir="${test.src.dir}"
destdir="${build.test.classes.dir}" debug="true"
classpath="${javac.test.classpath}"/>
+ <copy todir="${build.test.classes.dir}">
+ <fileset dir="${test.src.dir}" excludes="**/*.java"/>
+ </copy>
+ </target>
+ <target name="-post-compile-test">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="compile-test"
depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
+ <target name="-pre-compile-test-single">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-do-compile-test-single" if="have.tests"
depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
+ <fail unless="javac.includes">Must select some files in the IDE or set
javac.includes</fail>
+ <j2seproject3:javac srcdir="${test.src.dir}"
destdir="${build.test.classes.dir}" debug="true"
classpath="${javac.test.classpath}">
+ <customize>
+ <patternset includes="${javac.includes}"/>
+ </customize>
+ </j2seproject3:javac>
+ <copy todir="${build.test.classes.dir}">
+ <fileset dir="${test.src.dir}" excludes="**/*.java"/>
+ </copy>
+ </target>
+ <target name="-post-compile-test-single">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="compile-test-single"
depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
+ <!--
+ =======================
+ JUNIT EXECUTION SECTION
+ =======================
+ -->
+ <target name="-pre-test-run" if="have.tests" depends="init">
+ <mkdir dir="${build.test.results.dir}"/>
+ </target>
+ <target name="-do-test-run" if="have.tests"
depends="init,compile-test,-pre-test-run">
+ <j2seproject3:junit/>
+ </target>
+ <target name="-post-test-run" if="have.tests"
depends="init,compile-test,-pre-test-run,-do-test-run">
+ <fail if="tests.failed">Some tests failed; see details above.</fail>
+ </target>
+ <target name="test-report" if="have.tests" depends="init"/>
+ <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
+ <target name="test"
depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse"
description="Run unit tests."/>
+ <target name="-pre-test-run-single" if="have.tests" depends="init">
+ <mkdir dir="${build.test.results.dir}"/>
+ </target>
+ <target name="-do-test-run-single" if="have.tests"
depends="init,compile-test-single,-pre-test-run-single">
+ <fail unless="test.includes">Must select some files in the IDE or set
test.includes</fail>
+ <j2seproject3:junit includes="${test.includes}"/>
+ </target>
+ <target name="-post-test-run-single" if="have.tests"
depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
+ <fail if="tests.failed">Some tests failed; see details above.</fail>
+ </target>
+ <target name="test-single"
depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single"
description="Run single unit test."/>
+ <!--
+ =======================
+ JUNIT DEBUGGING SECTION
+ =======================
+ -->
+ <target name="-debug-start-debuggee-test" if="have.tests"
depends="init,compile-test">
+ <fail unless="test.class">Must select one file in the IDE or set
test.class</fail>
+ <j2seproject3:debug classname="junit.textui.TestRunner"
classpath="${debug.test.classpath}">
+ <customize>
+ <arg line="${test.class}"/>
+ </customize>
+ </j2seproject3:debug>
+ </target>
+ <target name="-debug-start-debugger-test" if="netbeans.home+have.tests"
depends="init,compile-test">
+ <j2seproject1:nbjpdastart name="${test.class}"
classpath="${debug.test.classpath}"/>
+ </target>
+ <target name="debug-test"
depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
+ <target name="-do-debug-fix-test" if="netbeans.home"
depends="init,-pre-debug-fix,compile-test-single">
+ <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
+ </target>
+ <target name="debug-fix-test" if="netbeans.home"
depends="init,-pre-debug-fix,-do-debug-fix-test"/>
+ <!--
+ =========================
+ APPLET EXECUTION SECTION
+ =========================
+ -->
+ <target name="run-applet" depends="init,compile-single">
+ <fail unless="applet.url">Must select one file in the IDE or set
applet.url</fail>
+ <j2seproject1:java classname="sun.applet.AppletViewer">
+ <customize>
+ <arg value="${applet.url}"/>
+ </customize>
+ </j2seproject1:java>
+ </target>
+ <!--
+ =========================
+ APPLET DEBUGGING SECTION
+ =========================
+ -->
+ <target name="-debug-start-debuggee-applet" if="netbeans.home"
depends="init,compile-single">
+ <fail unless="applet.url">Must select one file in the IDE or set
applet.url</fail>
+ <j2seproject3:debug classname="sun.applet.AppletViewer">
+ <customize>
+ <arg value="${applet.url}"/>
+ </customize>
+ </j2seproject3:debug>
+ </target>
+ <target name="debug-applet" if="netbeans.home"
depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
+ <!--
+ ===============
+ CLEANUP SECTION
+ ===============
+ -->
+ <target name="deps-clean" depends="init" unless="no.deps"/>
+ <target name="-do-clean" depends="init">
+ <delete dir="${build.dir}"/>
+ <delete dir="${dist.dir}"/>
+ </target>
+ <target name="-post-clean">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="clean" depends="init,deps-clean,-do-clean,-post-clean"
description="Clean build products."/>
+</project>
Added: trunk/apps/jfcp/nbproject/genfiles.properties
===================================================================
--- trunk/apps/jfcp/nbproject/genfiles.properties
(rev 0)
+++ trunk/apps/jfcp/nbproject/genfiles.properties 2007-06-12 01:56:18 UTC
(rev 13526)
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=24c41492
+build.xml.script.CRC32=2e406133
+build.xml.stylesheet.CRC32=240b97a2
+# This file is used by a NetBeans-based IDE to track changes in generated
files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never
regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=24c41492
+nbproject/build-impl.xml.script.CRC32=b040e50e
+nbproject/build-impl.xml.stylesheet.CRC32=20b9345e
Added: trunk/apps/jfcp/nbproject/project.properties
===================================================================
--- trunk/apps/jfcp/nbproject/project.properties
(rev 0)
+++ trunk/apps/jfcp/nbproject/project.properties 2007-06-12 01:56:18 UTC
(rev 13526)
@@ -0,0 +1,55 @@
+application.args=
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+debug.classpath=\
+ ${run.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/FreenetClient.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+jar.compress=false
+javac.classpath=
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.source=1.5
+javac.target=1.5
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}:\
+ ${libs.junit.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=Freenet Client Javadocs
+main.class=org.freenet.contrib.fcp.FreenetClient
+meta.inf.dir=${src.dir}/META-INF
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value
instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+src.dir=src
+test.src.dir=test
Added: trunk/apps/jfcp/nbproject/project.xml
===================================================================
--- trunk/apps/jfcp/nbproject/project.xml (rev 0)
+++ trunk/apps/jfcp/nbproject/project.xml 2007-06-12 01:56:18 UTC (rev
13526)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.java.j2seproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
+ <name>FreenetClient</name>
+ <minimum-ant-version>1.6.5</minimum-ant-version>
+ <source-roots>
+ <root id="src.dir"/>
+ </source-roots>
+ <test-roots>
+ <root id="test.src.dir"/>
+ </test-roots>
+ </data>
+ </configuration>
+</project>
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/FcpConnection.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/FcpConnection.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/FcpConnection.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,202 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.logging.Logger;
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+import org.freenet.contrib.fcp.message.MessageBuilderException;
+import org.freenet.contrib.fcp.message.client.ClientHello;
+import org.freenet.contrib.fcp.message.client.ClientMessage;
+import org.freenet.contrib.fcp.message.node.NodeMessage;
+import org.freenet.contrib.fcp.message.node.NodeMessageBuilder;
+
+
+
+/**
+ * Responsible for sending data to the node.
+ * @author res
+ */
+public class FcpConnection {
+ private static Logger logger =
Logger.getLogger(FcpConnection.class.getName());
+
+ private String _fcpVersion = "2.0";
+ private String _clientName = "FreenetClient";
+
+ private Socket _socket;
+ private PrintStream _out;
+ private BufferedReader _in;
+ private NodeAddress _nodeAddress;
+ private ExecutorService _messageSender;
+ private boolean _socketOpen;
+ private MessageReaderThread _messageReaderThread;
+ private FcpEventSupportRepository _eventSupport;
+
+ /** Creates a new instance of FcpConnection */
+ FcpConnection(NodeAddress na, FcpEventSupportRepository eventSupport) {
+ _nodeAddress = na;
+ _eventSupport = eventSupport;
+ }
+
+ /** Creates a new instance of FcpConnection */
+ FcpConnection(NodeAddress na, FcpEventSupportRepository eventSupport,
String name) {
+ this(na, eventSupport);
+ _clientName = name;
+ }
+
+ /**
+ * Opens a socket to the node.
+ * @throws java.net.UnknownHostException if host not found.
+ * @throws java.io.IOException on IO error.
+ */
+ public void open() throws UnknownHostException, IOException{
+ logger.fine("opening socket to " + _nodeAddress.getHostName() + ":" +
_nodeAddress.getPort());
+ _socket = new Socket(_nodeAddress.getHostName(),
_nodeAddress.getPort());
+ _in = new BufferedReader(new
InputStreamReader(_socket.getInputStream()));
+ _out = new PrintStream(_socket.getOutputStream());
+ _messageSender = Executors.newSingleThreadExecutor();
+ _messageReaderThread = new MessageReaderThread();
+ _messageReaderThread.start();
+ _socketOpen = true;
+ sendMessage(new ClientHello(_fcpVersion, _clientName));
+ }
+
+ /**
+ * Closes the connection to the node.
+ */
+ public void close(){
+ _socketOpen = false;
+ if(_messageSender != null){
+ _messageSender.shutdownNow();
+ _messageSender = null;
+ }
+ _messageReaderThread = null;
+ if(_socket != null){
+ try {
+ _socket.close();
+ } catch (Exception ex) {
+ logger.warning("error closing socket: " + ex.getMessage());
+ }
+ _socket = null;
+ }
+ if(_in != null){
+ try {
+ _in.close();
+ } catch (Exception ex) {
+ logger.warning("error closing input stream: " +
ex.getMessage());
+ }
+ _in = null;
+ }
+ if(_out != null){
+ try {
+ _out.close();
+ } catch (Exception ex) {
+ logger.warning("error closing output stream: " +
ex.getMessage());
+ }
+ _out = null;
+ }
+ _eventSupport.getConnectionEventSupport().fireFcpDisconnected();
+ }
+
+ /**
+ * Sends a message to the node. This method returns immediately,
+ * the message is put in a queue to be sent.
+ * @param message The message to be sent.
+ */
+ public void sendMessage(ClientMessage message){
+ if(_socketOpen)
+ _messageSender.execute(new MessageHolder(message));
+ }
+
+ private class MessageHolder implements Runnable{
+ private final ClientMessage _message;
+
+ MessageHolder(ClientMessage message){
+ _message = message;
+ }
+
+ public void run() {
+// logger.fine("sending message : " + _message.getHeaderString());
+ _message.writeMessage(_out);
+ if(_out.checkError()){
+ logger.warning("error sending message:\n\n" +
_message.getMessageString());
+ close();
+ }else{
+ _message.fireEvents(_eventSupport);
+ }
+ }
+ }
+
+
+
+ /**
+ * Determine whether the connection is up.
+ * @return boolean reflecting the connection's upness.
+ */
+ public boolean isSocketOpen() {
+ return _socketOpen;
+ }
+
+ /**
+ * get the node address for this connection
+ * @return the {@link NodeAddress NodeAddress}
+ */
+ public NodeAddress getNodeAddress() {
+ return _nodeAddress;
+ }
+
+ /**
+ * Setter for NodeAddress. Doesn't trigger a reconnection.
+ * @param nodeAddress the new {@link NodeAddress NodeAddress}
+ */
+ public void setNodeAddress(NodeAddress nodeAddress) {
+ this._nodeAddress = nodeAddress;
+ }
+
+
+ private class MessageReaderThread extends Thread{
+ private boolean _running;
+
+ public void run(){
+ _running = true;
+ String line;
+ try {
+
+ while(_socketOpen){
+ NodeMessageBuilder builder = new NodeMessageBuilder();
+ try {
+ builder.parse(_in);
+ NodeMessage message = builder.build();
+ message.fireEvents(_eventSupport);
+ } catch (MessageBuilderException ex) {
+ if(_socketOpen)
+ logger.warning("error building node message: " +
ex.getMessage());
+ }
+
+ }
+
+ } catch (IOException ex) {
+ logger.warning("error reading stream: " + ex.getMessage());
+ }
+
+ _running = false;
+ if(_socketOpen)
+ close();
+ }
+
+ public boolean isRunning() {
+ return _running;
+ }
+
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/FreenetClient.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/FreenetClient.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/FreenetClient.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,64 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp;
+
+import java.io.IOException;
+import java.net.UnknownHostException;
+import org.freenet.contrib.fcp.event.support.FcpEventSource;
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+import org.freenet.contrib.fcp.message.client.ClientGet;
+import org.freenet.contrib.fcp.message.client.ClientMessage;
+import org.freenet.contrib.fcp.message.client.GenerateSSK;
+import org.freenet.contrib.fcp.message.client.ListPeers;
+
+/**
+ *
+ * @author res
+ */
+public class FreenetClient{
+ private static String DEFAULT_CLIENT_NAME = "FreenetClient";
+ private FcpEventSupportRepository _eventSupport;
+ private FcpEventSource _eventSource;
+ private FcpConnection _conn;
+
+ public FreenetClient(){
+ this(new NodeAddress(), DEFAULT_CLIENT_NAME);
+ }
+
+ public FreenetClient(String name){
+ this(new NodeAddress(), name);
+ }
+
+ /** Creates a new instance of FreenetClient */
+ public FreenetClient(NodeAddress na, String name) {
+ _eventSupport = new FcpEventSupportRepository();
+ _eventSource = new FcpEventSource(_eventSupport);
+ _conn = new FcpConnection(na, _eventSupport, name);
+ }
+
+ public FcpEventSource getEventSource(){
+ return _eventSource;
+ }
+
+
+ public FcpConnection getConnection() {
+ return _conn;
+ }
+
+ public void refreshPeerList(){
+ _conn.sendMessage(new ListPeers(true, true));
+ }
+
+ public void get(String uri, String id){
+ ClientGet message = new ClientGet(uri, id);
+ message.setVerbosity(1);
+ message.setPriority(2);
+ _conn.sendMessage(message);
+ }
+
+ public void generateSSK(String id){
+ _conn.sendMessage(new GenerateSSK(id));
+ }
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeAddress.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeAddress.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeAddress.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,30 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp;
+
+import java.net.InetSocketAddress;
+
+/**
+ *
+ * @author res
+ */
+public class NodeAddress extends InetSocketAddress{
+ public static int DEFAULT_PORT = 9482;
+ public static String DEFAULT_HOST = "127.0.0.1";
+
+ /** Creates a new instance of NodeAddress */
+ public NodeAddress() {
+ super(DEFAULT_HOST, DEFAULT_PORT);
+ }
+
+ public NodeAddress(int port){
+ super(DEFAULT_HOST, port);
+ }
+
+ public NodeAddress(String host, int port){
+ super(host, port);
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeInfo.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeInfo.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/NodeInfo.java 2007-06-12
01:56:18 UTC (rev 13526)
@@ -0,0 +1,221 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp;
+
+import org.freenet.contrib.fcp.message.node.Peer;
+
+/**
+ *
+ * @author res
+ */
+public class NodeInfo {
+ private String _fcpVersion;
+ private String _node;
+ private String _build;
+ private String _extRevision;
+ private boolean _testNet;
+ private String _extBuild;
+ private String _compressionCodecs;
+ private String _revision;
+
+ private String _lastGoodVersion;
+ private String _physicalUdp;
+ private String _id;
+ private String _dsaGroupG;
+ private String _name;
+ private String _dsaPubKeyY;
+ private String _dsaGroupQ;
+ private String _arkNumber;
+ private String _version;
+ private String _arkPubUri;
+ private String _dsaGroupP;
+ private double _location;
+ private boolean _testnet;
+
+ /** Creates a new instance of NodeInfo */
+ public NodeInfo() {
+ }
+
+ public NodeInfo(Peer p){
+ _lastGoodVersion=p.getLastGoodVersion();
+ _physicalUdp=p.getPhysicalUdp();
+ _id=p.getId();
+ _dsaGroupG=p.getDsaGroupG();
+ _name=p.getName();
+ _dsaPubKeyY=p.getDsaPubKeyY();
+ _dsaGroupQ=p.getDsaGroupQ();
+ _arkNumber=p.getArkNumber();
+ _version=p.getVersion();
+ _arkPubUri=p.getArkPubUri();
+ _dsaGroupP=p.getDsaGroupP();
+ _location=p.getLocation();
+ _testNet=p.isTestnet();
+ }
+
+ public String getFcpVersion() {
+ return _fcpVersion;
+ }
+
+ public void setFcpVersion(String fcpVersion) {
+ this._fcpVersion = fcpVersion;
+ }
+
+ public String getVersion() {
+ return _version;
+ }
+
+ public void setVersion(String version) {
+ this._version = version;
+ }
+
+ public String getBuild() {
+ return _build;
+ }
+
+ public void setBuild(String build) {
+ this._build = build;
+ }
+
+ public String getExtRevision() {
+ return _extRevision;
+ }
+
+ public void setExtRevision(String extRevision) {
+ this._extRevision = extRevision;
+ }
+
+ public boolean isTestNet() {
+ return _testNet;
+ }
+
+ public void setTestNet(boolean testNet) {
+ this._testNet = testNet;
+ }
+
+ public String getExtBuild() {
+ return _extBuild;
+ }
+
+ public void setExtBuild(String extBuild) {
+ this._extBuild = extBuild;
+ }
+
+ public String getCompressionCodecs() {
+ return _compressionCodecs;
+ }
+
+ public void setCompressionCodecs(String compressionCodecs) {
+ this._compressionCodecs = compressionCodecs;
+ }
+
+ public String getRevision() {
+ return _revision;
+ }
+
+ public void setRevision(String revision) {
+ this._revision = revision;
+ }
+
+ public String getPhysicalUdp() {
+ return _physicalUdp;
+ }
+
+ public void setPhysicalUdp(String physicalUdp) {
+ this._physicalUdp = physicalUdp;
+ }
+
+ public String getLastGoodVersion() {
+ return _lastGoodVersion;
+ }
+
+ public void setLastGoodVersion(String lastGoodVersion) {
+ this._lastGoodVersion = lastGoodVersion;
+ }
+
+ public String getArkPubUri() {
+ return _arkPubUri;
+ }
+
+ public void setArkPubUri(String arkPubUri) {
+ this._arkPubUri = arkPubUri;
+ }
+
+ public String getArkNumber() {
+ return _arkNumber;
+ }
+
+ public void setArkNumber(String arkNumber) {
+ this._arkNumber = arkNumber;
+ }
+
+ public String getId() {
+ return _id;
+ }
+
+ public void setId(String id) {
+ this._id = id;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ this._name = name;
+ }
+
+ public double getLocation() {
+ return _location;
+ }
+
+ public void setLocation(double location) {
+ this._location = location;
+ }
+
+ public String getDsaGroupG() {
+ return _dsaGroupG;
+ }
+
+ public void setDsaGroupG(String dsaGroupG) {
+ this._dsaGroupG = dsaGroupG;
+ }
+
+ public String getDsaPubKeyY() {
+ return _dsaPubKeyY;
+ }
+
+ public void setDsaPubKeyY(String dsaPubKeyY) {
+ this._dsaPubKeyY = dsaPubKeyY;
+ }
+
+ public String getDsaGroupQ() {
+ return _dsaGroupQ;
+ }
+
+ public void setDsaGroupQ(String dsaGroupQ) {
+ this._dsaGroupQ = dsaGroupQ;
+ }
+
+ public String getDsaGroupP() {
+ return _dsaGroupP;
+ }
+
+ public void setDsaGroupP(String dsaGroupP) {
+ this._dsaGroupP = dsaGroupP;
+ }
+
+ public boolean isTestnet() {
+ return _testnet;
+ }
+
+ public void setTestnet(boolean testnet) {
+ this._testnet = testnet;
+ }
+
+ public String toString(){
+ return getName();
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/AllDataEvent.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/AllDataEvent.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/AllDataEvent.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,22 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event;
+
+import java.util.Map;
+import org.freenet.contrib.fcp.NodeInfo;
+import org.freenet.contrib.fcp.message.node.AllData;
+import org.freenet.contrib.fcp.message.node.DataFound;
+
+/**
+ *
+ * @author res
+ */
+public class AllDataEvent extends FcpEvent<AllData>{
+
+ public AllDataEvent(AllData ad){
+ super(ad);
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/DataFoundEvent.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/DataFoundEvent.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/DataFoundEvent.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,21 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event;
+
+import java.util.Map;
+import org.freenet.contrib.fcp.NodeInfo;
+import org.freenet.contrib.fcp.message.node.DataFound;
+
+/**
+ *
+ * @author res
+ */
+public class DataFoundEvent extends FcpEvent<DataFound>{
+
+ public DataFoundEvent(DataFound df){
+ super(df);
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpConnectEvent.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpConnectEvent.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpConnectEvent.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,20 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event;
+
+import org.freenet.contrib.fcp.message.node.NodeMessage;
+
+/**
+ *
+ * @author res
+ */
+public class FcpConnectEvent<NodeHello> extends FcpEvent{
+
+ /** Creates a new instance of FcpConnectEvent */
+ public FcpConnectEvent(NodeHello message) {
+ super(message);
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpDisconnectEvent.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpDisconnectEvent.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpDisconnectEvent.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,17 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event;
+
+/**
+ *
+ * @author res
+ */
+public class FcpDisconnectEvent extends FcpEvent{
+
+ /** Creates a new instance of FcpDisconnectEvent */
+ public FcpDisconnectEvent() {
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpEvent.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpEvent.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpEvent.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,33 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event;
+
+import java.util.Date;
+
+/**
+ *
+ * @author res
+ */
+abstract class FcpEvent<MessageType> {
+ protected Date timeStamp = new Date();
+ private MessageType _message;
+
+ /** Creates a new instance of FcpEvent */
+ public FcpEvent() {
+ }
+
+ /** Creates a new instance of FcpNodeMessageEvent */
+ public FcpEvent(MessageType message) {
+ _message = message;
+ }
+
+ public MessageType getMessage() {
+ return _message;
+ }
+
+ public Date getTimeStamp() {
+ return timeStamp;
+ }
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpKeyRequestedEvent.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpKeyRequestedEvent.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpKeyRequestedEvent.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,26 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event;
+
+import java.util.Map;
+import org.freenet.contrib.fcp.NodeInfo;
+import org.freenet.contrib.fcp.message.client.ClientGet;
+
+/**
+ *
+ * @author res
+ */
+public class FcpKeyRequestedEvent extends FcpEvent<ClientGet>{
+
+ /**
+ * Creates a new instance of FcpPeerListUpdatedEvent
+ */
+ public FcpKeyRequestedEvent(ClientGet cg) {
+ super(cg);
+ }
+
+
+
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpPeerListUpdatedEvent.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpPeerListUpdatedEvent.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpPeerListUpdatedEvent.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,29 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event;
+
+import java.util.Map;
+import org.freenet.contrib.fcp.NodeInfo;
+import org.freenet.contrib.fcp.message.node.Peer;
+import org.freenet.contrib.fcp.message.node.PeerMetaData;
+
+/**
+ *
+ * @author res
+ */
+public class FcpPeerListUpdatedEvent {
+ private Map<String, Peer> _peers;
+ /**
+ * Creates a new instance of FcpPeerListUpdatedEvent
+ */
+ public FcpPeerListUpdatedEvent(Map<String, Peer> peers) {
+ _peers = peers;
+ }
+
+ public Map<String, Peer> getPeers() {
+ return _peers;
+ }
+
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpSimpleProgressEvent.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpSimpleProgressEvent.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/FcpSimpleProgressEvent.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,21 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event;
+
+import java.util.Map;
+import org.freenet.contrib.fcp.NodeInfo;
+import org.freenet.contrib.fcp.message.node.SimpleProgress;
+
+/**
+ *
+ * @author res
+ */
+public class FcpSimpleProgressEvent extends FcpEvent<SimpleProgress>{
+
+ public FcpSimpleProgressEvent(SimpleProgress sp){
+ super(sp);
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/GetFailedEvent.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/GetFailedEvent.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/GetFailedEvent.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,20 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event;
+
+import org.freenet.contrib.fcp.message.node.GetFailed;
+
+/**
+ *
+ * @author res
+ */
+public class GetFailedEvent extends FcpEvent<GetFailed> {
+
+ /** Creates a new instance of GetFailedEvent */
+ public GetFailedEvent(GetFailed gf) {
+ super(gf);
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/SSKKeypairEvent.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/SSKKeypairEvent.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/SSKKeypairEvent.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,20 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event;
+
+import org.freenet.contrib.fcp.message.node.SSKKeypair;
+
+/**
+ *
+ * @author res
+ */
+public class SSKKeypairEvent extends FcpEvent<SSKKeypair>{
+
+ /** Creates a new instance of SSKKeypairEvent */
+ public SSKKeypairEvent(SSKKeypair kp) {
+ super(kp);
+ }
+
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/AbstractFcpEventSupport.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/AbstractFcpEventSupport.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/AbstractFcpEventSupport.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,39 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event.support;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ *
+ * @author res
+ */
+class AbstractFcpEventSupport<ListenerType> {
+ Set<ListenerType> _listeners = Collections.synchronizedSet(new HashSet());
+
+ public void addListener(ListenerType l){
+ if(l != null)
+ _listeners.add(l);
+ }
+
+ public void removeListener(ListenerType l){
+ if(l != null)
+ _listeners.remove(l);
+ }
+
+ protected abstract class NotifyHelper<EventType>{
+ void notifyListeners(EventType e){
+ synchronized(_listeners){
+ for(ListenerType l : (Set<ListenerType>) _listeners){
+ notifyListener(l, e);
+ }
+ }
+ }
+ abstract void notifyListener(ListenerType l, EventType e);
+ }
+
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpConnectionEventSupport.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpConnectionEventSupport.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpConnectionEventSupport.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,34 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event.support;
+
+import org.freenet.contrib.fcp.event.FcpConnectEvent;
+import org.freenet.contrib.fcp.event.FcpDisconnectEvent;
+import
org.freenet.contrib.fcp.event.support.AbstractFcpEventSupport.NotifyHelper;
+import org.freenet.contrib.fcp.listener.FcpConnectionListener;
+import org.freenet.contrib.fcp.message.node.NodeHello;
+
+/**
+ *
+ * @author res
+ */
+public class FcpConnectionEventSupport extends
AbstractFcpEventSupport<FcpConnectionListener>{
+ NotifyHelper _connectNotifier = new NotifyHelper<FcpConnectEvent>() {
+ void notifyListener(FcpConnectionListener l, FcpConnectEvent e)
{l.nodeConnected(e);}
+ };
+
+ NotifyHelper _disconnectNotifier = new NotifyHelper<FcpDisconnectEvent>() {
+ void notifyListener(FcpConnectionListener l, FcpDisconnectEvent e)
{l.nodeDisconnected(e);}
+ };
+
+
+ public void fireFcpConnected(NodeHello nh){
+ _connectNotifier.notifyListeners(new FcpConnectEvent(nh));
+ }
+
+ public void fireFcpDisconnected(){
+ _disconnectNotifier.notifyListeners(new FcpDisconnectEvent());
+ }
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpEventSource.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpEventSource.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpEventSource.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,38 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event.support;
+
+import org.freenet.contrib.fcp.listener.FcpConnectionListener;
+import org.freenet.contrib.fcp.listener.FcpPeerListListener;
+import org.freenet.contrib.fcp.listener.FcpQueueListener;
+
+/**
+ *
+ * @author res
+ */
+public class FcpEventSource {
+ private FcpEventSupportRepository _repository;
+ /** Creates a new instance of FcpEventSource */
+ public FcpEventSource(FcpEventSupportRepository repository) {
+ _repository = repository;
+ }
+
+ public void addConnectionListener(FcpConnectionListener l){
+ _repository.getConnectionEventSupport().addListener(l);
+ }
+
+ public void removeFcpConnectionListener(FcpConnectionListener l){
+ _repository.getConnectionEventSupport().removeListener(l);
+ }
+
+ public void addPeerListListener(FcpPeerListListener l){
+ _repository.getPeerListEventSupport().addListener(l);
+ }
+
+ public void addQueueListener(FcpQueueListener l){
+ _repository.getQueueEventSupport().addListener(l);
+ }
+
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpEventSupportRepository.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpEventSupportRepository.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpEventSupportRepository.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,29 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event.support;
+
+/**
+ *
+ * @author res
+ */
+public class FcpEventSupportRepository {
+
+ private FcpConnectionEventSupport _connectionEventSupport = new
FcpConnectionEventSupport();
+ private FcpPeerListEventSupport _peerListEventSupport = new
FcpPeerListEventSupport();
+ private FcpQueueEventSupport _queueEventSupport = new
FcpQueueEventSupport();
+
+ public FcpConnectionEventSupport getConnectionEventSupport() {
+ return _connectionEventSupport;
+ }
+
+ public FcpPeerListEventSupport getPeerListEventSupport() {
+ return _peerListEventSupport;
+ }
+
+ public FcpQueueEventSupport getQueueEventSupport() {
+ return _queueEventSupport;
+ }
+
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpPeerListEventSupport.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpPeerListEventSupport.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpPeerListEventSupport.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,38 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event.support;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.freenet.contrib.fcp.NodeInfo;
+import org.freenet.contrib.fcp.event.FcpPeerListUpdatedEvent;
+import
org.freenet.contrib.fcp.event.support.AbstractFcpEventSupport.NotifyHelper;
+import org.freenet.contrib.fcp.listener.FcpPeerListListener;
+import org.freenet.contrib.fcp.message.node.Peer;
+
+/**
+ *
+ * @author res
+ */
+public class FcpPeerListEventSupport extends
AbstractFcpEventSupport<FcpPeerListListener>{
+ private Map<String, Peer> _peers;
+
+ NotifyHelper _peerListUpdatedNotifier = new
NotifyHelper<FcpPeerListUpdatedEvent>() {
+ void notifyListener(FcpPeerListListener l, FcpPeerListUpdatedEvent e)
{l.peerListUpdated(e);}
+ };
+
+
+ public void firePeerListRequested(){
+ _peers = new HashMap();
+ }
+
+ public void firePeerUpdated(Peer peer){
+ _peers.put(peer.getId(), peer);
+ }
+
+ public void firePeerListUpdated(){
+ _peerListUpdatedNotifier.notifyListeners(new
FcpPeerListUpdatedEvent(_peers));
+ }
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpQueueEventSupport.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpQueueEventSupport.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/event/support/FcpQueueEventSupport.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,77 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.event.support;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+import org.freenet.contrib.fcp.event.AllDataEvent;
+import org.freenet.contrib.fcp.event.DataFoundEvent;
+import org.freenet.contrib.fcp.event.FcpKeyRequestedEvent;
+import org.freenet.contrib.fcp.event.FcpSimpleProgressEvent;
+import org.freenet.contrib.fcp.event.GetFailedEvent;
+import
org.freenet.contrib.fcp.event.support.AbstractFcpEventSupport.NotifyHelper;
+import org.freenet.contrib.fcp.listener.FcpQueueListener;
+import org.freenet.contrib.fcp.message.client.ClientGet;
+import org.freenet.contrib.fcp.message.node.AllData;
+import org.freenet.contrib.fcp.message.node.DataFound;
+import org.freenet.contrib.fcp.message.node.GetFailed;
+import org.freenet.contrib.fcp.message.node.SimpleProgress;
+
+/**
+ *
+ * @author res
+ */
+public class FcpQueueEventSupport extends
AbstractFcpEventSupport<FcpQueueListener>{
+ private static Logger logger =
Logger.getLogger(FcpQueueEventSupport.class.getName());
+
+ private Map<String, ClientGet> _items = Collections.synchronizedMap(new
HashMap());
+
+
+ NotifyHelper _keyRequestedNotifier = new
NotifyHelper<FcpKeyRequestedEvent>() {
+ void notifyListener(FcpQueueListener l, FcpKeyRequestedEvent e)
{l.keyRequested(e);}
+ };
+
+ NotifyHelper _simpleProgressNotifier = new
NotifyHelper<FcpSimpleProgressEvent>() {
+ void notifyListener(FcpQueueListener l, FcpSimpleProgressEvent e)
{l.simpleProgressUpdate(e);}
+ };
+
+ NotifyHelper _dataFoundNotifier = new NotifyHelper<DataFoundEvent>() {
+ void notifyListener(FcpQueueListener l, DataFoundEvent e)
{l.dataFound(e);}
+ };
+
+ NotifyHelper _allDataNotifier = new NotifyHelper<AllDataEvent>() {
+ void notifyListener(FcpQueueListener l, AllDataEvent e) {l.allData(e);}
+ };
+
+ NotifyHelper _getFailedNotifier = new NotifyHelper<GetFailedEvent>() {
+ void notifyListener(FcpQueueListener l, GetFailedEvent e)
{l.getFailed(e);}
+ };
+
+
+ public void fireKeyRequested(ClientGet cg){
+ if(_items.get(cg.getId()) != null)
+ logger.info("duplicate request id: " + cg.getId());
+ _items.put(cg.getId(), cg);
+ _keyRequestedNotifier.notifyListeners(new FcpKeyRequestedEvent(cg));
+ }
+
+ public void fireSimpleProgressUpdate(SimpleProgress sp){
+ _simpleProgressNotifier.notifyListeners(new
FcpSimpleProgressEvent(sp));
+ }
+
+ public void fireDataFound(DataFound df){
+ _dataFoundNotifier.notifyListeners(new DataFoundEvent(df));
+ }
+
+ public void fireAllData(AllData ad){
+ _allDataNotifier.notifyListeners(new AllDataEvent(ad));
+ }
+
+ public void fireGetFailed(GetFailed gf){
+ _getFailedNotifier.notifyListeners(new GetFailedEvent(gf));
+ }
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpConnectionListener.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpConnectionListener.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpConnectionListener.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,17 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.listener;
+
+import org.freenet.contrib.fcp.event.FcpConnectEvent;
+import org.freenet.contrib.fcp.event.FcpDisconnectEvent;
+
+/**
+ *
+ * @author res
+ */
+public interface FcpConnectionListener {
+ public void nodeConnected(FcpConnectEvent e);
+ public void nodeDisconnected(FcpDisconnectEvent e);
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpPeerListListener.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpPeerListListener.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpPeerListListener.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,18 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.listener;
+
+import org.freenet.contrib.fcp.event.FcpPeerListUpdatedEvent;
+
+/**
+ *
+ * @author res
+ */
+public interface FcpPeerListListener {
+
+ public void peerListUpdated(FcpPeerListUpdatedEvent e);
+
+
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpQueueListener.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpQueueListener.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpQueueListener.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,23 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.listener;
+
+import org.freenet.contrib.fcp.event.AllDataEvent;
+import org.freenet.contrib.fcp.event.DataFoundEvent;
+import org.freenet.contrib.fcp.event.FcpKeyRequestedEvent;
+import org.freenet.contrib.fcp.event.FcpSimpleProgressEvent;
+import org.freenet.contrib.fcp.event.GetFailedEvent;
+
+/**
+ *
+ * @author res
+ */
+public interface FcpQueueListener {
+ public void simpleProgressUpdate(FcpSimpleProgressEvent e);
+ public void keyRequested(FcpKeyRequestedEvent e);
+ public void dataFound(DataFoundEvent e);
+ public void allData(AllDataEvent e);
+ public void getFailed(GetFailedEvent e);
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpSSKKeypairListener.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpSSKKeypairListener.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/listener/FcpSSKKeypairListener.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,15 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.listener;
+
+import org.freenet.contrib.fcp.event.SSKKeypairEvent;
+
+/**
+ *
+ * @author res
+ */
+public interface FcpSSKKeypairListener {
+ public void keypairReceived(SSKKeypairEvent kpe);
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/FcpMessage.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/FcpMessage.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/FcpMessage.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,56 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public abstract class FcpMessage {
+ protected Map<String, String> _fields = new HashMap();
+ protected String _headerString;
+
+ public FcpMessage(){
+// String name = this.getClass().getName();
+// _headerString = name.substring(name.lastIndexOf('.') + 1);
+ _headerString = this.getClass().getSimpleName();
+ }
+
+ public Map<String, String> getFields() {
+ return _fields;
+ }
+
+ public String getHeaderString(){
+ return _headerString;
+ }
+
+ public abstract void fireEvents(FcpEventSupportRepository eventSupport);
+
+ public String[] getMandatoryFields() {
+ return new String[] {};
+ }
+
+ public void writeMessage(PrintStream out){
+ out.println(_headerString);
+ for(Map.Entry entry : _fields.entrySet()){
+ out.println(entry.getKey() + "=" + entry.getValue());
+ }
+ out.println("EndMessage");
+ }
+
+
+ public String getMessageString(){
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ writeMessage(new PrintStream(baos));
+ return baos.toString();
+ }
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/MessageBuilderException.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/MessageBuilderException.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/MessageBuilderException.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,18 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message;
+
+/**
+ *
+ * @author res
+ */
+public class MessageBuilderException extends Exception{
+
+ /** Creates a new instance of MessageBuilderException */
+ public MessageBuilderException(String message) {
+ super(message);
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ClientGet.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ClientGet.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ClientGet.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,163 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.client;
+
+import java.io.PrintStream;
+import java.net.FileNameMap;
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class ClientGet extends ClientMessage{
+ public enum ReturnType{
+ direct,
+ disk,
+ none
+ }
+
+ public enum Persistence{
+ connection,
+ reboot,
+ forever
+ }
+
+
+ public ClientGet(String uri, String identifier){
+ setUri(uri);
+ setId(identifier);
+ }
+
+ public String[] getMandatoryFields() {
+ return new String[] { "URI", "Identifier" };
+ }
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+ eventSupport.getQueueEventSupport().fireKeyRequested(this);
+ }
+
+
+ public boolean isIgnoreDs() {
+ return Boolean.parseBoolean(_fields.get("IgnoreDS"));
+ }
+
+ public void setIgnoreDs(boolean ignoreDs) {
+ _fields.put("IgnoreDS", String.valueOf(ignoreDs));
+ }
+
+ public boolean isDsOnly() {
+ return Boolean.parseBoolean(_fields.get("DSonly"));
+ }
+
+ public void setDsOnly(boolean dsOnly) {
+ _fields.put("DSonly", String.valueOf(dsOnly));
+ }
+
+ public String getUri() {
+ return _fields.get("URI");
+ }
+
+ public void setUri(String uri) {
+ _fields.put("URI", uri);
+ }
+
+ public String getId() {
+ return _fields.get("Identifier");
+ }
+
+ public void setId(String id) {
+ _fields.put("Identifier", id);
+ }
+
+ public int getVerbosity() {
+ return Integer.parseInt(_fields.get("Verbosity"));
+ }
+
+ public void setVerbosity(int verbosity) {
+ _fields.put("Verbosity", String.valueOf(verbosity));
+ }
+
+ public int getMaxSize() {
+ return Integer.parseInt(_fields.get("MaxSize"));
+ }
+
+ public void setMaxSize(int maxSize) {
+ _fields.put("MaxSize", String.valueOf(maxSize));
+ }
+
+ public int getMaxTempSize() {
+ return Integer.parseInt(_fields.get("MaxTempSize"));
+ }
+
+ public void setMaxTempSize(int maxTempSize) {
+ _fields.put("MaxTempSize", String.valueOf(maxTempSize));
+ }
+
+ public int getMaxRetries() {
+ return Integer.parseInt(_fields.get("MaxRetries"));
+ }
+
+ public void setMaxRetries(int maxRetries) {
+ _fields.put("MaxRetries", String.valueOf(maxRetries));
+ }
+
+ public int getPriority() {
+ return Integer.parseInt(_fields.get("PriorityClass"));
+ }
+
+ public void setPriority(int priority) {
+ _fields.put("PriorityClass", String.valueOf(priority));
+ }
+
+ public Persistence getPersistence() {
+ return Persistence.valueOf(_fields.get("Persistence"));
+ }
+
+ public void setPersistence(Persistence persistence) {
+ _fields.put("Persistence", persistence.toString());
+ }
+
+ public String getClientToken() {
+ return _fields.get("ClientToken");
+ }
+
+ public void setClientToken(String clientToken) {
+ _fields.put("ClientToken", clientToken);
+ }
+
+ public boolean isGlobal() {
+ return Boolean.parseBoolean(_fields.get("Global"));
+ }
+
+ public void setGlobal(boolean global) {
+ _fields.put("Global", String.valueOf(global));
+ }
+
+ public ReturnType getReturnType() {
+ return ReturnType.valueOf(_fields.get("ReturnType"));
+ }
+
+ public void setReturnType(ReturnType returnType) {
+ _fields.put("ReturnType", returnType.toString());
+ }
+
+
+ public String getFileName() {
+ return _fields.get("FileName");
+ }
+
+ public void setFileName(String fileName) {
+ _fields.put("FileName", fileName);
+ }
+
+ public String getTempFileName() {
+ return _fields.get("TempFilename");
+ }
+
+ public void setTempFileName(String tempFileName) {
+ _fields.put("TempFilename", tempFileName);
+ }
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ClientHello.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ClientHello.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ClientHello.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,44 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.client;
+
+import java.io.PrintStream;
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class ClientHello extends ClientMessage{
+
+ public ClientHello(String expectedVersion, String clientName){
+ setExpectedVersion(expectedVersion);
+ setName(clientName);
+ }
+
+ public String[] getMandatoryFields() {
+ return new String[] { "Name", "ExpectedVersion" };
+ }
+
+ public String getName() {
+ return _fields.get("Name");
+ }
+
+ public void setName(String name) {
+ _fields.put("Name", name);
+ }
+
+ public String getExpectedVersion() {
+ return _fields.get("ExpectedVersion");
+ }
+
+ public void setExpectedVersion(String expectedVersion) {
+ _fields.put("ExpectedVersion", expectedVersion);
+ }
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+ }
+
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ClientMessage.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ClientMessage.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ClientMessage.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,15 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.client;
+
+import org.freenet.contrib.fcp.message.FcpMessage;
+
+/**
+ *
+ * @author res
+ */
+public abstract class ClientMessage extends FcpMessage{
+
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/GenerateSSK.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/GenerateSSK.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/GenerateSSK.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,29 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.client;
+
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class GenerateSSK extends ClientMessage{
+
+ public GenerateSSK(String id){
+ setId(id);
+ }
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+ }
+
+ public String getId() {
+ return _fields.get("Identifier");
+ }
+
+ public void setId(String id) {
+ _fields.put("Identifier", id);
+ }
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ListPeers.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ListPeers.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ListPeers.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,44 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.client;
+
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class ListPeers extends ClientMessage{
+
+ /** Creates a new instance of ListPeers */
+ public ListPeers() {
+ }
+
+ /** Creates a new instance of ListPeers */
+ public ListPeers(boolean withMetadata, boolean withVolatile) {
+ setWithMetadata(withMetadata);
+ setWithVolatile(withVolatile);
+ }
+
+ public boolean isWithMetadata() {
+ return Boolean.parseBoolean(_fields.get("WithMetadata"));
+ }
+
+ public void setWithMetadata(boolean withMetadata) {
+ _fields.put("WithMetadata", String.valueOf(withMetadata));
+ }
+
+ public boolean isWithVolatile() {
+ return Boolean.parseBoolean(_fields.get("WithVolatile"));
+ }
+
+ public void setWithVolatile(boolean withVolatile) {
+ _fields.put("WithVolatile", String.valueOf(withVolatile));
+ }
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+ eventSupport.getPeerListEventSupport().firePeerListRequested();
+ }
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ShutDown.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ShutDown.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/client/ShutDown.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,22 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.client;
+
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class ShutDown extends ClientMessage{
+
+ /** Creates a new instance of ShutDown */
+ public ShutDown() {
+ }
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/AllData.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/AllData.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/AllData.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,63 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class AllData extends NodeMessage implements DataHoldingMessage{
+ private String _uri;
+ /** Creates a new instance of DataFound */
+ public AllData() {
+ }
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+ eventSupport.getQueueEventSupport().fireAllData(this);
+ }
+
+ public String getId() {
+ return _fields.get("Identifier");
+ }
+
+ public void setId(String id) {
+ _fields.put("Identifier", id);
+ }
+
+ public int getDataLength() {
+ return Integer.parseInt(_fields.get("DataLength"));
+ }
+
+ public void setDataLength(int dataLength) {
+ _fields.put("DataLength", String.valueOf(dataLength));
+ }
+
+ public String getData() {
+ return _fields.get("Data");
+ }
+
+ public void setData(String data) {
+ _fields.put("Data", data);
+ }
+
+ public String getUri() {
+ return _uri;
+ }
+
+ public void setUri(String uri) {
+ _uri = uri;
+ }
+
+ public String toString(){
+ try {
+ return URLEncoder.encode(_uri, "utf-8");
+ } catch (UnsupportedEncodingException ignore) { }
+ return _uri;
+ }
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/DataFound.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/DataFound.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/DataFound.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,46 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class DataFound extends NodeMessage{
+
+ /** Creates a new instance of DataFound */
+ public DataFound() {
+ }
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+ eventSupport.getQueueEventSupport().fireDataFound(this);
+ }
+
+ public String getId() {
+ return _fields.get("Identifier");
+ }
+
+ public void setId(String id) {
+ _fields.put("Identifier", id);
+ }
+
+ public String getContentType() {
+ return _fields.get("Metadata.ContentType");
+ }
+
+ public void setContentType(String contentType) {
+ _fields.put("Metadata.ContentType", contentType);
+ }
+
+ public int getDataLength() {
+ return Integer.parseInt(_fields.get("DataLength"));
+ }
+
+ public void setDataLength(int dataLength) {
+ _fields.put("ContentType", String.valueOf(dataLength));
+ }
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/DataHoldingMessage.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/DataHoldingMessage.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/DataHoldingMessage.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,15 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+/**
+ *
+ * @author res
+ */
+public interface DataHoldingMessage {
+ public String getData();
+ public void setData(String data);
+ public int getDataLength();
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/EndListPeers.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/EndListPeers.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/EndListPeers.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,19 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class EndListPeers extends NodeMessage{
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+ eventSupport.getPeerListEventSupport().firePeerListUpdated();
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/GetFailed.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/GetFailed.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/GetFailed.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,58 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class GetFailed extends NodeMessage{
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+ eventSupport.getQueueEventSupport().fireGetFailed(this);
+ }
+
+ public String getId() {
+ return _fields.get("Identifier");
+ }
+
+ public void setId(String id) {
+ _fields.put("Identifier", id);
+ }
+
+ public String getCode(){
+ return _fields.get("Code");
+ }
+
+ public String getCodeDescription(){
+ return _fields.get("CodeDescription");
+ }
+
+ public String getExtraDescription(){
+ return _fields.get("ExtraDescription");
+ }
+
+ public boolean getFatal(){
+ return Boolean.parseBoolean(_fields.get("Fatal"));
+ }
+
+ public long getExpectedDataLength(){
+ return Long.parseLong(_fields.get("ExpectedDataLength"));
+ }
+
+ public String getExpectedContentType(){
+ return _fields.get("ExpectedMetadata.ContentType");
+ }
+
+ public boolean getFinalizedExpected(){
+ return Boolean.parseBoolean(_fields.get("FinalizedExpected"));
+ }
+
+ public String getRedirectURI(){
+ return _fields.get("RedirectURI");
+ }
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/IdentifierCollision.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/IdentifierCollision.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/IdentifierCollision.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,26 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class IdentifierCollision extends NodeMessage{
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+
+ }
+
+ public String getId() {
+ return _fields.get("Identifier");
+ }
+
+ public void setId(String id) {
+ _fields.put("Identifier", id);
+ }
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/NodeHello.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/NodeHello.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/NodeHello.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,22 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class NodeHello extends NodeMessage{
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+ eventSupport.getConnectionEventSupport().fireFcpConnected(this);
+ }
+
+ public String getConnectionIdentifier(){
+ return _fields.get("ConnectionIdentifier");
+ }
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/NodeMessage.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/NodeMessage.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/NodeMessage.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,18 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+import org.freenet.contrib.fcp.message.FcpMessage;
+
+/**
+ *
+ * @author res
+ */
+public abstract class NodeMessage extends FcpMessage{
+
+
+
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/NodeMessageBuilder.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/NodeMessageBuilder.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/NodeMessageBuilder.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,90 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.util.logging.Logger;
+import org.freenet.contrib.fcp.FcpConnection;
+import org.freenet.contrib.fcp.message.FcpMessage;
+import org.freenet.contrib.fcp.message.MessageBuilderException;
+
+/**
+ *
+ * @author res
+ */
+public class NodeMessageBuilder {
+ private static Logger logger =
Logger.getLogger(NodeMessageBuilder.class.getName());
+ // FcpMessage
+ private NodeMessage _message;
+
+ public void parse(BufferedReader in) throws MessageBuilderException,
IOException{
+ String line;
+ boolean firstLine = true;
+
+ while((line = in.readLine()) != null){
+
+ if(line.trim().equals(""))
+ continue; // blank lines allowed for debugging
+
+
+ if(firstLine){
+ try {
+ _message = (NodeMessage) Class.forName(
+ this.getClass().getPackage().getName() + "." +
line).newInstance();
+ firstLine = false;
+ } catch (Exception ex) {
+ throw new MessageBuilderException("unknown message header
(" + line + ")");
+ }
+ continue;
+ }
+
+ if(line.equals("EndMessage"))
+ break;
+
+
+ int pos = line.indexOf('=');
+ if(pos < 0){
+ if(line.equals("Data") && _message instanceof
DataHoldingMessage){
+
+ DataHoldingMessage m = (DataHoldingMessage) _message;
+ char[] data = new char[m.getDataLength()];
+ StringBuffer sb = new StringBuffer();
+ char[] b = new char[4096];
+ int read = 0, toRead = m.getDataLength();
+ while(toRead > 0 &&
+ (read = in.read(b, 0, toRead > b.length ? b.length
: toRead)) != -1){
+ sb.append(b, 0, read);
+ toRead -= read;
+ }
+ m.setData(sb.toString());
+ break;
+
+ }else{
+ throw new MessageBuilderException(
+ "unknown tag (" + line + ") in message " +
_message.getHeaderString());
+ }
+
+ }else
+ _message.getFields().put(line.substring(0, pos),
line.substring(pos + 1));
+ }
+
+
+ }
+
+
+ public NodeMessage build() throws MessageBuilderException{
+ String[] mandatoryFields = _message.getMandatoryFields();
+
+ for(String field : mandatoryFields){
+ if(((FcpMessage) _message).getFields().get(field) == null)
+ throw new MessageBuilderException(
+ "mandatory field " + field + " not found in message "
+ ((FcpMessage) _message).getHeaderString()
+ );
+ }
+
+ return _message;
+ }
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/Peer.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/Peer.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/Peer.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,143 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+import org.freenet.contrib.fcp.NodeInfo;
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class Peer extends NodeMessage{
+ private PeerMetaData peerMetaData;
+ private PeerVolatileData peerVolatileData;
+
+ public Peer(){
+ peerMetaData = new PeerMetaData(this);
+ peerVolatileData = new PeerVolatileData(this);
+ }
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+ eventSupport.getPeerListEventSupport().firePeerUpdated(this);
+ }
+
+ public String getLastGoodVersion() {
+ return _fields.get("lastGoodVersion");
+ }
+
+ public void setLastGoodVersion(String lastGoodVersion) {
+ _fields.put("lastGoodVersion", lastGoodVersion);
+ }
+
+ public String getPhysicalUdp() {
+ return _fields.get("physical.udp");
+ }
+
+ public void setPhysicalUdp(String physicalUdp) {
+ _fields.put("physical.udp", physicalUdp);
+ }
+
+ public String getId() {
+ return _fields.get("identity");
+ }
+
+ public void setId(String identity) {
+ _fields.put("identity", identity);
+ }
+
+ public String getDsaGroupG() {
+ return _fields.get("dsaGroup.g");
+ }
+
+ public void setDsaGroupG(String dsaGroupG) {
+ _fields.put("dsaGroup.g", dsaGroupG);
+ }
+
+ public String getName() {
+ return _fields.get("myName");
+ }
+
+ public void setName(String name) {
+ _fields.put("myName", name);
+ }
+
+ public String getDsaPubKeyY() {
+ return _fields.get("dsaPubKey.y");
+ }
+
+ public void setDsaPubKeyY(String dsaPubKeyY) {
+ _fields.put("dsaPubKey.y", dsaPubKeyY);
+ }
+
+ public String getDsaGroupQ() {
+ return _fields.get("dsaGroup.q");
+ }
+
+ public void setDsaGroupQ(String dsaGroupQ) {
+ _fields.put("dsaGroup.q", dsaGroupQ);
+ }
+
+ public String getArkNumber() {
+ return _fields.get("ark.number");
+ }
+
+ public void setArkNumber(String arkNumber) {
+ _fields.put("ark.number", arkNumber);
+ }
+
+ public String getVersion() {
+ return _fields.get("version");
+ }
+
+ public void setVersion(String version) {
+ _fields.put("version", version);
+ }
+
+ public String getArkPubUri() {
+ return _fields.get("ark.pubURI");
+ }
+
+ public void setArkPubUri(String arkPubUri) {
+ _fields.put("ark.pubURI", arkPubUri);
+ }
+
+ public String getDsaGroupP() {
+ return _fields.get("dsaGroup.p");
+ }
+
+ public void setDsaGroupP(String dsaGroupP) {
+ _fields.put("dsaGroup.p", dsaGroupP);
+ }
+
+ public double getLocation() {
+ return Double.parseDouble(_fields.get("location"));
+ }
+
+ public void setLocation(double location) {
+ _fields.put("location", String.valueOf(location));
+ }
+
+ public boolean isTestnet() {
+ return Boolean.parseBoolean(_fields.get("testnet"));
+ }
+
+ public void setTestnet(boolean testnet) {
+ _fields.put("_testnet", String.valueOf(testnet));
+ }
+
+ public PeerMetaData getPeerMetaData() {
+ return peerMetaData;
+ }
+
+ public PeerVolatileData getPeerVolatileData() {
+ return peerVolatileData;
+ }
+
+
+ public String toString(){
+ return getName();
+ }
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/PeerMetaData.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/PeerMetaData.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/PeerMetaData.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,73 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+/**
+ *
+ * @author res
+ */
+public class PeerMetaData {
+ private Peer _p;
+
+// metadata.routableConnectionCheckCount=118630
+// metadata.hadRoutableConnectionCount=20859
+// metadata.timeLastConnected=1173191216637
+// metadata.timeLastRoutable=1173191216637
+// metadata.timeLastReceivedPacket=1173191156574
+// metadata.detected.udp=130.89.162.43:50591
+
+ public PeerMetaData(Peer p){
+ _p = p;
+ }
+
+ public int getRoutableConnectionCheckCount() {
+ return
Integer.parseInt(_p.getFields().get("metadata.routableConnectionCheckCount"));
+ }
+
+ public void setRoutableConnectionCheckCount(int
routableConnectionCheckCount) {
+ _p.getFields().put("metadata.routableConnectionCheckCount",
String.valueOf(routableConnectionCheckCount));
+ }
+
+ public int getHadRoutableConnectionCount() {
+ return
Integer.parseInt(_p.getFields().get("metadata.hadRoutableConnectionCount"));
+ }
+
+ public void setHadRoutableConnectionCount(int hadRoutableConnectionCount) {
+ _p.getFields().put("metadata.hadRoutableConnectionCount",
String.valueOf(hadRoutableConnectionCount));
+ }
+
+ public int getTimeLastConnected() {
+ return
Integer.parseInt(_p.getFields().get("metadata.timeLastConnected"));
+ }
+
+ public void setTimeLastConnected(int timeLastConnected) {
+ _p.getFields().put("metadata.timeLastConnected",
String.valueOf(timeLastConnected));
+ }
+
+ public int getTimeLastRoutable() {
+ return
Integer.parseInt(_p.getFields().get("metadata.timeLastRoutable"));
+ }
+
+ public void setTimeLastRoutable(int timeLastRoutable) {
+ _p.getFields().put("metadata.timeLastRoutable",
String.valueOf(timeLastRoutable));
+ }
+
+ public int getTimeLastReceivedPacket() {
+ return
Integer.parseInt(_p.getFields().get("metadata.timeLastReceivedPacket"));
+ }
+
+ public void setTimeLastReceivedPacket(int timeLastReceivedPacket) {
+ _p.getFields().put("metadata.timeLastReceivedPacket",
String.valueOf(timeLastReceivedPacket));
+ }
+
+ public String getDetectedUdp() {
+ return _p.getFields().get("metadata.detected.udp");
+ }
+
+ public void setDetectedUdp(String detectedUdp) {
+ _p.getFields().put("metadata.detected.udp", detectedUdp);
+ }
+
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/PeerVolatileData.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/PeerVolatileData.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/PeerVolatileData.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,162 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+/**
+ *
+ * @author res
+ */
+public class PeerVolatileData {
+ private Peer _p;
+
+ public enum Status{
+ CONNECTED,
+ DISCONNECTED,
+ BACKED_OFF,
+ TOO_OLD,
+ NEVER_CONNECTED
+ }
+
+ public enum LastRoutingBackoffReason{
+ AcceptedTimeout,
+ FatalTimeout,
+ ForwardRejectedOverload,
+ ForwardRejectedOverload2
+ }
+
+// volatile.averagePingTime=1.0
+// volatile.overloadProbability=0.0
+// volatile.idle=791670007
+// volatile.percentTimeRoutableConnection=17.58324201298154
+// volatile.routingBackoffPercent=0.0
+// volatile.status=DISCONNECTED
+// volatile.totalBytesIn=0
+// volatile.routingBackoffLength=1000
+// volatile.routingBackoff=0
+// volatile.totalBytesOut=8532482
+
+
+// volatile.averagePingTime=375.7280706108754
+// volatile.overloadProbability=0.262501082516091
+// volatile.percentTimeRoutableConnection=73.87877919472704
+// volatile.routingBackoffPercent=0.4766362445492835
+// volatile.status=CONNECTED
+// volatile.totalBytesIn=185355902
+// volatile.routingBackoffLength=1000
+// volatile.lastRoutingBackoffReason=FatalTimeout
+// volatile.routingBackoff=0
+// volatile.totalBytesOut=197757028
+
+
+// volatile.averagePingTime=5869.929339951476
+// volatile.overloadProbability=21.63939255794491
+// volatile.idle=89079368
+// volatile.percentTimeRoutableConnection=49.16023336672756
+// volatile.routingBackoffPercent=50.18356974749365
+// volatile.status=DISCONNECTED
+// volatile.totalBytesIn=30081871
+// volatile.routingBackoffLength=256000
+// volatile.lastRoutingBackoffReason=AcceptedTimeout
+// volatile.routingBackoff=0
+// volatile.totalBytesOut=72200884
+
+
+
+ /** Creates a new instance of PeerVolatileData */
+ public PeerVolatileData(Peer p) {
+ _p = p;
+ }
+
+ public float getAveragePingTime() {
+ return
Float.parseFloat(_p.getFields().get("volatile.averagePingTime"));
+ }
+
+ public void setAveragePingTime(float averagePingTime) {
+ _p.getFields().put("volatile.averagePingTime",
String.valueOf(averagePingTime));
+ }
+
+ public float getOverloadProbability() {
+ return
Float.parseFloat(_p.getFields().get("volatile.overloadProbability"));
+ }
+
+ public void setOverloadProbability(float overloadProbability) {
+ _p.getFields().put("volatile.overloadProbability",
String.valueOf(overloadProbability));
+ }
+
+ public int getIdle() {
+ return Integer.parseInt(_p.getFields().get("volatile.idle"));
+ }
+
+ public void setIdle(int idle) {
+ _p.getFields().put("volatile.idle", String.valueOf(idle));
+ }
+
+ public float getPercentTimeRoutableConnection() {
+ return
Float.parseFloat(_p.getFields().get("volatile.percentTimeRoutableConnection"));
+ }
+
+ public void setPercentTimeRoutableConnection(float
percentTimeRoutableConnection) {
+ _p.getFields().put("volatile.percentTimeRoutableConnection",
String.valueOf(percentTimeRoutableConnection));
+ }
+
+ public float getRoutingBackoffPercent() {
+ return
Float.parseFloat(_p.getFields().get("volatile.routingBackoffPercent"));
+ }
+
+ public void setRoutingBackoffPercent(float routingBackoffPercent) {
+ _p.getFields().put("volatile.routingBackoffPercent",
String.valueOf(routingBackoffPercent));
+ }
+
+ public Status getStatus() {
+ return Status.valueOf(_p.getFields().get("volatile.status").replace('
', '_'));
+ }
+
+ public void setStatus(Status status) {
+ _p.getFields().put("volatile.status", status.toString().replace('_', '
'));
+ }
+
+ public long getTotalBytesIn() {
+ return Long.parseLong(_p.getFields().get("volatile.totalBytesIn"));
+ }
+
+ public void setTotalBytesIn(long totalBytesIn) {
+ _p.getFields().put("volatile.totalBytesIn",
String.valueOf(totalBytesIn));
+ }
+
+ public long getRoutingBackoffLength() {
+ return
Long.parseLong(_p.getFields().get("volatile.routingBackoffLength"));
+ }
+
+ public void setRoutingBackoffLength(long routingBackoffLength) {
+ _p.getFields().put("volatile.routingBackoffLength",
String.valueOf(routingBackoffLength));
+ }
+
+ public LastRoutingBackoffReason getLastRoutingBackoffReason() {
+ return
LastRoutingBackoffReason.valueOf(_p.getFields().get("volatile.lastRoutingBackoffReason"));
+ }
+
+ public void setLastRoutingBackoffReason(LastRoutingBackoffReason
lastRoutingBackoffReason) {
+ _p.getFields().put("volatile.lastRoutingBackoffReason",
lastRoutingBackoffReason.toString());
+ }
+
+ public long getRoutingBackoff() {
+ return Long.parseLong(_p.getFields().get("volatile.routingBackoff"));
+ }
+
+ public void setRoutingBackoff(long routingBackoff) {
+ _p.getFields().put("volatile.routingBackoff",
String.valueOf(routingBackoff));
+ }
+
+ public long getTotalBytesOut() {
+ return Long.parseLong(_p.getFields().get("volatile.totalBytesOut"));
+ }
+
+ public void setTotalBytesOut(long totalBytesOut) {
+ _p.getFields().put("volatile.totalBytesOut",
String.valueOf(totalBytesOut));
+ }
+
+
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/SSKKeypair.java
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/SSKKeypair.java
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/SSKKeypair.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,54 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ * This is a message of the Freenet Client Protocol 2.0 (FCP 2.0).
+ * It is sent from the Freenet node to a client program in response to the
client
+ * issuing a GenerateSSK command.
+ * @author res
+ */
+public class SSKKeypair extends NodeMessage{
+
+ /** Creates a new instance of SSKKeypair */
+ public SSKKeypair() {
+ }
+
+ /**
+ *
+ * @inheritDoc
+ */
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+
+ }
+
+ public String getId() {
+ return _fields.get("Identifier");
+ }
+
+ public void setId(String id) {
+ _fields.put("Identifier", id);
+ }
+
+ public String getInsertURI() {
+ return _fields.get("InsertURI");
+ }
+
+ public void setInsertURI(String uri) {
+ _fields.put("InsertURI", uri);
+ }
+
+ public String getRequestURI() {
+ return _fields.get("RequestURI");
+ }
+
+ public void setRequestURI(String uri) {
+ _fields.put("RequestURI", uri);
+ }
+
+
+}
Added:
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/SimpleProgress.java
===================================================================
---
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/SimpleProgress.java
(rev 0)
+++
trunk/apps/jfcp/src/org/freenet/contrib/fcp/message/node/SimpleProgress.java
2007-06-12 01:56:18 UTC (rev 13526)
@@ -0,0 +1,75 @@
+/* This code is part of Freenet. It is distributed under the GNU General
+ * Public License, version 2 (or at your option any later version). See
+ * http://www.gnu.org/ for further details of the GPL. */
+
+package org.freenet.contrib.fcp.message.node;
+
+import org.freenet.contrib.fcp.event.support.FcpEventSupportRepository;
+
+/**
+ *
+ * @author res
+ */
+public class SimpleProgress extends NodeMessage{
+
+ public void fireEvents(FcpEventSupportRepository eventSupport) {
+ eventSupport.getQueueEventSupport().fireSimpleProgressUpdate(this);
+ }
+
+ public int getTotal() {
+ return Integer.parseInt(_fields.get("Total"));
+ }
+
+ public void setTotal(int total) {
+ _fields.put("Total", String.valueOf(total));
+ }
+
+ public int getRequired() {
+ return Integer.parseInt(_fields.get("Required"));
+ }
+
+ public void setRequired(int required) {
+ _fields.put("Required", String.valueOf(required));
+ }
+
+ public int getFailed() {
+ return Integer.parseInt(_fields.get("Failed"));
+ }
+
+ public void setFailed(int failed) {
+ _fields.put("Failed", String.valueOf(failed));
+ }
+
+ public int getFatallyFailed() {
+ return Integer.parseInt(_fields.get("FatallyFailed"));
+ }
+
+ public void setFatallyFailed(int fatallyFailed) {
+ _fields.put("FatallyFailed", String.valueOf(fatallyFailed));
+ }
+
+ public int getSucceeded() {
+ return Integer.parseInt(_fields.get("Succeeded"));
+ }
+
+ public void setSucceeded(int succeeded) {
+ _fields.put("Succeeded", String.valueOf(succeeded));
+ }
+
+ public boolean isFinalizedTotal() {
+ return Boolean.parseBoolean(_fields.get("FinalizedTotal"));
+ }
+
+ public void setFinalizedTotal(boolean finalizedTotal) {
+ _fields.put("FinalizedTotal", String.valueOf(finalizedTotal));
+ }
+
+ public String getId() {
+ return _fields.get("Identifier");
+ }
+
+ public void setId(String id) {
+ _fields.put("Identifier", id);
+ }
+
+}
Added: trunk/apps/jfcp/src/org/freenet/contrib/fcp/package.html
===================================================================
--- trunk/apps/jfcp/src/org/freenet/contrib/fcp/package.html
(rev 0)
+++ trunk/apps/jfcp/src/org/freenet/contrib/fcp/package.html 2007-06-12
01:56:18 UTC (rev 13526)
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+ <head>
+ <title>FCP overview?</title>
+ </head>
+ <body>
+ <h1>Main classes</h1>
+ <p>
+ The main classes of the FCP client library. You should start
+ with <code>FreenetClient</code>, which provides a facade for the
library.
+ Register listeners with the object returned by
<code>getEventSource</code>.
+ </p>
+ </body>
+</html>