Package org.xj3d.impl.core.eventmodel
Class DefaultNetworkManager
java.lang.Object
org.xj3d.impl.core.eventmodel.DefaultNetworkManager
- All Implemented Interfaces:
NetworkManager,NodeManager
The manager of network interactions.
Does not perform networking itself, but manages the different protocol handlers.
- Version:
- $Revision: 1.3 $
- Author:
- Alan Hudson
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance of the execution space manager to run all the routing. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddManagedNode(VRMLNodeType node) Add a network node to the management system.booleanRegister a new protocol handler instance.voidclear()Clear all of the nodes that this manager is currently dealing with.booleanAsk whether this manager needs to be run after the event model has been evaluated for this frame.booleanAsk whether this manager needs to be run before the event model has been evaluated for this frame.voidexecutePostEventModel(long time) Run the post-event modeling for this frame now.voidexecutePreEventModel(long time) Run the pre-event modeling for this frame now.int[]Get the list of node type IDs that this manager wants to handle.Get the list of component names that this manager would normally manage.booleanInitialise the node manager now with any per-manager setup that is needed.voidRemove a network node from the management system.voidRemove a previously registered protocol handler.voidReset the local time zero for the manager.voidsetErrorReporter(org.j3d.util.ErrorReporter reporter) Register an error reporter with the manager so that any errors generated by the loading of script code can be reported in a nice, pretty fashion.voidsetVRMLClock(VRMLClock clk) Set the VRMLClock instance in use by this manager.voidshutdown()Shutdown the node manager now.
-
Constructor Details
-
DefaultNetworkManager
public DefaultNetworkManager()Create a new instance of the execution space manager to run all the routing.
-
-
Method Details
-
initialize
public boolean initialize()Initialise the node manager now with any per-manager setup that is needed. If this returns false, then the node manager is assumed to have failed some part of the setup and will be removed from the system- Specified by:
initializein interfaceNodeManager- Returns:
- true if initialization was successful
-
shutdown
public void shutdown()Shutdown the node manager now. If this is using any external resources it should remove those now as the entire application is about to die- Specified by:
shutdownin interfaceNodeManager
-
setErrorReporter
public void setErrorReporter(org.j3d.util.ErrorReporter reporter) Register an error reporter with the manager so that any errors generated by the loading of script code can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.- Specified by:
setErrorReporterin interfaceNodeManager- Parameters:
reporter- The instance to use or null
-
evaluatePreEventModel
public boolean evaluatePreEventModel()Description copied from interface:NodeManagerAsk whether this manager needs to be run before the event model has been evaluated for this frame.- Specified by:
evaluatePreEventModelin interfaceNodeManager- Returns:
- true if this is to be run pre-event model, false otherwise
-
evaluatePostEventModel
public boolean evaluatePostEventModel()Description copied from interface:NodeManagerAsk whether this manager needs to be run after the event model has been evaluated for this frame.- Specified by:
evaluatePostEventModelin interfaceNodeManager- Returns:
- true if this is to be run post event model, false otherwise
-
getSupportedComponents
Get the list of component names that this manager would normally manage. The component definition is assumed to be the same across all versions of the specifications that the browser supports. The level of the component is assumed to be the lowest level supported (ie if the given level fails, then levels above this cannot be supported, but those below can still be).Mostly this is used for when initialization fails and we wish to disable support for loading of nodes in that component.
- Specified by:
getSupportedComponentsin interfaceNodeManager- Returns:
- The collection of components that this manager supports
-
setVRMLClock
Set the VRMLClock instance in use by this manager. Ignored for this manager.- Specified by:
setVRMLClockin interfaceNodeManager- Parameters:
clk- A reference to the clock to use
-
resetTimeZero
public void resetTimeZero()Reset the local time zero for the manager. This is called when a new root world has been loaded and any manager that needs to rely on delta time from the start of the world loading can reset it's local reference from the passed inVRMLClockinstance.- Specified by:
resetTimeZeroin interfaceNodeManager
-
getManagedNodeTypes
public int[] getManagedNodeTypes()Get the list of node type IDs that this manager wants to handle. These should be the constants fromTypeConstants.- Specified by:
getManagedNodeTypesin interfaceNodeManager- Returns:
- A list of managed node identifiers
-
executePreEventModel
public void executePreEventModel(long time) Run the pre-event modeling for this frame now. This is a blocking call and does not return until the event model is complete for this frame. The time should be system clock time, not VRML time.- Specified by:
executePreEventModelin interfaceNodeManager- Parameters:
time- The timestamp of this frame to evaluate
-
executePostEventModel
public void executePostEventModel(long time) Run the post-event modeling for this frame now. This is a blocking call and does not return until the event model is complete for this frame. The time should be system clock time, not VRML time.- Specified by:
executePostEventModelin interfaceNodeManager- Parameters:
time- The timestamp of this frame to evaluate
-
addManagedNode
Add a network node to the management system.- Specified by:
addManagedNodein interfaceNodeManager- Parameters:
node- The instance to add to this manager
-
removeManagedNode
Remove a network node from the management system.- Specified by:
removeManagedNodein interfaceNodeManager- Parameters:
node- The instance to add to this manager
-
clear
public void clear()Clear all of the nodes that this manager is currently dealing with. All listeners are removed and no watch is kept on the nodes.- Specified by:
clearin interfaceNodeManager
-
addProtocolHandler
Register a new protocol handler instance. If a handler has been registered for the given protocol type, this request is ignored and a value of false is returned.- Specified by:
addProtocolHandlerin interfaceNetworkManager- Parameters:
nph- The new protocol handler instance to use- Returns:
- false if a handler is already registered, true otherwise
-
removeProtocolHandler
Remove a previously registered protocol handler. If a this handler instance has not been registered previously, the request is silently ignored.- Specified by:
removeProtocolHandlerin interfaceNetworkManager- Parameters:
nph- The protocol handler instance to remove
-