org.commonreality.reality.impl
Class DefaultReality

java.lang.Object
  extended by org.commonreality.participant.impl.AbstractParticipant
      extended by org.commonreality.reality.impl.DefaultReality
All Implemented Interfaces:
java.io.Serializable, IIdentifiable, IParticipant, IReality

public class DefaultReality
extends AbstractParticipant
implements IReality

Author:
developer
See Also:
Serialized Form

Field Summary
static java.lang.String MESSAGE_TTL
           
 
Constructor Summary
DefaultReality()
           
 
Method Summary
 void add(ICredentials credentials, boolean wantsClockControl)
           
 void cleanUp()
          disconnect and shutdown
 void configure(java.util.Map<java.lang.String,java.lang.String> options)
           
 IAddressingInformation getAddressingInformation()
           
 MasterClock getClock()
          return the clock that this participant has access to
 ConnectionTracker getConnectionTracker()
           
 ICredentials getCredentials()
           
 java.lang.String getName()
           
 long getTimeout()
           
 void initialize()
          initialize common reality.
 IIdentifier newIdentifier(IIdentifier owner, IIdentifier template)
           
 void remove(ICredentials credentials)
           
 void reset(boolean clockWillBeReset)
          called when we are to reset to a post-initialize state.
 void resume()
           
 java.util.concurrent.Future<IAcknowledgement> send(IIdentifier identifier, IMessage message)
          send a message to a specific participant.
 java.util.concurrent.Future<IAcknowledgement> send(IMessage message)
          this will actually send to EVERYONE connected - and returns a null acknowldgement for now..
 void setTimeout(long timeout)
           
 void shutdown()
          tell folks to shut down..
 void start()
          tell all the participants to start
 void stop()
          called when this participant needs to stop
 void suspend()
           
 
Methods inherited from class org.commonreality.participant.impl.AbstractParticipant
addClientService, addServerService, connect, disconnect, getAfferentObjectManager, getAgentObjectManager, getEfferentCommandManager, getEfferentObjectManager, getIdentifier, getRealObjectManager, getSensorObjectManager, isConnected, isInitialized, isStarted, isSuspended, setIdentifier, waitForConnection, waitForInitialization, waitForResumption, waitForStart, waitForStop, waitForSuspension
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.commonreality.participant.IParticipant
connect, disconnect, getAfferentObjectManager, getAgentObjectManager, getEfferentCommandManager, getEfferentObjectManager, getRealObjectManager, getSensorObjectManager, isConnected, isInitialized, isStarted, isSuspended, waitForConnection, waitForResumption, waitForStart, waitForStop, waitForSuspension
 
Methods inherited from interface org.commonreality.identifier.IIdentifiable
getIdentifier
 

Field Detail

MESSAGE_TTL

public static final java.lang.String MESSAGE_TTL
See Also:
Constant Field Values
Constructor Detail

DefaultReality

public DefaultReality()
Method Detail

getConnectionTracker

public ConnectionTracker getConnectionTracker()

getTimeout

public long getTimeout()

setTimeout

public void setTimeout(long timeout)

getName

public java.lang.String getName()
Specified by:
getName in class AbstractParticipant

getClock

public MasterClock getClock()
Description copied from class: AbstractParticipant
return the clock that this participant has access to

Specified by:
getClock in interface IParticipant
Specified by:
getClock in interface IReality
Overrides:
getClock in class AbstractParticipant

initialize

public void initialize()
                throws java.lang.Exception
initialize common reality. this will make sure that we can accept connections. the initialize event will be sent immediately after the connection is established to the participant

Specified by:
initialize in interface IParticipant
Overrides:
initialize in class AbstractParticipant
Throws:
java.lang.Exception
See Also:
AbstractParticipant.initialize()

configure

public void configure(java.util.Map<java.lang.String,java.lang.String> options)
               throws java.lang.Exception
Specified by:
configure in interface IParticipant
Overrides:
configure in class AbstractParticipant
Throws:
java.lang.Exception

cleanUp

public void cleanUp()
disconnect and shutdown


reset

public void reset(boolean clockWillBeReset)
           throws java.lang.Exception
Description copied from class: AbstractParticipant
called when we are to reset to a post-initialize state. this impl attempts to reset the clock if it is INetworked or ISettabl

Specified by:
reset in interface IParticipant
Overrides:
reset in class AbstractParticipant
Throws:
java.lang.Exception
See Also:
org.commonreality.participant.impl.AbstractParticipant#reset()

start

public void start()
           throws java.lang.Exception
tell all the participants to start

Specified by:
start in interface IParticipant
Overrides:
start in class AbstractParticipant
Throws:
java.lang.Exception
See Also:
AbstractParticipant.start()

stop

public void stop()
          throws java.lang.Exception
Description copied from class: AbstractParticipant
called when this participant needs to stop

Specified by:
stop in interface IParticipant
Overrides:
stop in class AbstractParticipant
Throws:
java.lang.Exception
See Also:
AbstractParticipant.stop()

send

public java.util.concurrent.Future<IAcknowledgement> send(IMessage message)
this will actually send to EVERYONE connected - and returns a null acknowldgement for now..

Specified by:
send in interface IParticipant
Overrides:
send in class AbstractParticipant
Returns:
See Also:
AbstractParticipant.send(org.commonreality.message.IMessage)

send

public java.util.concurrent.Future<IAcknowledgement> send(IIdentifier identifier,
                                                          IMessage message)
Description copied from interface: IReality
send a message to a specific participant. Note, this should handle IIdentifier.ALL by sending the message to all participants

Specified by:
send in interface IReality
Returns:

resume

public void resume()
            throws java.lang.Exception
Specified by:
resume in interface IParticipant
Overrides:
resume in class AbstractParticipant
Throws:
java.lang.Exception
See Also:
AbstractParticipant.resume()

shutdown

public void shutdown()
              throws java.lang.Exception
tell folks to shut down..

Specified by:
shutdown in interface IParticipant
Overrides:
shutdown in class AbstractParticipant
Throws:
java.lang.Exception
See Also:
AbstractParticipant.shutdown()

suspend

public void suspend()
             throws java.lang.Exception
Specified by:
suspend in interface IParticipant
Overrides:
suspend in class AbstractParticipant
Throws:
java.lang.Exception
See Also:
AbstractParticipant.suspend()

getAddressingInformation

public IAddressingInformation getAddressingInformation()
Specified by:
getAddressingInformation in class AbstractParticipant
See Also:
AbstractParticipant.getAddressingInformation()

getCredentials

public ICredentials getCredentials()
Specified by:
getCredentials in class AbstractParticipant
See Also:
AbstractParticipant.getCredentials()

newIdentifier

public IIdentifier newIdentifier(IIdentifier owner,
                                 IIdentifier template)
Specified by:
newIdentifier in interface IReality
See Also:
org.commonreality.reality.IReality#newIdentifier(org.commonreality.participant.identifier.IParticipantIdentifier, java.lang.String)

add

public void add(ICredentials credentials,
                boolean wantsClockControl)
Specified by:
add in interface IReality
See Also:
org.commonreality.reality.IReality#add(org.commonreality.message.credentials.ICredentials)

remove

public void remove(ICredentials credentials)
Specified by:
remove in interface IReality
See Also:
IReality.remove(org.commonreality.message.credentials.ICredentials)