com.basistech.rlp
Class RLPEnvironment

java.lang.Object
  extended by com.basistech.rlp.RLPEnvironment

public class RLPEnvironment
extends Object

The RLP Environment class, which maintains the location of the available processors for RLP.


Nested Class Summary
static interface RLPEnvironment.LogCallback
          Interface for objects that accept RLP log messages.
 
Constructor Summary
RLPEnvironment(EnvironmentParameters params)
          Constructs a new RLPEnvironment object.
 
Method Summary
 void close()
          Explicitly releases resources.
 void finalize()
          Explicitly releases resources.
 RLPContext getContext(ContextParameters params)
          Creates a new RLPContext within the Environment.
 RLPContext getContextFromBuffer(String contextDefinition)
          Obtains a new context object that uses the configuration in the environment.
 RLPContext getContextFromFile(String contextDefinitionPath)
          Obtains a new context object that uses the configuration in the environment.
 String getProcessorReport()
          Obtains a string describing all the processors defined in this environment.
 boolean hasLicenseForLanguage(LanguageCode language, int functionality)
          Determines if a license exists for the specified language and functionality.
 boolean hasLicenseForNamedFeature(String feature, int functionality)
          Determines if a license exists for the feature and functionality.
 boolean hasLicenses()
          Determines if the license contains a valid license.
 void initialize()
          Initializes the RLPEnvironment, this must be done before creating contexts.
 void initializeFromFile(String pathname)
          Configures the environment from XML information stored in a file.
static String versionString()
          Retrieves the version String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RLPEnvironment

public RLPEnvironment(EnvironmentParameters params)
Constructs a new RLPEnvironment object.

Parameters:
params - Paramaters to use when it is initialized by initialize().
Method Detail

initialize

public void initialize()
                throws RLPException
Initializes the RLPEnvironment, this must be done before creating contexts.

Throws:
RLPException - Indicates initialization failed.

finalize

public void finalize()
Explicitly releases resources.

Overrides:
finalize in class Object
See Also:
close()

close

public void close()
Explicitly releases resources.


getContext

public RLPContext getContext(ContextParameters params)
                      throws RLPException
Creates a new RLPContext within the Environment.

Parameters:
params - Object specifying the parameters of the new context. This object is cloned and can therefore be reused.
Returns:
The new context; null if in a closed or partially initialized state.
Throws:
RLPException - Indicates uninitialized environment or trouble creating the context.

initializeFromFile

public void initializeFromFile(String pathname)
                        throws RLPException
Configures the environment from XML information stored in a file. This information must conform to the RLP global configuration DTD.

Parameters:
pathname - A file containing the configuration in XML.
Throws:
RLPException - Indicates an error initializing the environment from the specified file.

getContextFromFile

public RLPContext getContextFromFile(String contextDefinitionPath)
                              throws RLPException,
                                     IOException
Obtains a new context object that uses the configuration in the environment.

Parameters:
contextDefinitionPath - The pathname of a file containing the context definition in XML.
Returns:
RLPContext as requested.
Throws:
RLPException - Indicates an error creating a context from the specified configuration.
IOException - Indicates file I/O failure.

getContextFromBuffer

public RLPContext getContextFromBuffer(String contextDefinition)
                                throws RLPException
Obtains a new context object that uses the configuration in the environment.

Parameters:
contextDefinition - A string containing the context definition in XML.
Returns:
RLPContext as requested.
Throws:
RLPException - Indicates an error creating the context.

getProcessorReport

public String getProcessorReport()
                          throws RLPException
Obtains a string describing all the processors defined in this environment. The string is delimited with | characters, in the format
        ProcName0|ProcDescription0|ProcName1|ProcDescription1|...||.

Returns:
A description.
Throws:
RLPException - Indicates uninitialized environment or trouble creating the report.

versionString

public static String versionString()
Retrieves the version String.

Returns:
String containing the current version of the API

hasLicenses

public boolean hasLicenses()
                    throws RLPException
Determines if the license contains a valid license. This member function determines whether the environment contains a valid license.

Returns:
true if there is a valid license.
Throws:
RLPException - Indicates uninitialized environment or trouble reading licenses.

hasLicenseForLanguage

public boolean hasLicenseForLanguage(LanguageCode language,
                                     int functionality)
                              throws RLPException
Determines if a license exists for the specified language and functionality. This member function determines if a license exists for the language and functionality.

Parameters:
language - Language.
functionality - Functionality.
Returns:
true if there is a license for the language and functionality.
Throws:
RLPException - indicates uninitialized environment or trouble reading licenses.
See Also:
LanguageCode, RLPConstants

hasLicenseForNamedFeature

public boolean hasLicenseForNamedFeature(String feature,
                                         int functionality)
                                  throws RLPException
Determines if a license exists for the feature and functionality. This member function determines if a license exists for the feature and functionality.

Parameters:
feature - Feature.
functionality - Functionality.
Returns:
true There is a license for the feature and functionality.
Throws:
RLPException - indicates uninitialized environment or trouble reading licenses.
See Also:
RLPConstants


Copyright © 2004-2008 Basis Technology Corporation. All Rights Reserved.