[skycastle-commits] SF.net SVN: skycastle: [448] trunk/skycastle

  • From: zzorn@xxxxxxxxxxxxxxxxxxxxx
  • To: skycastle-commits@xxxxxxxxxxxxx
  • Date: Sat, 05 Apr 2008 20:04:13 -0700

Revision: 448
          http://skycastle.svn.sourceforge.net/skycastle/?rev=448&view=rev
Author:   zzorn
Date:     2008-04-05 20:04:12 -0700 (Sat, 05 Apr 2008)

Log Message:
-----------
Added shell scripts for running the server and client, and wiping the server 
database.  

Ran the server and client, and fixed a number of small bugs (missing 
serialization, missing method implementations, etc) until the connection and 
message passing now works.

Modified Paths:
--------------
    trunk/skycastle/modules/client/pom.xml
    
trunk/skycastle/modules/client/src/main/java/org/skycastle/client/SkycastleClient.java
    
trunk/skycastle/modules/core/src/main/java/org/skycastle/core/ClientContext.java
    
trunk/skycastle/modules/core/src/main/java/org/skycastle/core/ServerSideContext.java
    
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectAddedMessage.java
    
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectRemovedMessage.java
    
trunk/skycastle/modules/core/src/main/java/org/skycastle/protocol/MessageValidator.java
    trunk/skycastle/modules/server/SkycastleServer.properties
    trunk/skycastle/modules/server/pom.xml
    
trunk/skycastle/modules/server/src/main/java/org/skycastle/server/SkycastleClientSessionHandler.java
    
trunk/skycastle/modules/server/src/main/java/org/skycastle/server/SkycastleServer.java
    
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/collection/EmptyListenableList.java
    
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/collection/list/ListenableArrayList.java
    
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/collection/set/ListenableLinkedSet.java
    
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/map/ListenableLinkedMap.java
    
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/map/validator/DefaultValidatedMapEntry.java
    trunk/skycastle/pom.xml
    trunk/skycastle/run_client.bat
    trunk/skycastle/run_server.bat

Added Paths:
-----------
    
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/SpecifyRootObjectMessage.java
    trunk/skycastle/reset_server.sh
    trunk/skycastle/run_client.sh
    trunk/skycastle/run_server.sh
    trunk/skycastle/skycastle_assembly.xml

Modified: trunk/skycastle/modules/client/pom.xml
===================================================================
--- trunk/skycastle/modules/client/pom.xml      2008-04-05 22:57:50 UTC (rev 
447)
+++ trunk/skycastle/modules/client/pom.xml      2008-04-06 03:04:12 UTC (rev 
448)
@@ -33,7 +33,7 @@
 
                     <archive>
                         <manifest>
-                            
<mainClass>org.skycastle.client.hardcoded.Simple3DClient</mainClass>
+                            
<mainClass>org.skycastle.client.SkycastleClient</mainClass>
                         </manifest>
                     </archive>
                 </configuration>
@@ -295,19 +295,20 @@
             <artifactId>mina-core</artifactId>
             <version>1.1.0</version>
         </dependency>
-        <!--
-                <dependency>
-                    <groupId>org.slf4j.slf4j</groupId>
-                    <artifactId>slf4j-api</artifactId>
-                    <version>1.4.0-RC0</version>
-                </dependency>
-                <dependency>
-                    <groupId>org.slf4j.slf4j</groupId>
-                    <artifactId>slf4j-jdk14</artifactId>
-                    <version>1.4.0-RC0</version>
-                </dependency>
-        -->
 
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.4.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-jdk14</artifactId>
+            <version>1.4.0</version>
+        </dependency>
+
+
     </dependencies>
 
 

Modified: 
trunk/skycastle/modules/client/src/main/java/org/skycastle/client/SkycastleClient.java
===================================================================
--- 
trunk/skycastle/modules/client/src/main/java/org/skycastle/client/SkycastleClient.java
      2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/client/src/main/java/org/skycastle/client/SkycastleClient.java
      2008-04-06 03:04:12 UTC (rev 448)
@@ -4,6 +4,7 @@
 import com.sun.sgs.client.ClientChannelListener;
 import com.sun.sgs.client.simple.SimpleClient;
 import com.sun.sgs.client.simple.SimpleClientListener;
+import org.skycastle.core.ClientContext;
 import org.skycastle.core.GameContext;
 import org.skycastle.messaging.Message;
 import org.skycastle.messaging.modifications.ModificationMessage;
@@ -67,6 +68,7 @@
     // Private Constants
 
     private static final int PROTOCOL_NEGOTIATION_TIMEOUT_MS = 10000;
+
     /**
      * The name of the host property.
      */
@@ -101,6 +103,45 @@
     // Public Methods
 
     //----------------------------------------------------------------------
+    // Main Method
+
+    /**
+     * Main entry point for the Skycastle client.
+     *
+     * @param args command line arguments.
+     */
+    public static void main( final String[] args )
+    {
+        LOGGER.log( Level.INFO, "Skycastle Client starting up." );
+
+        // Initialize static context variable
+        GameContext.setGameObjectContext( new ClientContext() );
+
+/*
+        // Do not show logging output below the WARNING level (JME outputs a 
lot of debugging info at INFO level).
+        // This way the console output is a bit more relevant.
+        LOGGER.setLevel( Level.WARNING );
+*/
+
+        final SkycastleClient client = new SkycastleClient();
+
+        client.login();
+
+        // Idle forever
+        while ( true )
+        {
+            try
+            {
+                Thread.sleep( 1000 );
+            }
+            catch ( InterruptedException e )
+            {
+                e.printStackTrace();  //To change body of catch statement use 
File | Settings | File Templates.
+            }
+        }
+    }
+
+    //----------------------------------------------------------------------
     // Constructors
 
     /**
@@ -114,9 +155,6 @@
                PROTOCOL_NEGOTIATION_TIMEOUT_MS );
 
         mySimpleClient = new SimpleClient( this );
-
-        // DEBUG: For now, just try directly to log in.
-        login();
     }
 
     //----------------------------------------------------------------------
@@ -243,6 +281,8 @@
     protected void onProtocolNegotiationFailed( final NegotiationStatus status 
)
     {
         LOGGER.severe( "Could not negotiate a common protocol with the server: 
" + status.toString() );
+
+        disconnect();
     }
 
 
@@ -256,6 +296,8 @@
     @Override
     protected void onMessage( final Message message ) throws ProtocolException
     {
+        LOGGER.log( Level.INFO, "Recieved a message: " + message );
+
         if ( message instanceof UpdateMessage )
         {
             final UpdateMessage updateMessage = (UpdateMessage) message;
@@ -277,6 +319,15 @@
     // Private Methods
 
     /**
+     * Disconnects from the server gracefully.
+     */
+    private void disconnect()
+    {
+        mySimpleClient.logout( true );
+    }
+
+
+    /**
      * Initiates asynchronous login to the SGS server specified by the host 
and port properties.
      */
     // IDEA: This could be one action provided by a client side GameObject 
representing a server

Modified: 
trunk/skycastle/modules/core/src/main/java/org/skycastle/core/ClientContext.java
===================================================================
--- 
trunk/skycastle/modules/core/src/main/java/org/skycastle/core/ClientContext.java
    2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/core/src/main/java/org/skycastle/core/ClientContext.java
    2008-04-06 03:04:12 UTC (rev 448)
@@ -25,6 +25,7 @@
     private final Set<IssueListener> myIssueListeners = new 
HashSet<IssueListener>( 5 );
 
     private long myInGameClock_ms = 0L;
+    private GameObjectId myRootObjectId;
 
     //======================================================================
     // Public Methods
@@ -200,6 +201,31 @@
         }
     }
 
+
+    /**
+     * @return the id of the {@link GameObject} on the server side that the 
client can access the rest of the
+     *         server through.
+     *         <p/>
+     *         Typically an account, that allows the user to create new 
avatars or use existing ones.
+     */
+    public final GameObjectId getRootObjectId()
+    {
+        return myRootObjectId;
+    }
+
+
+    /**
+     * @param rootObjectId the id of the {@link GameObject} on the server side 
that the client can access the
+     *                     rest of the server through.
+     *                     <p/>
+     *                     Typically an account, that allows the user to 
create new avatars or use existing
+     *                     ones.
+     */
+    public final void setRootObjectId( final GameObjectId rootObjectId )
+    {
+        myRootObjectId = rootObjectId;
+    }
+
     //======================================================================
     // Private Methods
 

Modified: 
trunk/skycastle/modules/core/src/main/java/org/skycastle/core/ServerSideContext.java
===================================================================
--- 
trunk/skycastle/modules/core/src/main/java/org/skycastle/core/ServerSideContext.java
        2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/core/src/main/java/org/skycastle/core/ServerSideContext.java
        2008-04-06 03:04:12 UTC (rev 448)
@@ -4,11 +4,13 @@
 import com.sun.sgs.app.DataManager;
 import com.sun.sgs.app.ManagedReference;
 
+import java.io.Serializable;
+
 /**
  * @author Hans Häggström
  */
 public class ServerSideContext
-        implements GameObjectContext
+        implements GameObjectContext, Serializable
 {
 
     //======================================================================
@@ -29,7 +31,7 @@
 
         // Assign unique ID, and bind it, so that we can access this object 
easily in the future
         final ManagedReference reference = dataManager.createReference( 
gameObject );
-        final GameObjectId id = new GameObjectId( reference.getId().toString() 
);
+        final GameObjectId id = new GameObjectId( 
GameObjectId.GAME_OBJECT_BINDING_PREFIX + reference.getId().toString() );
         dataManager.setBinding( id.toString(), gameObject );
         return id;
     }

Modified: 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectAddedMessage.java
===================================================================
--- 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectAddedMessage.java
       2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectAddedMessage.java
       2008-04-06 03:04:12 UTC (rev 448)
@@ -20,6 +20,7 @@
  * {@link GameObject}s in their properties and such.
  *
  * @author Hans Haggstrom
+ * @deprecated replaced by the simpler SpecifyRootObjectMessage.
  */
 public final class GameObjectAddedMessage
         extends AbstractMessage

Modified: 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectRemovedMessage.java
===================================================================
--- 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectRemovedMessage.java
     2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/GameObjectRemovedMessage.java
     2008-04-06 03:04:12 UTC (rev 448)
@@ -14,6 +14,7 @@
  * A message to indicate that the specified GameObject is no longer available 
for the client.
  *
  * @author Hans Haggstrom
+ * @deprecated
  */
 public final class GameObjectRemovedMessage
         extends AbstractMessage

Added: 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/SpecifyRootObjectMessage.java
===================================================================
--- 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/SpecifyRootObjectMessage.java
                             (rev 0)
+++ 
trunk/skycastle/modules/core/src/main/java/org/skycastle/messaging/updates/object/SpecifyRootObjectMessage.java
     2008-04-06 03:04:12 UTC (rev 448)
@@ -0,0 +1,105 @@
+package org.skycastle.messaging.updates.object;
+
+import org.skycastle.core.ClientContext;
+import org.skycastle.core.GameObject;
+import org.skycastle.core.GameObjectContext;
+import org.skycastle.core.GameObjectId;
+import org.skycastle.messaging.AbstractMessage;
+import org.skycastle.messaging.updates.UpdateMessage;
+import org.skycastle.util.ParameterChecker;
+import org.skycastle.util.parameters.ValidationError;
+
+import java.util.Set;
+
+/**
+ * Used by the server to tell the client the {@link GameObjectId} of the 
facade / root / account object, which
+ * the client can use to access other functionality and objects on the server 
side.
+ * <p/>
+ * Typically it is a client specific account, with actions for creating a new 
avatar, or resuming an earlier
+ * one.
+ *
+ * @author Hans Häggström
+ */
+public final class SpecifyRootObjectMessage
+        extends AbstractMessage
+        implements UpdateMessage
+{
+
+    //======================================================================
+    // Private Fields
+
+    private final GameObjectId myRootObjectId;
+
+    //======================================================================
+    // Private Constants
+
+    private static final long serialVersionUID = 1L;
+
+    //======================================================================
+    // Public Methods
+
+    //----------------------------------------------------------------------
+    // Constructors
+
+    /**
+     * Creates a new {@link 
org.skycastle.messaging.updates.object.SpecifyRootObjectMessage}.
+     *
+     * @param senderId     id of the {@link GameObject} that sent this {@link 
SpecifyRootObjectMessage}.
+     * @param rootObjectId the id of the object that the client can use to 
access other objects on the
+     *                     server.
+     */
+    public SpecifyRootObjectMessage( final GameObjectId senderId,
+                                     final GameObjectId rootObjectId )
+    {
+        super( senderId );
+
+        ParameterChecker.checkNotNull( rootObjectId, "rootObjectId" );
+
+        myRootObjectId = rootObjectId;
+    }
+
+    //----------------------------------------------------------------------
+    // Message Implementation
+
+    @Override
+    public ValidationError validate( final Set<String> allowedContainedTypes, 
final String errorPrefix )
+    {
+        ValidationError validationError = super.validate( 
allowedContainedTypes, errorPrefix );
+
+        if ( validationError == null )
+        {
+            validationError = checkValue( myRootObjectId, "rootObjectId", 
allowedContainedTypes );
+        }
+
+        return validationError;
+    }
+
+    //----------------------------------------------------------------------
+    // UpdateMessage Implementation
+
+    public void applyStateChangeToModel( final GameObjectContext 
gameObjectContext )
+    {
+        if ( gameObjectContext instanceof ClientContext )
+        {
+            final ClientContext clientContext = (ClientContext) 
gameObjectContext;
+
+            clientContext.setRootObjectId( myRootObjectId );
+        }
+        else
+        {
+            throw new IllegalStateException( "The SpecifyRootObjectMessage can 
only be sent to the client." );
+        }
+    }
+
+    //----------------------------------------------------------------------
+    // Other Public Methods
+
+    /**
+     * @return the id of the object that the client can use to access other 
objects on the server.
+     */
+    public GameObjectId getRootObjectId()
+    {
+        return myRootObjectId;
+    }
+
+}

Modified: 
trunk/skycastle/modules/core/src/main/java/org/skycastle/protocol/MessageValidator.java
===================================================================
--- 
trunk/skycastle/modules/core/src/main/java/org/skycastle/protocol/MessageValidator.java
     2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/core/src/main/java/org/skycastle/protocol/MessageValidator.java
     2008-04-06 03:04:12 UTC (rev 448)
@@ -6,6 +6,7 @@
 import org.skycastle.messaging.modifications.property.SetPropertyMessage;
 import org.skycastle.messaging.updates.object.GameObjectAddedMessage;
 import org.skycastle.messaging.updates.object.GameObjectRemovedMessage;
+import org.skycastle.messaging.updates.object.SpecifyRootObjectMessage;
 import org.skycastle.messaging.updates.property.PropertyAddedMessage;
 import org.skycastle.messaging.updates.property.PropertyChangedMessage;
 import org.skycastle.messaging.updates.property.PropertyRemovedMessage;
@@ -71,6 +72,7 @@
         final Set<String> allowedClasses = new HashSet<String>();
 
         // Update messages
+        allowedClasses.add( SpecifyRootObjectMessage.class.getName() );
         allowedClasses.add( GameObjectAddedMessage.class.getName() );
         allowedClasses.add( GameObjectRemovedMessage.class.getName() );
         allowedClasses.add( PropertyAddedMessage.class.getName() );

Modified: trunk/skycastle/modules/server/SkycastleServer.properties
===================================================================
--- trunk/skycastle/modules/server/SkycastleServer.properties   2008-04-05 
22:57:50 UTC (rev 447)
+++ trunk/skycastle/modules/server/SkycastleServer.properties   2008-04-06 
03:04:12 UTC (rev 448)
@@ -1,4 +1,4 @@
 com.sun.sgs.app.name=SkycastleServer
 com.sun.sgs.app.root=data
 com.sun.sgs.app.port=1139
-com.sun.sgs.app.listener=org.skycastle.server.hardcoded.SkycastleServerListener
+com.sun.sgs.app.listener=org.skycastle.server.SkycastleServer

Modified: trunk/skycastle/modules/server/pom.xml
===================================================================
--- trunk/skycastle/modules/server/pom.xml      2008-04-05 22:57:50 UTC (rev 
447)
+++ trunk/skycastle/modules/server/pom.xml      2008-04-06 03:04:12 UTC (rev 
448)
@@ -23,7 +23,36 @@
 
     <build>
         <plugins>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <descriptorRefs>
+                        <descriptorRef>jar-with-dependencies</descriptorRef>
+                    </descriptorRefs>
 
+                    <archive>
+                        <manifest>
+                            
<mainClass>org.skycastle.server.SkycastleServer</mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+
+                <executions>
+                    <execution>
+                        <id>make-assembly</id>
+                        <!-- this is used for inheritance merges -->
+                        <phase>package</phase>
+                        <!-- append to the packaging phase. -->
+                        <goals>
+                            <goal>attached</goal>
+                            <!-- goals == mojos -->
+                        </goals>
+                    </execution>
+                </executions>
+
+            </plugin>
+
+
             <!--Specify where Scala sources can be found in a project. -->
             <!--
                         <plugin>

Modified: 
trunk/skycastle/modules/server/src/main/java/org/skycastle/server/SkycastleClientSessionHandler.java
===================================================================
--- 
trunk/skycastle/modules/server/src/main/java/org/skycastle/server/SkycastleClientSessionHandler.java
        2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/server/src/main/java/org/skycastle/server/SkycastleClientSessionHandler.java
        2008-04-06 03:04:12 UTC (rev 448)
@@ -5,7 +5,7 @@
 import org.skycastle.messaging.Message;
 import org.skycastle.messaging.modifications.ModificationMessage;
 import org.skycastle.messaging.updates.UpdateMessage;
-import org.skycastle.messaging.updates.object.GameObjectAddedMessage;
+import org.skycastle.messaging.updates.object.SpecifyRootObjectMessage;
 import org.skycastle.protocol.ProtocolCommunicator;
 import org.skycastle.protocol.ProtocolException;
 import org.skycastle.protocol.negotiation.NegotiationStatus;
@@ -137,8 +137,7 @@
     @Override
     protected void scheduleTimeoutCallback( final long timeout_ms )
     {
-        // TODO: Check if a ClientSessionListener is considered to be a Task, 
or if it can be one?
-        AppContext.getTaskManager().scheduleTask( this, timeout_ms );
+        // TODO: Implement.  Needs to work with SGS Tasks, but the 
ManagedObject that contains the session handler needs to be used.
     }
 
 
@@ -164,8 +163,7 @@
     protected void onProtocolNegotiationSucceeded( final String protocolId )
     {
         LOGGER.log( Level.INFO,
-                    "User '{0}' logged in.",
-                    new Object[]{ myClientSession.getName() } );
+                    "User '" + myClientSession.getName() + "' logged in." );
 
         final GameObject account = getUserAccount( myClientSession.getName() );
 
@@ -176,7 +174,7 @@
         try
         {
             // Send a reference to the account game object to the client side
-            sendMessage( new GameObjectAddedMessage( account.getId(), 
account.getId() ) );
+            sendMessage( new SpecifyRootObjectMessage( account.getId(), 
account.getId() ) );
         }
         catch ( ProtocolException e )
         {
@@ -246,10 +244,16 @@
 
         final String bindingName = ACCOUNT_PREFIX + userLoginName;
 
-        GameObject clientAccount = dataManager.getBinding( bindingName, 
GameObject.class );
-        if ( clientAccount == null )
+        GameObject clientAccount;
+
+        try
         {
+            clientAccount = dataManager.getBinding( bindingName, 
GameObject.class );
+        }
+        catch ( NameNotBoundException e )
+        {
             // If client doesn't yet have any account, create a new one
+
             clientAccount = new DefaultGameObject();
             // TODO: Do we need to store the client user name with the 
account?  Any other data?
             // TODO: This is a game / server extension point, as different 
servers could have different options and provided UI layouts here.

Modified: 
trunk/skycastle/modules/server/src/main/java/org/skycastle/server/SkycastleServer.java
===================================================================
--- 
trunk/skycastle/modules/server/src/main/java/org/skycastle/server/SkycastleServer.java
      2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/server/src/main/java/org/skycastle/server/SkycastleServer.java
      2008-04-06 03:04:12 UTC (rev 448)
@@ -3,7 +3,9 @@
 import com.sun.sgs.app.AppListener;
 import com.sun.sgs.app.ClientSession;
 import com.sun.sgs.app.ClientSessionListener;
+import org.skycastle.core.GameContext;
 import org.skycastle.core.PersistentReference;
+import org.skycastle.core.ServerSideContext;
 import org.skycastle.protocol.registry.ProtocolRegistry;
 import org.skycastle.protocol.registry.ProtocolRegistryImpl;
 
@@ -45,6 +47,12 @@
 
     public void initialize( final Properties properties )
     {
+        LOGGER.log( Level.INFO, "Skycastle Server starting up." );
+
+        // Initialize static context variable
+        // TODO: This might not work in a multi node (=multi JVM) environment. 
 Use autodetection and lazy creation instead?
+        GameContext.setGameObjectContext( new ServerSideContext() );
+
         // Create protocol registry
         myProtocolRegistryReference = new 
PersistentReference<ProtocolRegistry>( new ProtocolRegistryImpl() );
     }

Modified: 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/collection/EmptyListenableList.java
===================================================================
--- 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/collection/EmptyListenableList.java
       2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/collection/EmptyListenableList.java
       2008-04-06 03:04:12 UTC (rev 448)
@@ -2,6 +2,7 @@
 
 import org.skycastle.util.listenable.collection.list.ListenableList;
 
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -12,10 +13,15 @@
  * @author Hans Haggstrom
  */
 public final class EmptyListenableList
-        implements ListenableList, ListenableCollection
+        implements ListenableList, ListenableCollection, Serializable
 {
 
     //======================================================================
+    // Private Constants
+
+    private static final long serialVersionUID = 1L;
+
+    //======================================================================
     // Public Methods
 
     //----------------------------------------------------------------------

Modified: 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/collection/list/ListenableArrayList.java
===================================================================
--- 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/collection/list/ListenableArrayList.java
  2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/collection/list/ListenableArrayList.java
  2008-04-06 03:04:12 UTC (rev 448)
@@ -8,6 +8,7 @@
 
 import org.skycastle.util.listenable.collection.AbstractListenableCollection;
 
+import java.io.Serializable;
 import java.util.*;
 
 
@@ -16,17 +17,17 @@
  * <p/>
  * Can also return a read only view to the list.
  * <p/>
- * Also implements a cursor like concept, where one element in the list can be 
'active'. If the active element is
- * deleted, a new active element is selected.
+ * Also implements a cursor like concept, where one element in the list can be 
'active'. If the active element
+ * is deleted, a new active element is selected.
  * <p/>
  * IDEA: Also allow validating methods to be setOrientation for adding / 
removing elements.
  * <p/>
- * Returned sublists or iterators can not be used to modify the list, and they 
may be invalid after the main list is
- * modified.
+ * Returned sublists or iterators can not be used to modify the list, and they 
may be invalid after the main
+ * list is modified.
  */
 public class ListenableArrayList<E>
         extends AbstractListenableCollection<E>
-        implements ListenableMutableList<E>
+        implements ListenableMutableList<E>, Serializable
 {
 
     //======================================================================
@@ -39,6 +40,11 @@
     private transient List<E> myElementsReadOnly = null;
 
     //======================================================================
+    // Private Constants
+
+    private static final long serialVersionUID = 1L;
+
+    //======================================================================
     // Public Methods
 
     //----------------------------------------------------------------------
@@ -75,7 +81,8 @@
 
     /**
      * @param makeAddedElementActiveIfThereWasNoActiveElement
-     *         if true, an element will be setOrientation as active when it is 
added if the previous active element was null.
+     *         if true, an element will be setOrientation as active when it is 
added if the previous active
+     *         element was null.
      */
     public ListenableArrayList( final boolean 
makeAddedElementActiveIfThereWasNoActiveElement )
     {
@@ -89,7 +96,8 @@
 
     public boolean addAll( int index, Collection<? extends E> ts )
     {
-        throw new UnsupportedOperationException( "The addAll method is not yet 
implemented in ListenableArrayList." );
+        throw new UnsupportedOperationException(
+                "The addAll method is not yet implemented in 
ListenableArrayList." );
     }
 
 
@@ -101,13 +109,15 @@
 
     public E set( int index, E element )
     {
-        throw new UnsupportedOperationException( "The setOrientation(index, 
element) method is not yet implemented in ListenableArrayList." );
+        throw new UnsupportedOperationException(
+                "The setOrientation(index, element) method is not yet 
implemented in ListenableArrayList." );
     }
 
 
     public void add( int index, E element )
     {
-        throw new UnsupportedOperationException( "The add(index, element) 
method is not yet implemented in ListenableArrayList." );
+        throw new UnsupportedOperationException(
+                "The add(index, element) method is not yet implemented in 
ListenableArrayList." );
     }
 
 
@@ -162,7 +172,6 @@
     //----------------------------------------------------------------------
     // ListenableList Implementation
 
-
     public List<E> getReadOnlyList()
     {
         // Lazy initialization
@@ -184,7 +193,6 @@
     //----------------------------------------------------------------------
     // ListenableMutableCollection Implementation
 
-
     public void setActiveElement( E activeElement )
     {
         // Update the index of the active element
@@ -210,7 +218,6 @@
     //----------------------------------------------------------------------
     // ListenableMutableList Implementation
 
-
     public void setActiveElementIndex( int activeElementIndex )
     {
         if ( activeElementIndex < -1 || activeElementIndex >= 
myElements.size() )

Modified: 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/collection/set/ListenableLinkedSet.java
===================================================================
--- 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/collection/set/ListenableLinkedSet.java
   2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/collection/set/ListenableLinkedSet.java
   2008-04-06 03:04:12 UTC (rev 448)
@@ -7,6 +7,7 @@
 
 import org.skycastle.util.listenable.collection.AbstractListenableCollection;
 
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashSet;
@@ -18,17 +19,17 @@
  * <p/>
  * Can also return a read only view to the setOrientation.
  * <p/>
- * Also implements a cursor like concept, where one element in the 
setOrientation can be 'active'.
- * If the active element is deleted, a new active element is selected.
+ * Also implements a cursor like concept, where one element in the 
setOrientation can be 'active'. If the
+ * active element is deleted, a new active element is selected.
  * <p/>
  * IDEA: Also allow validating methods to be setOrientation for adding / 
removing elements.
  * <p/>
- * Returned subsets or iterators can not be used to modify the setOrientation,
- * and they may be invalid after the main setOrientation is modified.
+ * Returned subsets or iterators can not be used to modify the setOrientation, 
and they may be invalid after
+ * the main setOrientation is modified.
  */
 public class ListenableLinkedSet<E>
         extends AbstractListenableCollection<E>
-        implements ListenableMutableSet<E>
+        implements ListenableMutableSet<E>, Serializable
 {
 
     //======================================================================
@@ -38,7 +39,11 @@
 
     private transient Set<E> myElementsReadOnly = null;
 
+    //======================================================================
+    // Private Constants
 
+    private static final long serialVersionUID = 1L;
+
     //======================================================================
     // Public Methods
 
@@ -61,17 +66,17 @@
         setElements( initialElements );
     }
 
+
     /**
      * @param makeAddedElementActiveIfThereWasNoActiveElement
-     *         if true, an element will be setOrientation as active when it is 
added if the
-     *         previous active element was null.
+     *         if true, an element will be setOrientation as active when it is 
added if the previous active
+     *         element was null.
      */
     public ListenableLinkedSet( final boolean 
makeAddedElementActiveIfThereWasNoActiveElement )
     {
         super( makeAddedElementActiveIfThereWasNoActiveElement );
     }
 
-
     //----------------------------------------------------------------------
     // ListenableCollection Implementation
 
@@ -94,7 +99,6 @@
         return myElementsReadOnly;
     }
 
-
     //======================================================================
     // Protected Methods
 
@@ -112,4 +116,5 @@
             super.addElement( addedElement );
         }
     }
+
 }

Modified: 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/map/ListenableLinkedMap.java
===================================================================
--- 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/map/ListenableLinkedMap.java
      2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/map/ListenableLinkedMap.java
      2008-04-06 03:04:12 UTC (rev 448)
@@ -10,18 +10,21 @@
 import org.skycastle.util.listenable.map.validator.MapValidator;
 import org.skycastle.util.listenable.map.validator.ValidatedMapEntry;
 
+import java.io.Serializable;
 import java.util.*;
 
 
 /**
- * A Map that can be listened to, for add and remove notifications. Can also 
return a read only view to the map.
+ * A Map that can be listened to, for add and remove notifications. Can also 
return a read only view to the
+ * map.
  * <p/>
  * IDEA: Also allow validating methods to be setOrientation for adding / 
removing elements.
  * <p/>
- * Returned iterators can not be used to modify the map, and they may be 
invalid after the main map is modified.
+ * Returned iterators can not be used to modify the map, and they may be 
invalid after the main map is
+ * modified.
  */
 public class ListenableLinkedMap<K, V>
-        implements ListenableMutableMap<K, V>
+        implements ListenableMutableMap<K, V>, Serializable
 {
 
     //======================================================================
@@ -31,11 +34,17 @@
 
     private Set<MapValidator<K, V>> myValidators = null;
 
+    private Set<MapListener<K, V>> myMapListeners = null;
+
     private transient Map<K, V> myElementsReadOnly = null;
-    private transient Set<MapListener<K, V>> myMapListeners = null;
     private transient ValidatedMapEntry<K, V> myTempMapEntry = null;
 
     //======================================================================
+    // Private Constants
+
+    private static final long serialVersionUID = 1L;
+
+    //======================================================================
     // Public Methods
 
     //----------------------------------------------------------------------
@@ -105,7 +114,6 @@
     //----------------------------------------------------------------------
     // ListenableMutableMap Implementation
 
-
     public void setEntries( Map<K, V> newEntries )
     {
         clear();
@@ -214,7 +222,9 @@
         {
             for ( Entry<? extends K, ? extends V> addedEntry : 
addedEntries.entrySet() )
             {
-                notifyEntryChanged( addedEntry.getKey(), oldValues.get( 
addedEntry.getKey() ), addedEntry.getValue() );
+                notifyEntryChanged( addedEntry.getKey(),
+                                    oldValues.get( addedEntry.getKey() ),
+                                    addedEntry.getValue() );
             }
         }
     }
@@ -259,6 +269,12 @@
         return getReadOnlyMap().entrySet();
     }
 
+
+    public int hashCode()
+    {
+        return myElements.hashCode();
+    }
+
     //----------------------------------------------------------------------
     // Caononical Methods
 
@@ -267,23 +283,17 @@
         return myElements.equals( o );
     }
 
-
-    public int hashCode()
-    {
-        return myElements.hashCode();
-    }
-
     //======================================================================
     // Protected Methods
 
     /**
-     * @return true if this map has any listneners registered, false if not. 
Can be used to avoid calling of costly
-     *         update notification methods when nobody is listening anyway.
+     * @return true if this map has any listneners registered, false if not. 
Can be used to avoid calling of
+     *         costly update notification methods when nobody is listening 
anyway.
      */
     protected boolean hasListeners()
     {
         return myMapListeners != null &&
-                myMapListeners.size() > 0;
+               myMapListeners.size() > 0;
     }
 
 
@@ -306,8 +316,8 @@
      *
      * @param entry the map entry to be validated.
      *
-     * @return a map entry with the corrected and validated key and value, or 
null if the put operations should be
-     *         ignored.  Can be the same map entry used as the parameter, or a 
new one.
+     * @return a map entry with the corrected and validated key and value, or 
null if the put operations
+     *         should be ignored.  Can be the same map entry used as the 
parameter, or a new one.
      *
      * @throws IllegalArgumentException may be thrown if a validator deems the 
entry invalid.
      */

Modified: 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/map/validator/DefaultValidatedMapEntry.java
===================================================================
--- 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/map/validator/DefaultValidatedMapEntry.java
       2008-04-05 22:57:50 UTC (rev 447)
+++ 
trunk/skycastle/modules/utils/src/main/java/org/skycastle/util/listenable/map/validator/DefaultValidatedMapEntry.java
       2008-04-06 03:04:12 UTC (rev 448)
@@ -3,14 +3,35 @@
  */
 package org.skycastle.util.listenable.map.validator;
 
+import java.io.Serializable;
+
 /**
- * A small helper class used to hold an entry that should be validated with a 
MapValidator.
- * Has gettr and setters for the key and value.
+ * A small helper class used to hold an entry that should be validated with a 
MapValidator. Has gettr and
+ * setters for the key and value.
  *
  * @author Hans Häggström
  */
-public class DefaultValidatedMapEntry<K,V> implements ValidatedMapEntry<K,V>
+public class DefaultValidatedMapEntry<K, V>
+        implements ValidatedMapEntry<K, V>, Serializable
 {
+
+    //======================================================================
+    // Private Fields
+
+    private K myKey;
+    private V myValue;
+
+    //======================================================================
+    // Private Constants
+
+    private static final long serialVersionUID = 1L;
+
+    //======================================================================
+    // Public Methods
+
+    //----------------------------------------------------------------------
+    // Constructors
+
     public DefaultValidatedMapEntry()
     {
     }
@@ -22,7 +43,10 @@
         myValue = value;
     }
 
+    //----------------------------------------------------------------------
+    // ValidatedMapEntry Implementation
 
+
     public void setEntry( K key, V value )
     {
         myKey = key;
@@ -30,10 +54,6 @@
     }
 
 
-    private K myKey;
-    private V myValue;
-
-
     public K getKey()
     {
         return myKey;

Modified: trunk/skycastle/pom.xml
===================================================================
--- trunk/skycastle/pom.xml     2008-04-05 22:57:50 UTC (rev 447)
+++ trunk/skycastle/pom.xml     2008-04-06 03:04:12 UTC (rev 448)
@@ -354,16 +354,17 @@
             -->
 
             <!-- Assemble the results -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <descriptorRefs>
-                        <descriptorRef>jar-with-dependencies</descriptorRef>
-                    </descriptorRefs>
-                </configuration>
-            </plugin>
 
+            <!--
+                  <plugin>
+                    <artifactId>maven-assembly-plugin</artifactId>
+                    <configuration>
+                      <descriptors>
+                        <descriptor>skycastle_assembly.xml</descriptor>
+                      </descriptors>
+                    </configuration>
+                  </plugin>
+            -->
 
         </plugins>
     </build>

Added: trunk/skycastle/reset_server.sh
===================================================================
--- trunk/skycastle/reset_server.sh                             (rev 0)
+++ trunk/skycastle/reset_server.sh     2008-04-06 03:04:12 UTC (rev 448)
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+echo "### Setting environment variables"
+
+SKYCASTLE_HOME=.
+SKYCASTLE_DATA_DIR=$SKYCASTLE_HOME/data/dsdb
+
+export SKYCASTLE_HOME SKYCASTLE_DATA_DIR
+
+echo "### Clearing up Skycastle server database"
+
+rm  $SKYCASTLE_DATA_DIR/*
+


Property changes on: trunk/skycastle/reset_server.sh
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/skycastle/run_client.bat
===================================================================
--- trunk/skycastle/run_client.bat      2008-04-05 22:57:50 UTC (rev 447)
+++ trunk/skycastle/run_client.bat      2008-04-06 03:04:12 UTC (rev 448)
@@ -1,3 +1,3 @@
-rem TODO: use archiever plugin to make an expanded directory that includes 
dependencies and native files.  Then we can create a startup script.
+echo TODO: Copy the implementation from the .sh version
 
 pause;
\ No newline at end of file

Added: trunk/skycastle/run_client.sh
===================================================================
--- trunk/skycastle/run_client.sh                               (rev 0)
+++ trunk/skycastle/run_client.sh       2008-04-06 03:04:12 UTC (rev 448)
@@ -0,0 +1,15 @@
+#! /bin/sh
+
+echo "### Setting environment variables"
+
+SKYCASTLE_HOME=.
+
+export SKYCASTLE_HOME 
+
+echo "### Starting up Skycastle client"
+
+java -jar 
$SKYCASTLE_HOME/modules/client/target/skycastle-client-0.0.4-SNAPSHOT-jar-with-dependencies.jar
 
+
+
+
+


Property changes on: trunk/skycastle/run_client.sh
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/skycastle/run_server.bat
===================================================================
--- trunk/skycastle/run_server.bat      2008-04-05 22:57:50 UTC (rev 447)
+++ trunk/skycastle/run_server.bat      2008-04-06 03:04:12 UTC (rev 448)
@@ -1,2 +1,3 @@
-call lib\darkstar\sgs-0.9.3-r2804\sgs.bat  
modules\server\target\skycastle-server-0.0.4-SNAPSHOT.jar  
modules\server\SkycastleServer.properties
-pause
\ No newline at end of file
+echo TODO: Copy the implementation from the .sh version
+
+pause;
\ No newline at end of file

Added: trunk/skycastle/run_server.sh
===================================================================
--- trunk/skycastle/run_server.sh                               (rev 0)
+++ trunk/skycastle/run_server.sh       2008-04-06 03:04:12 UTC (rev 448)
@@ -0,0 +1,15 @@
+#! /bin/sh
+
+echo "### Setting environment variables"
+
+SKYCASTLE_HOME=.
+
+SGSHOME=$SKYCASTLE_HOME/lib/darkstar/sgs-0.9.3-r2804
+
+export SKYCASTLE_HOME SGSHOME
+
+echo "### Starting up Skycastle server"
+
+$SGSHOME/sgs.sh  
$SKYCASTLE_HOME/modules/server/target/skycastle-server-0.0.4-SNAPSHOT-jar-with-dependencies.jar
 $SKYCASTLE_HOME/modules/server/SkycastleServer.properties
+
+


Property changes on: trunk/skycastle/run_server.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/skycastle/skycastle_assembly.xml
===================================================================
--- trunk/skycastle/skycastle_assembly.xml                              (rev 0)
+++ trunk/skycastle/skycastle_assembly.xml      2008-04-06 03:04:12 UTC (rev 
448)
@@ -0,0 +1,51 @@
+<assembly>
+    <id>bin</id>
+    <formats>
+        <format>dir</format>
+        <!--   <format>tar.gz</format>
+       <format>tar.bz2</format>
+       <format>zip</format> -->
+    </formats>
+
+    <includeBaseDirectory>false</includeBaseDirectory>
+
+    <fileSets>
+        <fileSet>
+            <includes>
+                <include>readme.txt</include>
+                <include>license.txt</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>target</directory>
+            <outputDirectory></outputDirectory>
+            <includes>
+                <include>*.jar</include>
+            </includes>
+        </fileSet>
+    </fileSets>
+
+    <moduleSets>
+        <moduleSet>
+            <includes>
+                <include>*</include>
+            </includes>
+            <binaries>
+                <outputDirectory>testout/${artifactId}</outputDirectory>
+                <unpack>false</unpack>
+            </binaries>
+        </moduleSet>
+    </moduleSets>
+
+    <dependencySets>
+        <dependencySet>
+            <outputDirectory></outputDirectory>
+            <unpack>true</unpack>
+            <scope>runtime</scope>
+            <excludes>
+                <exclude>junit:junit</exclude>
+            </excludes>
+        </dependencySet>
+    </dependencySets>
+</assembly>
+


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

Other related posts:

  • » [skycastle-commits] SF.net SVN: skycastle: [448] trunk/skycastle