Refactored DataStore and moved it into the Modules directory

This commit is contained in:
Joe0 2011-12-04 19:59:24 -06:00
parent 978de20d53
commit 6634a8d22a
15 changed files with 145 additions and 7 deletions

View File

@ -4,11 +4,12 @@
<property name="bin" location="bin" /> <property name="bin" location="bin" />
<property name="lib_managed" location="lib_managed" /> <property name="lib_managed" location="lib_managed" />
<property name="lib" location="lib" /> <property name="lib" location="lib" />
<property name="module" location="module" />
<property name="doc" location="doc" /> <property name="doc" location="doc" />
<property name="jar" value="moparclassic.jar" /> <property name="jar" value="moparclassic.jar" />
<property name="main-class" value="org.moparscape.msc.gs.Server" /> <property name="main-class" value="org.moparscape.msc.gs.Server" />
<property name="scala-version" value="2.9.1" /> <property name="scala-version" value="2.9.1" />
<property name="ivy.lib.dir" value="lib_managed"/> <property name="ivy.lib.dir" value="lib_managed" />
<fileset id="libraries" dir="${lib}"> <fileset id="libraries" dir="${lib}">
<include name="*.jar" /> <include name="*.jar" />
@ -18,6 +19,10 @@
<include name="*.jar" /> <include name="*.jar" />
</fileset> </fileset>
<fileset id="modules" dir="${module}">
<include name="*.jar" />
</fileset>
<fileset id="production-classes" dir="${bin}"> <fileset id="production-classes" dir="${bin}">
<include name="**/*.class" /> <include name="**/*.class" />
</fileset> </fileset>
@ -29,6 +34,7 @@
<path id="library-path"> <path id="library-path">
<fileset refid="libraries" /> <fileset refid="libraries" />
<fileset refid="libraries_managed" /> <fileset refid="libraries_managed" />
<fileset refid="modules" />
</path> </path>
<path id="master-path"> <path id="master-path">

Binary file not shown.

Binary file not shown.

BIN
GameServer/moparclassic.jar Normal file

Binary file not shown.

View File

@ -6,7 +6,7 @@ import org.moparscape.msc.gs.db.DBConnection;
import org.moparscape.msc.gs.db.ReportHandlerQueries; import org.moparscape.msc.gs.db.ReportHandlerQueries;
import org.moparscape.msc.gs.model.World; import org.moparscape.msc.gs.model.World;
import org.moparscape.msc.gs.persistence.DataStore; import org.moparscape.msc.gs.persistence.DataStore;
import org.moparscape.msc.gs.persistence.DataStoreFactory; import org.moparscape.msc.gs.persistence.impl.DataStoreFactory;
import org.moparscape.msc.gs.plugins.dependencies.PluginHandler; import org.moparscape.msc.gs.plugins.dependencies.PluginHandler;
/** /**

View File

@ -1,4 +1,6 @@
package org.moparscape.msc.gs.persistence; package org.moparscape.msc.gs.persistence.impl;
import org.moparscape.msc.gs.persistence.DataStore;
public class DataStoreFactory { public class DataStoreFactory {

View File

@ -26,7 +26,7 @@
</target> </target>
<target name="runls" depends="build"> <target name="run" depends="build">
<java classname="org.moparscape.msc.ls.Server" fork="true"> <java classname="org.moparscape.msc.ls.Server" fork="true">
<classpath> <classpath>
<pathelement location="${lib}/mina.jar" /> <pathelement location="${lib}/mina.jar" />

Binary file not shown.

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="XML Using XStream" default="build" basedir="../../../">
<property name="base" location="Modules/DataStore/XMLUsingXStream" />
<property name="src" location="${base}/src" />
<property name="bin" location="${base}/bin" />
<property name="lib" location="${base}/lib" />
<property name="common-lib" location="${base}/../lib" />
<property name="jar" value="${base}/XMLUsingXStreamDataStore.jar" />
<fileset id="mopar" dir="GameServer">
<include name="moparclassic.jar" />
</fileset>
<fileset id="libraries" dir="${lib}">
<include name="*.jar" />
</fileset>
<fileset id="common-libraries" dir="${common-lib}">
<include name="*.jar" />
</fileset>
<fileset id="datastore-core" dir="${base}/../">
<include name="DataStoreCore.jar" />
</fileset>
<fileset id="production-classes" dir="${bin}">
<include name="**/*.class" />
</fileset>
<path id="binary-path">
<pathelement path="${bin}" />
</path>
<path id="library-path">
<fileset refid="common-libraries" />
<fileset refid="libraries" />
<fileset refid="mopar" />
<fileset refid="datastore-core" />
</path>
<path id="master-path">
<path refid="binary-path" />
<path refid="library-path" />
</path>
<target name="init">
<mkdir dir="${bin}" />
<mkdir dir="${lib}" />
</target>
<target name="build" depends="init">
<javac destdir="${bin}" includeantruntime="false">
<src path="${src}" />
<classpath refid="library-path" />
</javac>
<jar destfile="${jar}">
<zipgroupfileset refid="libraries" />
<fileset refid="production-classes" />
</jar>
</target>
<target name="clean">
<delete dir="${bin}" />
<delete file="${jar}" />
</target>
</project>

View File

@ -36,12 +36,16 @@ import com.thoughtworks.xstream.XStream;
* A DataStore that parses XML using XStream. * A DataStore that parses XML using XStream.
* *
* @author Joe Pritzel * @author Joe Pritzel
* *
*/ */
@NotThreadSafe @NotThreadSafe
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class XMLUsingXStream implements DataStore { public class XMLUsingXStream implements DataStore {
protected XMLUsingXStream() {
// To conform to the contract specified by the DataStore interface.
}
private static final XStream xstream = new XStream(); private static final XStream xstream = new XStream();
static { static {

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="DataStore Core" default="build" basedir="../../">
<property name="base" location="Modules/DataStore" />
<property name="src" location="${base}/src" />
<property name="bin" location="${base}/bin" />
<property name="lib" location="${base}/lib" />
<property name="jar" value="${base}/DataStoreCore.jar" />
<fileset id="mopar" dir="GameServer">
<include name="moparclassic.jar" />
</fileset>
<fileset id="libraries" dir="${lib}">
<include name="*.jar" />
</fileset>
<fileset id="production-classes" dir="${bin}">
<include name="**/*.class" />
</fileset>
<path id="binary-path">
<pathelement path="${bin}" />
</path>
<path id="library-path">
<fileset refid="libraries" />
<fileset refid="mopar" />
</path>
<path id="master-path">
<path refid="binary-path" />
<path refid="library-path" />
</path>
<target name="init">
<mkdir dir="${bin}" />
<mkdir dir="${lib}" />
</target>
<target name="build" depends="init">
<javac destdir="${bin}" includeantruntime="false">
<src path="${src}" />
<classpath refid="library-path" />
</javac>
<jar destfile="${jar}">
<zipgroupfileset refid="libraries" />
<fileset refid="production-classes" />
</jar>
</target>
<target name="clean">
<delete dir="${bin}" />
<delete file="${jar}" />
</target>
</project>

Binary file not shown.

View File

@ -13,12 +13,17 @@ import org.moparscape.msc.gs.npchandler.NpcHandlerDef;
import org.moparscape.msc.gs.phandler.PacketHandlerDef; import org.moparscape.msc.gs.phandler.PacketHandlerDef;
/** /**
* Any retrieval of unchanging data should be done through this interface. * Any retrieval of unchanging data should be done through this interface. All
* implementations should be only accessable by the
* org.moparscape.msc.gs.persistence.impl package.<br>
* Implementations should also use JCIP annotations to specify their degree of thread
* saftey.
* *
* @author Joe Pritzel * @author Joe Pritzel
* *
*/ */
public interface DataStore { public abstract interface DataStore {
public PacketHandlerDef[] loadPacketHandlerDefs(); public PacketHandlerDef[] loadPacketHandlerDefs();
public PacketHandlerDef[] loadLSPacketHandlerDefs(); public PacketHandlerDef[] loadLSPacketHandlerDefs();