oemware.core
Class InstanceConf

java.lang.Object
  extended by oemware.core.BaseSharedJob
      extended by oemware.core.InstanceConf
All Implemented Interfaces:
SharedJob

public final class InstanceConf
extends BaseSharedJob

The instance configuration. This component can be registered with a shared job runner if you want it to refresh. If a user attempts get a property that doesn't exist, an exception is thrown. This component pulls the data from a file.

This component is to be used for instance configuration and should not be used for storing rapidly changing application states.

Version:
$Id: InstanceConf.java 13 2008-06-15 19:43:04Z oemware $

Field Summary
static java.lang.String DIR_DATA_KEY
           
static java.lang.String ENV_NAME_KEY
           
static java.lang.String INSTANCE_ID_KEY
           
static java.lang.String NODE_ID_KEY
           
static java.lang.String SERVICE_NAME_KEY
           
 
Constructor Summary
InstanceConf(java.lang.String pSystemPropertyName)
          Construct a new instance.
 
Method Summary
 int getIntProperty(java.lang.String pName)
          Returns an integer property value (works same as string version).
 long getLongProperty(java.lang.String pName)
          Returns a long property value (works same as string version).
 java.lang.String getProperty(java.lang.String pName)
          Returns the property
 short getShortProperty(java.lang.String pName)
          Returns a short property value (works same as string version).
 void runJob()
          This is the method called by the shared job runner.
 void setProperty(java.lang.String pName, java.lang.String pValue)
          Set the property.
 
Methods inherited from class oemware.core.BaseSharedJob
getJobFrequency, getJobName, getLastRunTime, setJobFrequency, setJobName, setLastRunTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_ID_KEY

public static final java.lang.String NODE_ID_KEY
See Also:
Constant Field Values

INSTANCE_ID_KEY

public static final java.lang.String INSTANCE_ID_KEY
See Also:
Constant Field Values

SERVICE_NAME_KEY

public static final java.lang.String SERVICE_NAME_KEY
See Also:
Constant Field Values

ENV_NAME_KEY

public static final java.lang.String ENV_NAME_KEY
See Also:
Constant Field Values

DIR_DATA_KEY

public static final java.lang.String DIR_DATA_KEY
See Also:
Constant Field Values
Constructor Detail

InstanceConf

public InstanceConf(java.lang.String pSystemPropertyName)
Construct a new instance. You must pass the system property in the constructor.

Parameters:
pSystemPropertyName - The system property name (-Dfoo=value).
Method Detail

runJob

public final void runJob()
This is the method called by the shared job runner.

Specified by:
runJob in interface SharedJob
Specified by:
runJob in class BaseSharedJob

getProperty

public final java.lang.String getProperty(java.lang.String pName)
                                   throws ServiceException
Returns the property

Parameters:
pName - The property name (required).
Returns:
The value. An exception is thrown if not available.
Throws:
ServiceException

getLongProperty

public final long getLongProperty(java.lang.String pName)
                           throws ServiceException
Returns a long property value (works same as string version).

Parameters:
pName - The property name (required).
Returns:
The value. An exception is thrown if not available.
Throws:
ServiceException

getIntProperty

public final int getIntProperty(java.lang.String pName)
                         throws ServiceException
Returns an integer property value (works same as string version).

Parameters:
pName - The property name (required).
Returns:
The value. An exception is thrown if not available.
Throws:
ServiceException

getShortProperty

public final short getShortProperty(java.lang.String pName)
                             throws ServiceException
Returns a short property value (works same as string version).

Parameters:
pName - The property name (required).
Returns:
The value. An exception is thrown if not available.
Throws:
ServiceException

setProperty

public final void setProperty(java.lang.String pName,
                              java.lang.String pValue)
                       throws ServiceException
Set the property.

Parameters:
pName - The property name.
pValue - The property value.
Throws:
ServiceException


Copyright © 2008 Deft Labs - Released under LGPL, Version 3.0