Xj3D 2.0 VRML/X3D Code API

org.xj3d.impl.core.loading
Class AbstractLoadManager

java.lang.Object
  extended by org.xj3d.impl.core.loading.AbstractLoadManager
All Implemented Interfaces:
VRMLUrlListener, ContentLoadManager, LoadConstants
Direct Known Subclasses:
DefaultLoadManager, MemCacheLoadManager

public abstract class AbstractLoadManager
extends java.lang.Object
implements ContentLoadManager, LoadConstants, VRMLUrlListener

Common base implementation of a load manager.

Properties

The following properties are used by this class

Note Sort order is not implemented yet.

Version:
$Revision: 1.4 $
Author:
Justin Couch

Field Summary
 
Fields inherited from interface org.xj3d.core.loading.LoadConstants
DEFAULT_SORT_ORDER, MEM_ALLOC_PROP, SORT_AUDIO, SORT_CREATE, SORT_INLINE, SORT_LOAD_URL, SORT_MOVIE, SORT_ORDER_PROP, SORT_OTHER, SORT_PROTO, SORT_SCRIPT, SORT_SHADER, SORT_TEXTURE
 
Constructor Summary
protected AbstractLoadManager()
          Create a new load manager initialised with the content loading threads ready to work.
 
Method Summary
 void clear()
          Force clearing all state from this manager now.
protected abstract  FileCache getCache()
          Request to fetch the cache used by the derived type.
 int getNumberInProgress()
          Get the number of items that need to be loaded.
 void queueExternProtoLoad(VRMLExternProtoDeclare proto)
          Queue for loading a single externproto implementation.
 void queueNodesLoad(NodeArray nodes)
          Queue an arbitrary collection of nodes for loading.
 void queueSceneLoad(BasicScene scene)
          Start loading the contents of the given scene.
 void setErrorReporter(ErrorReporter reporter)
          Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion.
 void shutdown()
          Notification that the manager needs to shut down all the currently running threads.
 void stopSceneLoad(BasicScene scene)
          Stop the named scene from loading.
 void urlChanged(VRMLNodeType node, int index)
          Notification that the Url content for this node has changed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLoadManager

protected AbstractLoadManager()
Create a new load manager initialised with the content loading threads ready to work.

Method Detail

setErrorReporter

public void setErrorReporter(ErrorReporter reporter)
Register an error reporter with the engine 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:
setErrorReporter in interface ContentLoadManager
Parameters:
reporter - The instance to use or null

queueExternProtoLoad

public void queueExternProtoLoad(VRMLExternProtoDeclare proto)
Queue for loading a single externproto implementation. Used as a way of getting externprotos in to load from the scripting APIs and their createProto or createVRMLFromString methods that have queued up content to load but have no other way of pushing it into the system.

Specified by:
queueExternProtoLoad in interface ContentLoadManager
Parameters:
proto - The proto declaration that needs to be queued up

queueSceneLoad

public void queueSceneLoad(BasicScene scene)
Start loading the contents of the given scene. If there are other scenes already loading, this is placed in the queue behind them. If the scene does not contain any external nodes or is null then it is not queued for loading.

Specified by:
queueSceneLoad in interface ContentLoadManager
Parameters:
scene - The new scene to queue up

queueNodesLoad

public void queueNodesLoad(NodeArray nodes)
Queue an arbitrary collection of nodes for loading.

Specified by:
queueNodesLoad in interface ContentLoadManager
Parameters:
nodes - Array of nodes to add

stopSceneLoad

public void stopSceneLoad(BasicScene scene)
Stop the named scene from loading. If there are any loads in progress this action forces them to stop. If this is not a known scene then the request is ignored.

Specified by:
stopSceneLoad in interface ContentLoadManager
Parameters:
scene - The scene to stop loading

clear

public void clear()
Force clearing all state from this manager now. This is used to indicate that a new world is about to be loaded and everything should be cleaned out now.

Specified by:
clear in interface ContentLoadManager

urlChanged

public void urlChanged(VRMLNodeType node,
                       int index)
Notification that the Url content for this node has changed

Specified by:
urlChanged in interface VRMLUrlListener
Parameters:
index - The index of the field that has changed

getNumberInProgress

public int getNumberInProgress()
Get the number of items that need to be loaded.

Specified by:
getNumberInProgress in interface ContentLoadManager
Returns:
The number of items queued.

shutdown

public void shutdown()
Notification that the manager needs to shut down all the currently running threads. Normally called when the application is exiting, so it is not expected that the manager needs to act sanely after this method has been called.

Specified by:
shutdown in interface ContentLoadManager

getCache

protected abstract FileCache getCache()
Request to fetch the cache used by the derived type.

Returns:
The file cache instance

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium