Package org.xj3d.impl.core.loading
Class AbstractLoadManager
java.lang.Object
org.xj3d.impl.core.loading.AbstractLoadManager
- All Implemented Interfaces:
VRMLUrlListener
,ContentLoadManager
,LoadConstants
- Direct Known Subclasses:
DefaultLoadManager
,MemCacheLoadManager
public abstract class AbstractLoadManager
extends Object
implements ContentLoadManager, LoadConstants, VRMLUrlListener
Common base implementation of a load manager.
Properties
The following properties are used by this class
org.web3d.vrml.nodes.loader.sort_order
A space separated list containing one or more of the wordsscripts
,inlines
,textures
,externprotos
,audio
andothers
. The declaration order is the sort order for values to be fetched within a given scene. Any values not declared are placed at the end of the list in any arbitrary order.org.web3d.vrml.nodes.loader.cache.mem.size
The amount of memory in Kilobytes (integer value) to allocate to in-memory file caching. If the value is zero or less, no caching is performed.
- 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
ConstructorsModifierConstructorDescriptionprotected
Create a new load manager initialised with the content loading threads ready to work. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Force clearing all state from this manager now.protected abstract FileCache
getCache()
Request to fetch the cache used by the derived loadConstantsType.int
Get the number of items that need to be loaded.void
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
(org.j3d.util.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
-
Constructor Details
-
AbstractLoadManager
protected AbstractLoadManager()Create a new load manager initialised with the content loading threads ready to work.
-
-
Method Details
-
setErrorReporter
public void setErrorReporter(org.j3d.util.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 interfaceContentLoadManager
- Parameters:
reporter
- The instance to use or null
-
queueExternProtoLoad
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 interfaceContentLoadManager
- Parameters:
proto
- The proto declaration that needs to be queued up
-
queueSceneLoad
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 interfaceContentLoadManager
- Parameters:
scene
- The new scene to queue up
-
queueNodesLoad
Queue an arbitrary collection of nodes for loading.- Specified by:
queueNodesLoad
in interfaceContentLoadManager
- Parameters:
nodes
- Array of nodes to add
-
stopSceneLoad
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 interfaceContentLoadManager
- 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 interfaceContentLoadManager
-
urlChanged
Notification that the Url content for this node has changed- Specified by:
urlChanged
in interfaceVRMLUrlListener
- Parameters:
node
-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 interfaceContentLoadManager
- 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 interfaceContentLoadManager
-
getCache
Request to fetch the cache used by the derived loadConstantsType.- Returns:
- The file cache instance
-