|
NASA World Wind | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nasa.worldwind.BasicFactory
public class BasicFactory
A basic implementation of the Factory
interface.
Constructor Summary | |
---|---|
BasicFactory()
|
Method Summary | |
---|---|
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 |
createFromClassName(String className)
Creates an object given the object's class name. |
Object |
createFromConfigFile(String fileName)
A no-op implemenation of the Factory.createFromConfigFile(String) method provided so that this class can
be instantiated. |
Object |
createFromDataConfig(DataConfiguration dataConfig,
AVList params)
A no-op implementation of the Factory.createFromDataConfig(DataConfiguration, gov.nasa.worldwind.avlist.AVList) method provided so
that this class can be instantiated. |
Object |
createFromKeys(String[] sourceKeys)
Creates an object, determining the method to use from a list of specified keys. |
protected Object |
doCreateFromCapabilities(Capabilities caps,
AVList params)
Implemented by subclasses to perform the actual object creation. |
protected Object |
doCreateFromKey(String key)
Called during createFromKeys(String[]) for each key prior to attempting to create an object by the
default mechanisms. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicFactory()
Method Detail |
---|
public Object createFromCapabilities(String capsFileName, AVList params)
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.
IllegalArgumentException
- if the file name is null.
IllegalStateException
- if the capabilites document contains no named layer definitions.
WWRuntimeException
- if an error occurs while opening, reading or parsing the capabilities document.public Object createFromClassName(String className)
Class.forName(className.trim()).newInstance()
.
createFromClassName
in interface Factory
className
- the fully qualified class name of the class to create.
public Object createFromConfigFile(String fileName)
Factory.createFromConfigFile(String)
method provided so that this class can
be instantiated. Not all factories need a createfromConfigFile
method; this class is therefore
useful as is in these cases.
createFromConfigFile
in interface Factory
fileName
- normally the path to the configuration file. It must be either an absolute path or a relative
path available on the classpath. But this dummy method implementation ignores this argument.
public Object createFromDataConfig(DataConfiguration dataConfig, AVList params)
Factory.createFromDataConfig(DataConfiguration, gov.nasa.worldwind.avlist.AVList)
method provided so
that this class can be instantiated. Not all factories need a createFromDataConfig
method; this
class is therefore useful as is in these cases.
createFromDataConfig
in interface Factory
dataConfig
- normally the configuration information describing the component.params
- normally key-value parameters which will override or supplement the information provided in the
specified configuration. A null reference is permitted.
public Object createFromKeys(String[] sourceKeys)
Configuration
the actual configuration file name or class name, respectively. A key
without recognizable terminating characters is considered to be a class name key, as though its terminating
characters are "ClassName".
Each key is tried in the order specified. The method whose key is first recognized and whose corresponding
configuration component, e.g., class name or configuration file name, is found is used to create an object. If no
mechanism is matched then an exception is thrown. An exception is also thrown when a matched method fails during
its attempt to create the object.
Subclasses are given the chance to handle each key before the other mechanisms are tried. For each key, the
method doCreateFromKey(String)
is called prior to trying the other mechanisms. If that method returns
non-null then this method returns immediately. If doCreateFromKey(String)
returns null, the other
mechanisms are tried before calling it again with the next key.
createFromKeys
in interface Factory
sourceKeys
- an array of keys identifying which mechanisms to use to create the object.
IllegalArgumentException
- if sourceKeys
is null or empty.
WWRuntimeException
- if no mechanism is matched or the matched mechanism throws an exception or
otherwise fails.protected Object doCreateFromCapabilities(Capabilities caps, AVList params)
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.
protected Object doCreateFromKey(String key)
createFromKeys(String[])
for each key prior to attempting to create an object by the
default mechanisms. This give subclasses the first opportunity to create the object. If this method returns null,
the other mechanisms are tried for the indicated key. If those other mechanisms fail, this method is called again
with the next key.
key
- the key identifying the mechanism to use to create an object and the resource with which to do it.
|
NASA World Wind | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |