obixserver.core
Class ObixEnv

java.lang.Object
  extended by obixserver.core.ObixEnv

public class ObixEnv
extends Object

Environment singleton. It holds obix server environment, including properties and version.


Field Summary
private static ObixEnv instance
          Singleton instance.
private static Logger logger
           
private static Properties properties
          Application Properties, loaded from application specific .properties file.
private static String propfile
           
private  String version
          Version of the package/application.
 
Constructor Summary
ObixEnv()
           
 
Method Summary
static ObixEnv getInstance()
          Returns a singleton instance of this class.
 Properties getProperties()
           
 String getProperty(String name)
          Returns property previously loaded from properties file.
 String getProperty(String name, String defaultValue)
          Returns property previously loaded from properties file.
 int getPropertyInt(String name)
          Returns property and throws exception of property doesn't exist or is not int.
 String getPropertyString(String name)
          Returns property or throws exception of property doesn't exist.
 String getVersion()
          Returns the version of this package.
protected static void init(String resource)
          Initializes the application, loading properties from given resource.
static void initServer()
          Initializes the server using the current directory to search for resources.
static void initServer(String resourceFile)
           
static void initServer(String resourceDir, String resourceFile)
          Initializes the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final Logger logger

propfile

private static String propfile

instance

private static ObixEnv instance
Singleton instance.


version

private String version
Version of the package/application.


properties

private static Properties properties
Application Properties, loaded from application specific .properties file.

Constructor Detail

ObixEnv

public ObixEnv()
Method Detail

getVersion

public String getVersion()
Returns the version of this package.


init

protected static void init(String resource)
Initializes the application, loading properties from given resource.

Parameters:
resource - resource to load properties from.

getInstance

public static ObixEnv getInstance()
Returns a singleton instance of this class.


getProperty

public String getProperty(String name)
Returns property previously loaded from properties file.

Parameters:
name -
Returns:
property value

getProperty

public String getProperty(String name,
                          String defaultValue)
Returns property previously loaded from properties file.

Parameters:
name -
defaultValue -
Returns:
property value

getPropertyInt

public int getPropertyInt(String name)
Returns property and throws exception of property doesn't exist or is not int.

Parameters:
name -
Returns:
property value as int

getPropertyString

public String getPropertyString(String name)
Returns property or throws exception of property doesn't exist.

Parameters:
name -
Returns:
property string

initServer

public static void initServer()
Initializes the server using the current directory to search for resources.


initServer

public static void initServer(String resourceDir,
                              String resourceFile)
Initializes the server.

Parameters:
resourceDir - directory to use to load resources from.
resourceFile - file to use to load resources from.

initServer

public static void initServer(String resourceFile)

getProperties

public Properties getProperties()


Copyright © 2006-2008 Peter Michalek All Rights Reserved.