com.sas.services
Class ServiceInitializationObject

com.sas.services.ServiceInitializationObject
All Implemented Interfaces:
InitializationObjectInterface, java.io.Serializable

public class ServiceInitializationObject
implements InitializationObjectInterface

Foundation service's configuration represented as an XML document.

A service's configuration is represented as a UTF-8 encoded XML document. Supported object types are:

Since:
1.0
See Also:
Serialized Form

Constructor Summary
ServiceInitializationObject()
          Constructs a default instance for a service which does not have a configuration.
ServiceInitializationObject(org.xml.sax.InputSource configXMLInputSource)
          Constructs an initialization object initialized with the specified service factory.
ServiceInitializationObject(java.lang.String configXML)
          Constructs an initialization object initialized with the specified service factory.
 
Method Summary
 void addConfiguration(java.lang.String configName, java.lang.String configXML)
          Adds a configuration.
 void addConfigurationDocument(java.lang.String configName, org.w3c.dom.Document document)
          Adds a configuration.
 org.w3c.dom.Document createDocument(java.lang.Object config)
          Creates an XML document representation of the service configuration.
 AbstractServiceComponentConfig getConfiguration(DocumentServiceConfigAdapterInterface adapter)
          Gets a service configuration using the specified adapter to convert XML document to a service configuration.
 java.util.List<ServiceConfigDocument> getConfigurations()
          Gets a copy of the collection of the service's configurations.
 java.lang.Object getInitializationObject()
          Gets an object used to configure the service.
 void setInitializationObject(java.lang.Object config)
          Sets the initialization object.
 

Constructor Detail

ServiceInitializationObject

public ServiceInitializationObject()
Constructs a default instance for a service which does not have a configuration.

Use setInitializationObject(Object) to specify the service's configuration data.


ServiceInitializationObject

public ServiceInitializationObject(java.lang.String configXML)
                            throws ServiceException,
                                   java.lang.IllegalArgumentException
Constructs an initialization object initialized with the specified service factory.

Parameters:
configXML - Initialization data or null if the service does not have any configuration data.
Throws:
ServiceException - if unable to create a configuration.
java.lang.IllegalArgumentException - if invalid XML is specified.
See Also:
ServiceInitializationObject(InputSource)

ServiceInitializationObject

public ServiceInitializationObject(org.xml.sax.InputSource configXMLInputSource)
                            throws ServiceException,
                                   java.lang.IllegalArgumentException
Constructs an initialization object initialized with the specified service factory.

Parameters:
configXMLInputSource - Initialization data or null if the service does not have any configuration data.
Throws:
ServiceException - if unable to create a configuration.
java.lang.IllegalArgumentException - if an invalid input source is specified.
See Also:
ServiceInitializationObject(String)
Method Detail

createDocument

public final org.w3c.dom.Document createDocument(java.lang.Object config)
                                          throws InitializationException
Creates an XML document representation of the service configuration.

Parameters:
config - A String or InputSource that represents a service's XML configuration.
Returns:
XML document representation of the service's configuration.
Throws:
InitializationException

setInitializationObject

public final void setInitializationObject(java.lang.Object config)
                                   throws InitializationException
Sets the initialization object.

Parameters:
config - Configuration from which an XML document will be obtained that represents a service's configuration. A service's configuration is represented as a UTF-8 encoded XML document.

Supported object types are:

Throws:
InitializationException - if an invalid object is specified.

addConfiguration

public final void addConfiguration(java.lang.String configName,
                                   java.lang.String configXML)
                            throws InitializationException
Adds a configuration.

Parameters:
configName - Service configuration's name.
configXML - XML service configuration.
Throws:
InitializationException

addConfigurationDocument

public final void addConfigurationDocument(java.lang.String configName,
                                           org.w3c.dom.Document document)
                                    throws InitializationException
Adds a configuration.

Parameters:
configName - Service configuration's name.
document - XML document that represents the service's configuration.
Throws:
InitializationException

getInitializationObject

public final java.lang.Object getInitializationObject()
Gets an object used to configure the service.

Specified by:
getInitializationObject in interface InitializationObjectInterface
Returns:
Service's initialization data.

getConfigurations

public final java.util.List<ServiceConfigDocument> getConfigurations()
Gets a copy of the collection of the service's configurations.

Returns:
Collection of the service's configurations. Each list element will be of type ServiceConfigDocument.

getConfiguration

public final AbstractServiceComponentConfig getConfiguration(DocumentServiceConfigAdapterInterface adapter)
                                                      throws ServiceException
Gets a service configuration using the specified adapter to convert XML document to a service configuration.

Parameters:
adapter - Adapter used to translate an XML document into a service configuration.
Returns:
Service configuration or null if a configuration is not defined.
Throws:
ServiceException - if unable to create a configuration.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.