GigaSpaces XAP 9.7.2 API

net.jini.config
Interface Configuration

All Known Implementing Classes:
AbstractConfiguration, AggregateConfig, ConfigurationFile, EmptyConfiguration, PlainConfiguration

public interface Configuration

Defines an interface for obtaining objects needed to configure applications, such as Exporter or ProxyPreparer instances, or other application-specific objects, from configuration files, databases, or other sources. Configuration entries are identified by a component and a name. Methods that retrieve entries can specify a default value to return in case the entry is not found, and supply data to use when computing the value of the entry.

Application developers are encouraged to use this interface, rather than explicitly constructing instances of exporters and proxy preparers, so that applications can be customized without requiring code modifications. Applications should normally use ConfigurationProvider to obtain Configuration instances, rather than referencing implementation classes directly, so that the interpretation of configuration options can be customized without requiring code modifications.

Since:
2.0
Author:
Sun Microsystems, Inc.

Field Summary
static Object NO_DATA
          An object to pass for data in calls to getEntry to specify no data.
static Object NO_DEFAULT
          An object to pass for defaultValue in calls to getEntry to specify no default value.
 
Method Summary
 Object getEntry(String component, String name, Class type)
          Returns an object of the specified type created using the information in the entry matching the specified component and name, which must be found, and supplying no data.
 Object getEntry(String component, String name, Class type, Object defaultValue)
          Returns an object of the specified type created using the information in the entry matching the specified component and name, and supplying no data, returning the default value if no matching entry is found and the default value is not NO_DEFAULT.
 Object getEntry(String component, String name, Class type, Object defaultValue, Object data)
          Returns an object of the specified type created using the information in the entry matching the specified component and name, and using the specified data (unless it is NO_DATA), returning the default value if no matching entry is found and the default value is not NO_DEFAULT.
 

Field Detail

NO_DEFAULT

static final Object NO_DEFAULT
An object to pass for defaultValue in calls to getEntry to specify no default value.

See Also:
getEntry(String, String, Class, Object), getEntry(String, String, Class, Object, Object)

NO_DATA

static final Object NO_DATA
An object to pass for data in calls to getEntry to specify no data.

See Also:
getEntry(String, String, Class, Object, Object)
Method Detail

getEntry

Object getEntry(String component,
                String name,
                Class type)
                throws ConfigurationException
Returns an object of the specified type created using the information in the entry matching the specified component and name, which must be found, and supplying no data. If type is a primitive type, then the result is returned as an instance of the associated wrapper class. Repeated calls with the same arguments may or may not return the identical object.

The component identifies the object whose behavior will be configured using the object returned. The value of component must be a QualifiedIdentifier, as defined in the Java(TM) Language Specification (JLS), and is typically the class or package name of the object being configured. The name identifies which of possibly several entries are available for the given component. The value of name must be an Identifier, as defined in the JLS.

Calling this method is equivalent to calling getEntry(component, name, type, NO_DEFAULT, NO_DATA).

Parameters:
component - the component being configured
name - the name of the entry for the component
type - the type of the object to be returned
Returns:
an object created using the information in the entry matching component and name
Throws:
NoSuchEntryException - if no matching entry is found
ConfigurationException - if a matching entry is found but a problem occurs creating the object for the entry, or if type is a reference type and the result for the matching entry is not either null or an instance of type, or if type is a primitive type and the result is not an instance of the associated wrapper class. Any Error thrown while creating the object is propagated to the caller; it is not wrapped in a ConfigurationException.
IllegalArgumentException - if component is not null and is not a valid QualifiedIdentifier, or if name is not null and is not a valid Identifier
NullPointerException - if any argument is null
See Also:
getEntry(String, String, Class, Object)

getEntry

Object getEntry(String component,
                String name,
                Class type,
                Object defaultValue)
                throws ConfigurationException
Returns an object of the specified type created using the information in the entry matching the specified component and name, and supplying no data, returning the default value if no matching entry is found and the default value is not NO_DEFAULT. If type is a primitive type, then the result is returned as an instance of the associated wrapper class. Repeated calls with the same arguments may or may not return the identical object.

The component identifies the object whose behavior will be configured using the object returned. The value of component must be a QualifiedIdentifier, as defined in the Java Language Specification (JLS), and is typically the class or package name of the object being configured. The name identifies which of possibly several entries are available for the given component. The value of name must be an Identifier, as defined in the JLS.

Calling this method is equivalent to calling getEntry(component, name, type, defaultValue, NO_DATA).

Parameters:
component - the component being configured
name - the name of the entry for the component
type - the type of the object to be returned
defaultValue - the object to return if no matching entry is found, or NO_DEFAULT to specify no default
Returns:
an object created using the information in the entry matching component and name, or defaultValue if no matching entry is found and defaultValue is not NO_DEFAULT
Throws:
NoSuchEntryException - if no matching entry is found and defaultValue is NO_DEFAULT
ConfigurationException - if a matching entry is found but a problem occurs creating the object for the entry, or if type is a reference type and the result for the matching entry is not either null or an instance of type, or if type is a primitive type and the result is not an instance of the associated wrapper class. Any Error thrown while creating the object is propagated to the caller; it is not wrapped in a ConfigurationException.
IllegalArgumentException - if component is not null and is not a valid QualifiedIdentifier; or if name is not null and is not a valid Identifier; or if type is a reference type and defaultValue is not NO_DEFAULT, null, or an instance of type; or if type is a primitive type and defaultValue is not NO_DEFAULT or an instance of the associated wrapper class
NullPointerException - if component, name, or type is null
See Also:
getEntry(String, String, Class, Object, Object)

getEntry

Object getEntry(String component,
                String name,
                Class type,
                Object defaultValue,
                Object data)
                throws ConfigurationException
Returns an object of the specified type created using the information in the entry matching the specified component and name, and using the specified data (unless it is NO_DATA), returning the default value if no matching entry is found and the default value is not NO_DEFAULT. If type is a primitive type, then the result is returned as an instance of the associated wrapper class. Repeated calls with the same arguments may or may not return the identical object.

The component identifies the object whose behavior will be configured using the object returned. The value of component must be a QualifiedIdentifier, as defined in the Java Language Specification (JLS), and is typically the class or package name of the object being configured. The name identifies which of possibly several entries are available for the given component. The value of name must be an Identifier, as defined in the JLS.

Parameters:
component - the component being configured
name - the name of the entry for the component
type - the type of the object to be returned
defaultValue - the object to return if no matching entry is found, or NO_DEFAULT to specify no default
data - an object to use when computing the value of the entry, or NO_DATA to specify no data
Returns:
an object created using the information in the entry matching component and name, and using the value of data (unless it is NO_DATA), or defaultValue if no matching entry is found and defaultValue is not NO_DEFAULT
Throws:
NoSuchEntryException - if no matching entry is found and defaultValue is NO_DEFAULT
ConfigurationException - if a matching entry is found but a problem occurs creating the object for the entry, or if type is a reference type and the result for the matching entry is not either null or an instance of type, or if type is a primitive type and the result is not an instance of the associated wrapper class. Any Error thrown while creating the object is propagated to the caller; it is not wrapped in a ConfigurationException.
IllegalArgumentException - if component is not null and is not a valid QualifiedIdentifier; or if name is not null and is not a valid Identifier; or if type is a reference type and defaultValue is not NO_DEFAULT, null, or an instance of type; or if type is a primitive type and defaultValue is not NO_DEFAULT or an instance of the associated wrapper class
NullPointerException - if component, name, or type is null

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.