NASA World Wind

gov.nasa.worldwind
Class BasicFactory

java.lang.Object
  extended by gov.nasa.worldwind.BasicFactory
All Implemented Interfaces:
Factory
Direct Known Subclasses:
BasicElevationModelFactory, BasicLayerFactory

public class BasicFactory
extends Object
implements Factory

A basic implementation of the Factory interface.


Constructor Summary
BasicFactory()
           
 
Method Summary
static Object create(String factoryKey, Object configSource)
          Static method to create an object from a factory and configuration source.
static Object create(String factoryKey, Object configSource, AVList params)
          Static method to create an object from a factory, a configuration source, and an optional configuration parameter list.
 Object createFromCapabilities(String capsFileName, AVList params)
          Create an object such as a layer or elevation model given a local OGC capabilities document containing named layer descriptions.
 Object createFromConfigSource(Object configSource, AVList params)
          Creates an object from a general configuration source.
protected  Object doCreateFromCapabilities(OGCCapabilities caps, AVList params)
          Implemented by subclasses to perform the actual object creation.
protected  Object doCreateFromElement(Element domElement, AVList params)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicFactory

public BasicFactory()
Method Detail

create

public static Object create(String factoryKey,
                            Object configSource)
Static method to create an object from a factory and configuration source.

Parameters:
factoryKey - the key identifying the factory in Configuration.
configSource - the configuration source. May be any of the types listed for createFromConfigSource(Object, gov.nasa.worldwind.avlist.AVList)
Returns:
a new instance of the requested object.
Throws:
IllegalArgumentException - if the factory key is null, or if the configuration source is null or an empty string.

create

public static Object create(String factoryKey,
                            Object configSource,
                            AVList params)
Static method to create an object from a factory, a configuration source, and an optional configuration parameter list.

Parameters:
factoryKey - the key identifying the factory in Configuration.
configSource - the configuration source. May be any of the types listed for createFromConfigSource(Object, gov.nasa.worldwind.avlist.AVList)
params - key-value parameters to override or supplement the information provided in the specified configuration source. May be null.
Returns:
a new instance of the requested object.
Throws:
IllegalArgumentException - if the factory key is null, or if the configuration source is null or an empty string.

createFromCapabilities

public Object createFromCapabilities(String capsFileName,
                                     AVList params)
Create an object such as a layer or elevation model given a local OGC capabilities document containing named layer descriptions.

Parameters:
capsFileName - the path to the capabilities file. The file must be either an absolute path or a relative path available on the classpath. The file contents must be a valid OGC capabilities document.
params - a list of configuration properties. These properties override any specified in the capabilities document. The list should contain the AVKey.LAYER_NAMES property for services that define layer, indicating which named layers described in the capabilities document to create. If this argumet is null or contains no layers, the first named layer is used.
Returns:
the requested object.
Throws:
IllegalArgumentException - if the file name is null or empty.
IllegalStateException - if the capabilites document contains no named layer definitions.
WWRuntimeException - if an error occurs while opening, reading or parsing the capabilities document. The exception indicating the source of the failure is included as the Throwable.initCause(Throwable).

createFromConfigSource

public Object createFromConfigSource(Object configSource,
                                     AVList params)
Creates an object from a general configuration source. The source can be one of the following:

Specified by:
createFromConfigSource in interface Factory
Parameters:
configSource - the configuration source. See above for supported types.
params - key-value parameters to override or supplement the information provided in the specified configuration source. May be null.
Returns:
the new object.
Throws:
IllegalArgumentException - if the configuration source is null or an empty string.
WWUnrecognizedException - if the source type is unrecognized.
WWRuntimeException - if object creation fails. The exception indicating the source of the failure is included as the Throwable.initCause(Throwable).

doCreateFromCapabilities

protected Object doCreateFromCapabilities(OGCCapabilities caps,
                                          AVList params)
Implemented by subclasses to perform the actual object creation. This default implementation always returns null.

Parameters:
caps - the capabilities document.
params - a list of configuration properties. These properties override any specified in the capabilities document. The list should contain the AVKey.LAYER_NAMES property for services that define layers, indicating which named layers described in the capabilities document to create. If this argumet is null or contains no layers, the first named layer is used.
Returns:
the requested object.

doCreateFromElement

protected Object doCreateFromElement(Element domElement,
                                     AVList params)
                              throws Exception
Throws:
Exception

NASA World Wind