From: <sno...@us...> - 2006-04-11 23:12:35
|
Revision: 55 Author: snowdog_ Date: 2006-04-11 16:12:13 -0700 (Tue, 11 Apr 2006) ViewCVS: http://svn.sourceforge.net/openrpg/?rev=55&view=rev Log Message: ----------- Integrated skeletal group modules into core and made minor changes to module loading scheme. Modified Paths: -------------- trunk/src/openrpg2/client/core/ClientModuleLoader.java trunk/src/openrpg2/client/core/ORPGClient.java trunk/src/openrpg2/common/core/ORPGConstants.java trunk/src/openrpg2/common/core/engine/Engine.java trunk/src/openrpg2/common/core/engine/ModuleLoader.java trunk/src/openrpg2/common/core/engine/ModuleManager.java trunk/src/openrpg2/common/core/group/GroupManager.java trunk/src/openrpg2/common/core/network/NetworkClient.java trunk/src/openrpg2/common/core/network/NetworkServer.java trunk/src/openrpg2/server/core/ORPGServer.java Added Paths: ----------- trunk/src/openrpg2/common/core/group/GroupClientModule.java trunk/src/openrpg2/common/core/group/GroupMessageConstants.java trunk/src/openrpg2/common/core/group/GroupServerModule.java trunk/src/openrpg2/common/core/network/NetworkModuleProvider.java Modified: trunk/src/openrpg2/client/core/ClientModuleLoader.java =================================================================== --- trunk/src/openrpg2/client/core/ClientModuleLoader.java 2006-04-11 06:37:32 UTC (rev 54) +++ trunk/src/openrpg2/client/core/ClientModuleLoader.java 2006-04-11 23:12:13 UTC (rev 55) @@ -38,7 +38,7 @@ } protected void loadDefaultModule(){ - + //no default client module (discard unknown messages) } /** Modified: trunk/src/openrpg2/client/core/ORPGClient.java =================================================================== --- trunk/src/openrpg2/client/core/ORPGClient.java 2006-04-11 06:37:32 UTC (rev 54) +++ trunk/src/openrpg2/client/core/ORPGClient.java 2006-04-11 23:12:13 UTC (rev 55) @@ -68,7 +68,7 @@ /* SPLASH SCREEN UPDATE */splash.setProgress("Initializing Modules", 20); ClientModuleLoader ml = new ClientModuleLoader(); - ml.setNetworkModule(new NetworkClientModule(nc)); + ml.setNetworkModuleProvider(nc); /* SPLASH SCREEN UPDATE */splash.setProgress("Initializing Engine", 40); Modified: trunk/src/openrpg2/common/core/ORPGConstants.java =================================================================== --- trunk/src/openrpg2/common/core/ORPGConstants.java 2006-04-11 06:37:32 UTC (rev 54) +++ trunk/src/openrpg2/common/core/ORPGConstants.java 2006-04-11 23:12:13 UTC (rev 55) @@ -43,6 +43,7 @@ //ORPGMESSAGE RESERVED TYPES //These are special message type identifiers that are part of the core implementation and are therefore reserved static final public String TYPE_NETWORK = "_NET_"; + static final public String TYPE_GROUP = "_GRP_"; //OPERATION MODE CONSTANTS Modified: trunk/src/openrpg2/common/core/engine/Engine.java =================================================================== --- trunk/src/openrpg2/common/core/engine/Engine.java 2006-04-11 06:37:32 UTC (rev 54) +++ trunk/src/openrpg2/common/core/engine/Engine.java 2006-04-11 23:12:13 UTC (rev 55) @@ -108,8 +108,9 @@ guiManager = new GUIManager(developerConsole); groupManager = new GroupManager(networkNotifier); moduleManager = new ModuleManager(moduleLoader); - moduleManager.setGUIManager(guiManager); moduleManager.setMode(OperationMode); + moduleManager.registerGUIManager(guiManager); + moduleManager.registerGroupManager(groupManager); moduleManager.registerNetwork(networkRelay); try{ moduleManager.initialize(); Modified: trunk/src/openrpg2/common/core/engine/ModuleLoader.java =================================================================== --- trunk/src/openrpg2/common/core/engine/ModuleLoader.java 2006-04-11 06:37:32 UTC (rev 54) +++ trunk/src/openrpg2/common/core/engine/ModuleLoader.java 2006-04-11 23:12:13 UTC (rev 55) @@ -21,10 +21,12 @@ package openrpg2.common.core.engine; -import openrpg2.common.module.NetworkedModule; +import java.util.logging.Logger; +import openrpg2.common.core.group.GroupManager; +import openrpg2.common.core.network.NetworkModuleProvider; /** - * + * Base class to handle low level module loading tasks * @author Snowdog */ public abstract class ModuleLoader { @@ -34,37 +36,63 @@ */ public ModuleManager moduleManager = null; /** - * Private reference to special network module + * Reference to a network object that can supply a NetworkModule */ - private NetworkedModule netMod = null; + public NetworkModuleProvider netModuleProvider = null; + /** + * Standard logging object reference. + */ + private Logger log = Logger.getLogger(this.getClass().getName()); + /** Creates a new instance of ModuleLoader */ public ModuleLoader(){ } /** - * This is a special routine to hand the a network interface module to the ModuleManager. - * It is registered from outside the normal channels due to its need for network - * hook references that it cannot obtain via the normal module loading routines. - * @param networkModuleReference reference to this module loader of special network module + * Informs this ModuleLoader of which ModuleManager will be used when registering modules. + * @param managerReference ModuleManager to register modules with */ - public void setNetworkModule(NetworkedModule networkModuleReference){ - netMod = networkModuleReference; + public void setModuleManagerCallback(ModuleManager managerReference){ + if (managerReference != null){ + moduleManager = managerReference; + }else{ + throw new java.lang.RuntimeException("ModuleLoader provided with null ModuleManager reference!"); + } } /** + * Informs this ModuleLoader of the object that will provide the NetworkModule object. + * @param networkProvider A network reference that will supply a NetworkModule + */ + public void setNetworkModuleProvider(NetworkModuleProvider networkProvider){ + if (networkProvider != null){ + netModuleProvider = networkProvider; + } + } + + /** * Protected method called by the ModuleManager during initialization to register the network module - * @param managerReference The ModuleManager to register the Network Module with - * @throws openrpg2.common.core.engine.NoSuchModuleException This exception is thrown if the Network Module has not be set prior to being handled by the ModuleManager. */ - protected void loadNetworkModule(ModuleManager managerReference) throws NoSuchModuleException{ - moduleManager = managerReference; - if (netMod == null ){ - throw new NoSuchModuleException("Network Module not set"); + protected void loadNetworkModule(){ + moduleManager.registerModule(netModuleProvider.getNetworkModule()); + } + + + /** + * Queries the moduleManager to determine which GroupModule to from the GroupManager. + * @param groupManagerReference GroupManager to get group module from. + */ + protected void loadGroupModule(GroupManager groupManagerReference){ + if( moduleManager.isClient()){ + moduleManager.registerModule(groupManagerReference.getGroupClientModule()); } - moduleManager.registerModule(netMod); + if( moduleManager.isServer()){ + moduleManager.registerModule(groupManagerReference.getGroupServerModule()); + } } + /** * Called by the ModuleManager to load all modules * @param managerReference The ModuleManager to register modules with Modified: trunk/src/openrpg2/common/core/engine/ModuleManager.java =================================================================== --- trunk/src/openrpg2/common/core/engine/ModuleManager.java 2006-04-11 06:37:32 UTC (rev 54) +++ trunk/src/openrpg2/common/core/engine/ModuleManager.java 2006-04-11 23:12:13 UTC (rev 55) @@ -20,11 +20,13 @@ */ package openrpg2.common.core.engine; +import java.util.logging.Logger; import javax.swing.JPanel; import openrpg2.common.core.network.NetworkMessageRelay; import openrpg2.common.module.NetworkedModule; import openrpg2.common.core.ORPGConstants; import openrpg2.common.core.ORPGMessage; +import openrpg2.common.core.group.GroupManager; import openrpg2.common.core.gui.GUIManager; import openrpg2.common.module.BaseModule; @@ -46,6 +48,8 @@ private ModuleRegistry moduleRegistry = new ModuleRegistry(); private ModuleLoader moduleLoader = null; private GUIManager guiManager = null; + private GroupManager groupManager = null; + private Logger log = Logger.getLogger(this.getClass().getName()); /** Creates a new instance of ModuleManager */ @@ -53,10 +57,6 @@ moduleLoader = modLoader; } - public void setGUIManager(GUIManager m){ - guiManager = m; - } - /** * ModuleManager in Client mode? * @return true if the ModuleManager is in Client mode @@ -114,10 +114,27 @@ */ protected void registerModuleLoader(ModuleLoader loader){ moduleLoader = loader; + } + /** + * Registers a GUIManager with the ModuleManager + * @param m Reference to the GUIManager object that will supply JPanel display service. + */ + public void registerGUIManager(GUIManager m){ + guiManager = m; + } /** + * Registers a GroupManager with the Module Manager + * @param m Reference to the GroupManager object that will supply client grouping and role services + */ + public void registerGroupManager(GroupManager m){ + groupManager = m; + } + + + /** * Called to initialize the ModuleManager. Does a sanity check to make sure the * Network hook and module loader are present then initializes the ModuleManager * @throws openrpg2.common.core.engine.NoNetworkHookException Exception thrown if network hook doesn't exist (failed sanity check) @@ -154,7 +171,9 @@ * Initializes the ModuleManger to service client side modules. */ private void init() throws NoSuchModuleException { - moduleLoader.loadNetworkModule(this); + moduleLoader.setModuleManagerCallback(this); + moduleLoader.loadGroupModule(groupManager); + moduleLoader.loadNetworkModule(); moduleLoader.loadModules(this); } Added: trunk/src/openrpg2/common/core/group/GroupClientModule.java =================================================================== --- trunk/src/openrpg2/common/core/group/GroupClientModule.java (rev 0) +++ trunk/src/openrpg2/common/core/group/GroupClientModule.java 2006-04-11 23:12:13 UTC (rev 55) @@ -0,0 +1,116 @@ +/* + * GroupClientModule.java + * + * Author: snowdog + * Created: April 11, 2006, 1:54 PM + * + * ==================================================================== + * Copyright (C) 2005-2006 The OpenRPG Project (www.openrpg.com) + * + * 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 software 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 on www.gnu.org for more details. + * ==================================================================== + */ + +package openrpg2.common.core.group; + +import openrpg2.common.core.ORPGConstants; +import openrpg2.common.core.ORPGMessage; +import openrpg2.common.module.ClientLoadable; +import openrpg2.common.module.NetworkedModule; + + +/** + * GroupClientModule is the loadable module that tracks client grouping + * information client side. This module makes requests for group changes + * for the client to the GroupServerModule on the server and recieves + * confirmation and notification of all group changing activities from + * the server. + * + * @author snowdog + */ + +public class GroupClientModule extends NetworkedModule implements ClientLoadable { + private GroupManager groupManager = null; + + /** + * Creates a new instance of GroupClientModule + */ + public GroupClientModule(GroupManager grpmgr) { + groupManager = null; + } + + /** + * doRegistration is called by the ModuleManager when loading this module to + * allow the module to register components and services with the ModuleManager. + */ + protected void doRegistration(){ + modCom.registerMessageType(ORPGConstants.TYPE_GROUP, this); + } + + /** + * processMessage() is called by message routing threads to handle messages for this module. + * It is required by the NetworkedModule base class. + */ + public void processMessage(ORPGMessage msg){ + //NOTE messages of this type ALWAYS come from the server + int operation = Integer.parseInt(msg.getHeader(GroupMessageConstants.HEADER_OP)); + switch(operation){ + case(GroupMessageConstants.OP_REFRESH):{ handleRefreshMessage(msg);break; } + case(GroupMessageConstants.OP_GROUP):{ handleGroupMessage(msg);break; } + case(GroupMessageConstants.OP_CLIENT):{ handleClientMessage(msg); break; } + default: {break;} + } + } + /** + * Handle a message from the server that contains complete + * group information (reload GroupManager data). + * Used primarily when a client connects to a running server + * and needs complete group data initially. + */ + private void handleRefreshMessage(ORPGMessage msg){ + //TODO: pull new group information from message and update GroupManager + } + + /** + * Handles a message that deals with changes to the group + * structure. This can include adding or removing groups + * as well as changing group data. + */ + private void handleGroupMessage(ORPGMessage msg){ + int operation = Integer.parseInt(msg.getHeader(GroupMessageConstants.HEADER_SUB_OP)); + switch(operation){ + case(GroupMessageConstants.SUB_OP_ADD):{break; } //add a new group + case(GroupMessageConstants.SUB_OP_DROP):{break; } //remove an existing group + case(GroupMessageConstants.SUB_OP_ALTER):{break; } //change group info + case(GroupMessageConstants.SUB_OP_UPDATE):{break; } //refresh/replace group info + default: {break;} + } + } + + /** + * Handles messages that pertain to changes in clients + * within groups. This includes adding/removing clients + * from groups as well as changes to client roles. + */ + private void handleClientMessage(ORPGMessage msg){ + int operation = Integer.parseInt(msg.getHeader(GroupMessageConstants.HEADER_SUB_OP)); + switch(operation){ + case(GroupMessageConstants.SUB_OP_ADD):{break; } //add a new client + case(GroupMessageConstants.SUB_OP_DROP):{break; } //remove an existing client (disconnect) + case(GroupMessageConstants.SUB_OP_ALTER):{break; } //change client info + case(GroupMessageConstants.SUB_OP_UPDATE):{break; } //refresh/replace client info + default: {break;} + } + } + + + +} Property changes on: trunk/src/openrpg2/common/core/group/GroupClientModule.java ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/openrpg2/common/core/group/GroupManager.java =================================================================== --- trunk/src/openrpg2/common/core/group/GroupManager.java 2006-04-11 06:37:32 UTC (rev 54) +++ trunk/src/openrpg2/common/core/group/GroupManager.java 2006-04-11 23:12:13 UTC (rev 55) @@ -272,4 +272,12 @@ } } } + + public GroupClientModule getGroupClientModule(){ + return new GroupClientModule(this); + } + + public GroupServerModule getGroupServerModule(){ + return new GroupServerModule(this); + } } Added: trunk/src/openrpg2/common/core/group/GroupMessageConstants.java =================================================================== --- trunk/src/openrpg2/common/core/group/GroupMessageConstants.java (rev 0) +++ trunk/src/openrpg2/common/core/group/GroupMessageConstants.java 2006-04-11 23:12:13 UTC (rev 55) @@ -0,0 +1,47 @@ +/* + * GroupMessageConstants.java + * + * Author: snowdog + * Created: April 11, 2006, 2:20 PM + * + * ==================================================================== + * Copyright (C) 2005-2006 The OpenRPG Project (www.openrpg.com) + * + * 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 software 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 on www.gnu.org for more details. + * ==================================================================== + */ + +package openrpg2.common.core.group; + +/** + * + * @author snowdog + */ + +public class GroupMessageConstants { + + public final static String HEADER_OP = "OP"; + public final static int OP_REFRESH = 0; + public final static int OP_GROUP = 1; + public final static int OP_CLIENT = 2; + + public final static String HEADER_SUB_OP = "SUB"; + public final static int SUB_OP_ADD = 1; + public final static int SUB_OP_DROP = 2; + public final static int SUB_OP_ALTER = 3; + public final static int SUB_OP_MOVE = 4; + public final static int SUB_OP_UPDATE = 5; + + /** Creates a new instance of GroupMessageConstants */ + public GroupMessageConstants() { + } + +} Property changes on: trunk/src/openrpg2/common/core/group/GroupMessageConstants.java ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/src/openrpg2/common/core/group/GroupServerModule.java =================================================================== --- trunk/src/openrpg2/common/core/group/GroupServerModule.java (rev 0) +++ trunk/src/openrpg2/common/core/group/GroupServerModule.java 2006-04-11 23:12:13 UTC (rev 55) @@ -0,0 +1,108 @@ +/* + * GroupServerModule.java + * + * Author: snowdog + * Created: April 11, 2006, 2:45 PM + * + * ==================================================================== + * Copyright (C) 2005-2006 The OpenRPG Project (www.openrpg.com) + * + * 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 software 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 on www.gnu.org for more details. + * ==================================================================== + */ + +package openrpg2.common.core.group; + +import openrpg2.common.core.ORPGConstants; +import openrpg2.common.core.ORPGMessage; +import openrpg2.common.module.NetworkedModule; +import openrpg2.common.module.ServerLoadable; + +/** + * + * @author snowdog + */ + +public class GroupServerModule extends NetworkedModule implements ServerLoadable{ + private GroupManager groupManager = null; + + /** Creates a new instance of GroupServerModule */ + public GroupServerModule(GroupManager grpmgr) { + groupManager = null; + } + + /** + * doRegistration is called by the ModuleManager when loading this module to + * allow the module to register components and services with the ModuleManager. + */ + protected void doRegistration(){ + modCom.registerMessageType(ORPGConstants.TYPE_GROUP, this); + } + + /** + * processMessage() is called by message routing threads to handle messages for this module. + * It is required by the NetworkedModule base class. + */ + public void processMessage(ORPGMessage msg){ + //NOTE messages of this type ALWAYS come from the server + int operation = Integer.parseInt(msg.getHeader(GroupMessageConstants.HEADER_OP)); + switch(operation){ + case(GroupMessageConstants.OP_REFRESH):{ handleRefreshMessage(msg);break; } + case(GroupMessageConstants.OP_GROUP):{ handleGroupMessage(msg);break; } + case(GroupMessageConstants.OP_CLIENT):{ handleClientMessage(msg); break; } + default: {break;} + } + } + /** + * Handle a message from clients that requests complete + * group information (reload GroupManager data). + * Used primarily when a client connects to a running server + * and needs complete group data initially. + */ + private void handleRefreshMessage(ORPGMessage msg){ + //TODO: construct a refresh group message and send back to requesting client. + } + + /** + * Handles a message that deals with changes to the group + * structure. This can include adding or removing groups + * as well as changing group data. + */ + private void handleGroupMessage(ORPGMessage msg){ + int operation = Integer.parseInt(msg.getHeader(GroupMessageConstants.HEADER_SUB_OP)); + switch(operation){ + case(GroupMessageConstants.SUB_OP_ADD):{break; } //add a new group + case(GroupMessageConstants.SUB_OP_DROP):{break; } //remove an existing group + case(GroupMessageConstants.SUB_OP_ALTER):{break; } //change group info + case(GroupMessageConstants.SUB_OP_UPDATE):{break; } //refresh/replace group info + default: {break;} + } + } + + /** + * Handles messages that pertain to changes in clients + * within groups. This includes adding/removing clients + * from groups as well as changes to client roles. + */ + private void handleClientMessage(ORPGMessage msg){ + int operation = Integer.parseInt(msg.getHeader(GroupMessageConstants.HEADER_SUB_OP)); + switch(operation){ + case(GroupMessageConstants.SUB_OP_ADD):{break; } //add a new client + case(GroupMessageConstants.SUB_OP_DROP):{break; } //remove an existing client (disconnect) + case(GroupMessageConstants.SUB_OP_ALTER):{break; } //change client info + case(GroupMessageConstants.SUB_OP_UPDATE):{break; } //refresh/replace client info + default: {break;} + } + } + + + +} \ No newline at end of file Property changes on: trunk/src/openrpg2/common/core/group/GroupServerModule.java ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/openrpg2/common/core/network/NetworkClient.java =================================================================== --- trunk/src/openrpg2/common/core/network/NetworkClient.java 2006-04-11 06:37:32 UTC (rev 54) +++ trunk/src/openrpg2/common/core/network/NetworkClient.java 2006-04-11 23:12:13 UTC (rev 55) @@ -35,13 +35,14 @@ import java.util.Set; import openrpg2.common.core.ORPGMessage; import openrpg2.common.core.ORPGMessageQueue; +import openrpg2.common.module.NetworkedModule; /** * * @author snowdog */ -public class NetworkClient implements NetworkMessageRelay{ +public class NetworkClient implements NetworkMessageRelay, NetworkModuleProvider{ private ORPGMessageQueue inQueue; private ORPGMessageQueue outQueue; @@ -282,42 +283,44 @@ } }; writeThread.start(); - } - //methods to satisfy NetworkMessageRelay interface - public Observable addMessageQueueObserver(Observer o){ + } + //methods to satisfy NetworkMessageRelay interface + public Observable addMessageQueueObserver(Observer o){ inQueue.addObserver(o); return inQueue; //return reference to object for comparison only in case more than one observable is being monitored. } - /** - * Method to allow an ORPGMessage object to be accepted for processing - * @param msg ORPGMessage Object - * @return boolean. True on success, False on failure - */ - - public boolean putORPGMessage(ORPGMessage msg){ - return sendMessage(msg); + /** + * Method to allow an ORPGMessage object to be accepted for processing + * @param msg ORPGMessage Object + * @return boolean. True on success, False on failure + */ + + public boolean putORPGMessage(ORPGMessage msg){ + return sendMessage(msg); + } + /** + * Retrieve first available ORPGMessage object + * @throws openrpg2.common.core.network.NoMessageAvailableException Thrown if no messages are available for retrieval + * @return ORPGMessage object + */ + public ORPGMessage getORPGMessage() throws NoMessageAvailableException{ + ORPGMessage msg = readMessage(); + if (msg == null){ + throw new NoMessageAvailableException(); } - /** - * Retrieve first available ORPGMessage object - * @throws openrpg2.common.core.network.NoMessageAvailableException Thrown if no messages are available for retrieval - * @return ORPGMessage object - */ - public ORPGMessage getORPGMessage() throws NoMessageAvailableException{ - ORPGMessage msg = readMessage(); - if (msg == null){ - throw new NoMessageAvailableException(); - } - return msg; - } - - /** - * Check if ORPGMessage can be retrieved with getORPGMessage() method - * @return True if 1 or more ORPGMessages are ready for retrieval otherwise false. - */ - public boolean hasORPGMessage(){ - return messageAvailable(); - } - - + return msg; + } + /** + * Check if ORPGMessage can be retrieved with getORPGMessage() method + * @return True if 1 or more ORPGMessages are ready for retrieval otherwise false. + */ + public boolean hasORPGMessage(){ + return messageAvailable(); + } + + + public NetworkedModule getNetworkModule(){ + return new NetworkClientModule(this); + } } Added: trunk/src/openrpg2/common/core/network/NetworkModuleProvider.java =================================================================== --- trunk/src/openrpg2/common/core/network/NetworkModuleProvider.java (rev 0) +++ trunk/src/openrpg2/common/core/network/NetworkModuleProvider.java 2006-04-11 23:12:13 UTC (rev 55) @@ -0,0 +1,34 @@ +/* + * NetworkModuleProvider.java + * + * Author: snowdog + * Created on April 11, 2006, 3:20 PM + * + * ==================================================================== + * Copyright (C) 2005-2006 The OpenRPG Project (www.openrpg.com) + * + * 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 software 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 on www.gnu.org for more details. + * ==================================================================== + */ + +package openrpg2.common.core.network; + +import openrpg2.common.module.NetworkedModule; + +/** + * + * @author snowdog + */ +public interface NetworkModuleProvider { + + public NetworkedModule getNetworkModule(); + +} Property changes on: trunk/src/openrpg2/common/core/network/NetworkModuleProvider.java ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/openrpg2/common/core/network/NetworkServer.java =================================================================== --- trunk/src/openrpg2/common/core/network/NetworkServer.java 2006-04-11 06:37:32 UTC (rev 54) +++ trunk/src/openrpg2/common/core/network/NetworkServer.java 2006-04-11 23:12:13 UTC (rev 55) @@ -38,6 +38,7 @@ import java.util.logging.Logger; import openrpg2.common.core.ORPGMessage; import openrpg2.common.core.ORPGMessageQueue; +import openrpg2.common.module.NetworkedModule; /** @@ -49,7 +50,7 @@ * @author snowdog */ -public class NetworkServer implements NetworkMessageRelay, NetworkConnectionNotifier{ +public class NetworkServer implements NetworkMessageRelay, NetworkConnectionNotifier, NetworkModuleProvider{ private ServerSocketChannel ssc = null; private Selector selector = null; private boolean initDone = false; @@ -375,4 +376,12 @@ } + /** + * Required for implementation of NetworkModuleProvider interface. + * + */ + public NetworkedModule getNetworkModule(){ + return new NetworkServerModule(this); + } + } Modified: trunk/src/openrpg2/server/core/ORPGServer.java =================================================================== --- trunk/src/openrpg2/server/core/ORPGServer.java 2006-04-11 06:37:32 UTC (rev 54) +++ trunk/src/openrpg2/server/core/ORPGServer.java 2006-04-11 23:12:13 UTC (rev 55) @@ -51,7 +51,7 @@ NetworkServer server = new NetworkServer(); ServerModuleLoader ml = new ServerModuleLoader(); - ml.setNetworkModule(new NetworkServerModule(server)); + ml.setNetworkModuleProvider(server); Engine thor = new Engine(server, server, ml, d, ORPGConstants.OPMODE_SERVER); thor.start(); server.setServerAddress(new InetSocketAddress(NetworkConnection.DEFAULT_HOST, NetworkConnection.DEFAULT_PORT)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |