certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] jcerti/src/certi rti/impl/CertiLogicalTimeInter...


From: certi-cvs
Subject: [certi-cvs] jcerti/src/certi rti/impl/CertiLogicalTimeInter...
Date: Wed, 19 May 2010 14:11:05 +0000

CVSROOT:        /sources/certi
Module name:    jcerti
Changes by:     Eric NOULARD <erk>      10/05/19 14:11:05

Modified files:
        src/certi/rti/impl: CertiLogicalTimeInterval.java 
                            CertiFederateHandleSet.java 
                            CertiRtiAmbassador.java 
                            CertiHandleValuePairCollection.java 
                            CertiAttributeHandleSet.java 
                            CertiLogicalTime.java 
        src/certi/communication: MessageBuffer.java 
        src/certi/logging: HtmlFormatter.java 
        src/certi/rti/jlc: CertiRtiFactory.java 
Added files:
        src/certi/communication: MessageFactory.java 

Log message:
        Merge in modifications from Andrej (16th may 2010)
        - separate MessageBuffer class from factory machinery
        - improve documentation
        - use property file for handling log levels

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/rti/impl/CertiLogicalTimeInterval.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/rti/impl/CertiFederateHandleSet.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/rti/impl/CertiRtiAmbassador.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/rti/impl/CertiHandleValuePairCollection.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/rti/impl/CertiAttributeHandleSet.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/rti/impl/CertiLogicalTime.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/communication/MessageBuffer.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/communication/MessageFactory.java?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/logging/HtmlFormatter.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/certi/rti/jlc/CertiRtiFactory.java?cvsroot=certi&r1=1.2&r2=1.3

Patches:
Index: rti/impl/CertiLogicalTimeInterval.java
===================================================================
RCS file: 
/sources/certi/jcerti/src/certi/rti/impl/CertiLogicalTimeInterval.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- rti/impl/CertiLogicalTimeInterval.java      29 Mar 2010 07:53:22 -0000      
1.2
+++ rti/impl/CertiLogicalTimeInterval.java      19 May 2010 14:11:04 -0000      
1.3
@@ -170,10 +170,7 @@
             return false;
         }
         final CertiLogicalTimeInterval other = (CertiLogicalTimeInterval) obj;
-        if (this.interval != other.interval) {
-            return false;
-        }
-        return true;
+        return this.interval == other.interval;
     }
 
     @Override

Index: rti/impl/CertiFederateHandleSet.java
===================================================================
RCS file: /sources/certi/jcerti/src/certi/rti/impl/CertiFederateHandleSet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- rti/impl/CertiFederateHandleSet.java        29 Mar 2010 07:53:22 -0000      
1.2
+++ rti/impl/CertiFederateHandleSet.java        19 May 2010 14:11:04 -0000      
1.3
@@ -31,7 +31,7 @@
 public class CertiFederateHandleSet extends HashSet<Integer> implements 
FederateHandleSet {
 
     public void add(int handle) {
-        add(handle);
+        super.add(handle);
     }
 
     public void empty() {
@@ -51,7 +51,7 @@
     }
 
     public void remove(int handle) {
-        remove(handle);
+        super.remove(handle);
     }
 
     /**

Index: rti/impl/CertiRtiAmbassador.java
===================================================================
RCS file: /sources/certi/jcerti/src/certi/rti/impl/CertiRtiAmbassador.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- rti/impl/CertiRtiAmbassador.java    29 Mar 2010 07:53:22 -0000      1.2
+++ rti/impl/CertiRtiAmbassador.java    19 May 2010 14:11:04 -0000      1.3
@@ -25,6 +25,8 @@
 import hla.rti.*;
 import hla.rti.jlc.RTIambassadorEx;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.ServerSocket;
@@ -33,17 +35,18 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Properties;
 import java.util.logging.FileHandler;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
 
 public class CertiRtiAmbassador implements RTIambassadorEx {
 
     private final static Logger LOGGER = 
Logger.getLogger(CertiRtiAmbassador.class.getName());
     private FederateAmbassador federateAmbassador;
     private Socket socket;
-    private ServerSocket serverSocket;
-    private MessageBuffer messageBuffer = new MessageBuffer();
+    private MessageBuffer messageBuffer;
 
     class JavaMachineHook extends Thread {
 
@@ -62,30 +65,67 @@
     }
 
     public CertiRtiAmbassador() throws RTIinternalError {
+        //////////////////////////
+        // Load properties file //
+        //////////////////////////       
+        Properties properties = new Properties();
+
+        try {
+            InputStream propertyInsideJarStream = 
CertiRtiAmbassador.class.getClassLoader().getResourceAsStream("certi.properties");
+
+            if (propertyInsideJarStream != null) {
+                properties.load(propertyInsideJarStream);
+            }
+        } catch (IOException ex) {
+            LOGGER.severe("Loading property file from JAR failed. " + 
ex.getLocalizedMessage());
+        }
+
+        try {
+            properties.load(new FileInputStream("certi.properties"));
+        } catch (FileNotFoundException ex) { //Property file not found - not a 
big deal
+        } catch (IOException ex) {
+            LOGGER.severe("Loading property file from outside JAR failed. " + 
ex.getLocalizedMessage());
+        }
+
+
         /////////////////////
         // Prepare logging //
         /////////////////////
-
-        //FileHandler fileTxt = new FileHandler("rti.log");
-        //fileTxt.setFormatter(new SimpleFormatter());
-        //LOGGER.addHandler(fileTxt);
+        Level logLevel = Level.parse(properties.getProperty("logLevel") != 
null ? properties.getProperty("logLevel") : "OFF");
 
         Logger rootLogger = Logger.getLogger("certi");
+        rootLogger.setLevel(logLevel);
 
+        if (logLevel != Level.OFF) {
+            String enableHtmlLoggingString = 
properties.getProperty("enableHtmlLogging") != null ? 
properties.getProperty("enableHtmlLogging") : "false";
+            if (Boolean.parseBoolean(enableHtmlLoggingString)) {
         try {
-            FileHandler fileHtml = new FileHandler("rti-ambassador.html");
+                    String htmlLogFileNamePropertyString = 
properties.getProperty("htmlLogFileName") != null ? 
properties.getProperty("htmlLogFileName") : "librti.html";
+                    FileHandler fileHtml = new 
FileHandler(htmlLogFileNamePropertyString);
             fileHtml.setFormatter(new HtmlFormatter());
             rootLogger.addHandler(fileHtml);
         } catch (IOException exception) {
-            LOGGER.severe("Creating log file failed. " + 
exception.getLocalizedMessage());
-
+                    LOGGER.severe("Creating html log file failed. " + 
exception.getLocalizedMessage());
+                }
         }
 
-        rootLogger.setLevel(Level.ALL);
+            String enableTextLoggingString = 
properties.getProperty("enableTextLogging") != null ? 
properties.getProperty("enableTextLogging") : "false";
+            if (Boolean.parseBoolean(enableTextLoggingString)) {
+                try {
+                    String textLogFileNameString = 
properties.getProperty("textLogFileName") != null ? 
properties.getProperty("textLogFileName") : "librti.log";
+                    FileHandler fileTxt = new 
FileHandler(textLogFileNameString);
+                    fileTxt.setFormatter(new SimpleFormatter());
+                    LOGGER.addHandler(fileTxt);
+                } catch (IOException exception) {
+                    LOGGER.severe("Creating text log file failed. " + 
exception.getLocalizedMessage());
+                }
+            }
+        }
 
         ////////////////////
         // Prepare socket //
         ////////////////////
+        ServerSocket serverSocket;
         try {
             serverSocket = new ServerSocket(0, 1);
         } catch (IOException exception) {
@@ -95,19 +135,20 @@
         LOGGER.info("Using TCP socket server on port " + 
serverSocket.getLocalPort());
 
         try {
-            Runtime.getRuntime().exec("rtia -p " + 
serverSocket.getLocalPort());
+            String rtiaPathString = properties.getProperty("rtiaPath") != null 
? properties.getProperty("rtiaPath") : "";
 
+            Runtime.getRuntime().exec(rtiaPathString + "rtia -p " + 
serverSocket.getLocalPort());
         } catch (IOException exception) {
             throw new RTIinternalError("RTI Ambassador executable not found. " 
+ exception.getLocalizedMessage());
         }
 
         try {
             socket = serverSocket.accept();
+            messageBuffer = new MessageBuffer(socket.getInputStream(), 
socket.getOutputStream());
         } catch (IOException exception) {
             throw new RTIinternalError("Connection to RTIA failed. " + 
exception.getLocalizedMessage());
         }
 
-
         ////////////////////
         // Open connexion //
         ////////////////////
@@ -142,7 +183,7 @@
 
     private boolean tickKernel(boolean multiple, double minimum, double 
maximum) throws SpecifiedSaveLabelDoesNotExist, ConcurrentAccessAttempted, 
RTIinternalError {
         //TODO Code is hard to read - rewrite
-        TickRequest tickRequest = null;
+        TickRequest tickRequest;
         CertiMessage tickResponse = null;
 
         LOGGER.fine("Request callback(s) from the local RTIA");
@@ -154,7 +195,7 @@
         tickRequest.writeMessage(this.messageBuffer);
 
         try {
-            this.messageBuffer.send(this.socket.getOutputStream());
+            this.messageBuffer.send();
         } catch (IOException ex) {
             throw new RTIinternalError("NetworkError in tick() while sending 
TICK_REQUEST: " + ex.getMessage());
         }
@@ -162,9 +203,8 @@
         LOGGER.fine("Reading response(s) from the local RTIA");
         while (true) {
             try {
-                InputStream in = this.socket.getInputStream();
+                tickResponse = MessageFactory.readMessage(messageBuffer);
 
-                tickResponse = this.messageBuffer.receive(in);
                 LOGGER.info("Received: " + tickResponse.toString() + "\n");
             } catch (IOException ex) {
                 throw new RTIinternalError("NetworkError in tick() while 
receiving response: " + ex.getMessage());
@@ -212,7 +252,7 @@
                 tickNext.writeMessage(this.messageBuffer);
 
                 try {
-                    this.messageBuffer.send(this.socket.getOutputStream());
+                    this.messageBuffer.send();
                 } catch (IOException ex) {
                     throw new RTIinternalError("NetworkError in tick() while 
sending TICK_REQUEST_NEXT: " + ex.getMessage());
                 }
@@ -950,7 +990,7 @@
         try {
             RegisterObjectInstance response = (RegisterObjectInstance) 
processRequest(request);
 
-            return (int) response.getObject();
+            return response.getObject();
         } catch (ObjectClassNotDefined ex) {
             throw ex;
         } catch (ObjectClassNotPublished ex) {
@@ -984,7 +1024,7 @@
 
         try {
             RegisterObjectInstance response = (RegisterObjectInstance) 
processRequest(request);
-            return (int) response.getObject();
+            return response.getObject();
         } catch (ObjectClassNotDefined ex) {
             throw ex;
         } catch (ObjectClassNotPublished ex) {
@@ -2361,7 +2401,7 @@
         try {
             DdmCreateRegion response = (DdmCreateRegion) 
processRequest(request);
 
-            return new CertiRegion(response.getRegion(), (int) 
response.getSpace(), numberOfExtents);
+            return new CertiRegion(response.getRegion(), response.getSpace(), 
numberOfExtents);
         } catch (SpaceNotDefined ex) {
             throw ex;
         } catch (InvalidExtents ex) {
@@ -2472,7 +2512,7 @@
         try {
             DdmRegisterObject response = (DdmRegisterObject) 
processRequest(request);
 
-            return (int) response.getObject();
+            return response.getObject();
         } catch (ObjectClassNotDefined ex) {
             throw ex;
         } catch (ObjectClassNotPublished ex) {
@@ -2535,7 +2575,7 @@
         try {
             DdmRegisterObject response = (DdmRegisterObject) 
processRequest(request);
 
-            return (int) response.getObject();
+            return response.getObject();
         } catch (ObjectClassNotDefined ex) {
             throw ex;
         } catch (ObjectClassNotPublished ex) {
@@ -2978,7 +3018,7 @@
 
         try {
             GetObjectClassHandle response = (GetObjectClassHandle) 
processRequest(request);
-            return (int) response.getObjectClass(); //hack handles maju 
rozdielne velkosti
+            return response.getObjectClass(); //hack handles maju rozdielne 
velkosti
         } catch (NameNotFound ex) {
             throw ex;
         } catch (FederateNotExecutionMember ex) {
@@ -3065,7 +3105,7 @@
         try {
             GetInteractionClassHandle response = (GetInteractionClassHandle) 
processRequest(request);
 
-            return (int) response.getInteractionClass();
+            return response.getInteractionClass();
         } catch (NameNotFound ex) {
             throw ex;
         } catch (FederateNotExecutionMember ex) {
@@ -3173,7 +3213,7 @@
         try {
             GetObjectInstanceHandle response = (GetObjectInstanceHandle) 
processRequest(request);
 
-            return (int) response.getObject();
+            return response.getObject();
         } catch (ObjectNotKnown ex) {
             throw ex;
         } catch (FederateNotExecutionMember ex) {
@@ -3226,7 +3266,7 @@
         try {
             GetSpaceHandle response = (GetSpaceHandle) processRequest(request);
 
-            return (int) response.getSpace();
+            return response.getSpace();
         } catch (NameNotFound ex) {
             throw ex;
         } catch (FederateNotExecutionMember ex) {
@@ -3279,7 +3319,7 @@
         try {
             GetDimensionHandle response = (GetDimensionHandle) 
processRequest(request);
 
-            return (int) response.getDimension();
+            return response.getDimension();
         } catch (SpaceNotDefined ex) {
             throw ex;
         } catch (NameNotFound ex) {
@@ -3333,7 +3373,7 @@
         try {
             GetAttributeSpaceHandle response = (GetAttributeSpaceHandle) 
processRequest(request);
 
-            return (int) response.getSpace();
+            return response.getSpace();
         } catch (ObjectClassNotDefined ex) {
             throw ex;
         } catch (AttributeNotDefined ex) {
@@ -3358,7 +3398,7 @@
         try {
             GetObjectClass response = (GetObjectClass) processRequest(request);
 
-            return (int) response.getObjectClass();
+            return response.getObjectClass();
         } catch (ObjectNotKnown ex) {
             throw ex;
         } catch (FederateNotExecutionMember ex) {
@@ -3383,7 +3423,7 @@
         try {
             GetInteractionSpaceHandle response = (GetInteractionSpaceHandle) 
processRequest(request);
 
-            return (int) response.getSpace();
+            return response.getSpace();
         } catch (InteractionClassNotDefined ex) {
             throw ex;
         } catch (FederateNotExecutionMember ex) {
@@ -3680,7 +3720,7 @@
 
         try {
             LOGGER.info("Sending message (" + request.toString() + ")");
-            this.messageBuffer.send(this.socket.getOutputStream());
+            this.messageBuffer.send();
         } catch (IOException ex) {
             LOGGER.severe("libRTI: exception: NetworkError (write)");
             throw new RTIinternalError("libRTI: Network Write Error");
@@ -3688,9 +3728,8 @@
 
         CertiMessage response = null;
         try {
-            InputStream in = this.socket.getInputStream();
+            response = MessageFactory.readMessage(messageBuffer);
 
-            response = this.messageBuffer.receive(in);
             LOGGER.info("Received message (" + response.toString() + ")\n");
 
             if (request.getType() != (response.getType())) {
@@ -4010,23 +4049,23 @@
             switch (message.getType()) {
                 case SYNCHRONIZATION_POINT_REGISTRATION_SUCCEEDED:
                     
federateAmbassador.synchronizationPointRegistrationSucceeded(
-                            ((SynchronizationPointRegistrationSucceeded) 
message).getLabel());
+                            message.getLabel());
                     break;
 
                 case ANNOUNCE_SYNCHRONIZATION_POINT:
                     federateAmbassador.announceSynchronizationPoint(
-                            (((AnnounceSynchronizationPoint) 
message).getLabel()),
-                            ((AnnounceSynchronizationPoint) message).getTag());
+                            (message.getLabel()),
+                            message.getTag());
                     break;
 
                 case FEDERATION_SYNCHRONIZED:
                     federateAmbassador.federationSynchronized(
-                            ((FederationSynchronized) message).getLabel());
+                            message.getLabel());
                     break;
 
                 case INITIATE_FEDERATE_SAVE:
                     federateAmbassador.initiateFederateSave(
-                            ((InitiateFederateSave) message).getLabel());
+                            message.getLabel());
                     break;
 
                 case FEDERATION_SAVED:
@@ -4035,13 +4074,13 @@
 
                 case REQUEST_FEDERATION_RESTORE_SUCCEEDED:
                     federateAmbassador.requestFederationRestoreSucceeded(
-                            ((RequestFederationRestoreSucceeded) 
message).getLabel());
+                            message.getLabel());
                     break;
 
                 case REQUEST_FEDERATION_RESTORE_FAILED:
                     federateAmbassador.requestFederationRestoreFailed(
-                            (((RequestFederationRestoreFailed) 
message).getLabel()),
-                            new String(((RequestFederationRestoreFailed) 
message).getTag()));
+                            (message.getLabel()),
+                            new String(message.getTag()));
                     break;
 
                 case FEDERATION_RESTORE_BEGUN:
@@ -4050,7 +4089,7 @@
 
                 case INITIATE_FEDERATE_RESTORE:
                     federateAmbassador.initiateFederateRestore(
-                            (((InitiateFederateRestore) message).getLabel()),
+                            (message.getLabel()),
                             ((InitiateFederateRestore) message).getFederate());
                     break;
 
@@ -4064,82 +4103,82 @@
 
                 case START_REGISTRATION_FOR_OBJECT_CLASS:
                     federateAmbassador.startRegistrationForObjectClass(
-                            (int) ((StartRegistrationForObjectClass) 
message).getObjectClass());
+                            ((StartRegistrationForObjectClass) 
message).getObjectClass());
                     break;
 
                 case STOP_REGISTRATION_FOR_OBJECT_CLASS:
                     federateAmbassador.stopRegistrationForObjectClass(
-                            (int) ((StopRegistrationForObjectClass) 
message).getObjectClass());
+                            ((StopRegistrationForObjectClass) 
message).getObjectClass());
                     break;
 
                 case TURN_INTERACTIONS_ON:
                     federateAmbassador.turnInteractionsOn(
-                            (int) ((TurnInteractionsOn) 
message).getInteractionClass());
+                            ((TurnInteractionsOn) 
message).getInteractionClass());
                     break;
 
                 case TURN_INTERACTIONS_OFF:
                     federateAmbassador.turnInteractionsOff(
-                            (int) ((TurnInteractionsOff) 
message).getInteractionClass());
+                            ((TurnInteractionsOff) 
message).getInteractionClass());
                     break;
 
                 case DISCOVER_OBJECT_INSTANCE:
                     federateAmbassador.discoverObjectInstance(
-                            (int) ((DiscoverObjectInstance) 
message).getObject(),
-                            (int) ((DiscoverObjectInstance) 
message).getObjectClass(),
+                            ((DiscoverObjectInstance) message).getObject(),
+                            ((DiscoverObjectInstance) 
message).getObjectClass(),
                             ((DiscoverObjectInstance) 
message).getObjectName());
                     break;
 
                 case REFLECT_ATTRIBUTE_VALUES:
-                    if (((ReflectAttributeValues) message).getFederationTime() 
!= null) {
+                    if (message.getFederationTime() != null) {
                         federateAmbassador.reflectAttributeValues(
-                                (int) ((ReflectAttributeValues) 
message).getObject(),
+                                ((ReflectAttributeValues) message).getObject(),
                                 ((ReflectAttributeValues) 
message).getReflectedAttributes(),
-                                ((ReflectAttributeValues) message).getTag(),
+                                message.getTag(),
                                 message.getFederationTime(), 
message.getEventRetraction());
                     } else {
                         federateAmbassador.reflectAttributeValues(
-                                (int) ((ReflectAttributeValues) 
message).getObject(),
+                                ((ReflectAttributeValues) message).getObject(),
                                 ((ReflectAttributeValues) 
message).getReflectedAttributes(),
-                                ((ReflectAttributeValues) message).getTag());
+                                message.getTag());
                     }
 
                     break;
 
                 case RECEIVE_INTERACTION:
-                    if (((ReceiveInteraction) message).getFederationTime() != 
null) {
+                    if (message.getFederationTime() != null) {
                         federateAmbassador.receiveInteraction(
-                                (int) ((ReceiveInteraction) 
message).getInteractionClass(),
+                                ((ReceiveInteraction) 
message).getInteractionClass(),
                                 ((ReceiveInteraction) 
message).getReceivedInteraction(),
-                                (((ReceiveInteraction) message).getTag()),
-                                ((ReceiveInteraction) 
message).getFederationTime(),
-                                ((ReceiveInteraction) 
message).getEventRetraction());
+                                (message.getTag()),
+                                message.getFederationTime(),
+                                message.getEventRetraction());
                     } else {
                         federateAmbassador.receiveInteraction(
-                                (int) ((ReceiveInteraction) 
message).getInteractionClass(),
+                                ((ReceiveInteraction) 
message).getInteractionClass(),
                                 ((ReceiveInteraction) 
message).getReceivedInteraction(),
-                                (((ReceiveInteraction) message).getTag()));
+                                (message.getTag()));
                     }
                     break;
 
 
                 case REMOVE_OBJECT_INSTANCE:
-                    if (((RemoveObjectInstance) message).getFederationTime() 
!= null) {
+                    if (message.getFederationTime() != null) {
                         federateAmbassador.removeObjectInstance(
-                                (int) ((RemoveObjectInstance) 
message).getObject(),
-                                ((RemoveObjectInstance) message).getTag(),
-                                ((RemoveObjectInstance) 
message).getFederationTime(),
-                                ((RemoveObjectInstance) 
message).getEventRetraction());
+                                ((RemoveObjectInstance) message).getObject(),
+                                message.getTag(),
+                                message.getFederationTime(),
+                                message.getEventRetraction());
                     } else {
                         federateAmbassador.removeObjectInstance(
-                                (int) ((RemoveObjectInstance) 
message).getObject(),
-                                ((RemoveObjectInstance) message).getTag());
+                                ((RemoveObjectInstance) message).getObject(),
+                                message.getTag());
                     }
                     break;
 
 
                 case PROVIDE_ATTRIBUTE_VALUE_UPDATE:
                     federateAmbassador.provideAttributeValueUpdate(
-                            (int) ((ProvideAttributeValueUpdate) 
message).getObject(),
+                            ((ProvideAttributeValueUpdate) 
message).getObject(),
                             ((ProvideAttributeValueUpdate) 
message).getAttributes());
                     break;
 
@@ -4148,52 +4187,52 @@
 
                 case REQUEST_ATTRIBUTE_OWNERSHIP_ASSUMPTION:
                     federateAmbassador.requestAttributeOwnershipAssumption(
-                            (int) ((RequestAttributeOwnershipAssumption) 
message).getObject(),
+                            ((RequestAttributeOwnershipAssumption) 
message).getObject(),
                             ((RequestAttributeOwnershipAssumption) 
message).getAttributes(),
-                            ((RequestAttributeOwnershipAssumption) 
message).getTag());
+                            message.getTag());
                     break;
 
                 case REQUEST_ATTRIBUTE_OWNERSHIP_RELEASE:
                     federateAmbassador.requestAttributeOwnershipRelease(
-                            (int) ((RequestAttributeOwnershipRelease) 
message).getObject(),
+                            ((RequestAttributeOwnershipRelease) 
message).getObject(),
                             ((RequestAttributeOwnershipRelease) 
message).getAttributes(),
-                            ((RequestAttributeOwnershipRelease) 
message).getTag());
+                            message.getTag());
                     break;
 
                 case ATTRIBUTE_OWNERSHIP_UNAVAILABLE:
                     federateAmbassador.attributeOwnershipUnavailable(
-                            (int) ((AttributeOwnershipUnavailable) 
message).getObject(),
+                            ((AttributeOwnershipUnavailable) 
message).getObject(),
                             (((AttributeOwnershipUnavailable) 
message).getAttributes()));
                     break;
 
                 case ATTRIBUTE_OWNERSHIP_ACQUISITION_NOTIFICATION:
                     
federateAmbassador.attributeOwnershipAcquisitionNotification(
-                            (int) ((AttributeOwnershipAcquisitionNotification) 
message).getObject(),
+                            ((AttributeOwnershipAcquisitionNotification) 
message).getObject(),
                             ((AttributeOwnershipAcquisitionNotification) 
message).getAttributes());
                     break;
 
                 case ATTRIBUTE_OWNERSHIP_DIVESTITURE_NOTIFICATION:
                     
federateAmbassador.attributeOwnershipDivestitureNotification(
-                            (int) ((AttributeOwnershipDivestitureNotification) 
message).getObject(),
+                            ((AttributeOwnershipDivestitureNotification) 
message).getObject(),
                             ((AttributeOwnershipDivestitureNotification) 
message).getAttributes());
                     break;
 
                 case CONFIRM_ATTRIBUTE_OWNERSHIP_ACQUISITION_CANCELLATION:
                     
federateAmbassador.confirmAttributeOwnershipAcquisitionCancellation(
-                            (int) 
((ConfirmAttributeOwnershipAcquisitionCancellation) message).getObject(),
+                            
((ConfirmAttributeOwnershipAcquisitionCancellation) message).getObject(),
                             
((ConfirmAttributeOwnershipAcquisitionCancellation) message).getAttributes());
                     break;
 
                 case INFORM_ATTRIBUTE_OWNERSHIP:
                     federateAmbassador.informAttributeOwnership(
-                            (int) ((InformAttributeOwnership) 
message).getObject(),
+                            ((InformAttributeOwnership) message).getObject(),
                             ((InformAttributeOwnership) 
message).getAttribute(),
                             ((InformAttributeOwnership) 
message).getFederate());
                     break;
 
                 case ATTRIBUTE_IS_NOT_OWNED:
                     federateAmbassador.attributeIsNotOwned(
-                            (int) ((AttributeIsNotOwned) message).getObject(),
+                            ((AttributeIsNotOwned) message).getObject(),
                             ((AttributeIsNotOwned) message).getAttribute());
                     break;
 

Index: rti/impl/CertiHandleValuePairCollection.java
===================================================================
RCS file: 
/sources/certi/jcerti/src/certi/rti/impl/CertiHandleValuePairCollection.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- rti/impl/CertiHandleValuePairCollection.java        29 Mar 2010 07:53:22 
-0000      1.2
+++ rti/impl/CertiHandleValuePairCollection.java        19 May 2010 14:11:04 
-0000      1.3
@@ -187,10 +187,7 @@
                 return false;
             }
             final HandleValuePair other = (HandleValuePair) obj;
-            if (this.handle != other.handle) {
-                return false;
-            }
-            return true;
+            return this.handle == other.handle;
         }
 
         @Override

Index: rti/impl/CertiAttributeHandleSet.java
===================================================================
RCS file: 
/sources/certi/jcerti/src/certi/rti/impl/CertiAttributeHandleSet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- rti/impl/CertiAttributeHandleSet.java       29 Mar 2010 07:53:22 -0000      
1.2
+++ rti/impl/CertiAttributeHandleSet.java       19 May 2010 14:11:04 -0000      
1.3
@@ -52,7 +52,7 @@
     }
 
     public void remove(int handle) throws AttributeNotDefined {
-        remove(handle);
+        super.remove(handle);
     }
 
     /**

Index: rti/impl/CertiLogicalTime.java
===================================================================
RCS file: /sources/certi/jcerti/src/certi/rti/impl/CertiLogicalTime.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- rti/impl/CertiLogicalTime.java      29 Mar 2010 07:53:22 -0000      1.2
+++ rti/impl/CertiLogicalTime.java      19 May 2010 14:11:04 -0000      1.3
@@ -207,10 +207,7 @@
             return false;
         }
         final CertiLogicalTime other = (CertiLogicalTime) obj;
-        if (this.time != other.time) {
-            return false;
-        }
-        return true;
+        return this.time == other.time;
     }
 
     @Override

Index: communication/MessageBuffer.java
===================================================================
RCS file: /sources/certi/jcerti/src/certi/communication/MessageBuffer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- communication/MessageBuffer.java    29 Mar 2010 07:53:22 -0000      1.2
+++ communication/MessageBuffer.java    19 May 2010 14:11:04 -0000      1.3
@@ -19,7 +19,6 @@
 // ----------------------------------------------------------------------------
 package certi.communication;
 
-import certi.communication.messages.*;
 import certi.rti.impl.*;
 import hla.rti.*;
 import java.util.List;
@@ -45,19 +44,21 @@
  * @version 3.3.3
  */
 public class MessageBuffer {
-    public static final int BYTE_LENGTH = 8;
 
+    public static final int BYTE_LENGTH = 8;
     private final static Logger LOGGER = 
Logger.getLogger(MessageBuffer.class.getName());
     private Vector<Byte> buffer = new Vector<Byte>();
     private Iterator<Byte> iter;       //the Iterator useful for the read 
operations
     private static byte BIG_ENDIAN = 1;
-    private byte endianness;
+    private byte endianness = BIG_ENDIAN;
+    private InputStream inputStream;
+    private OutputStream outputStream;
 
-    /**
-     *
-     */
-    public MessageBuffer() {
-        endianness = BIG_ENDIAN;
+    
+
+    public MessageBuffer(InputStream inputStream, OutputStream outputStream) {
+        this.inputStream = inputStream;
+        this.outputStream = outputStream;
         reset();
     }
 
@@ -288,311 +289,38 @@
     }
 
     /**
-     * Instantiate <code>CertiMessage</code> from supplied message type. It 
does not use reflection for safety.
-     *
-     * @param messageType message type to instantiate
-     * @return instantiated message
-     */
-    public CertiMessage instantiate(CertiMessageType messageType) {
-        LOGGER.info("Trying to instantiate " + messageType);
-        switch (messageType) {
-            case OPEN_CONNEXION:
-                return new OpenConnexion();
-            case CLOSE_CONNEXION:
-                return new CloseConnexion();
-            case CREATE_FEDERATION_EXECUTION:
-                return new CreateFederationExecution();
-            case DESTROY_FEDERATION_EXECUTION:
-                return new DestroyFederationExecution();
-            case REGISTER_FEDERATION_SYNCHRONIZATION_POINT:
-                return new RegisterFederationSynchronizationPoint();
-            case ANNOUNCE_SYNCHRONIZATION_POINT:
-                return new AnnounceSynchronizationPoint();
-            case REQUEST_FEDERATION_RESTORE_FAILED:
-                return new RequestFederationRestoreFailed();
-            case SYNCHRONIZATION_POINT_REGISTRATION_FAILED:
-                return new SynchronizationPointRegistrationFailed();
-            case SYNCHRONIZATION_POINT_REGISTRATION_SUCCEEDED:
-                return new SynchronizationPointRegistrationSucceeded();
-            case SYNCHRONIZATION_POINT_ACHIEVED:
-                return new SynchronizationPointAchieved();
-            case FEDERATION_SYNCHRONIZED:
-                return new FederationSynchronized();
-            case REQUEST_FEDERATION_RESTORE:
-                return new RequestFederationRestore();
-            case REQUEST_FEDERATION_RESTORE_SUCCEEDED:
-                return new RequestFederationRestoreSucceeded();
-            case INITIATE_FEDERATE_RESTORE:
-                return new InitiateFederateRestore();
-            case INITIATE_FEDERATE_SAVE:
-                return new InitiateFederateSave();
-            case REQUEST_FEDERATION_SAVE:
-                return new RequestFederationSave();
-            case UNPUBLISH_OBJECT_CLASS:
-                return new UnpublishObjectClass();
-            case UNSUBSCRIBE_OBJECT_CLASS:
-                return new UnsubscribeObjectClass();
-            case START_REGISTRATION_FOR_OBJECT_CLASS:
-                return new StartRegistrationForObjectClass();
-            case STOP_REGISTRATION_FOR_OBJECT_CLASS:
-                return new StopRegistrationForObjectClass();
-            case IS_ATTRIBUTE_OWNED_BY_FEDERATE:
-                return new IsAttributeOwnedByFederate();
-            case QUERY_ATTRIBUTE_OWNERSHIP:
-                return new QueryAttributeOwnership();
-            case ATTRIBUTE_IS_NOT_OWNED:
-                return new AttributeIsNotOwned();
-            case INFORM_ATTRIBUTE_OWNERSHIP:
-                return new InformAttributeOwnership();
-            case NEGOTIATED_ATTRIBUTE_OWNERSHIP_DIVESTITURE:
-                return new NegotiatedAttributeOwnershipDivestiture();
-            case REQUEST_ATTRIBUTE_OWNERSHIP_ASSUMPTION:
-                return new RequestAttributeOwnershipAssumption();
-            case ATTRIBUTE_OWNERSHIP_ACQUISITION:
-                return new AttributeOwnershipAcquisition();
-            case REQUEST_ATTRIBUTE_OWNERSHIP_RELEASE:
-                return new RequestAttributeOwnershipRelease();
-            case ATTRIBUTE_OWNERSHIP_ACQUISITION_IF_AVAILABLE:
-                return new AttributeOwnershipAcquisitionIfAvailable();
-            case ATTRIBUTE_OWNERSHIP_ACQUISITION_NOTIFICATION:
-                return new AttributeOwnershipAcquisitionNotification();
-            case ATTRIBUTE_OWNERSHIP_UNAVAILABLE:
-                return new AttributeOwnershipUnavailable();
-            case UNCONDITIONAL_ATTRIBUTE_OWNERSHIP_DIVESTITURE:
-                return new UnconditionalAttributeOwnershipDivestiture();
-            case CANCEL_NEGOTIATED_ATTRIBUTE_OWNERSHIP_DIVESTITURE:
-                return new CancelNegotiatedAttributeOwnershipDivestiture();
-            case ATTRIBUTE_OWNERSHIP_RELEASE_RESPONSE:
-                return new AttributeOwnershipReleaseResponse();
-            case CANCEL_ATTRIBUTE_OWNERSHIP_ACQUISITION:
-                return new CancelAttributeOwnershipAcquisition();
-            case CONFIRM_ATTRIBUTE_OWNERSHIP_ACQUISITION_CANCELLATION:
-                return new ConfirmAttributeOwnershipAcquisitionCancellation();
-            case ATTRIBUTE_OWNERSHIP_DIVESTITURE_NOTIFICATION:
-                return new AttributeOwnershipDivestitureNotification();
-            case DDM_ASSOCIATE_REGION:
-                return new DdmAssociateRegion();
-            case DDM_REGISTER_OBJECT:
-                return new DdmRegisterObject();
-            case DDM_SUBSCRIBE_ATTRIBUTES:
-                return new DdmSubscribeAttributes();
-            case DDM_UNASSOCIATE_REGION:
-                return new DdmUnassociateRegion();
-            case DDM_UNSUBSCRIBE_ATTRIBUTES:
-                return new DdmUnsubscribeAttributes();
-            case DDM_SUBSCRIBE_INTERACTION:
-                return new DdmSubscribeInteraction();
-            case DDM_UNSUBSCRIBE_INTERACTION:
-                return new DdmUnsubscribeInteraction();
-            case GET_ATTRIBUTE_SPACE_HANDLE:
-                return new GetAttributeSpaceHandle();
-            case DDM_CREATE_REGION:
-                return new DdmCreateRegion();
-            case GET_INTERACTION_SPACE_HANDLE:
-                return new GetInteractionSpaceHandle();
-            case JOIN_FEDERATION_EXECUTION:
-                return new JoinFederationExecution();
-            case PUBLISH_OBJECT_CLASS:
-                return new PublishObjectClass();
-            case SUBSCRIBE_OBJECT_CLASS_ATTRIBUTES:
-                return new SubscribeObjectClassAttributes();
-            case REGISTER_OBJECT_INSTANCE:
-                return new RegisterObjectInstance();
-            case UPDATE_ATTRIBUTE_VALUES:
-                return new UpdateAttributeValues();
-            case REFLECT_ATTRIBUTE_VALUES:
-                return new ReflectAttributeValues();
-            case DISCOVER_OBJECT_INSTANCE:
-                return new DiscoverObjectInstance();
-            case DELETE_OBJECT_INSTANCE:
-                return new DeleteObjectInstance();
-            case REMOVE_OBJECT_INSTANCE:
-                return new RemoveObjectInstance();
-            case LOCAL_DELETE_OBJECT_INSTANCE:
-                return new LocalDeleteObjectInstance();
-            case GET_OBJECT_CLASS_HANDLE:
-                return new GetObjectClassHandle();
-            case GET_OBJECT_CLASS_NAME:
-                return new GetObjectClassName();
-            case GET_ATTRIBUTE_HANDLE:
-                return new GetAttributeHandle();
-            case GET_ATTRIBUTE_NAME:
-                return new GetAttributeName();
-            case GET_OBJECT_CLASS:
-                return new GetObjectClass();
-            case GET_SPACE_HANDLE:
-                return new GetSpaceHandle();
-            case GET_SPACE_NAME:
-                return new GetSpaceName();
-            case GET_DIMENSION_HANDLE:
-                return new GetDimensionHandle();
-            case GET_DIMENSION_NAME:
-                return new GetDimensionName();
-            case SEND_INTERACTION:
-                return new SendInteraction();
-            case RECEIVE_INTERACTION:
-                return new ReceiveInteraction();
-            case GET_INTERACTION_CLASS_HANDLE:
-                return new GetInteractionClassHandle();
-            case GET_INTERACTION_CLASS_NAME:
-                return new GetInteractionClassName();
-            case GET_PARAMETER_HANDLE:
-                return new GetParameterHandle();
-            case GET_PARAMETER_NAME:
-                return new GetParameterName();
-            case CHANGE_ATTRIBUTE_TRANSPORTATION_TYPE:
-                return new ChangeAttributeTransportationType();
-            case CHANGE_ATTRIBUTE_ORDER_TYPE:
-                return new ChangeAttributeOrderType();
-            case CHANGE_INTERACTION_TRANSPORTATION_TYPE:
-                return new ChangeInteractionTransportationType();
-            case CHANGE_INTERACTION_ORDER_TYPE:
-                return new ChangeInteractionOrderType();
-            case GET_TRANSPORTATION_HANDLE:
-                return new GetTransportationHandle();
-            case GET_TRANSPORTATION_NAME:
-                return new GetTransportationName();
-            case GET_ORDERING_HANDLE:
-                return new GetOrderingHandle();
-            case GET_ORDERING_NAME:
-                return new GetOrderingName();
-            case DDM_MODIFY_REGION:
-                return new DdmModifyRegion();
-            case DDM_DELETE_REGION:
-                return new DdmDeleteRegion();
-            case GET_OBJECT_INSTANCE_HANDLE:
-                return new GetObjectInstanceHandle();
-            case GET_OBJECT_INSTANCE_NAME:
-                return new GetObjectInstanceName();
-            case RESIGN_FEDERATION_EXECUTION:
-                return new ResignFederationExecution();
-            case PUBLISH_INTERACTION_CLASS:
-                return new PublishInteractionClass();
-            case UNPUBLISH_INTERACTION_CLASS:
-                return new UnpublishInteractionClass();
-            case SUBSCRIBE_INTERACTION_CLASS:
-                return new SubscribeInteractionClass();
-            case UNSUBSCRIBE_INTERACTION_CLASS:
-                return new UnsubscribeInteractionClass();
-            case TURN_INTERACTIONS_ON:
-                return new TurnInteractionsOn();
-            case TURN_INTERACTIONS_OFF:
-                return new TurnInteractionsOff();
-            case ENABLE_TIME_REGULATION:
-                return new EnableTimeRegulation();
-            case DISABLE_TIME_REGULATION:
-                return new DisableTimeRegulation();
-            case ENABLE_TIME_CONSTRAINED:
-                return new EnableTimeConstrained();
-            case DISABLE_TIME_CONSTRAINED:
-                return new DisableTimeConstrained();
-            case ENABLE_CLASS_RELEVANCE_ADVISORY_SWITCH:
-                return new EnableClassRelevanceAdvisorySwitch();
-            case DISABLE_CLASS_RELEVANCE_ADVISORY_SWITCH:
-                return new DisableClassRelevanceAdvisorySwitch();
-            case ENABLE_INTERACTION_RELEVANCE_ADVISORY_SWITCH:
-                return new EnableInteractionRelevanceAdvisorySwitch();
-            case DISABLE_INTERACTION_RELEVANCE_ADVISORY_SWITCH:
-                return new DisableInteractionRelevanceAdvisorySwitch();
-            case ENABLE_ATTRIBUTE_RELEVANCE_ADVISORY_SWITCH:
-                return new EnableAttributeRelevanceAdvisorySwitch();
-            case DISABLE_ATTRIBUTE_RELEVANCE_ADVISORY_SWITCH:
-                return new DisableAttributeRelevanceAdvisorySwitch();
-            case ENABLE_ATTRIBUTE_SCOPE_ADVISORY_SWITCH:
-                return new EnableAttributeScopeAdvisorySwitch();
-            case DISABLE_ATTRIBUTE_SCOPE_ADVISORY_SWITCH:
-                return new DisableAttributeScopeAdvisorySwitch();
-            case TICK_REQUEST:
-                return new TickRequest();
-            case REQUEST_CLASS_ATTRIBUTE_VALUE_UPDATE:
-                return new RequestClassAttributeValueUpdate();
-            case REQUEST_OBJECT_ATTRIBUTE_VALUE_UPDATE:
-                return new RequestObjectAttributeValueUpdate();
-            case PROVIDE_ATTRIBUTE_VALUE_UPDATE:
-                return new ProvideAttributeValueUpdate();
-            case MODIFY_LOOKAHEAD:
-                return new ModifyLookahead();
-            case QUERY_LOOKAHEAD:
-                return new QueryLookahead();
-            case FEDERATE_SAVE_BEGUN:
-                return new FederateSaveBegun();
-            case FEDERATE_SAVE_COMPLETE:
-                return new FederateSaveComplete();
-            case FEDERATE_SAVE_NOT_COMPLETE:
-                return new FederateSaveNotComplete();
-            case FEDERATE_RESTORE_COMPLETE:
-                return new FederateRestoreComplete();
-            case FEDERATE_RESTORE_NOT_COMPLETE:
-                return new FederateRestoreNotComplete();
-            case QUERY_FEDERATE_TIME:
-                return new QueryFederateTime();
-            case ENABLE_ASYNCHRONOUS_DELIVERY:
-                return new EnableAsynchronousDelivery();
-            case DISABLE_ASYNCHRONOUS_DELIVERY:
-                return new DisableAsynchronousDelivery();
-            case QUERY_LBTS:
-                return new QueryLbts();
-            case TIME_ADVANCE_REQUEST:
-                return new TimeAdvanceRequest();
-            case TIME_ADVANCE_REQUEST_AVAILABLE:
-                return new TimeAdvanceRequestAvailable();
-            case NEXT_EVENT_REQUEST:
-                return new NextEventRequest();
-            case NEXT_EVENT_REQUEST_AVAILABLE:
-                return new NextEventRequestAvailable();
-            case FLUSH_QUEUE_REQUEST:
-                return new FlushQueueRequest();
-            case TIME_ADVANCE_GRANT:
-                return new TimeAdvanceGrant();
-            case TIME_REGULATION_ENABLED:
-                return new TimeRegulationEnabled();
-            case TIME_CONSTRAINED_ENABLED:
-                return new TimeConstrainedEnabled();
-            case QUERY_MIN_NEXT_EVENT_TIME:
-                return new QueryMinNextEventTime();
-            case TICK_REQUEST_STOP:
-                return new TickRequestStop();
-            case TICK_REQUEST_NEXT:
-                return new TickRequestNext();
-            default:
-                LOGGER.severe("Received an unknown type of message: " + 
messageType);
-                throw new UnsupportedOperationException("Message is not 
supported yet.");
-        }
-    }
-
-    /**
      * Receives the message
      * The buffer is reseted after returning the message.
-     * @param in
+     * @param inputStream
      * @return
      * @throws IOException
      * @throws CertiException
      */
-    public CertiMessage receive(InputStream in) throws IOException, 
CertiException {
-        endianness = (byte) in.read();
+    public void receiveData() throws IOException, CertiException {
+        this.reset();
+
+        //Read endianess
+        endianness = (byte) inputStream.read();
+
+        //Read size
         int size = 0;
         //Same as readInt, but on the InputStream instead of the iterator
         if (endianness == BIG_ENDIAN) {
             for (int i = 3; i >= 0; i--) {
-                size = size | (in.read() & 0x000000FF) << i * BYTE_LENGTH;
+                size = size | (inputStream.read() & 0x000000FF) << i * 
BYTE_LENGTH;
             }
         } else {
             for (int i = 0; i <= 3; i++) {
-                size = size | (in.read() & 0x000000FF) << i * BYTE_LENGTH;
+                size = size | (inputStream.read() & 0x000000FF) << i * 
BYTE_LENGTH;
             }
         }
 
+        //Read the message
         for (int i = 0; i <= size - 6; i++) {
-            buffer.add((byte) in.read());
+            buffer.add((byte) inputStream.read());
         }
 
         iter = buffer.iterator();
-
-        CertiMessage message = 
instantiate(CertiMessageType.reverseType.get(this.readInt())); //read first 
integer from header and instantiate class
-
-        message.readMessage(this);
-
-        return message;
     }
 
     /**
@@ -600,7 +328,7 @@
      * @param out
      * @throws IOException
      */
-    public void send(OutputStream out) throws IOException {
+    public void send() throws IOException {
         //Construct the header
         Vector<Byte> message = new Vector<Byte>();
 
@@ -621,7 +349,7 @@
         }
 
         //Write it to output stream
-        out.write(byteArray);
+        outputStream.write(byteArray);
         this.reset();
     }
 
@@ -650,7 +378,7 @@
 
         for (int i = 0; i < size; i++) {
             try {
-                attributeHandleSet.add((int) this.readInt());
+                attributeHandleSet.add(this.readInt());
             } catch (AttributeNotDefined ex) {
                 LOGGER.severe("Error has occured while reading 
AttributeHandleSet from buffer.");
             }
@@ -767,7 +495,7 @@
      * @return
      */
     public List<Long> readRegions() {
-        int n = (int) this.readInt();
+        int n = this.readInt();
         List<Long> regions = new ArrayList<Long>(n);
 
         for (int i = 0; i < n; i++) {

Index: logging/HtmlFormatter.java
===================================================================
RCS file: /sources/certi/jcerti/src/certi/logging/HtmlFormatter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- logging/HtmlFormatter.java  29 Mar 2010 07:53:23 -0000      1.2
+++ logging/HtmlFormatter.java  19 May 2010 14:11:05 -0000      1.3
@@ -44,7 +44,9 @@
             stringBuffer.append(rec.getLevel());
         }
         stringBuffer.append("</TD><TD>");
-        stringBuffer.append(new Date(rec.getMillis()) + "</TD><TD>" + 
this.formatMessage(rec));
+        stringBuffer.append(new Date(rec.getMillis()));
+        stringBuffer.append("</TD><TD>");
+        stringBuffer.append(this.formatMessage(rec));
         stringBuffer.append("<TD></TR>\n");
 
         return stringBuffer.toString();

Index: rti/jlc/CertiRtiFactory.java
===================================================================
RCS file: /sources/certi/jcerti/src/certi/rti/jlc/CertiRtiFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- rti/jlc/CertiRtiFactory.java        29 Mar 2010 07:53:24 -0000      1.2
+++ rti/jlc/CertiRtiFactory.java        19 May 2010 14:11:05 -0000      1.3
@@ -59,7 +59,7 @@
      * @return
      */
     public String RtiVersion() {
-        return "3.3.3";
+        return "3.4.0";
     }
 
     /**

Index: communication/MessageFactory.java
===================================================================
RCS file: communication/MessageFactory.java
diff -N communication/MessageFactory.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ communication/MessageFactory.java   19 May 2010 14:11:04 -0000      1.1
@@ -0,0 +1,317 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA Run Time Infrastructure
+// Copyright (C) 2010 Andrej Pancik
+//
+// This program is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// ----------------------------------------------------------------------------
+package certi.communication;
+
+import certi.communication.messages.*;
+import java.io.IOException;
+
+public class MessageFactory {
+
+    /**
+     * Instantiate <code>CertiMessage</code> from supplied message type. It 
does not use reflection for safety.
+     *
+     * @param messageType message type to instantiate
+     * @return instantiated message
+     */
+    public static CertiMessage instantiate(CertiMessageType messageType) {
+        // LOGGER.info("Trying to instantiate " + messageType);
+        switch (messageType) {
+            case OPEN_CONNEXION:
+                return new OpenConnexion();
+            case CLOSE_CONNEXION:
+                return new CloseConnexion();
+            case CREATE_FEDERATION_EXECUTION:
+                return new CreateFederationExecution();
+            case DESTROY_FEDERATION_EXECUTION:
+                return new DestroyFederationExecution();
+            case REGISTER_FEDERATION_SYNCHRONIZATION_POINT:
+                return new RegisterFederationSynchronizationPoint();
+            case ANNOUNCE_SYNCHRONIZATION_POINT:
+                return new AnnounceSynchronizationPoint();
+            case REQUEST_FEDERATION_RESTORE_FAILED:
+                return new RequestFederationRestoreFailed();
+            case SYNCHRONIZATION_POINT_REGISTRATION_FAILED:
+                return new SynchronizationPointRegistrationFailed();
+            case SYNCHRONIZATION_POINT_REGISTRATION_SUCCEEDED:
+                return new SynchronizationPointRegistrationSucceeded();
+            case SYNCHRONIZATION_POINT_ACHIEVED:
+                return new SynchronizationPointAchieved();
+            case FEDERATION_SYNCHRONIZED:
+                return new FederationSynchronized();
+            case REQUEST_FEDERATION_RESTORE:
+                return new RequestFederationRestore();
+            case REQUEST_FEDERATION_RESTORE_SUCCEEDED:
+                return new RequestFederationRestoreSucceeded();
+            case INITIATE_FEDERATE_RESTORE:
+                return new InitiateFederateRestore();
+            case INITIATE_FEDERATE_SAVE:
+                return new InitiateFederateSave();
+            case REQUEST_FEDERATION_SAVE:
+                return new RequestFederationSave();
+            case UNPUBLISH_OBJECT_CLASS:
+                return new UnpublishObjectClass();
+            case UNSUBSCRIBE_OBJECT_CLASS:
+                return new UnsubscribeObjectClass();
+            case START_REGISTRATION_FOR_OBJECT_CLASS:
+                return new StartRegistrationForObjectClass();
+            case STOP_REGISTRATION_FOR_OBJECT_CLASS:
+                return new StopRegistrationForObjectClass();
+            case IS_ATTRIBUTE_OWNED_BY_FEDERATE:
+                return new IsAttributeOwnedByFederate();
+            case QUERY_ATTRIBUTE_OWNERSHIP:
+                return new QueryAttributeOwnership();
+            case ATTRIBUTE_IS_NOT_OWNED:
+                return new AttributeIsNotOwned();
+            case INFORM_ATTRIBUTE_OWNERSHIP:
+                return new InformAttributeOwnership();
+            case NEGOTIATED_ATTRIBUTE_OWNERSHIP_DIVESTITURE:
+                return new NegotiatedAttributeOwnershipDivestiture();
+            case REQUEST_ATTRIBUTE_OWNERSHIP_ASSUMPTION:
+                return new RequestAttributeOwnershipAssumption();
+            case ATTRIBUTE_OWNERSHIP_ACQUISITION:
+                return new AttributeOwnershipAcquisition();
+            case REQUEST_ATTRIBUTE_OWNERSHIP_RELEASE:
+                return new RequestAttributeOwnershipRelease();
+            case ATTRIBUTE_OWNERSHIP_ACQUISITION_IF_AVAILABLE:
+                return new AttributeOwnershipAcquisitionIfAvailable();
+            case ATTRIBUTE_OWNERSHIP_ACQUISITION_NOTIFICATION:
+                return new AttributeOwnershipAcquisitionNotification();
+            case ATTRIBUTE_OWNERSHIP_UNAVAILABLE:
+                return new AttributeOwnershipUnavailable();
+            case UNCONDITIONAL_ATTRIBUTE_OWNERSHIP_DIVESTITURE:
+                return new UnconditionalAttributeOwnershipDivestiture();
+            case CANCEL_NEGOTIATED_ATTRIBUTE_OWNERSHIP_DIVESTITURE:
+                return new CancelNegotiatedAttributeOwnershipDivestiture();
+            case ATTRIBUTE_OWNERSHIP_RELEASE_RESPONSE:
+                return new AttributeOwnershipReleaseResponse();
+            case CANCEL_ATTRIBUTE_OWNERSHIP_ACQUISITION:
+                return new CancelAttributeOwnershipAcquisition();
+            case CONFIRM_ATTRIBUTE_OWNERSHIP_ACQUISITION_CANCELLATION:
+                return new ConfirmAttributeOwnershipAcquisitionCancellation();
+            case ATTRIBUTE_OWNERSHIP_DIVESTITURE_NOTIFICATION:
+                return new AttributeOwnershipDivestitureNotification();
+            case DDM_ASSOCIATE_REGION:
+                return new DdmAssociateRegion();
+            case DDM_REGISTER_OBJECT:
+                return new DdmRegisterObject();
+            case DDM_SUBSCRIBE_ATTRIBUTES:
+                return new DdmSubscribeAttributes();
+            case DDM_UNASSOCIATE_REGION:
+                return new DdmUnassociateRegion();
+            case DDM_UNSUBSCRIBE_ATTRIBUTES:
+                return new DdmUnsubscribeAttributes();
+            case DDM_SUBSCRIBE_INTERACTION:
+                return new DdmSubscribeInteraction();
+            case DDM_UNSUBSCRIBE_INTERACTION:
+                return new DdmUnsubscribeInteraction();
+            case GET_ATTRIBUTE_SPACE_HANDLE:
+                return new GetAttributeSpaceHandle();
+            case DDM_CREATE_REGION:
+                return new DdmCreateRegion();
+            case GET_INTERACTION_SPACE_HANDLE:
+                return new GetInteractionSpaceHandle();
+            case JOIN_FEDERATION_EXECUTION:
+                return new JoinFederationExecution();
+            case PUBLISH_OBJECT_CLASS:
+                return new PublishObjectClass();
+            case SUBSCRIBE_OBJECT_CLASS_ATTRIBUTES:
+                return new SubscribeObjectClassAttributes();
+            case REGISTER_OBJECT_INSTANCE:
+                return new RegisterObjectInstance();
+            case UPDATE_ATTRIBUTE_VALUES:
+                return new UpdateAttributeValues();
+            case REFLECT_ATTRIBUTE_VALUES:
+                return new ReflectAttributeValues();
+            case DISCOVER_OBJECT_INSTANCE:
+                return new DiscoverObjectInstance();
+            case DELETE_OBJECT_INSTANCE:
+                return new DeleteObjectInstance();
+            case REMOVE_OBJECT_INSTANCE:
+                return new RemoveObjectInstance();
+            case LOCAL_DELETE_OBJECT_INSTANCE:
+                return new LocalDeleteObjectInstance();
+            case GET_OBJECT_CLASS_HANDLE:
+                return new GetObjectClassHandle();
+            case GET_OBJECT_CLASS_NAME:
+                return new GetObjectClassName();
+            case GET_ATTRIBUTE_HANDLE:
+                return new GetAttributeHandle();
+            case GET_ATTRIBUTE_NAME:
+                return new GetAttributeName();
+            case GET_OBJECT_CLASS:
+                return new GetObjectClass();
+            case GET_SPACE_HANDLE:
+                return new GetSpaceHandle();
+            case GET_SPACE_NAME:
+                return new GetSpaceName();
+            case GET_DIMENSION_HANDLE:
+                return new GetDimensionHandle();
+            case GET_DIMENSION_NAME:
+                return new GetDimensionName();
+            case SEND_INTERACTION:
+                return new SendInteraction();
+            case RECEIVE_INTERACTION:
+                return new ReceiveInteraction();
+            case GET_INTERACTION_CLASS_HANDLE:
+                return new GetInteractionClassHandle();
+            case GET_INTERACTION_CLASS_NAME:
+                return new GetInteractionClassName();
+            case GET_PARAMETER_HANDLE:
+                return new GetParameterHandle();
+            case GET_PARAMETER_NAME:
+                return new GetParameterName();
+            case CHANGE_ATTRIBUTE_TRANSPORTATION_TYPE:
+                return new ChangeAttributeTransportationType();
+            case CHANGE_ATTRIBUTE_ORDER_TYPE:
+                return new ChangeAttributeOrderType();
+            case CHANGE_INTERACTION_TRANSPORTATION_TYPE:
+                return new ChangeInteractionTransportationType();
+            case CHANGE_INTERACTION_ORDER_TYPE:
+                return new ChangeInteractionOrderType();
+            case GET_TRANSPORTATION_HANDLE:
+                return new GetTransportationHandle();
+            case GET_TRANSPORTATION_NAME:
+                return new GetTransportationName();
+            case GET_ORDERING_HANDLE:
+                return new GetOrderingHandle();
+            case GET_ORDERING_NAME:
+                return new GetOrderingName();
+            case DDM_MODIFY_REGION:
+                return new DdmModifyRegion();
+            case DDM_DELETE_REGION:
+                return new DdmDeleteRegion();
+            case GET_OBJECT_INSTANCE_HANDLE:
+                return new GetObjectInstanceHandle();
+            case GET_OBJECT_INSTANCE_NAME:
+                return new GetObjectInstanceName();
+            case RESIGN_FEDERATION_EXECUTION:
+                return new ResignFederationExecution();
+            case PUBLISH_INTERACTION_CLASS:
+                return new PublishInteractionClass();
+            case UNPUBLISH_INTERACTION_CLASS:
+                return new UnpublishInteractionClass();
+            case SUBSCRIBE_INTERACTION_CLASS:
+                return new SubscribeInteractionClass();
+            case UNSUBSCRIBE_INTERACTION_CLASS:
+                return new UnsubscribeInteractionClass();
+            case TURN_INTERACTIONS_ON:
+                return new TurnInteractionsOn();
+            case TURN_INTERACTIONS_OFF:
+                return new TurnInteractionsOff();
+            case ENABLE_TIME_REGULATION:
+                return new EnableTimeRegulation();
+            case DISABLE_TIME_REGULATION:
+                return new DisableTimeRegulation();
+            case ENABLE_TIME_CONSTRAINED:
+                return new EnableTimeConstrained();
+            case DISABLE_TIME_CONSTRAINED:
+                return new DisableTimeConstrained();
+            case ENABLE_CLASS_RELEVANCE_ADVISORY_SWITCH:
+                return new EnableClassRelevanceAdvisorySwitch();
+            case DISABLE_CLASS_RELEVANCE_ADVISORY_SWITCH:
+                return new DisableClassRelevanceAdvisorySwitch();
+            case ENABLE_INTERACTION_RELEVANCE_ADVISORY_SWITCH:
+                return new EnableInteractionRelevanceAdvisorySwitch();
+            case DISABLE_INTERACTION_RELEVANCE_ADVISORY_SWITCH:
+                return new DisableInteractionRelevanceAdvisorySwitch();
+            case ENABLE_ATTRIBUTE_RELEVANCE_ADVISORY_SWITCH:
+                return new EnableAttributeRelevanceAdvisorySwitch();
+            case DISABLE_ATTRIBUTE_RELEVANCE_ADVISORY_SWITCH:
+                return new DisableAttributeRelevanceAdvisorySwitch();
+            case ENABLE_ATTRIBUTE_SCOPE_ADVISORY_SWITCH:
+                return new EnableAttributeScopeAdvisorySwitch();
+            case DISABLE_ATTRIBUTE_SCOPE_ADVISORY_SWITCH:
+                return new DisableAttributeScopeAdvisorySwitch();
+            case TICK_REQUEST:
+                return new TickRequest();
+            case REQUEST_CLASS_ATTRIBUTE_VALUE_UPDATE:
+                return new RequestClassAttributeValueUpdate();
+            case REQUEST_OBJECT_ATTRIBUTE_VALUE_UPDATE:
+                return new RequestObjectAttributeValueUpdate();
+            case PROVIDE_ATTRIBUTE_VALUE_UPDATE:
+                return new ProvideAttributeValueUpdate();
+            case MODIFY_LOOKAHEAD:
+                return new ModifyLookahead();
+            case QUERY_LOOKAHEAD:
+                return new QueryLookahead();
+            case FEDERATE_SAVE_BEGUN:
+                return new FederateSaveBegun();
+            case FEDERATE_SAVE_COMPLETE:
+                return new FederateSaveComplete();
+            case FEDERATE_SAVE_NOT_COMPLETE:
+                return new FederateSaveNotComplete();
+            case FEDERATE_RESTORE_COMPLETE:
+                return new FederateRestoreComplete();
+            case FEDERATE_RESTORE_NOT_COMPLETE:
+                return new FederateRestoreNotComplete();
+            case QUERY_FEDERATE_TIME:
+                return new QueryFederateTime();
+            case ENABLE_ASYNCHRONOUS_DELIVERY:
+                return new EnableAsynchronousDelivery();
+            case DISABLE_ASYNCHRONOUS_DELIVERY:
+                return new DisableAsynchronousDelivery();
+            case QUERY_LBTS:
+                return new QueryLbts();
+            case TIME_ADVANCE_REQUEST:
+                return new TimeAdvanceRequest();
+            case TIME_ADVANCE_REQUEST_AVAILABLE:
+                return new TimeAdvanceRequestAvailable();
+            case NEXT_EVENT_REQUEST:
+                return new NextEventRequest();
+            case NEXT_EVENT_REQUEST_AVAILABLE:
+                return new NextEventRequestAvailable();
+            case FLUSH_QUEUE_REQUEST:
+                return new FlushQueueRequest();
+            case TIME_ADVANCE_GRANT:
+                return new TimeAdvanceGrant();
+            case TIME_REGULATION_ENABLED:
+                return new TimeRegulationEnabled();
+            case TIME_CONSTRAINED_ENABLED:
+                return new TimeConstrainedEnabled();
+            case QUERY_MIN_NEXT_EVENT_TIME:
+                return new QueryMinNextEventTime();
+            case TICK_REQUEST_STOP:
+                return new TickRequestStop();
+            case TICK_REQUEST_NEXT:
+                return new TickRequestNext();
+            default:
+                //LOGGER.severe("Received an unknown type of message: " + 
messageType);
+                throw new UnsupportedOperationException("Message is not 
supported yet.");
+        }
+    }
+
+    /**
+     * Receives the message
+     * The buffer is reseted after returning the message.
+     * @param messageBuffer
+     * @return
+     * @throws IOException
+     * @throws CertiException
+     */
+    public static CertiMessage readMessage(MessageBuffer messageBuffer) throws 
IOException, CertiException {
+        messageBuffer.receiveData();
+
+        CertiMessage message = 
instantiate(CertiMessageType.reverseType.get(messageBuffer.readInt())); //read 
first integer from header and instantiate class
+
+        message.readMessage(messageBuffer);
+
+        return message;
+    }
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]