com.sun.j3d.utils.universe
Class ConfigContainer

java.lang.Object
  extended by com.sun.j3d.utils.universe.ConfigContainer

public class ConfigContainer
extends java.lang.Object

Loads a Java 3D configuration file and creates a container of named objects that will effect the viewing configuration specified in the file. These can include Viewers, ViewingPlatforms, ViewPlatformBehaviors, InputDevices, Sensors, and other objects.

Clients can construct the view side of a scene graph by retrieving these objects using the accessor methods provided by this class. This could involve as little as just attaching ViewingPlatforms to a Locale, depending upon how completely the viewing configuration is specified in the file. The ConfiguredUniverse class is an example of a ConfigContainer client and how it can be used.

ConfigContainer can be useful for clients other than ConfiguredUniverse. InputDevice and ViewPlatformBehavior configuration is fully supported, so a given Java 3D installation can provide configuration files to an application that will allow it to fully utilize whatever site-specific devices and behaviors are available. The configuration mechanism can be extended for any target object through the use of the NewObject and ObjectProperty configuration commands.

Since:
Java 3D 1.3.1
See Also:
ConfiguredUniverse, The Java 3D Configuration File, Example Configuration Files

Nested Class Summary
private static class ConfigContainer.ConfigAlias
          A class that does nothing but reference another ConfigObject.
private static class ConfigContainer.ReadOnlyIterator
           
private static class ConfigContainer.ReadOnlyMap
           
private static class ConfigContainer.ReadOnlySet
           
 
Field Summary
private  java.util.Map baseNameMap
           
private  ConfigContainer.ReadOnlyMap behaviorMap
           
private  ConfigContainer.ReadOnlySet behaviors
           
private  ConfigContainer.ReadOnlySet bodies
           
private  ConfigContainer.ReadOnlyMap bodyMap
           
private  java.lang.ClassLoader classLoader
           
(package private)  java.lang.String currentFileName
          The name of the file this ConfigContainer is currently loading.
private  ConfigContainer.ReadOnlyMap deviceMap
           
private  ConfigContainer.ReadOnlySet devices
           
private  ConfigContainer.ReadOnlyMap environmentMap
           
private  ConfigContainer.ReadOnlySet environments
           
private  ConfigContainer.ReadOnlyMap genericObjectMap
           
private  ConfigContainer.ReadOnlySet genericObjects
           
private  ConfigContainer.ReadOnlyMap platformMap
           
private  ConfigContainer.ReadOnlySet platforms
           
private  ConfigContainer.ReadOnlyMap sensorMap
           
private  ConfigContainer.ReadOnlySet sensors
           
private  boolean setVisible
           
private  int transformCount
           
private  java.util.Map viewCanvasMap
           
private  ConfigContainer.ReadOnlyMap viewerMap
           
private  ConfigContainer.ReadOnlySet viewers
           
 
Constructor Summary
ConfigContainer(java.net.URL userConfig)
          Creates a new ConfigContainer and loads the configuration file at the specified URL.
ConfigContainer(java.net.URL userConfig, boolean setVisible, int transformCount)
          Creates a new ConfigContainer and loads the configuration file at the specified URL.
ConfigContainer(java.net.URL userConfig, boolean setVisible, int transformCount, boolean attachBehaviors)
          Package-scoped constructor for ConfigContainer.
ConfigContainer(java.net.URL userConfig, boolean setVisible, int transformCount, boolean attachBehaviors, java.lang.ClassLoader classLoader)
          Package scoped constructor that adds the ability to set the ClassLoader which will be used to load any app specific classes specified in the configuration file.
ConfigContainer(java.net.URL userConfig, boolean setVisible, int transformCount, java.lang.ClassLoader classLoader)
          Creates a new ConfigContainer and loads the configuration file at the specified URL.
ConfigContainer(java.net.URL userConfig, java.lang.ClassLoader classLoader)
          Creates a new ConfigContainer and loads the configuration file at the specified URL.
 
Method Summary
private  void addConfigObject(ConfigObject object)
          Adds the specified ConfigObject instance into this container using the given ConfigCommand's base name and instance name.
 void clear()
          Release memory references used by this ConfigContainer.
private  ConfigObject createConfigAlias(ConfigCommand cmd)
          Instantiate and initialize a ConfigObject base class containing alias information.
private  ConfigObject createConfigObject(ConfigCommand cmd)
          Instantiates and initializes an object that extends the ConfigObject base class.
private  ConfigContainer.ReadOnlyMap createMap(java.lang.String baseName)
           
private  ConfigContainer.ReadOnlySet createSet(java.lang.String baseName)
           
(package private)  java.lang.Object evaluateBuiltIn(ConfigCommand cmd)
          This method gets called from a ConfigObject to evaluate a retained built-in command nested within a property command.
(package private)  void evaluateCommand(java.util.ArrayList elements, int lineNumber)
          This method gets called from the s-expression parser to process a configuration command.
private  ConfigObject findConfigObject(java.lang.String baseName, ConfigCommand cmd)
          Returns the ConfigObject associated with the name in the given ConfigCommand.
(package private)  ConfigObject findConfigObject(java.lang.String baseName, java.lang.String instanceName)
          Finds a config object matching the given base name and the instance name.
(package private)  java.util.Collection findConfigObjects(java.lang.String baseName)
          Find instances of config objects with the given base name.
(package private)  java.util.Collection findConfigObjects(java.lang.String baseName, boolean filterAlias)
          Find instances of config objects with the given base name.
static java.net.URL getConfigURL()
          Returns the config file URL based on system properties.
static java.net.URL getConfigURL(java.lang.String defaultURLString)
          Returns the config file URL based on system properties.
 java.util.Set getGenericObjects()
          Returns a read-only Set of all generic configuration object instances in the order they were defined in the configuration file.
 java.util.Set getInputDevices()
          Returns a read-only Set of all configured InputDevice instances in the order they were defined in the configuration file.
 java.util.Map getNamedCanvases(java.lang.String viewName)
          Returns a read-only Map containing the named Canvas3D instances used by the specified Viewer.
 java.util.Map getNamedGenericObjects()
          Returns a read-only Map that maps generic object names to instances.
 java.util.Map getNamedInputDevices()
          Returns a read-only Map that maps InputDevice names to instances.
 java.util.Map getNamedPhysicalBodies()
          Returns a read-only Map that maps PhysicalBody names to instances.
 java.util.Map getNamedPhysicalEnvironments()
          Returns a read-only Map that maps PhysicalEnvironment names to instances.
 java.util.Map getNamedSensors()
          Returns a read-only Map that maps Sensor names to instances.
 java.util.Map getNamedViewers()
          Returns a read-only Map that maps Viewer names to instances.
 java.util.Map getNamedViewingPlatforms()
          Returns a read-only Map that maps ViewingPlatform names to instances.
 java.util.Map getNamedViewPlatformBehaviors()
          Returns a read-only Map that maps ViewPlatformBehavior names to instances.
 java.util.Set getPhysicalBodies()
          Returns a read-only Set of all configured PhysicalBody instances in the order they were defined in the configuration file.
 java.util.Set getPhysicalEnvironments()
          Returns a read-only Set of all configured PhysicalEnvironment instances in the order they were defined in the configuration file.
 java.util.Set getSensors()
          Returns a read-only Set of all configured Sensor instances in the order they were defined in the configuration file.
 java.util.Set getViewers()
          Returns a read-only Set of all configured Viewer instances in the order they were defined in the configuration file.
 boolean getViewerVisibility()
          Returns whether Viewers should be created with their AWT components initially visible or invisible.
 java.util.Set getViewingPlatforms()
          Returns a read-only Set of all configured ViewingPlatform instances in the order they were defined in the configuration file.
 java.util.Set getViewPlatformBehaviors()
          Returns a read-only Set of all configured ViewPlatformBehavior instances in the order they were defined in the configuration file.
 int getViewPlatformTransformCount()
          Returns the number of TransformGroups with which ViewingPlatforms should be created.
private  void loadConfig(java.net.URL userConfig)
          Open, parse, and load the contents of a configuration file.
private  void processConfig(boolean setVisible, int transformCount, boolean attachBehaviors)
          Process the configuration after parsing the configuration file.
private  void processDevices(java.util.Collection c, java.util.Collection s, java.util.Collection p)
           
private  void processGenericObjects(java.util.Collection objects)
           
private  void processPhysicalBodies(java.util.Collection c)
           
private  void processPhysicalEnvironments(java.util.Collection c)
           
private  void processViewPlatformBehaviors(java.util.Collection behaviors, java.util.Collection viewPlatforms, boolean attach)
           
private  void processViewPlatforms(java.util.Collection c, int numTransforms)
           
private  void processViews(java.util.Collection c, boolean setVisible)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baseNameMap

private java.util.Map baseNameMap

viewCanvasMap

private java.util.Map viewCanvasMap

bodyMap

private ConfigContainer.ReadOnlyMap bodyMap

environmentMap

private ConfigContainer.ReadOnlyMap environmentMap

viewerMap

private ConfigContainer.ReadOnlyMap viewerMap

deviceMap

private ConfigContainer.ReadOnlyMap deviceMap

sensorMap

private ConfigContainer.ReadOnlyMap sensorMap

behaviorMap

private ConfigContainer.ReadOnlyMap behaviorMap

platformMap

private ConfigContainer.ReadOnlyMap platformMap

genericObjectMap

private ConfigContainer.ReadOnlyMap genericObjectMap

bodies

private ConfigContainer.ReadOnlySet bodies

environments

private ConfigContainer.ReadOnlySet environments

viewers

private ConfigContainer.ReadOnlySet viewers

devices

private ConfigContainer.ReadOnlySet devices

sensors

private ConfigContainer.ReadOnlySet sensors

behaviors

private ConfigContainer.ReadOnlySet behaviors

platforms

private ConfigContainer.ReadOnlySet platforms

genericObjects

private ConfigContainer.ReadOnlySet genericObjects

transformCount

private int transformCount

setVisible

private boolean setVisible

classLoader

private java.lang.ClassLoader classLoader

currentFileName

java.lang.String currentFileName
The name of the file this ConfigContainer is currently loading.

Constructor Detail

ConfigContainer

public ConfigContainer(java.net.URL userConfig)
Creates a new ConfigContainer and loads the configuration file at the specified URL. All ViewingPlatform instances are created with a single TransformGroup and all Viewer components are initially invisible.

Parameters:
userConfig - URL of the configuration file to load

ConfigContainer

public ConfigContainer(java.net.URL userConfig,
                       java.lang.ClassLoader classLoader)
Creates a new ConfigContainer and loads the configuration file at the specified URL. All ViewingPlatform instances are created with a single TransformGroup and all Viewer components are initially invisible.

Parameters:
userConfig - URL of the configuration file to load
classLoader - the class loader to use to load classes specified in the config file.

ConfigContainer

public ConfigContainer(java.net.URL userConfig,
                       boolean setVisible,
                       int transformCount)
Creates a new ConfigContainer and loads the configuration file at the specified URL. Any ViewingPlatform instantiated by the configuration file will be created with the specified number of transforms. Viewer components may be set initially visible or invisible with the setVisible flag.

Parameters:
userConfig - URL of the configuration file to load
setVisible - if true, setVisible(true) is called on all Viewers
transformCount - number of transforms to be included in any ViewingPlatform created; must be greater than 0

ConfigContainer

public ConfigContainer(java.net.URL userConfig,
                       boolean setVisible,
                       int transformCount,
                       java.lang.ClassLoader classLoader)
Creates a new ConfigContainer and loads the configuration file at the specified URL. Any ViewingPlatform instantiated by the configuration file will be created with the specified number of transforms. Viewer components may be set initially visible or invisible with the setVisible flag.

Parameters:
userConfig - URL of the configuration file to load
setVisible - if true, setVisible(true) is called on all Viewers
transformCount - number of transforms to be included in any ViewingPlatform created; must be greater than 0
classLoader - the class loader to use to load classes specified in the config file.

ConfigContainer

ConfigContainer(java.net.URL userConfig,
                boolean setVisible,
                int transformCount,
                boolean attachBehaviors)
Package-scoped constructor for ConfigContainer. This provides an additional flag, attachBehaviors, which indicates whether or not ViewPlatformBehaviors should be attached to the ViewingPlatforms specified for them.

Normally the flag should be true. However, when instantiated by ConfiguredUniverse, this flag is set false so that ConfiguredUniverse can set a reference to itself in the ViewingPlatform before attaching the behavior. This provides backwards compatibility to behaviors that access the ConfiguredUniverse instance from a call to setViewingPlatform in order to look up the actual Sensor, Viewer, Behavior, etc., instances associated with the names provided them from the configuration file.

The preferred methods to retrieve instances of specific objects defined in the configuration file are to either 1) get the ConfiguredUniverse instance when the behavior's initialize method is called, or to 2) define properties that accept object instances directly, and then use the newer Device, Sensor, ViewPlatform, etc., built-in commands in the configuration file. These built-ins will return an object instance from a name.

Parameters:
userConfig - URL of the configuration file to load
setVisible - if true, setVisible(true) is called on all Viewers
transformCount - number of transforms to be included in any ViewingPlatform created; must be greater than 0
attachBehaviors - if true, attach ViewPlatformBehaviors to the appropriate ViewingPlatforms

ConfigContainer

ConfigContainer(java.net.URL userConfig,
                boolean setVisible,
                int transformCount,
                boolean attachBehaviors,
                java.lang.ClassLoader classLoader)
Package scoped constructor that adds the ability to set the ClassLoader which will be used to load any app specific classes specified in the configuration file. By default SystemClassLoader is used.

Method Detail

loadConfig

private void loadConfig(java.net.URL userConfig)
Open, parse, and load the contents of a configuration file.

Parameters:
userConfig - location of the configuration file

evaluateCommand

void evaluateCommand(java.util.ArrayList elements,
                     int lineNumber)
This method gets called from the s-expression parser to process a configuration command.

Parameters:
elements - tokenized list of sexp elements
lineNumber - command line number

createConfigObject

private ConfigObject createConfigObject(ConfigCommand cmd)
Instantiates and initializes an object that extends the ConfigObject base class. The class name of the object is derived from the command, which is of the following form:

(New{baseName} {instanceName} ... [Alias {aliasName}])

The first two command elements and the optional trailing Alias syntax are processed here, at which point the subclass implementation of initialize() is called. Subclasses must override initialize() if they need to process more than what is processed by default here.

Parameters:
cmd - configuration command that creates a new ConfigObject

createConfigAlias

private ConfigObject createConfigAlias(ConfigCommand cmd)
Instantiate and initialize a ConfigObject base class containing alias information. The command is of the form:

({baseName}Alias {aliasName} {originalName})

Parameters:
cmd - configuration command that creates a new alias
Returns:
the new ConfigObject with alias information

addConfigObject

private void addConfigObject(ConfigObject object)
Adds the specified ConfigObject instance into this container using the given ConfigCommand's base name and instance name.

Parameters:
object - the ConfigObject instance to add into the database

findConfigObject

ConfigObject findConfigObject(java.lang.String baseName,
                              java.lang.String instanceName)
Finds a config object matching the given base name and the instance name. If an alias is found, then its original is returned. If the object is not found, an IllegalArgumentException is thrown.

Parameters:
basename - base name of the config object
instanceName - name associated with this config object instance
Returns:
the found ConfigObject

findConfigObjects

java.util.Collection findConfigObjects(java.lang.String baseName)
Find instances of config objects with the given base name. This is the same as findConfigObjects(baseName, true). Aliases are filtered out so that all returned instances are unique.

Parameters:
baseName - base name of desired config object class
Returns:
ArrayList of config object instances of the desired base class, or null if instances of the base class don't exist

findConfigObjects

java.util.Collection findConfigObjects(java.lang.String baseName,
                                       boolean filterAlias)
Find instances of config objects with the given base name.

Parameters:
baseName - base name of desired config object class
filterAlias - if true, aliases are filtered out so that all returned instances are unique
Returns:
ArrayList of config object instances of the desired base class, or null if instances of the base class don't exist

findConfigObject

private ConfigObject findConfigObject(java.lang.String baseName,
                                      ConfigCommand cmd)
Returns the ConfigObject associated with the name in the given ConfigCommand. This is used for evaluating retained built-in commands after the config file has already been parsed. The parser won't catch any of the exceptions generated by this method, so the error messages are wrapped accordingly.

Parameters:
basename - base name of the config object
cmd - command containing the name in argv[1]
Returns:
the found ConfigObject

evaluateBuiltIn

java.lang.Object evaluateBuiltIn(ConfigCommand cmd)
This method gets called from a ConfigObject to evaluate a retained built-in command nested within a property command. These are commands that can't be evaluated until the entire config file is parsed.

Parameters:
cmd - the built-in command
Returns:
object representing result of evaluation

processConfig

private void processConfig(boolean setVisible,
                           int transformCount,
                           boolean attachBehaviors)
Process the configuration after parsing the configuration file. Note: the processing order of the various config objects is significant.

Parameters:
setVisible - true if Viewer components should be visible
transformCount - number of TransformGroups with which ViewingPlatforms should be created
attachBehaviors - true if behaviors should be attached to ViewingPlatforms

processPhysicalEnvironments

private void processPhysicalEnvironments(java.util.Collection c)

processPhysicalBodies

private void processPhysicalBodies(java.util.Collection c)

processViews

private void processViews(java.util.Collection c,
                          boolean setVisible)

processDevices

private void processDevices(java.util.Collection c,
                            java.util.Collection s,
                            java.util.Collection p)

processViewPlatforms

private void processViewPlatforms(java.util.Collection c,
                                  int numTransforms)

processViewPlatformBehaviors

private void processViewPlatformBehaviors(java.util.Collection behaviors,
                                          java.util.Collection viewPlatforms,
                                          boolean attach)

processGenericObjects

private void processGenericObjects(java.util.Collection objects)

createSet

private ConfigContainer.ReadOnlySet createSet(java.lang.String baseName)

createMap

private ConfigContainer.ReadOnlyMap createMap(java.lang.String baseName)

getPhysicalBodies

public java.util.Set getPhysicalBodies()
Returns a read-only Set of all configured PhysicalBody instances in the order they were defined in the configuration file. PhysicalBody instances are created with the following command:

(NewPhysicalBody <instance name> [Alias <alias name>])
The PhysicalBody is configured through the following command:

(PhysicalBodyProperty <instance name> <property name> <property value>)

Returns:
read-only Set of all unique instances, or null

getNamedPhysicalBodies

public java.util.Map getNamedPhysicalBodies()
Returns a read-only Map that maps PhysicalBody names to instances. Names may be aliases and if so will map to the original instances.

Returns:
read-only Map from names to PhysicalBody instances, or null if no instances

getPhysicalEnvironments

public java.util.Set getPhysicalEnvironments()
Returns a read-only Set of all configured PhysicalEnvironment instances in the order they were defined in the configuration file.

PhysicalEnvironment instances are created with the following command:

(NewPhysicalEnvironment <instance name> [Alias <alias name>])
The PhysicalEnvironment is configured through the following command:

(PhysicalEnvironmentProperty <instance name> <property name> <property value>)

Returns:
read-only Set of all unique instances, or null

getNamedPhysicalEnvironments

public java.util.Map getNamedPhysicalEnvironments()
Returns a read-only Map that maps PhysicalEnvironment names to instances. Names may be aliases and if so will map to the original instances.

Returns:
read-only Map from names to PhysicalEnvironment instances, or null if no instances

getViewers

public java.util.Set getViewers()
Returns a read-only Set of all configured Viewer instances in the order they were defined in the configuration file. The Viewers will have incorporated any PhysicalEnvironment and PhysicalBody objects specfied for them in the configuration file, and will be attached to any ViewingPlatforms specified for them.

Viewer instances are created with the following command:

(NewView <instance name> [Alias <alias name>])
The Viewer is configured through the following command:

(ViewProperty <instance name> <property name> <property value>)

Returns:
read-only Set of all unique instances, or null

getNamedViewers

public java.util.Map getNamedViewers()
Returns a read-only Map that maps Viewer names to instances. Names may be aliases and if so will map to the original instances. The Viewers will have incorporated any PhysicalEnvironment and PhysicalBody objects specfied for them in the configuration file, and will be attached to any ViewingPlatforms specified for them.

Returns:
read-only Map from names to Viewer instances, or null if no instances

getInputDevices

public java.util.Set getInputDevices()
Returns a read-only Set of all configured InputDevice instances in the order they were defined in the configuration file. All InputDevice instances in the set are initialized and registered with any PhysicalEnvironments that reference them.

InputDevice instances are created with the following command:

(NewDevice <instanceName> <className> [Alias <alias name>])
className must be the fully-qualified name of a class that implements the InputDevice interface. The implementation must provide a parameterless constructor.

The InputDevice is configured through the DeviceProperty command:

(DeviceProperty <instanceName> <propertyName> <arg0> ... <argn>)
propertyName must be the name of a input device method that takes an array of Objects as its only parameter; the array is populated with the values of arg0 through argn when the method is invoked to set the property. These additional requirements for configurable input devices can usually be fulfilled by extending or wrapping available InputDevice implementations.

Returns:
read-only Set of all unique instances, or null

getNamedInputDevices

public java.util.Map getNamedInputDevices()
Returns a read-only Map that maps InputDevice names to instances. Names may be aliases and if so will map to the original instances. All InputDevice instances in the map are initialized and registered with any PhysicalEnvironments that reference them.

Returns:
read-only Map from names to InputDevice instances, or null if no instances
See Also:
getInputDevices()

getSensors

public java.util.Set getSensors()
Returns a read-only Set of all configured Sensor instances in the order they were defined in the configuration file. The associated InputDevices are all initialized and registered with any PhysicalEnvironments that reference them.

Sensor instances are named with the following command:

(NewSensor <instance name> <device name> <sensor index> [Alias <alias name>])
device name is the instance name of a previously defined InputDevice, and sensor index is the index of the Sensor to be bound to instance name. The InputDevice implementation is responsible for creating its own Sensor objects, so this command does not create any new instances.

The Sensor is configured through the SensorProperty command:

(SensorProperty <instance name> <property name> <property value>)
With the sole exception of the Sensor assigned to the head tracker, none of the Sensors defined in the configuration file are placed into the Sensor array maintained by a PhysicalEnvironment.

Returns:
read-only Set of all unique instances, or null

getNamedSensors

public java.util.Map getNamedSensors()
Returns a read-only Map that maps Sensor names to instances. Names may be aliases and if so will map to the original instances. The associated InputDevices are all initialized and registered with any PhysicalEnvironments that reference them.

With the sole exception of the Sensor assigned to the head tracker, none of the Sensors defined in the configuration file are placed into the Sensor array maintained by a PhysicalEnvironment.

Returns:
read-only Map from names to Sensor instances, or null if no instances

getViewingPlatforms

public java.util.Set getViewingPlatforms()
Returns a read-only Set of all configured ViewingPlatform instances in the order they were defined in the configuration file. The ConfigContainer class itself does not attach the ViewingPlatform instances to any scengraph components or universe Locales; they are not "live" until made so by a separate client such as ConfiguredUniverse. ViewingPlatform instances are created with the following command:

(NewViewPlatform <instance name> [Alias <alias name>])
The ViewingPlatform is configured through the following command:

(ViewPlatformProperty <instance name> <property name> <property value>)

Returns:
read-only Set of all unique instances, or null

getNamedViewingPlatforms

public java.util.Map getNamedViewingPlatforms()
Returns a read-only Map that maps ViewingPlatform names to instances. Names may be aliases and if so will map to the original instances. The ConfigContainer class itself does not attach the ViewingPlatform instances to any scengraph components or universe Locales; they are not "live" until made so by a separate client such as ConfiguredUniverse.

Returns:
read-only Map from names to ViewingPlatform instances, or null if no instances

getViewPlatformBehaviors

public java.util.Set getViewPlatformBehaviors()
Returns a read-only Set of all configured ViewPlatformBehavior instances in the order they were defined in the configuration file.

The behaviors are attached to any ViewingPlatforms that specified them; that is, the setViewPlatformBehavior and setViewingPlatform methods of ViewingPlatform and ViewPlatformBehavior have been called if appropriate. However, a behavior's initialize method is not called until the ViewingPlatform to which it is attached is made live.

ViewPlatformBehavior instances are created by the following command:

(NewViewPlatformBehavior <instanceName> <className>)
className must be the fully qualified name of a concrete class that extends the abstract ViewPlatformBehavior class. The implementation must provide a parameterless constructor.

The behavior is configured using ViewPlatformBehaviorProperty:

(ViewPlatformBehaviorProperty <instanceName> <propertyName> <arg0> ... <argn>)
ViewPlatformBehavior subclasses inherit a number of pre-defined properties that can be directly specified with the propertyName string; see the configuration file documentation for details.

Concrete ViewPlatformBehavior instances can also define their own unique properties. In those cases, propertyName must be the name of a behavior method that takes an array of Objects as its only parameter; the array is populated with the values of arg0 through argn when the method is invoked to set the property. These additional requirements for configurable behaviors can usually be fulfilled by extending or wrapping available ViewPlatformBehavior subclasses.

Returns:
read-only Set of all unique instances, or null

getNamedViewPlatformBehaviors

public java.util.Map getNamedViewPlatformBehaviors()
Returns a read-only Map that maps ViewPlatformBehavior names to instances. Names may be aliases and if so will map to the original instances.

The behaviors are attached to any ViewingPlatforms that specified them; that is, the setViewPlatformBehavior and setViewingPlatform methods of ViewingPlatform and ViewPlatformBehavior have been called if appropriate. However, a behavior's initialize method is not called until the ViewingPlatform to which it is attached is made live.

Returns:
read-only Map from names to ViewPlatformBehavior instances, or null if no instances
See Also:
getViewPlatformBehaviors()

getNamedCanvases

public java.util.Map getNamedCanvases(java.lang.String viewName)
Returns a read-only Map containing the named Canvas3D instances used by the specified Viewer. Names may be aliases and if so will map to the original instances. The set of unique Canvas3D instances used by a Viewer may be obtained by calling the Viewer's accessor methods directly.

A named Canvas3D is created and added to a Viewer whenever any of the following configuration commands are used:

(ViewProperty <view> Screen <screenName>)
(ViewProperty <view> Window <windowName>)
view is the name of a Viewer created with the NewView command. The screenName and windowName parameters of the above commands are the keys to use when looking up the associated Canvas3D instances in the Map returned by this method. Note: the NewScreen and NewWindow commands do not create Canvas3D instances themselves; they are created only by the above configuration commands.

Parameters:
viewName - the name of the Viewer
Returns:
read-only Map containing the Viewer's named Canvas3D instances

getGenericObjects

public java.util.Set getGenericObjects()
Returns a read-only Set of all generic configuration object instances in the order they were defined in the configuration file.

Generic object instances are created with the following command:

(NewObject <instanceName> <className>)
className must be the fully-qualified name of a class that provides a parameterless constructor.

The object is configured through the ObjectProperty command:

(ObjectProperty <instanceName> <propertyName> <arg0> ... <argn>)
propertyName must be the name of a method provided by object instanceName. It must take an array of Objects as its only parameter; the array is populated with the values of arg0 through argn when the method is invoked to set the property. These additional requirements for configurable objects can usually be fulfilled by extending or wrapping available object classes.

Returns:
read-only Set of all unique instances, or null

getNamedGenericObjects

public java.util.Map getNamedGenericObjects()
Returns a read-only Map that maps generic object names to instances. Names may be aliases and if so will map to the original instances.

Returns:
read-only Map from names to generic object instances, or null if no instances
See Also:
getGenericObjects()

getViewPlatformTransformCount

public int getViewPlatformTransformCount()
Returns the number of TransformGroups with which ViewingPlatforms should be created. This is useful for clients that wish to provide a default ViewingPlatform if the configuration file doesn't specify one.

Returns:
the number of TransformGroups

getViewerVisibility

public boolean getViewerVisibility()
Returns whether Viewers should be created with their AWT components initially visible or invisible. This is useful for clients that wish to provide a default Viewer if the configuration file doesn't specify one.

Returns:
true if Viewer components should be initially visible; false otherwise

clear

public void clear()
Release memory references used by this ConfigContainer. All Sets and Maps obtained from this ConfigContainer are cleared.


getConfigURL

public static java.net.URL getConfigURL()
Returns the config file URL based on system properties. The current implementation of this method parses the j3d.configURL property as a URL string. For example, the following command line would specify that the config file is taken from the file "j3dconfig" in the current directory:

Returns:
the URL of the config file; null is returned if no valid URL is defined by the system properties

getConfigURL

public static java.net.URL getConfigURL(java.lang.String defaultURLString)
Returns the config file URL based on system properties. The current implementation of this method parses the j3d.configURL property as a URL string. For example, the following command line would specify that the config file is taken from the file "j3dconfig" in the current directory:

Parameters:
defaultURLString - the default string used to construct the URL if the appropriate system properties are not defined
Returns:
the URL of the config file; null is returned if no valid URL is defined either by the system properties or the default URL string


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.