[Java-link-svn] SF.net SVN: java-link: [16] trunk
Status: Pre-Alpha
Brought to you by:
welterde0
From: <wel...@us...> - 2006-10-09 17:50:03
|
Revision: 16 http://svn.sourceforge.net/java-link/?rev=16&view=rev Author: welterde0 Date: 2006-10-09 10:49:22 -0700 (Mon, 09 Oct 2006) Log Message: ----------- added module libdb for server projects: added module libdb for server build(build.xml): added dep for jcr-1.0.jar of libdb fixed missing mkdirs in share and server deps server(pom.xml): added deb for libdb server: rewritten the Main class rewritten the Core added JMX support to Main Modified Paths: -------------- trunk/build.xml trunk/server/nbproject/project.xml trunk/server/pom.xml trunk/server/src/main/java/org/jlink/server/jmx/JMXAgent.java trunk/server/src/main/java/org/jlink/server/jmx/run.properties Added Paths: ----------- trunk/libdb/ trunk/libdb/nbproject/ trunk/libdb/nbproject/mavencall.xml trunk/libdb/nbproject/project.properties trunk/libdb/nbproject/project.xml trunk/libdb/pom.xml trunk/libdb/src/ trunk/libdb/src/main/ trunk/libdb/src/main/java/ trunk/libdb/src/main/java/org/ trunk/libdb/src/main/java/org/jlink/ trunk/libdb/src/main/java/org/jlink/server/ trunk/libdb/src/main/java/org/jlink/server/libdb/ trunk/libdb/src/main/java/org/jlink/server/libdb/StorageManager.java trunk/libdb/src/main/java/org/jlink/server/libdb/drivers/ trunk/libdb/src/main/java/org/jlink/server/libdb/drivers/Driver.java trunk/libdb/src/main/java/org/jlink/server/libdb/drivers/JackrabbitDriver.java trunk/libdb/src/main/resources/ trunk/libdb/src/site/ trunk/libdb/src/site/site.xml trunk/libdb/src/test/ trunk/libdb/src/test/java/ trunk/server/src/main/java/org/jlink/server/Main.java trunk/server/src/main/java/org/jlink/server/MainJMX.java trunk/server/src/main/java/org/jlink/server/MainJMXMBean.java Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2006-10-08 19:29:46 UTC (rev 15) +++ trunk/build.xml 2006-10-09 17:49:22 UTC (rev 16) @@ -31,6 +31,7 @@ --> <!--Targets--> <target name="share-deps"> + <mkdir dir="tmp"/> <echo message="downloading dep client/jfunutil.jar"/> <get src="http://${sf.mirror}.dl.sourceforge.net/sourceforge/java-link/jfunutil-5.0.jar" dest="tmp/jfunutil.jar"/> <exec executable="mvn"> @@ -48,8 +49,21 @@ </target> - - <target name="server" depends="share"> + <target name="server-deps" depends="share"> + <mkdir dir="tmp"/> + <echo message="downloading dep server/jcr.jar"/> + <get src="http://${sf.mirror}.dl.sourceforge.net/sourceforge/java-link/jcr-1.0.jar" dest="tmp/jcr.jar"/> + <exec executable="mvn"> + <arg line="install:install-file -DgroupId=jsr170 -DartifactId=jcr -Dversion=1.0 -Dpackaging=jar -Dfile=tmp/jcr.jar"/> + </exec> + <echo message="[done]"/> + </target> + <target name="server-mods" depends="server-deps"> + <exec executable="mvn" dir="libdb" output="libdb.server.build.log"> + <arg value="install"/> + </exec> + </target> + <target name="server" depends="server-deps, server-mods"> <exec executable="mvn" dir="server" output="server.build.log"> <arg value="compile"/> </exec> Added: trunk/libdb/nbproject/mavencall.xml =================================================================== --- trunk/libdb/nbproject/mavencall.xml (rev 0) +++ trunk/libdb/nbproject/mavencall.xml 2006-10-09 17:49:22 UTC (rev 16) @@ -0,0 +1,42 @@ +<project name="client" default="build" basedir=".."> + <property file="nbproject/private/private.properties"/> + <property file="nbproject/project.properties"/> + <target name="build" description="Build"> + <exec dir="${basedir}" executable="${mvn.path}"> + <arg line="package"/> + </exec> + </target> + <target name="clean" description="Clean"> + <exec dir="${basedir}" executable="${mvn.path}"> + <arg line="clean:clean"/> + </exec> + </target> + <target name="javadoc" description="Javadoc"> + <exec dir="${basedir}" executable="${mvn.path}"> + <arg line="site:site"/> + </exec> + </target> + <target name="run" description="Install Locally"> + <exec dir="${basedir}" executable="${mvn.path}"> + <arg line="install"/> + </exec> + </target> + <target name="test" description="Test Project"> + <exec dir="${basedir}" executable="${mvn.path}"> + <arg line="test"/> + </exec> + </target> + <target name="jalopy" description="Format Code"> + <exec dir="${basedir}" executable="${mvn.path}"> + <arg line="jalopy:format"/> + </exec> + </target> + <target name="refresh-project" description="Refresh Project"> + <copy file="nbproject/mavencall.xml" tofile="nbproject/mavencall.xml.bak"/> + <exec dir="${basedir}" executable="${mvn.path}"> + <arg line="netbeans-freeform:generate-netbeans-project"/> + </exec> + <delete file="nbproject.xml"/> + <move file="nbproject/mavencall.xml.bak" tofile="nbproject/mavencall.xml"/> + </target> +</project> \ No newline at end of file Added: trunk/libdb/nbproject/project.properties =================================================================== --- trunk/libdb/nbproject/project.properties (rev 0) +++ trunk/libdb/nbproject/project.properties 2006-10-09 17:49:22 UTC (rev 16) @@ -0,0 +1,5 @@ +#The netbeans freeform property file +#Mon Oct 09 18:04:07 CEST 2006 +local.repository=/Users/welterde/.m2/repository +mvn.path=mvn +project.directory=/Users/welterde/Documents/dev/jlink/current_trunk/libdb Added: trunk/libdb/nbproject/project.xml =================================================================== --- trunk/libdb/nbproject/project.xml (rev 0) +++ trunk/libdb/nbproject/project.xml 2006-10-09 17:49:22 UTC (rev 16) @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://www.netbeans.org/ns/project/1"> + <type>org.netbeans.modules.ant.freeform</type> + <configuration> + <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1"> + <name>JLink libdb</name> + <properties> + <property name="ant.script">nbproject/mavencall.xml</property> + <property-file>nbproject/project.properties</property-file> + </properties> + <folders> + <source-folder> + <label>src/main/java</label> + <type>java</type> + <location>src/main/java</location> + </source-folder> + <source-folder> + <label>src/test/java</label> + <type>java</type> + <location>src/test/java</location> + </source-folder> + </folders> + <ide-actions> + <action name="build"> + <script>${ant.script}</script> + <target>build</target> + </action> + <action name="clean"> + <script>${ant.script}</script> + <target>clean</target> + </action> + <action name="rebuild"> + <script>${ant.script}</script> + <target>clean</target> + <target>build</target> + </action> + <action name="javadoc"> + <script>${ant.script}</script> + <target>javadoc</target> + </action> + <action name="run"> + <script>${ant.script}</script> + <target>run</target> + </action> + <action name="test"> + <script>${ant.script}</script> + <target>test</target> + </action> + </ide-actions> + <export> + <type>folder</type> + <location>target/classes</location> + <script>${ant.script}</script> + <build-target>build</build-target> + </export> + <export> + <type>folder</type> + <location>target/test-classes</location> + <script>${ant.script}</script> + <build-target>build</build-target> + </export> + <view> + <items> + <source-folder style="packages"> + <label>src/main/java</label> + <location>src/main/java</location> + </source-folder> + <source-folder style="packages"> + <label>src/test/java</label> + <location>src/test/java</location> + </source-folder> + <source-file> + <label>pom</label> + <location>pom.xml</location> + </source-file> + <source-file> + <label>mavencall</label> + <location>nbproject/mavencall.xml</location> + </source-file> + <source-folder style="tree"> + <label>src/main/resources</label> + <location>src/main/resources</location> + </source-folder> + <source-folder style="tree"> + <label>src/test/resources</label> + <location>src/test/resources</location> + </source-folder> + <source-folder style="tree"> + <label>src/site</label> + <location>src/site</location> + </source-folder> + <source-folder style="tree"> + <label>target</label> + <location>target</location> + </source-folder> + </items> + <context-menu> + <action> + <script>${ant.script}</script> + <label>Refresh Project</label> + <target>refresh-project</target> + </action> + <ide-action name="build"/> + <ide-action name="clean"/> + <ide-action name="rebuild"/> + <ide-action name="javadoc"/> + <ide-action name="run"/> + <ide-action name="test"/> + <action> + <script>${ant.script}</script> + <label>Format Code</label> + <target>jalopy</target> + </action> + </context-menu> + </view> + <subprojects/> + </general-data> + <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2"> + <compilation-unit> + <package-root>src/main/java</package-root> + <classpath mode="compile">${local.repository}/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar:${local.repository}/log4j/log4j/1.2.8/log4j-1.2.8.jar:${local.repository}/commons-beanutils/commons-beanutils/1.4/commons-beanutils-1.4.jar:${local.repository}/commons-lang/commons-lang/2.1/commons-lang-2.1.jar:${local.repository}/commons-collections/commons-collections/3.1/commons-collections-3.1.jar:${local.repository}/org/apache/derby/derby/10.1.1.0/derby-10.1.1.0.jar:${local.repository}/commons-jxpath/commons-jxpath/1.2/commons-jxpath-1.2.jar:${local.repository}/commons-digester/commons-digester/1.6/commons-digester-1.6.jar:${local.repository}/org/apache/jackrabbit/jackrabbit-core/1.0.1/jackrabbit-core-1.0.1.jar:${local.repository}/ant/ant-optional/1.5.1/ant-optional-1.5.1.jar:${local.repository}/lucene/lucene/1.4.3/lucene-1.4.3.jar:${local.repository}/commons-configuration/commons-configuration/1.3/commons-configuration-1.3.jar:${local.repository}/commons-logging/commons-logging/1.0/commons-logging-1.0.jar:${local.repository}/commons-codec/commons-codec/1.3/commons-codec-1.3.jar:${local.repository}/xerces/xercesImpl/2.2.1/xercesImpl-2.2.1.jar:${local.repository}/xerces/xerces/1.2.3/xerces-1.2.3.jar:${local.repository}/xalan/xalan/2.7.0/xalan-2.7.0.jar:${local.repository}/xerces/xmlParserAPIs/2.0.2/xmlParserAPIs-2.0.2.jar:${local.repository}/jdom/jdom/b9/jdom-b9.jar:${local.repository}/javax/servlet/servlet-api/2.2/servlet-api-2.2.jar:${local.repository}/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar:${local.repository}/commons-beanutils/commons-beanutils-core/1.7.0/commons-beanutils-core-1.7.0.jar:${local.repository}/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar:${local.repository}/org/slf4j/slf4j-log4j12/1.0/slf4j-log4j12-1.0.jar:${local.repository}/geronimo-spec/geronimo-spec-jta/1.0-M1/geronimo-spec-jta-1.0-M1.jar:${local.repository}/jsr170/jcr/1.0/jcr-1.0.jar</classpath> + <built-to>target/classes</built-to> + <source-level>1.5</source-level> + </compilation-unit> + <compilation-unit> + <package-root>src/test/java</package-root> + <unit-tests/> + <classpath mode="compile">target/classes:${local.repository}/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar:${local.repository}/junit/junit/3.8.1/junit-3.8.1.jar:${local.repository}/log4j/log4j/1.2.8/log4j-1.2.8.jar:${local.repository}/commons-beanutils/commons-beanutils/1.4/commons-beanutils-1.4.jar:${local.repository}/commons-lang/commons-lang/2.1/commons-lang-2.1.jar:${local.repository}/commons-collections/commons-collections/3.1/commons-collections-3.1.jar:${local.repository}/org/apache/derby/derby/10.1.1.0/derby-10.1.1.0.jar:${local.repository}/commons-jxpath/commons-jxpath/1.2/commons-jxpath-1.2.jar:${local.repository}/commons-digester/commons-digester/1.6/commons-digester-1.6.jar:${local.repository}/org/apache/jackrabbit/jackrabbit-core/1.0.1/jackrabbit-core-1.0.1.jar:${local.repository}/ant/ant-optional/1.5.1/ant-optional-1.5.1.jar:${local.repository}/lucene/lucene/1.4.3/lucene-1.4.3.jar:${local.repository}/commons-configuration/commons-configuration/1.3/commons-configuration-1.3.jar:${local.repository}/commons-logging/commons-logging/1.0/commons-logging-1.0.jar:${local.repository}/commons-codec/commons-codec/1.3/commons-codec-1.3.jar:${local.repository}/xerces/xercesImpl/2.2.1/xercesImpl-2.2.1.jar:${local.repository}/xerces/xerces/1.2.3/xerces-1.2.3.jar:${local.repository}/xalan/xalan/2.7.0/xalan-2.7.0.jar:${local.repository}/xerces/xmlParserAPIs/2.0.2/xmlParserAPIs-2.0.2.jar:${local.repository}/jdom/jdom/b9/jdom-b9.jar:${local.repository}/javax/servlet/servlet-api/2.2/servlet-api-2.2.jar:${local.repository}/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar:${local.repository}/commons-beanutils/commons-beanutils-core/1.7.0/commons-beanutils-core-1.7.0.jar:${local.repository}/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar:${local.repository}/org/slf4j/slf4j-log4j12/1.0/slf4j-log4j12-1.0.jar:${local.repository}/geronimo-spec/geronimo-spec-jta/1.0-M1/geronimo-spec-jta-1.0-M1.jar:${local.repository}/jsr170/jcr/1.0/jcr-1.0.jar</classpath> + <built-to>target/test-classes</built-to> + <source-level>1.5</source-level> + </compilation-unit> + </java-data> + </configuration> +</project> Added: trunk/libdb/pom.xml =================================================================== --- trunk/libdb/pom.xml (rev 0) +++ trunk/libdb/pom.xml 2006-10-09 17:49:22 UTC (rev 16) @@ -0,0 +1,141 @@ +<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"> +<!--//////////////////////////////////////// + /////////////General//////////////////// + /////////////////////////////////////--> + <modelVersion>4.0.0</modelVersion> + <groupId>org.jlink</groupId> + <artifactId>libdb</artifactId> + <packaging>jar</packaging> + <version>0.0.1-SNAPSHOT</version> + <name>JLink libdb</name> + <url>http://java-link.sf.net/</url> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>commons-configuration</groupId> + <artifactId>commons-configuration</artifactId> + <version>1.3</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.jackrabbit</groupId> + <artifactId>jackrabbit-core</artifactId> + <version>1.0.1</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>jsr170</groupId> + <artifactId>jcr</artifactId> + <version>1.0</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.13</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>commons-configuration</groupId> + <artifactId>commons-configuration</artifactId> + <version>1.3</version> + <scope>compile</scope> + </dependency> + </dependencies> +<!--//////////////////////////////////////// + /////////////Reporting////////////////// + /////////////////////////////////////--> + <reporting> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jxr-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + <configuration> + <rulesets> + <ruleset>/rulesets/basic.xml</ruleset> + <ruleset>/rulesets/braces.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> +<!--//////////////////////////////////////// + /////////////Building/////////////////// + /////////////////////////////////////--> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + </plugins> + </build> +<!--//////////////////////////////////////// + /////////////Deploying////////////////// + /////////////////////////////////////--> + <distributionManagement> + <site> + <id>jlink-sf</id> + <url>scp://shell.sf.net/home/groups/j/ja/java-link/htdocs/maven2/libdb</url> + </site> + </distributionManagement> +<!--//////////////////////////////////////// + /////////////Include from root////////// + /////////////////////////////////////--> + <ciManagement> + <system>cruisecontrol</system> + <url>http://welterde.i2p/cruisecontrol/</url> + </ciManagement> + <issueManagement> + <system>sourceforge</system> + <url>http://sourceforge.net/tracker/?group_id=162264</url> + </issueManagement> + <developers> + <developer> + <id>welterde</id> + <email>wel...@ar...</email> + </developer> + </developers> + <scm> + <connection>scm:svn:https://svn.sourceforge.net/svnroot/javalink</connection> + <url>http://svn.sourceforge.net/viewcvs.cgi/java-link/</url> + </scm> +</project> Added: trunk/libdb/src/main/java/org/jlink/server/libdb/StorageManager.java =================================================================== --- trunk/libdb/src/main/java/org/jlink/server/libdb/StorageManager.java (rev 0) +++ trunk/libdb/src/main/java/org/jlink/server/libdb/StorageManager.java 2006-10-09 17:49:22 UTC (rev 16) @@ -0,0 +1,121 @@ +/* + * StorageManager.java + * + * Created on 10. September 2006, 11: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.libdb; + +import javax.jcr.Repository; +import javax.jcr.RepositoryException; +import org.apache.commons.configuration.Configuration; +import org.apache.log4j.Logger; + +import org.jlink.server.libdb.drivers.Driver; + +/** + * + * @author welterde + */ +public class StorageManager { + //Static Configuration + public static final String ENV_SEP = System.getProperty("file.separator"); + public static final String DB_HOME = System.getProperty("user.home") + + ENV_SEP + ".jlink" + ENV_SEP + "server" + ENV_SEP + "db"; + public static final String DB_CONF = DB_HOME + ENV_SEP + "config.xml"; + + /** Creates a new instance of StorageManager */ + public StorageManager() { + log.debug("Storagemanager created"); + } + + + //Lifecycle + /** + * + * + * + * called when game is started. + */ + public void init(Configuration conf) { + log.info("initing Storagemanger"); + //null check + if(conf == null) + throw new NullPointerException("the config may not be null"); + + // <editor-fold defaultstate="collapsed" desc=" create Driver "> + String driverClass = conf.getString("server.db.driver", "org.jlink." + + "server.libdb.drivers.JackrabbitDriver"); + log.info("creating DatabaseDriver: " + driverClass); + //try to create the driver wanted + try { + //load the class + Class driver = Class.forName(driverClass); + //ok, now create an instance of it + Object obj = driver.newInstance(); + //ok, everything went right, now lets cast it into an Driver and we + //are done here + this.db_driver = (Driver) obj; + + } catch(ClassNotFoundException exc) { + log.fatal("cannot create StorageManager Driver", exc); + //TODO: crash + } catch(InstantiationException exc) { + log.fatal("cannot create StorageManager Driver", exc); + //TODO: crash + } catch(IllegalAccessException exc) { + log.fatal("cannot create StorageManager Driver", exc); + //TODO: crash + } catch(ClassCastException exc) { + log.fatal("cannot create StorageManager Driver", exc); + //TODO: crash + } + // </editor-fold> + + // <editor-fold defaultstate="collapsed" desc=" init Driver "> + try { + String home = null; + String config = null; + + //load the strings from the config, with local defaults + home = conf.getString("server.db.home", "db"); + config = conf.getString("server.db.conf", "db/config.xml"); + this.db_driver.init(config, home); + } catch(RepositoryException exc) { + log.fatal("cannot init driver", exc); + //TODO: crash + } + // </editor-fold> + + } + public void destroy() { + + } + + + + + + + private Repository db_repo = null; + private Driver db_driver = null; + private Configuration conf = null; + private Logger log = Logger.getLogger(StorageManager.class); +} Added: trunk/libdb/src/main/java/org/jlink/server/libdb/drivers/Driver.java =================================================================== --- trunk/libdb/src/main/java/org/jlink/server/libdb/drivers/Driver.java (rev 0) +++ trunk/libdb/src/main/java/org/jlink/server/libdb/drivers/Driver.java 2006-10-09 17:49:22 UTC (rev 16) @@ -0,0 +1,52 @@ +/* + * Driver.java + * + * Created on 10. September 2006, 11:29 + * + * 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.libdb.drivers; + +import java.io.File; +import java.io.IOException; + +import javax.jcr.Repository; +import javax.jcr.RepositoryException; + +/** + * + * @author welterde + */ +public interface Driver { + /** + * Create an Repository. + */ + public Repository init(String config, String home) throws RepositoryException; + + + + public void create(File home) throws RepositoryException; + + public void delete(File home) throws IOException; + + + + public void shutdown(Repository repo) throws RepositoryException; + +} Added: trunk/libdb/src/main/java/org/jlink/server/libdb/drivers/JackrabbitDriver.java =================================================================== --- trunk/libdb/src/main/java/org/jlink/server/libdb/drivers/JackrabbitDriver.java (rev 0) +++ trunk/libdb/src/main/java/org/jlink/server/libdb/drivers/JackrabbitDriver.java 2006-10-09 17:49:22 UTC (rev 16) @@ -0,0 +1,74 @@ +/* + * JackrabbitDriver.java + * + * Created on 10. September 2006, 12:01 + * + * 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.libdb.drivers; + + +import java.io.File; +import java.io.IOException; + + +import javax.jcr.Repository; +import javax.jcr.RepositoryException; + +import org.apache.jackrabbit.core.RepositoryImpl; +import org.apache.jackrabbit.core.config.RepositoryConfig; + +/** + * + * @author welterde + */ +public class JackrabbitDriver implements Driver { + + /** Creates a new instance of JackrabbitDriver */ + public JackrabbitDriver() { + } + + public Repository init(String config, String home) throws RepositoryException { + Repository ret = null; + + //creating config object needed for creation of repo + RepositoryConfig conf = RepositoryConfig.create(config, home); + + //use the conf object to create the repo + ret = RepositoryImpl.create(conf); + + return ret; + } + + public void create(File home) throws RepositoryException { + //TODO: work this out + throw new UnsupportedOperationException("aehm... yeah... you have to configure the jackrabbit yourself"); + } + + public void delete(File home) throws IOException { + //TODO: work this out + throw new UnsupportedOperationException("aehm... yeah... you have also to delete it yourself"); + } + + public void shutdown(Repository repo) throws RepositoryException { + //FIXME: might cause an ClassCastException if this isnt an jackrabbit repo + ((org.apache.jackrabbit.core.RepositoryImpl) repo).shutdown(); + } + +} Property changes on: trunk/libdb/src/site ___________________________________________________________________ Name: svn:ignore + .DS_Store Added: trunk/libdb/src/site/site.xml =================================================================== --- trunk/libdb/src/site/site.xml (rev 0) +++ trunk/libdb/src/site/site.xml 2006-10-09 17:49:22 UTC (rev 16) @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<project name="JLink libdb"> + <bannerRight> + <src>http://sflogo.sourceforge.net/sflogo.php?group_id=162264&type=3</src> + </bannerRight> + <body> + ${reports} + </body> +</project> Modified: trunk/server/nbproject/project.xml =================================================================== --- trunk/server/nbproject/project.xml 2006-10-08 19:29:46 UTC (rev 15) +++ trunk/server/nbproject/project.xml 2006-10-09 17:49:22 UTC (rev 16) @@ -1,134 +1,121 @@ -<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://www.netbeans.org/ns/project/1"> - <type>org.netbeans.modules.ant.freeform</type> - <configuration> - <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1"> - <name>JLink Server</name> - <properties> - <property name="ant.script">nbproject/mavencall.xml</property> - <property-file>nbproject/project.properties</property-file> - </properties> - <folders> - <source-folder> - <label>src/main/java</label> - <type>java</type> - <location>src/main/java</location> - </source-folder> - <source-folder> - <label>src/test/java</label> - <type>java</type> - <location>src/test/java</location> - </source-folder> - </folders> - <ide-actions> - <action name="build"> - <script>${ant.script}</script> - <target>build</target> - </action> - <action name="clean"> - <script>${ant.script}</script> - <target>clean</target> - </action> - <action name="rebuild"> - <script>${ant.script}</script> - <target>clean</target> - <target>build</target> - </action> - <action name="javadoc"> - <script>${ant.script}</script> - <target>javadoc</target> - </action> - <action name="run"> - <script>${ant.script}</script> - <target>run</target> - </action> - <action name="test"> - <script>${ant.script}</script> - <target>test</target> - </action> - </ide-actions> - <export> - <type>folder</type> - <location>target/classes</location> - <script>${ant.script}</script> - <build-target>build</build-target> - </export> - <export> - <type>folder</type> - <location>target/test-classes</location> - <script>${ant.script}</script> - <build-target>build</build-target> - </export> - <view> - <items> - <source-folder style="packages"> - <label>src/main/java</label> - <location>src/main/java</location> - </source-folder> - <source-folder style="packages"> - <label>src/test/java</label> - <location>src/test/java</location> - </source-folder> - <source-file> - <label>pom</label> - <location>pom.xml</location> - </source-file> - <source-file> - <label>mavencall</label> - <location>nbproject/mavencall.xml</location> - </source-file> - <source-folder style="tree"> - <label>src/main/resources</label> - <location>src/main/resources</location> - </source-folder> - <source-folder style="tree"> - <label>src/test/resources</label> - <location>src/test/resources</location> - </source-folder> - <source-folder style="tree"> - <label>src/site</label> - <location>src/site</location> - </source-folder> - <source-folder style="tree"> - <label>target</label> - <location>target</location> - </source-folder> - </items> - <context-menu> - <action> - <script>${ant.script}</script> - <label>Refresh Project</label> - <target>refresh-project</target> - </action> - <ide-action name="build"/> - <ide-action name="clean"/> - <ide-action name="rebuild"/> - <ide-action name="javadoc"/> - <ide-action name="run"/> - <ide-action name="test"/> - <action> - <script>${ant.script}</script> - <label>Format Code</label> - <target>jalopy</target> - </action> - </context-menu> - </view> - <subprojects/> - </general-data> - <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2"> - <compilation-unit> - <package-root>src/main/java</package-root> - <classpath mode="compile">${local.repository}/org/jlink/share/0.0.1-SNAPSHOT/share-0.0.1-SNAPSHOT.jar:${local.repository}/log4j/log4j/1.2.13/log4j-1.2.13.jar</classpath> - <built-to>target/classes</built-to> - <source-level>1.5</source-level> - </compilation-unit> - <compilation-unit> - <package-root>src/test/java</package-root> - <unit-tests/> - <classpath mode="compile">target/classes:${local.repository}/org/jlink/share/0.0.1-SNAPSHOT/share-0.0.1-SNAPSHOT.jar:${local.repository}/junit/junit/3.8.1/junit-3.8.1.jar:${local.repository}/log4j/log4j/1.2.13/log4j-1.2.13.jar</classpath> - <built-to>target/test-classes</built-to> - <source-level>1.5</source-level> - </compilation-unit> - </java-data> - </configuration> -</project> + <type>org.netbeans.modules.ant.freeform</type> + <configuration> + <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1"> + <name>JLink Server</name> + <properties> + <property name="ant.script">nbproject/mavencall.xml</property> + <property-file>nbproject/project.properties</property-file> + </properties> + <folders> + <source-folder> + <label>src/main/java</label> + <type>java</type> + <location>src/main/java</location> + </source-folder> + <source-folder> + <label>src/test/java</label> + <type>java</type> + <location>src/test/java</location> + </source-folder> + </folders> + <ide-actions> + <action name="build"> + <script>${ant.script}</script> + <target>build</target> + </action> + <action name="clean"> + <script>${ant.script}</script> + <target>clean</target> + </action> + <action name="rebuild"> + <script>${ant.script}</script> + <target>clean</target> + <target>build</target> + </action> + <action name="javadoc"> + <script>${ant.script}</script> + <target>javadoc</target> + </action> + <action name="run"> + <script>${ant.script}</script> + <target>run</target> + </action> + <action name="test"> + <script>${ant.script}</script> + <target>test</target> + </action> + </ide-actions> + <view> + <items> + <source-file> + <label>pom</label> + <location>pom.xml</location> + </source-file> + <source-file> + <label>mavencall</label> + <location>nbproject/mavencall.xml</location> + </source-file> + <source-folder style="packages"> + <label>src/main/java</label> + <location>src/main/java</location> + </source-folder> + <source-folder style="packages"> + <label>src/test/java</label> + <location>src/test/java</location> + </source-folder> + <source-folder style="tree"> + <label>src/main/resources</label> + <location>src/main/resources</location> + </source-folder> + <source-folder style="tree"> + <label>src/test/resources</label> + <location>src/test/resources</location> + </source-folder> + <source-folder style="tree"> + <label>src/site</label> + <location>src/site</location> + </source-folder> + <source-folder style="tree"> + <label>target</label> + <location>target</location> + </source-folder> + </items> + <context-menu> + <action> + <script>${ant.script}</script> + <label>Refresh Project</label> + <target>refresh-project</target> + </action> + <ide-action name="build"/> + <ide-action name="clean"/> + <ide-action name="rebuild"/> + <ide-action name="javadoc"/> + <ide-action name="run"/> + <ide-action name="test"/> + <action> + <script>${ant.script}</script> + <label>Format Code</label> + <target>jalopy</target> + </action> + </context-menu> + </view> + <subprojects/> + </general-data> + <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2"> + <compilation-unit> + <package-root>src/main/java</package-root> + <classpath mode="compile">${local.repository}/commons-codec/commons-codec/1.3/commons-codec-1.3.jar:${local.repository}/commons-lang/commons-lang/1.0/commons-lang-1.0.jar:${local.repository}/commons-logging/commons-logging/1.0/commons-logging-1.0.jar:${local.repository}/xerces/xercesImpl/2.2.1/xercesImpl-2.2.1.jar:${local.repository}/org/jlink/share/0.0.1-SNAPSHOT/share-0.0.1-SNAPSHOT.jar:${local.repository}/xerces/xerces/1.2.3/xerces-1.2.3.jar:${local.repository}/commons-beanutils/commons-beanutils/1.4/commons-beanutils-1.4.jar:${local.repository}/xalan/xalan/2.7.0/xalan-2.7.0.jar:${local.repository}/log4j/log4j/1.2.13/log4j-1.2.13.jar:${local.repository}/commons-collections/commons-collections/3.1/commons-collections-3.1.jar:${local.repository}/jdom/jdom/b9/jdom-b9.jar:${local.repository}/commons-jxpath/commons-jxpath/1.2/commons-jxpath-1.2.jar:${local.repository}/javax/servlet/servlet-api/2.2/servlet-api-2.2.jar:${local.repository}/commons-digester/commons-digester/1.6/commons-digester-1.6.jar:${local.repository}/ant/ant-optional/1.5.1/ant-optional-1.5.1.jar:${local.repository}/commons-cli/commons-cli/1.0/commons-cli-1.0.jar:${local.repository}/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar:${local.repository}/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar:${local.repository}/commons-beanutils/commons-beanutils-core/1.7.0/commons-beanutils-core-1.7.0.jar:${local.repository}/commons-configuration/commons-configuration/1.3/commons-configuration-1.3.jar</classpath> + <built-to>target/classes</built-to> + <source-level>1.4</source-level> + </compilation-unit> + <compilation-unit> + <package-root>src/test/java</package-root> + <unit-tests/> + <classpath mode="compile">target/classes:${local.repository}/commons-codec/commons-codec/1.3/commons-codec-1.3.jar:${local.repository}/commons-lang/commons-lang/1.0/commons-lang-1.0.jar:${local.repository}/commons-logging/commons-logging/1.0/commons-logging-1.0.jar:${local.repository}/xerces/xercesImpl/2.2.1/xercesImpl-2.2.1.jar:${local.repository}/org/jlink/share/0.0.1-SNAPSHOT/share-0.0.1-SNAPSHOT.jar:${local.repository}/junit/junit/3.8.1/junit-3.8.1.jar:${local.repository}/xerces/xerces/1.2.3/xerces-1.2.3.jar:${local.repository}/commons-beanutils/commons-beanutils/1.4/commons-beanutils-1.4.jar:${local.repository}/xalan/xalan/2.7.0/xalan-2.7.0.jar:${local.repository}/log4j/log4j/1.2.13/log4j-1.2.13.jar:${local.repository}/commons-collections/commons-collections/3.1/commons-collections-3.1.jar:${local.repository}/jdom/jdom/b9/jdom-b9.jar:${local.repository}/commons-jxpath/commons-jxpath/1.2/commons-jxpath-1.2.jar:${local.repository}/javax/servlet/servlet-api/2.2/servlet-api-2.2.jar:${local.repository}/commons-digester/commons-digester/1.6/commons-digester-1.6.jar:${local.repository}/ant/ant-optional/1.5.1/ant-optional-1.5.1.jar:${local.repository}/commons-cli/commons-cli/1.0/commons-cli-1.0.jar:${local.repository}/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar:${local.repository}/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar:${local.repository}/commons-beanutils/commons-beanutils-core/1.7.0/commons-beanutils-core-1.7.0.jar:${local.repository}/commons-configuration/commons-configuration/1.3/commons-configuration-1.3.jar</classpath> + <built-to>target/test-classes</built-to> + <source-level>1.4</source-level> + </compilation-unit> + </java-data> + </configuration> +</project> \ No newline at end of file Modified: trunk/server/pom.xml =================================================================== --- trunk/server/pom.xml 2006-10-08 19:29:46 UTC (rev 15) +++ trunk/server/pom.xml 2006-10-09 17:49:22 UTC (rev 16) @@ -23,11 +23,29 @@ <scope>compile</scope> </dependency> <dependency> + <groupId>org.jlink</groupId> + <artifactId>libdb</artifactId> + <version>0.0.1-SNAPSHOT</version> + <scope>compile</scope> + </dependency> + <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.13</version> <scope>compile</scope> </dependency> + <dependency> + <groupId>commons-cli</groupId> + <artifactId>commons-cli</artifactId> + <version>1.0</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>commons-configuration</groupId> + <artifactId>commons-configuration</artifactId> + <version>1.3</version> + <scope>compile</scope> + </dependency> </dependencies> <!--//////////////////////////////////////// /////////////Reporting////////////////// Added: trunk/server/src/main/java/org/jlink/server/Main.java =================================================================== --- trunk/server/src/main/java/org/jlink/server/Main.java (rev 0) +++ trunk/server/src/main/java/org/jlink/server/Main.java 2006-10-09 17:49:22 UTC (rev 16) @@ -0,0 +1,198 @@ +/* + * Main.java + * + * Created on 8. Oktober 2006, 11:33 + * + * 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; + +//imports +//imports::own +//imports::own::server +//imports::own::server::jmx +import org.jlink.server.jmx.JMXAgent; + +//imports::sys +//imports::sys::commons-cli +import org.apache.commons.cli.Option; +import org.apache.commons.cli.OptionBuilder; +import org.apache.commons.cli.Options; +import org.apache.commons.cli.GnuParser; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.ParseException; +//import::sys::log4j +import org.apache.log4j.PropertyConfigurator; +import org.apache.log4j.xml.DOMConfigurator; +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Logger; +//import::sys::commons-configuration +import org.apache.commons.configuration.Configuration; +import org.apache.commons.configuration.XMLConfiguration; +import org.apache.commons.configuration.ConfigurationException; + +/** + * + * @author welterde + */ +public class Main { + + /** Creates a new instance of Main */ + private Main() { + } + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + String conf_log = null; + String conf_srv = null; + + // <editor-fold defaultstate="collapsed" desc=" parse arguments "> + try { + //create options + // ...configs + Option opt_conf_srv = OptionBuilder.withArgName("config") + .hasArg() + .withDescription("The path to the server configuration") + .withLongOpt("config") + .create('C'); + Option opt_conf_log = OptionBuilder.withArgName("log") + .hasArg() + .withDescription("The path to the log4j configuration") + .withLongOpt("log") + .create('L'); + // ...ops + Option opt_op_help = new Option( "help", "print this message" ); + //asamble + Options opts = new Options(); + opts.addOption(opt_conf_srv); + opts.addOption(opt_conf_log); + opts.addOption(opt_op_help); + //parse + CommandLine cmd = new GnuParser().parse(opts, args); + //process + if(cmd.hasOption("help")) { + new HelpFormatter().printHelp("jlink", opts); + System.exit(0); + } + if(cmd.hasOption('C')) { + conf_srv = cmd.getOptionValue('C'); + } else { + //crash + System.err.println("missing server config, please refer to help"); + System.exit(1); + } + if(cmd.hasOption('L')) { + conf_log = cmd.getOptionValue('L'); + } else { + //crash + System.err.println("missing logging config, please refer to help"); + System.exit(1); + } + } catch(ParseException exc) { + throw new Error("error in cmd", exc); + } + // </editor-fold> + + // <editor-fold defaultstate="collapsed" desc=" init logging "> + //TODO: add existence check + if(conf_log.endsWith("properties") || conf_log.endsWith("cfg")) { + PropertyConfigurator.configure(conf_log); + } else if(conf_log.endsWith("xml")) { + DOMConfigurator.configure(conf_log); + } else { + //VOTE: shall we crash here or use simply BasicConf + BasicConfigurator.configure(); + //TODO: till when vote is over, add log message telling that init logging failed + } + log = Logger.getLogger(Main.class); + log.info("logging started"); + { + Logger sys = Logger.getLogger("jlink.init.sysinfo"); + sys.info("retrieving system information"); + sys.info("java.version: " + System.getProperty("java.version")); + sys.info("java.class.path: "+ System.getProperty("java.class.path")); + sys.info("System.compiler: " + System.getProperty("java.compiler")); + sys.info("os.name: " + System.getProperty("os.name")); + sys.info("os.arch: " + System.getProperty("os.arch")); + sys.info("os.version: " + System.getProperty("os.version")); + sys.info("user.dir: " + System.getProperty("user.dir")); + } + // </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); + log.debug("configuration loaded"); + } catch(ConfigurationException exc) { + log.fatal("cannot load server configuration", exc); + System.exit(1); + } + conf = xconf; + + // </editor-fold> + + // <editor-fold defaultstate="collapsed" desc=" startup "> + + // </editor-fold> + + // <editor-fold defaultstate="collapsed" desc=" JMX "> + JMXAgent agent = JMXAgent.getDefault(); + // </editor-fold> + + Core core = new Core(); + + core.start(); + + } + + + + public static void shutdown() { + log.info("shutdown requested"); + //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); + } + } + public static void confReload() { + //TODO: write this + } + + + private static Configuration conf = null; + private static XMLConfiguration xconf = null; + private static Logger log = null; +} Added: trunk/server/src/main/java/org/jlink/server/MainJMX.java =================================================================== --- trunk/server/src/main/java/org/jlink/server/MainJMX.java (rev 0) +++ trunk/server/src/main/java/org/jlink/server/MainJMX.java 2006-10-09 17:49:22 UTC (rev 16) @@ -0,0 +1,122 @@ +/* + * MainJMX.java + * + * Created on 8. Oktober 2006, 17:03 + * + * 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 javax.management.*; +import java.util.Arrays; + +/** + * Dynamic MBean based on StandardMBean + * Class MainJMX + * Server Mainclass Controllbean + * @author welterde + */ +public class MainJMX extends javax.management.StandardMBean implements MainJMXMBean { + + public MainJMX() throws NotCompliantMBeanException { + super(MainJMXMBean.class); + } + + /** + * Next are the methods to compute MBeanInfo. + * You shouldn't update these methods. + */ + protected String getDescription(MBeanInfo info) { + return "Server Mainclass Controllbean"; + } + + protected String getDescription(MBeanAttributeInfo info) { + String description = null; + return description; + } + + protected String getDescription(MBeanOperationInfo op, + MBeanParameterInfo param, + int sequence) { + if (op.getName().equals("shutdown")) { + switch (sequence) { + default : return null; + } + } + return null; + } + + protected String getParameterName(MBeanOperationInfo op, + MBeanParameterInfo param, + int sequence) { + if (op.getName().equals("shutdown")) { + switch (sequence) { + default : return null; + } + } + return null; + } + + protected String getDescription(MBeanOperationInfo info) { + String description = null; + MBeanParameterInfo[] params = info.getSignature(); + String[] signature = new String[params.length]; + for (int i = 0; i < params.length; i++) + signature[i] = params[i].getType(); + String[] methodSignature; + + methodSignature = new String[] { + }; + if (info.getName().equals("shutdown") && Arrays.equals(signature, methodSignature)) { + description = "Operation exposed for management"; + } + + return description; + } + + public MBeanInfo getMBeanInfo() { + MBeanInfo mbinfo = super.getMBeanInfo(); + return new MBeanInfo(mbinfo.getClassName(), + mbinfo.getDescription(), + mbinfo.getAttributes(), + mbinfo.getConstructors(), + mbinfo.getOperations(), + getNotificationInfo()); + } + + public MBeanNotificationInfo[] getNotificationInfo() { + return new MBeanNotificationInfo[] {}; + } + + /** + * Operation exposed for management + */ + public void shutdown() { + Main.shutdown(); + } + + public void configSave() { + Main.confSave(); + } + + public void configReload() { + Main.confReload(); + } +} + + Added: trunk/server/src/main/java/org/jlink/server/MainJMXMBean.java =================================================================== --- trunk/server/src/main/java/org/jlink/server/MainJMXMBean.java (rev 0) +++ trunk/server/src/main/java/org/jlink/server/MainJMXMBean.java 2006-10-09 17:49:22 UTC (rev 16) @@ -0,0 +1,45 @@ +/* + * MainJMXMBean.java + * + * Created on 8. Oktober 2006, 17:03 + * + * 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; + +/** + * Interface MainJMXMBean + * Server Mainclass Controllbean + * @author welterde + */ +public interface MainJMXMBean +{ + /** + * Operation exposed for management + */ + public void shutdown(); + + + public void configSave(); + + + public void configReload(); +} + + Modified: trunk/server/src/main/java/org/jlink/server/jmx/JMXAgent.java =================================================================== --- trunk/server/src/main/java/org/jlink/server/jmx/JMXAgent.java 2006-10-08 19:29:46 UTC (rev 15) +++ trunk/server/src/main/java/org/jlink/server/jmx/JMXAgent.java 2006-10-09 17:49:22 UTC (rev 16) @@ -25,12 +25,19 @@ //import //import::own +//import::own::server +import org.jlink.server.MainJMX; +//import::own::server::libdb +import org.jlink.server.libdb.StorageManagerJMX; //import::sys //import::sys::jmx import javax.management.ObjectName; import javax.management.MBeanServer; import java.lang.management.ManagementFactory; +//import::sys::log4j +import org.apache.log4j.Logger; + /** * JMX agent class. * @author tassilo @@ -40,6 +47,22 @@ * Instantiate and register your MBeans. */ public void init() throws Exception { + log.info("registering jmx objects"); + //Main::JMX::add() + { + log.debug("registering MainJMX"); + ObjectName name = new ObjectName("org.jlink.server:type=MainJMX"); + MainJMX obj = new MainJMX(); + this.mbs.registerMBean(obj, name); + log.debug("done"); + } +// { +// log.debug("registering StorageManagerJMX"); +// ObjectName name = new ObjectName("org.jlink.server.libdb:type=StorageManagerJMX"); +// StorageManagerJMX obj = new StorageManagerJMX(); +// this.mbs.registerMBean(obj, name); +// log.debug("done"); +// } //Core::JMX::add() //Database::JMX::add() @@ -73,6 +96,9 @@ private final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); // Singleton instance private static JMXAgent singleton; + + + private Logger log = Logger.getLogger(JMXAgent.class); } Modified: trunk/server/src/main/java/org/jlink/server/jmx/run.properties =================================================================== --- trunk/server/src/main/java/org/jlink/server/jmx/run.properties 2006-10-08 19:29:46 UTC (rev 15) +++ trunk/server/src/main/java/org/jlink/server/jmx/run.properties 2006-10-09 17:49:22 UTC (rev 16) @@ -244,7 +244,7 @@ # # For a non-default password file location use the foll... [truncated message content] |