NASA World Wind

gov.nasa.worldwind
Interface Factory

All Known Implementing Classes:
BasicElevationModelFactory, BasicFactory, BasicLayerFactory

public interface Factory

General factory interface.


Method Summary
 Object createFromClassName(String className)
          Create an object given its class name.
 Object createFromConfigFile(String fileName)
          Create a component from a specified configuration file.
 Object createFromDataConfig(DataConfiguration dataConfig, AVList params)
          Create a component from a specified data configuration, potentially overriding values from the configuration with values from the specified parameters.
 Object createFromKeys(String[] sourceKeys)
          Creates a component using one of several specified configuration mechanisms.
 

Method Detail

createFromClassName

Object createFromClassName(String className)
Create an object given its class name.

Parameters:
className - the fully qualified class name of the class to create.
Returns:
an instance of the requested class.
Throws:
WWRuntimeException - if the class cannot be created for any reason.

createFromConfigFile

Object createFromConfigFile(String fileName)
Create a component from a specified configuration file.

Parameters:
fileName - the path to the configuration file. The file must be either an absolute path or a relative path available on the classpath.
Returns:
an instance of the requested class.
Throws:
WWRuntimeException - if the class cannot be created for any reason.

createFromDataConfig

Object createFromDataConfig(DataConfiguration dataConfig,
                            AVList params)
Create a component from a specified data configuration, potentially overriding values from the configuration with values from the specified parameters.

Parameters:
dataConfig - the configuration information describing the component.
params - key-value parameters which override or supplement the information provided in the specified configuration. A null reference is permitted.
Returns:
an instance of the requested class.
Throws:
WWRuntimeException - if the class cannot be created for any reason.

createFromKeys

Object createFromKeys(String[] sourceKeys)
Creates a component using one of several specified configuration mechanisms. The factory determines which mechanism to use, but typically attempts the specified ones in the order given until one is successful.

A key can be any unique string that identifies a creation source or mechanism. An example is AVKey.EARTH_ELEVATION_MODEL_CONFIG_FILE, which causes the factory to look up via Configuration the name of the configuration file given by this key. Another example is AVKey.EARTH_ELEVATION_MODEL_CLASS_NAME, which tells the factory to create an instance of the class whose name is determined by looking up the key in Configuration. The characters at the end of these strings are "ConfigFile" and "ClassName", respectively. These trailing characters indicate to the factory the type of creation mechanism to use. Factories can implement any similar scheme.

Parameters:
sourceKeys - an array of keys identifying the mechanisms to use to create the component.
Returns:
the requested component.
Throws:
IllegalArgumentException - if the key array is null or empty.
WWRuntimeException - if none of the methods are successful.

NASA World Wind