org.molwind.util
Class MolwindServerConfiguration

java.lang.Object
  extended by java.util.Observable
      extended by org.molwind.util.MolwindServerConfiguration
All Implemented Interfaces:
WorldLocator, Configurator

public final class MolwindServerConfiguration
extends java.util.Observable
implements WorldLocator, Configurator

Holds the configuration options of the molwind server. This is a singleton as there is only one per server.

Version:
1.0
Author:
Oliver Karch

Field Summary
static boolean DEFAULT_INTERMEDIATE_LAYER
          Default intermediate layer flag.
static int DEFAULT_MOLECULES_PER_LEVEL
          Default maximum number of molecules per level.
static double DEFAULT_ZOOM
          Default zoom factor.
 
Method Summary
 void addWorldLocator(WorldLocator locator)
          Adds a world locator used to find worlds.
 void addWorldPath(java.lang.String searchPath)
          Adds a search path for world data to locate.
static MolwindServerConfiguration getInstance()
          Creates a new configuration object and initializes it with default values (lazily loaded).
static MolwindServerConfiguration getInstance(java.lang.String path)
          Creates a new configuration object and initializes it with default values (lazily loaded).
 int getMoleculesPerLevel()
          Get the MoleculesPerLevel value.
 java.lang.String getPath()
          Get the Path value.
 javax.servlet.ServletContext getServletContext()
          Get the ServletContext value.
 WorldLocator[] getWorldLocators()
          Returns an array of world locators.
 java.lang.String[] getWorldNames()
          Returns a (possibly empty) list of locatable worlds
 java.lang.String[] getWorldPaths()
          Returns an array of search paths for worlds.
 double getZoom()
          Get the Zoom value.
 boolean isIntermediateLayer()
          Get the IntermediateLayer value.
 MolwindWorld locateWorld(java.lang.String worldName)
          Locates a world with the given name.
 void setIntermediateLayer(boolean newIntermediateLayer)
          Set the IntermediateLayer value.
 void setMoleculesPerLevel(int newMoleculesPerLevel)
          Set the MoleculesPerLevel value.
 void setPath(java.lang.String newPath)
          Set the Path value.
 void setServletContext(javax.servlet.ServletContext newServletContext)
          Set the ServletContext value.
 void setup(Configurable object)
          Configures the given object.
 void setZoom(double newZoom)
          Set the Zoom value.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MOLECULES_PER_LEVEL

public static final int DEFAULT_MOLECULES_PER_LEVEL
Default maximum number of molecules per level.

See Also:
Constant Field Values

DEFAULT_ZOOM

public static final double DEFAULT_ZOOM
Default zoom factor.

See Also:
Constant Field Values

DEFAULT_INTERMEDIATE_LAYER

public static final boolean DEFAULT_INTERMEDIATE_LAYER
Default intermediate layer flag.

See Also:
Constant Field Values
Method Detail

getInstance

public static MolwindServerConfiguration getInstance(java.lang.String path)
Creates a new configuration object and initializes it with default values (lazily loaded).

Parameters:
path - the path to the configuration file
Returns:
the configuration instance

getInstance

public static MolwindServerConfiguration getInstance()
Creates a new configuration object and initializes it with default values (lazily loaded).

Returns:
the configuration instance

getPath

public java.lang.String getPath()
Get the Path value.

Returns:
the Path value

setPath

public void setPath(java.lang.String newPath)
Set the Path value.

Parameters:
newPath - the new Path value

getMoleculesPerLevel

public int getMoleculesPerLevel()
Get the MoleculesPerLevel value.

Returns:
the MoleculesPerLevel value

setMoleculesPerLevel

public void setMoleculesPerLevel(int newMoleculesPerLevel)
Set the MoleculesPerLevel value.

Parameters:
newMoleculesPerLevel - the new MoleculesPerLevel value

getZoom

public double getZoom()
Get the Zoom value.

Returns:
the Zoom value

setZoom

public void setZoom(double newZoom)
Set the Zoom value.

Parameters:
newZoom - the new Zoom value

isIntermediateLayer

public boolean isIntermediateLayer()
Get the IntermediateLayer value.

Returns:
the IntermediateLayer value

setIntermediateLayer

public void setIntermediateLayer(boolean newIntermediateLayer)
Set the IntermediateLayer value.

Parameters:
newIntermediateLayer - the new IntermediateLayer value

addWorldPath

public void addWorldPath(java.lang.String searchPath)
Adds a search path for world data to locate.

Parameters:
searchPath - a path where world data can be found

getWorldPaths

public java.lang.String[] getWorldPaths()
Returns an array of search paths for worlds.

Returns:
array of search paths

addWorldLocator

public void addWorldLocator(WorldLocator locator)
Adds a world locator used to find worlds.

Parameters:
locator - the locator to be added

getWorldLocators

public WorldLocator[] getWorldLocators()
Returns an array of world locators.

Returns:
an array of locators

locateWorld

public MolwindWorld locateWorld(java.lang.String worldName)
                         throws java.io.IOException
Locates a world with the given name.

Specified by:
locateWorld in interface WorldLocator
Parameters:
worldName - the name of the world
Returns:
a molwind world descriptor
Throws:
java.io.IOException - is thrown upon i/o error

getServletContext

public javax.servlet.ServletContext getServletContext()
Get the ServletContext value.

Returns:
the ServletContext value

setServletContext

public void setServletContext(javax.servlet.ServletContext newServletContext)
Set the ServletContext value.

Parameters:
newServletContext - the new ServletContext value

setup

public void setup(Configurable object)
           throws ConfigException
Configures the given object.

Specified by:
setup in interface Configurator
Parameters:
object - the object to be configured
Throws:
ConfigException - is thrown upon config error

getWorldNames

public java.lang.String[] getWorldNames()
Description copied from interface: WorldLocator
Returns a (possibly empty) list of locatable worlds

Specified by:
getWorldNames in interface WorldLocator
Returns:
returns an array of available worlds


Copyright © 2008-2010. All Rights Reserved.