Thread: [Java-link-svn] SF.net SVN: java-link: [21] branches/private_welterde0
Status: Pre-Alpha
Brought to you by:
welterde0
From: <wel...@us...> - 2006-11-25 16:37:50
|
Revision: 21 http://svn.sourceforge.net/java-link/?rev=21&view=rev Author: welterde0 Date: 2006-11-25 08:37:42 -0800 (Sat, 25 Nov 2006) Log Message: ----------- updated doc, with links to the wiki updated license information Modified Paths: -------------- branches/private_welterde0/LICENSE branches/private_welterde0/MODDING branches/private_welterde0/README Modified: branches/private_welterde0/LICENSE =================================================================== --- branches/private_welterde0/LICENSE 2006-10-24 17:26:13 UTC (rev 20) +++ branches/private_welterde0/LICENSE 2006-11-25 16:37:42 UTC (rev 21) @@ -277,64 +277,4 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. + END OF TERMS AND CONDITIONS \ No newline at end of file Modified: branches/private_welterde0/MODDING =================================================================== --- branches/private_welterde0/MODDING 2006-10-24 17:26:13 UTC (rev 20) +++ branches/private_welterde0/MODDING 2006-11-25 16:37:42 UTC (rev 21) @@ -0,0 +1,2 @@ +see http://java-link.sourceforge.net/moin +ok, there isnt an article(at the time of writeing this) Modified: branches/private_welterde0/README =================================================================== --- branches/private_welterde0/README 2006-10-24 17:26:13 UTC (rev 20) +++ branches/private_welterde0/README 2006-11-25 16:37:42 UTC (rev 21) @@ -21,4 +21,7 @@ TODO: write this :-) 5.Credits -TODO: write this :-) \ No newline at end of file +TODO: write this :-) + +6.Further Questions +see http://java-link.sourceforge.net/moin \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wel...@us...> - 2006-11-25 16:40:51
|
Revision: 22 http://svn.sourceforge.net/java-link/?rev=22&view=rev Author: welterde0 Date: 2006-11-25 08:40:48 -0800 (Sat, 25 Nov 2006) Log Message: ----------- updated svn:ignore properties Property Changed: ---------------- branches/private_welterde0/ branches/private_welterde0/client/ branches/private_welterde0/env_server/logs/ branches/private_welterde0/libdb/ branches/private_welterde0/libgui/ branches/private_welterde0/libnet/ branches/private_welterde0/libserver/ branches/private_welterde0/libworld/ branches/private_welterde0/server/ branches/private_welterde0/share/ Property changes on: branches/private_welterde0 ___________________________________________________________________ Name: svn:ignore - .DS_Store + .DS_Store tmp share.build.log client.build.log server.build.log libdb.server.build.log Property changes on: branches/private_welterde0/client ___________________________________________________________________ Name: svn:ignore - .DS_Store + .DS_Store target Property changes on: branches/private_welterde0/env_server/logs ___________________________________________________________________ Name: svn:ignore + *.log.xml Property changes on: branches/private_welterde0/libdb ___________________________________________________________________ Name: svn:ignore + .DS_Store target Property changes on: branches/private_welterde0/libgui ___________________________________________________________________ Name: svn:ignore + .DS_Store target Property changes on: branches/private_welterde0/libnet ___________________________________________________________________ Name: svn:ignore + .DS_Store target Property changes on: branches/private_welterde0/libserver ___________________________________________________________________ Name: svn:ignore + .DS_Store target Property changes on: branches/private_welterde0/libworld ___________________________________________________________________ Name: svn:ignore + .DS_Store target Property changes on: branches/private_welterde0/server ___________________________________________________________________ Name: svn:ignore - .DS_Store + .DS_Store target Property changes on: branches/private_welterde0/share ___________________________________________________________________ Name: svn:ignore - .DS_Store + .DS_Store target This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wel...@us...> - 2006-11-25 16:50:13
|
Revision: 24 http://svn.sourceforge.net/java-link/?rev=24&view=rev Author: welterde0 Date: 2006-11-25 08:50:09 -0800 (Sat, 25 Nov 2006) Log Message: ----------- added the missing lib files(since the NB5.0 to NB5.5 update) Added Paths: ----------- branches/private_welterde0/client/lib/ branches/private_welterde0/client/lib/complibs/ branches/private_welterde0/libdb/lib/ branches/private_welterde0/libdb/lib/complibs/ branches/private_welterde0/libgui/lib/ branches/private_welterde0/libgui/lib/complibs/ branches/private_welterde0/libnet/lib/ branches/private_welterde0/libnet/lib/complibs/ branches/private_welterde0/libserver/lib/ branches/private_welterde0/libserver/lib/complibs/ branches/private_welterde0/libworld/lib/ branches/private_welterde0/libworld/lib/complibs/ branches/private_welterde0/server/lib/ branches/private_welterde0/server/lib/complibs/ branches/private_welterde0/share/lib/ branches/private_welterde0/share/lib/complibs/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wel...@us...> - 2006-12-10 11:04:52
|
Revision: 32 http://svn.sourceforge.net/java-link/?rev=32&view=rev Author: welterde0 Date: 2006-12-10 03:04:49 -0800 (Sun, 10 Dec 2006) Log Message: ----------- updated docu to be better readable in the console(for all those console geeks out there) Modified Paths: -------------- branches/private_welterde0/LICENSE branches/private_welterde0/PROJECTS branches/private_welterde0/README branches/private_welterde0/TODO Modified: branches/private_welterde0/LICENSE =================================================================== --- branches/private_welterde0/LICENSE 2006-11-25 17:27:34 UTC (rev 31) +++ branches/private_welterde0/LICENSE 2006-12-10 11:04:49 UTC (rev 32) @@ -277,4 +277,4 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS \ No newline at end of file + END OF TERMS AND CONDITIONS Modified: branches/private_welterde0/PROJECTS =================================================================== --- branches/private_welterde0/PROJECTS 2006-11-25 17:27:34 UTC (rev 31) +++ branches/private_welterde0/PROJECTS 2006-12-10 11:04:49 UTC (rev 32) @@ -10,4 +10,4 @@ 4 Share -5 Themes \ No newline at end of file +5 Themes Modified: branches/private_welterde0/README =================================================================== --- branches/private_welterde0/README 2006-11-25 17:27:34 UTC (rev 31) +++ branches/private_welterde0/README 2006-12-10 11:04:49 UTC (rev 32) @@ -24,4 +24,4 @@ TODO: write this :-) 6.Further Questions -see http://java-link.sourceforge.net/moin \ No newline at end of file +see http://java-link.sourceforge.net/moin Modified: branches/private_welterde0/TODO =================================================================== --- branches/private_welterde0/TODO 2006-11-25 17:27:34 UTC (rev 31) +++ branches/private_welterde0/TODO 2006-12-10 11:04:49 UTC (rev 32) @@ -10,4 +10,4 @@ /////////////////////////////////////////////////// //////////Share//////////////////////////////////// -/////////////////////////////////////////////////// \ No newline at end of file +/////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wel...@us...> - 2007-01-07 18:45:56
|
Revision: 33 http://svn.sourceforge.net/java-link/?rev=33&view=rev Author: welterde0 Date: 2007-01-07 10:45:53 -0800 (Sun, 07 Jan 2007) Log Message: ----------- preperation for switch to ant as build system Modified Paths: -------------- branches/private_welterde0/client/pom.xml branches/private_welterde0/server/pom.xml branches/private_welterde0/server/src/main/java/org/jlink/server/Core.java branches/private_welterde0/server/src/main/java/org/jlink/server/Main.java branches/private_welterde0/server/src/main/java/org/jlink/server/MainJMX.java branches/private_welterde0/server/src/main/java/org/jlink/server/net/NetworkManager.java Added Paths: ----------- branches/private_welterde0/env_client/log4j.xml branches/private_welterde0/env_client/run.bat branches/private_welterde0/env_client/run.sh branches/private_welterde0/env_server/run.sh branches/private_welterde0/examples/ branches/private_welterde0/examples/view_0.1_basic.xml branches/private_welterde0/libgui/src/main/java/org/jlink/libgui/GUIPanel.java branches/private_welterde0/libview/ branches/private_welterde0/libview/catalog.xml branches/private_welterde0/libview/pom.xml branches/private_welterde0/libview/src/ branches/private_welterde0/libview/src/main/ branches/private_welterde0/libview/src/main/java/ branches/private_welterde0/libview/src/main/java/org/ branches/private_welterde0/libview/src/main/java/org/jlink/ branches/private_welterde0/libview/src/main/java/org/jlink/libview/ branches/private_welterde0/libview/src/main/java/org/jlink/libview/View.java branches/private_welterde0/libview/src/test/ branches/private_welterde0/libview/src/test/java/ branches/private_welterde0/libview/src/test/java/org/ branches/private_welterde0/libview/src/test/java/org/jlink/ branches/private_welterde0/libview/src/test/java/org/jlink/libview/ branches/private_welterde0/libview/src/test/java/org/jlink/libview/AppTest.java branches/private_welterde0/server/src/main/java/org/jlink/server/ConnectionHandler.java branches/private_welterde0/server/src/main/java/org/jlink/server/Context.java branches/private_welterde0/server/src/main/java/org/jlink/server/ScriptManager.java branches/private_welterde0/server/src/main/java/org/jlink/server/Session.java branches/private_welterde0/server/src/main/java/org/jlink/server/SessionManager.java branches/private_welterde0/server/src/main/java/org/jlink/server/net/Connection.java branches/private_welterde0/server/src/main/java/org/jlink/server/net/ConnectionID.java branches/private_welterde0/server/src/main/java/org/jlink/server/net/ConnectionIDFactory.java branches/private_welterde0/server/src/main/java/org/jlink/server/net/ConnectionManager.java branches/private_welterde0/server/src/main/java/org/jlink/server/net/Protocol.java branches/private_welterde0/server/src/main/java/org/jlink/server/net/ProtocolManager.java branches/private_welterde0/server/src/main/java/org/jlink/server/net/SimpleConnectionIDFactory.java Modified: branches/private_welterde0/client/pom.xml =================================================================== --- branches/private_welterde0/client/pom.xml 2006-12-10 11:04:49 UTC (rev 32) +++ branches/private_welterde0/client/pom.xml 2007-01-07 18:45:53 UTC (rev 33) @@ -77,43 +77,51 @@ <reporting> <plugins> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>jxr-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + <configuration> + <threshold>low</threshold> + <effort>Max</effort> + </configuration> </plugin> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jxr-maven-plugin</artifactId> </plugin> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-pmd-plugin</artifactId> - <configuration> - <rulesets> - <ruleset>/rulesets/basic.xml</ruleset> - <ruleset>/rulesets/codesize.xml</ruleset> - <ruleset>/rulesets/coupling.xml</ruleset> - <ruleset>/rulesets/design.xml</ruleset>- - <ruleset>/rulesets/finalizers.xml</ruleset> - <ruleset>/rulesets/imports.xml</ruleset> - <ruleset>/rulesets/javabeans.xml</ruleset> - <ruleset>/rulesets/logging-java.xml</ruleset> - <ruleset>/rulesets/naming.xml</ruleset> - <ruleset>/rulesets/optimizations.xml</ruleset> - <ruleset>/rulesets/strictexception.xml</ruleset> - <ruleset>/rulesets/strings.xml</ruleset> - <ruleset>/rulesets/sunsecure.xml</ruleset> - <ruleset>/rulesets/unusedcode.xml</ruleset> - </rulesets> - <linkXref>true</linkXref> - <sourceEncoding>utf-8</sourceEncoding> - <minimumTokens>100</minimumTokens> - <targetJdk>1.5</targetJdk> - </configuration> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> </plugin> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-report-plugin</artifactId> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + <configuration> + <rulesets> + <ruleset>/rulesets/basic.xml</ruleset> + <ruleset>/rulesets/codesize.xml</ruleset> + <ruleset>/rulesets/coupling.xml</ruleset> + <ruleset>/rulesets/design.xml</ruleset>- + <ruleset>/rulesets/finalizers.xml</ruleset> + <ruleset>/rulesets/imports.xml</ruleset> + <ruleset>/rulesets/javabeans.xml</ruleset> + <ruleset>/rulesets/logging-java.xml</ruleset> + <ruleset>/rulesets/naming.xml</ruleset> + <ruleset>/rulesets/optimizations.xml</ruleset> + <ruleset>/rulesets/strictexception.xml</ruleset> + <ruleset>/rulesets/strings.xml</ruleset> + <ruleset>/rulesets/sunsecure.xml</ruleset> + <ruleset>/rulesets/unusedcode.xml</ruleset> + </rulesets> + <linkXref>true</linkXref> + <sourceEncoding>utf-8</sourceEncoding> + <minimumTokens>100</minimumTokens> + <targetJdk>1.5</targetJdk> + </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-report-plugin</artifactId> + </plugin> </plugins> </reporting> <!--//////////////////////////////////////// Added: branches/private_welterde0/env_client/log4j.xml =================================================================== --- branches/private_welterde0/env_client/log4j.xml (rev 0) +++ branches/private_welterde0/env_client/log4j.xml 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> + +<log4j:configuration> + <appender name="LIVE-I" class="org.apache.log4j.ConsoleAppender"> + <param name="Threshold" value="info"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d{ISO8601} %-5p %c - %m%n"/> + </layout> + </appender> + <appender name="DEBUG-I" class="org.apache.log4j.FileAppender"> + <param name="Threshold" value="all"/> + <param name="File" value="logs/debug.log.xml"/> + <param name="Append" value="false"/> + <layout class="org.apache.log4j.xml.XMLLayout"/> + </appender> +<!-- + <appender name="FILE-I" class="org.apache.log4j.DailyRollingFileAppender"> + <param name="datePattern" value="'.'yyyy-MM-dd-HH"/> + <param name="File" value="logs/server.log.xml"/> + <param name="Threshold" value="debug"/> + <layout class="org.apache.log4j.xml.XMLLayout"/> + </appender> +--> + <root> + <priority value ="all" /> + <appender-ref ref="LIVE-I"/> + <appender-ref ref="DEBUG-I"/> + <!--<appender-ref ref="FILE-I"/> --> + </root> + +</log4j:configuration> Added: branches/private_welterde0/env_client/run.bat =================================================================== Added: branches/private_welterde0/env_client/run.sh =================================================================== --- branches/private_welterde0/env_client/run.sh (rev 0) +++ branches/private_welterde0/env_client/run.sh 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,3 @@ +#!/bin/sh + +java \ No newline at end of file Added: branches/private_welterde0/env_server/run.sh =================================================================== --- branches/private_welterde0/env_server/run.sh (rev 0) +++ branches/private_welterde0/env_server/run.sh 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,6 @@ +#!/bin/sh + +export CONF=config/example.xml +if[ -f config/config.xml ]; then + export CONF=config/config.xml +endif \ No newline at end of file Added: branches/private_welterde0/examples/view_0.1_basic.xml =================================================================== --- branches/private_welterde0/examples/view_0.1_basic.xml (rev 0) +++ branches/private_welterde0/examples/view_0.1_basic.xml 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<view:root xmlns:view="http://java-link.sourceforge.net/specs/VIEW/0.0.1dev"> + <info:view xmlns:info="http://java-link.sourceforge.net/specs/INFO/0.0.1dev"> + <info:name>Basic</info:name> + <info:requires> + <info:require plugin="auth_passowrd" as="auth" /><!-- this is for having an simple component as password input --> + <info:require plugin="pwprotocol" as "proto" /><!-- how the password will be transfered --> + </info:requires> + </info:view> + <config:view xmlns:components="http://java-link.sourceforge.net/specs/CONFIG/0.0.1dev"> + <config:define component="pwscreen" plugin="$$auth"> + <config:submit host="example.com" path="/login/auth/pw/nv&43d3_$1" protocol="$$proto"/> + <config:text domain="example.com" company="Example AG" /> + <config:forward on="$$proto.success" to="http://example.com/secure/?sess=$$proto.session" /> + </config:define> + </config:view> + <layout:view xmlns:layout="http://java-link.sourceforge.net/specs/LAYOUT/0.0.1dev"> + <layout:config use="null" /> + <layout:show component="$$pwscreen" /> + </layout:view> +</view:root> \ No newline at end of file Added: branches/private_welterde0/libgui/src/main/java/org/jlink/libgui/GUIPanel.java =================================================================== --- branches/private_welterde0/libgui/src/main/java/org/jlink/libgui/GUIPanel.java (rev 0) +++ branches/private_welterde0/libgui/src/main/java/org/jlink/libgui/GUIPanel.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,36 @@ +/* + * GUIPanel.java + * + * Created on 2. November 2006, 14:42 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.libgui; + +/** + * + * @author welterde + */ +public class GUIPanel { + + /** Creates a new instance of GUIPanel */ + public GUIPanel() { + } + +} Added: branches/private_welterde0/libview/catalog.xml =================================================================== --- branches/private_welterde0/libview/catalog.xml (rev 0) +++ branches/private_welterde0/libview/catalog.xml 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1 @@ + Added: branches/private_welterde0/libview/pom.xml =================================================================== --- branches/private_welterde0/libview/pom.xml (rev 0) +++ branches/private_welterde0/libview/pom.xml 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.jlink</groupId> + <artifactId>libview</artifactId> + <packaging>jar</packaging> + <version>0.0.1-SNAPSHOT</version> + <name>JLink Views</name> + <url>http://java-link.sourceforge.net/</url> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>jdom</groupId> + <artifactId>jdom</artifactId> + <version>1.0</version> + <scope>compile</scope> + </dependency> + </dependencies> +</project> Added: branches/private_welterde0/libview/src/main/java/org/jlink/libview/View.java =================================================================== --- branches/private_welterde0/libview/src/main/java/org/jlink/libview/View.java (rev 0) +++ branches/private_welterde0/libview/src/main/java/org/jlink/libview/View.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,36 @@ +/* + * View.java + * + * Created on 7. Januar 2007, 14:59 + * + * JLink: An Uplink Clone with multiplayer support. + * Copyright (C) 2007 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.libview; + +/** + * + * @author welterde + */ +public class View { + + /** Creates a new instance of View */ + public View() { + } + +} Added: branches/private_welterde0/libview/src/test/java/org/jlink/libview/AppTest.java =================================================================== --- branches/private_welterde0/libview/src/test/java/org/jlink/libview/AppTest.java (rev 0) +++ branches/private_welterde0/libview/src/test/java/org/jlink/libview/AppTest.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,38 @@ +package org.jlink.libview; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} Modified: branches/private_welterde0/server/pom.xml =================================================================== --- branches/private_welterde0/server/pom.xml 2006-12-10 11:04:49 UTC (rev 32) +++ branches/private_welterde0/server/pom.xml 2007-01-07 18:45:53 UTC (rev 33) @@ -52,6 +52,14 @@ /////////////////////////////////////--> <reporting> <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + <configuration> + <threshold>low</threshold> + <effort>Max</effort> + </configuration> + </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jxr-maven-plugin</artifactId> Added: branches/private_welterde0/server/src/main/java/org/jlink/server/ConnectionHandler.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/ConnectionHandler.java (rev 0) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/ConnectionHandler.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,37 @@ +/* + * ConnectionHandler.java + * + * Created on 13. Dezember 2006, 21:07 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.server; + +//import +//import::own +import org.jlink.server.net.Connection; +//import::sys + +/** + * + * @author welterde + */ +public interface ConnectionHandler { + public void newConnection(Connection con); +} Added: branches/private_welterde0/server/src/main/java/org/jlink/server/Context.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/Context.java (rev 0) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/Context.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,81 @@ +/* + * Context.java + * + * Created on 7. Januar 2007, 15:03 + * + * JLink: An Uplink Clone with multiplayer support. + * Copyright (C) 2007 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.server; + +//import +//import::own +//import::sys +import org.apache.commons.configuration.Configuration; +import org.apache.log4j.Logger; + +/** + * + * @author welterde + */ +public class Context { + + /** Creates a new instance of Context */ + public Context(Configuration cfg) { + if(cfg == null) + throw new NullPointerException(); + this.cfg = cfg; + this.log = Logger.getLogger(Context.class); + log.debug("Context created"); + } + + public void setCore(Core core) { + log.debug("setting Core"); + if(this.app_core != null) + throw new IllegalStateException("you may not set the core again"); + else + this.app_core = core; + log.debug("Core set!"); + } + public Core getCore() { + if(log.isTraceEnabled()) + log.trace("Core requested"); + return this.app_core; + } + + public Configuration getConfig() { + if(log.isTraceEnabled()) + log.trace("Config requested"); + return this.cfg; + } + public void reloadConfig() { + if(log.isDebugEnabled()) + log.debug("reload of config requested"); + log.error("not implemented"); + // TODO: reload the config + } + + + + private Configuration cfg = null; + + private Core app_core = null; + + private Logger log = null; + +} Modified: branches/private_welterde0/server/src/main/java/org/jlink/server/Core.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/Core.java 2006-12-10 11:04:49 UTC (rev 32) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/Core.java 2007-01-07 18:45:53 UTC (rev 33) @@ -39,27 +39,30 @@ import org.apache.log4j.Logger; /** - * + * The core of the Server. + * It is responsible for managing all other components of the Server * @author welterde */ public class Core implements Runnable { /** Creates a new instance of Core */ - public Core() { + public Core(Context ctx) { + if(ctx == null) + throw new NullPointerException(); log.debug("Core created"); + this.ctx = ctx; + } - public void init(Configuration conf) { + public void init() { log.info("initing Core"); - if(conf == null) - throw new NullPointerException("the config may not be null"); // <editor-fold defaultstate="collapsed" desc=" init StorageManager "> { try { log.info("initalizing StorageManager"); //create subset for the StorageManager - Configuration comp_conf = conf.subset("server.db"); + Configuration comp_conf = this.ctx.getConfig().subset("database"); //create an instance of the StorageManager this.app_storage = new StorageManager(); //init him, with the config @@ -81,9 +84,9 @@ try { log.info("initalizing NetworkManager"); //create subset for the NetworkManager - Configuration comp_conf = conf.subset("server.net"); + Configuration comp_conf = this.ctx.getConfig().subset("network"); //create an instance of the NetworkManager - this.app_network = new NetworkManager(); + this.app_network = new NetworkManager(this); //init it, with the subset of the config this.app_network.init(comp_conf); //create the JMX wrapper for the NetworkManager @@ -100,8 +103,32 @@ } // </editor-fold> + // <editor-fold defaultstate="collapsed" desc=" init SessionManager "> + { + try { + log.info("initializing SessionManager"); + //create subset for the SessionManager + Configuration comp_conf = this.ctx.getConfig().subset("session"); + //create an instance of the SessionManager + this.app_session = new SessionManager(this); + //init it, with the subset of the config + this.app_session.init(comp_conf); + //create the JMX wrapper for the NetworkManager + //TODO: do this + //register the JMX wrapper + //TODO: register the JMX wrapper + log.info("SessionManager initalized"); + } catch(Exception exc) { + log.error("initializing failed", exc); + //TODO: seperate problems into NetworkManager and NetworkManagerJMX + } + + + } + // </editor-fold> + } @@ -157,12 +184,21 @@ public StorageManager getStorage() { return this.app_storage; } + public NetworkManager getNetwork() { + return this.app_network; + } - private Logger log = Logger.getLogger(Core.class); - private Thread thread = new Thread(this); - private Object runLock = "lock009ij"; + /////////////////////////////////////// + ////////////// Variables ////////////// + /////////////////////////////////////// + + private Logger log = Logger.getLogger(Core.class); + private Context ctx = null; + private Thread thread = new Thread(this); + private Object runLock = "lock009ij"; + private boolean doStop = false; //Composite stuff @@ -171,4 +207,6 @@ public NetworkManager app_network = null; + public SessionManager app_session = null; + } Modified: branches/private_welterde0/server/src/main/java/org/jlink/server/Main.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/Main.java 2006-12-10 11:04:49 UTC (rev 32) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/Main.java 2007-01-07 18:45:53 UTC (rev 33) @@ -65,6 +65,8 @@ String conf_log = null; String conf_srv = null; + Context ctx = null; + // <editor-fold defaultstate="collapsed" desc=" parse arguments "> try { //create options @@ -119,12 +121,14 @@ } else if(conf_log.endsWith("xml")) { DOMConfigurator.configure(conf_log); } else { - //VOTE: shall we crash here or use simply BasicConf + //to make it simple for server operators, use the simple BasicConfigurator BasicConfigurator.configure(); - //TODO: till when vote is over, add log message telling that init logging failed } + // now tell the user, that we started logging log = Logger.getLogger(Main.class); log.info("logging started"); + // print the system information to the log file + // this information is mostly used by us for debugging and bug reports { Logger sys = Logger.getLogger("jlink.init.sysinfo"); sys.info("retrieving system information"); @@ -139,7 +143,6 @@ // </editor-fold> // <editor-fold defaultstate="collapsed" desc=" load config "> - //TODO: check existance of file log.info("loading server configuration"); try { xconf = new XMLConfiguration(conf_srv); @@ -152,6 +155,8 @@ // </editor-fold> + ctx = new Context(conf); + // <editor-fold defaultstate="collapsed" desc=" startup "> // </editor-fold> @@ -160,7 +165,7 @@ JMXAgent agent = JMXAgent.getDefault(); // </editor-fold> - Core core = new Core(); + Core core = new Core(ctx); core.start(); @@ -170,24 +175,14 @@ public static void shutdown() { log.info("shutdown requested"); - confSave(); //TODO: shutdown everything log.info("shutdown complete, exiting"); System.exit(0); } - - - public static void confSave() { - //FIX: Threadsave? - log.debug("saving config"); - try { - xconf.save(); - log.trace("config saved"); - } catch (ConfigurationException exc) { - log.warn("couldnt save config", exc); - } - } + /** + * This will cause the reload of the configuration + */ public static void confReload() { log.info("hit unimplemented method"); //TODO: write this Modified: branches/private_welterde0/server/src/main/java/org/jlink/server/MainJMX.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/MainJMX.java 2006-12-10 11:04:49 UTC (rev 32) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/MainJMX.java 2007-01-07 18:45:53 UTC (rev 33) @@ -103,6 +103,7 @@ return new MBeanNotificationInfo[] {}; } + // Delegates to Main /** * Operation exposed for management */ Added: branches/private_welterde0/server/src/main/java/org/jlink/server/ScriptManager.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/ScriptManager.java (rev 0) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/ScriptManager.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,72 @@ +/* + * ScriptManager.java + * + * Created on 10. Dezember 2006, 13:34 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.server; + +//import +//import::own +import org.jlink.server.Core; +//import::sys +import org.apache.log4j.Logger; +import org.apache.commons.configuration.Configuration; + +/** + * + * @author welterde + */ +public class ScriptManager { + + /** Creates a new instance of ScriptManager */ + public ScriptManager(Core core) { + log.debug("ScriptManager created"); + if (core == null) + throw new NullPointerException(); + this.core = core; + } + + public void init(Configuration conf) { + log.info("initializing ScriptManager"); + if(conf == null) + throw new NullPointerException("the config may not be null"); + + } + + public Object run(String script) { + if(script == null) + throw new NullPointerException(); + return null; + } + + public void destroy() { + + } + + + + + + private Logger log = Logger.getLogger(ScriptManager.class); + + private Core core = null; + +} Added: branches/private_welterde0/server/src/main/java/org/jlink/server/Session.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/Session.java (rev 0) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/Session.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,36 @@ +/* + * Session.java + * + * Created on 20. Dezember 2006, 19:16 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.server; + +/** + * + * @author welterde + */ +public class Session { + + /** Creates a new instance of Session */ + public Session() { + } + +} Added: branches/private_welterde0/server/src/main/java/org/jlink/server/SessionManager.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/SessionManager.java (rev 0) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/SessionManager.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,87 @@ +/* + * SessionManager.java + * + * Created on 20. Dezember 2006, 19:17 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.server; + +//import +//import::own +//import::sys +import org.apache.commons.configuration.Configuration; +import org.apache.log4j.Logger; + +/** + * + * @author welterde + */ +public class SessionManager { + + /** Creates a new instance of SessionManager */ + public SessionManager(Core core) { + log.trace("SessionManager created"); + if(core == null) + throw new NullPointerException(); + else + this.core = core; + } + + public void init(Configuration conf) { + if(this.valid) + return; + log.debug("initializing SessionManager"); + if(conf == null) + throw new NullPointerException(); + this.config = conf; + + + + this.valid = true; + } + + public void start() { + + } + + protected void run() { + + } + + public void stop() { + + } + + public void destroy() { + + } + + + private Logger log = Logger.getLogger(SessionManager.class); + + private Core core = null; + + private Configuration config = null; + + // Status + private boolean valid = false; + + private boolean running = false; +} Added: branches/private_welterde0/server/src/main/java/org/jlink/server/net/Connection.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/net/Connection.java (rev 0) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/net/Connection.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,71 @@ +/* + * Connection.java + * + * Created on 13. Dezember 2006, 20:31 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.server.net; + +//import +//import::own +//import::sys +import java.net.Socket; +import java.util.Queue; +import java.util.concurrent.LinkedBlockingQueue; + +/** + * Wrapper around the Socket. + * @author welterde + */ +public class Connection { + + /** Creates a new instance of Connection */ + public Connection(Socket sock) { + if(sock == null) + throw new NullPointerException("that is an wrapper around an TCP! but where is the Socket?"); + this.sock = sock; + } + + public void send(Object msg) throws InterruptedException { + if(msg == null) + throw new NullPointerException(); + //enque the Message to be sent + //this.toSent.put(msg); + } + + + + + + + public boolean alive() { + return this.sock.isClosed(); + } + + public boolean valid() { + boolean v = true; + boolean a = this.alive(); + return (v||a); + } + + private Socket sock = null; + + private Queue<Object> toSent = new LinkedBlockingQueue<Object>(); +} Added: branches/private_welterde0/server/src/main/java/org/jlink/server/net/ConnectionID.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/net/ConnectionID.java (rev 0) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/net/ConnectionID.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,44 @@ +/* + * ConnectionID.java + * + * Created on 18. Dezember 2006, 21:43 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.server.net; + +/** + * + * @author welterde + */ +public class ConnectionID { + + /** Creates a new instance of ConnectionID */ + public ConnectionID(String id) { + if(id == null) + throw new NullPointerException(); + this.id = id; + } + + public String id() { + return this.id; + } + + String id; +} Added: branches/private_welterde0/server/src/main/java/org/jlink/server/net/ConnectionIDFactory.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/net/ConnectionIDFactory.java (rev 0) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/net/ConnectionIDFactory.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,32 @@ +/* + * ConnectionIDFactory.java + * + * Created on 18. Dezember 2006, 21:44 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.server.net; + +/** + * + * @author welterde + */ +public interface ConnectionIDFactory { + public ConnectionID generateID(); +} Added: branches/private_welterde0/server/src/main/java/org/jlink/server/net/ConnectionManager.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/net/ConnectionManager.java (rev 0) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/net/ConnectionManager.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,71 @@ +/* + * ConnectionManager.java + * + * Created on 18. Dezember 2006, 20:13 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.server.net; + +//import +//import::own +//import::sys +import org.apache.log4j.Logger; +import java.util.Map; +import java.util.HashMap; + +/** + * This class is responsible for maintaining an list of connections. + * + * @author welterde + */ +public class ConnectionManager { + + /** Creates a new instance of ConnectionManager */ + public ConnectionManager() { + log.debug("ConnectionManager created"); + } + + public void add(Connection con) { + // first check if this connection is already there + //boolean c = this.connections.contains(con); + if(true) { + return; + } else { + //this.connections.add(null, con); + } + + // now we handle the beginning of the JLink Protocol + // TODO: handle the beginning of the JLink Protocol + } + + public void remove(Connection con) { + this.connections.remove(con); + } + + public void purge() { + + } + + + + private Map<ConnectionID, Connection> connections = new HashMap<ConnectionID, Connection>(); + + private Logger log = Logger.getLogger(ConnectionManager.class); +} Modified: branches/private_welterde0/server/src/main/java/org/jlink/server/net/NetworkManager.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/net/NetworkManager.java 2006-12-10 11:04:49 UTC (rev 32) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/net/NetworkManager.java 2007-01-07 18:45:53 UTC (rev 33) @@ -25,24 +25,44 @@ //import //import::own +import org.jlink.server.Core; //import::sys import org.apache.log4j.Logger; import org.apache.commons.configuration.Configuration; +import java.io.IOException; +import java.util.List; +import java.util.LinkedList; +//import::sys::net +import java.net.ServerSocket; +import java.net.Socket; /** - * + * The NetworkManager manages everything related to networking. + * It is a bit like a meta-manager, because it only handles the Socket and the + * creation of connection objects. * @author welterde */ public class NetworkManager implements Runnable { - /** Creates a new instance of NetworkManager */ - public NetworkManager() { + /** + * Creates a new instance of NetworkManager + * @param core The core of the server + */ + public NetworkManager(Core core) { log.trace("NetworkManager created"); + if(core == null) + throw new NullPointerException(); + else + this.core = core; } + /** + * This will initialize, this NetworkManager, with the given configuration. + * @param conf Thats the configuration loaded, has to be the subset, for this module + */ public void init(Configuration conf) { - //bypass, so it isnt inited multiple times + //bypass, so it isnt initialized multiple times if(this.valid) return; log.debug("initing NetworkManager"); @@ -50,20 +70,65 @@ if(conf == null) throw new NullPointerException("no, the configuration may not be null"); this.config = conf; + //enough of the wrapper code, lets get to the business code + /////////////////// + // Business code // + /////////////////// + { + // the port we will listen on + int port = 0; + // the interface we will listen on + String bind = null; + // how many errors may occour before, the port is treated as closed + int errMax = 0; + + //read port and bind adress from the config + port = this.config.getInt("port", 4242); + bind = this.config.getString("bindTo", null); + errMax = this.config.getInt("maxErr", 42); + // now validate the stuff + if (port < 1024) { + log.fatal("it can be dangerous to run jlink on an port < 1024"); + //but lets continue(he knows what he is doing) + } + // empty strings are not valid interfaces + if (bind == "" || bind == " ") + bind = null; + + // read from config; validated; now save it + this.port = port; + this.host = bind; + this.errMax = errMax; + } + + + //set the status variable, so we know that the NM is valid this.valid = true; } + /** + * Starts the NetworkManager, if it is has been initialized. + * It will start listening on the port defined on the port given in the given config. + * Alternatively it will listen on the default port, which is 4242. + */ public void start() { //bypass, so we dont start it multiple times if(this.running) return; log.debug("starting NetworkManager"); + + //now create an new thread, and get to work + this.thread = new Thread(this); + this.thread.start(); } + /** + * should not be called from outside. + */ public void run() { - //bypass, so we have only one instance + //bypass, so we have only one instance runnings if(this.running) return; //TODO: add check for not gracefully stopped threads @@ -73,38 +138,105 @@ //set the status variable, so we know that we're running this.running = true; - //TODO: business code + /////////////////// + // Business code // + /////////////////// + { + // first start the ServerSocket + if(this.host == null) + try { + // listen on port, specified when initialized + this.socket = new ServerSocket(this.port); + } catch(IOException err) { + // tell the user, what failed + log.fatal("cannot listen on port:" + this.port, err); + // now crash the server + throw new RuntimeException("listen failed", err); + } + else { + // listening on an specified port is not possible + throw new UnsupportedOperationException("binding to an selected interface not implemented"); + } + // the connection to the client + Socket sock = null; + // the socket nllw + Connection con = null; + // the current error count + int errC = 0; + // run forever until we should stop + while(!this.doStop) { + try { + // accept one connection + sock = this.socket.accept(); + // now create an Connection object for that object + con = new Connection(sock); + // save the connection + this.connections.add(con); + // call the core as ConnectionHandler + + } catch(IOException err) { + // tell the user, that something has went terrible wrong + log.fatal("accept failed", err); + // increase the error count + errC++; + // if the errorcount exeeds the maximum, stop + if(errC > this.errMax) + this.stop(); + } + } + } //set the status variable, so we know that we're not running anymore this.running = false; } + /** + * Waits until the networkmanager thread has finished. + * Returns immideatly if the thread is not running + * @throws java.lang.InterruptedException delegated from Thread + */ public void join() throws InterruptedException { //bypass, so we dont want to wait for an stopped thread if(!this.running) return; + // tell the user, what we are doing log.debug("joining NetworkManager"); this.thread.join(); } + /** + * This will enque stopping of the server. + * Returns immideatly. + */ public void stop() { //bypass, so we dont want to stop an stopped thread if(!this.running) return; - log.debug("stopping NetworkManager"); + // tell the user, what we are doing + log.debug("stopping NetworkManager"); + + // set async flag to stop + this.doStop = true; } + /** + * This will undo every change done in init(config) and turn this NetworkManager + * invalid. + */ public void destroy() { //bypass, so we dont destroy something destroid if(!this.valid) return; + // tell the user, what we are doing log.debug("destroying NetworkManager"); //check first if the thread is running, if so stop him if(this.running) { + // gently shutdown this.stop(); try { + // wait for the thread to end this.join(); } catch(InterruptedException exc) { //this should never happen @@ -121,13 +253,67 @@ - private Logger log = Logger.getLogger(NetworkManager.class); + /** + * The connection to the operator, to tell him whats going on. + */ + private Logger log = Logger.getLogger(NetworkManager.class); - private Configuration config = null; + /** + * The configuration of us. + */ + private Configuration config = null; - private Thread thread = null; + /** + * The thread we will run on. + */ + private Thread thread = null; + /** + * The core of the Server. + * Used for callbacks. + */ + private Core core = null; + + //business stuff + /** + * The ServerSocket, we will listen on. + */ + private ServerSocket socket = null; + + /** + * All connections + */ + private List<Connection> connections = new LinkedList<Connection>(); + + /** + * The port, we will listen on + */ + private int port = 0; + + /** + * The interface we will listen on + */ + private String host = null; + + /** + * How many errors may occour, before we think thats to much. + */ + private int errMax = 0; + //Status - private boolean valid = false; - private boolean running = false; + /** + * This is true if this NetworkManager is valid. + */ + private boolean valid = false; + /** + * This is true, if this NetworkManager is runnning. + */ + private boolean running = false; + + //operations + /** + * Thats one operation flag. + * If true and if the NetworkManager is running, the run method will stop. + */ + private boolean doStop = false; } Added: branches/private_welterde0/server/src/main/java/org/jlink/server/net/Protocol.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/net/Protocol.java (rev 0) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/net/Protocol.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,44 @@ +/* + * Protocol.java + * + * Created on 19. Dezember 2006, 17:54 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.server.net; + +//import +//import::own +import org.jlink.server.Session; +//import::sys + +/** + * + * @author welterde + */ +public interface Protocol { + public boolean recocgnize(byte[] data); + + public void init(Connection con); + + public Session start(); + + public void reset(); + +} Added: branches/private_welterde0/server/src/main/java/org/jlink/server/net/ProtocolManager.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/net/ProtocolManager.java (rev 0) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/net/ProtocolManager.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,68 @@ +/* + * ProtocolManager.java + * + * Created on 19. Dezember 2006, 18:08 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.server.net; + +//import +//import::own +//import::sys +import java.util.List; +import java.util.LinkedList; + +/** + * + * @author welterde + */ +public class ProtocolManager { + + /** Creates a new instance of ProtocolManager */ + private ProtocolManager() { + } + + public static void register(Protocol p) { + if(p == null) + throw new NullPointerException(); + protocols.add(p); + } + public static ProtocolManager getInstance() { + if(instance == null) + instance = new ProtocolManager(); + return instance; + } + + + + public Protocol recocgnize(byte[] data) { + for(int i = 0; i < protocols.size();i++) { + if(protocols.get(i).recocgnize(data)) + return protocols.get(i); + } + throw new RuntimeException("no suitable protocol found"); + } + + + + private static List<Protocol> protocols = new LinkedList<Protocol>(); + + private static ProtocolManager instance = null; +} Added: branches/private_welterde0/server/src/main/java/org/jlink/server/net/SimpleConnectionIDFactory.java =================================================================== --- branches/private_welterde0/server/src/main/java/org/jlink/server/net/SimpleConnectionIDFactory.java (rev 0) +++ branches/private_welterde0/server/src/main/java/org/jlink/server/net/SimpleConnectionIDFactory.java 2007-01-07 18:45:53 UTC (rev 33) @@ -0,0 +1,59 @@ +/* + * SimpleConnectionIDFactory.java + * + * Created on 18. Dezember 2006, 21:46 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.server.net; + +import java.util.Random; + +/** + * + * @author welterde + */ +public class SimpleConnectionIDFactory implements ConnectionIDFactory { + public SimpleConnectionIDFactory() { + current = current + 34500; + this.rand = new Random(); + } + + public ConnectionID generateID(String namespace) { + int add = 0; + long c = 0L; + synchronized(current_lock) { + c = current; + } + add = rand.nextInt(); + long res = c + add; + return new ConnectionID(namespace + res); + } + public ConnectionID generateID() { + return this.generateID(""); + } + + + + private static long current = 0L; + + private static String current_lock = "adsfdcvbhztrf"; + + private Random rand = null; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |