|
| Services |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
java.lang.Object | +--com.sas.services.AbstractServiceComponentConfig
Abstract implementation of a foundation service component's configuration.
A concrete subclass must implement the following abstract methods:
getServiceFactoryClassName() to return the fully-qualified
name of the service factory's classgetConfig(Document serviceConfigDocument) to obtain a
service configuration from the specified XML document.appendDOM(Document document, AbstractServiceComponentConfig serviceConfig)
to create an XML representation of the service configuration.mergeConfig(ServiceComponent serviceComponent, Document serviceConfiguration)
to provide an implementation that can update the service component's configuration
by merging configuration data that is additive in nature (i.e. 0..* associations)mergeConfiguration(AbstractServiceComponentConfig currentConfig, AbstractServiceComponentConfig newConfig)validateServiceConfigurationCustom(Node serviceConfiguration)
to determine whether or not the specified service configuration is valid
| Field Summary | |
static String |
ENCODING
Service configurations are encoded using UTF-8. |
static String |
PROPERTY_NAME_INIT_DATA
The name of a Property used to represent the service's configuration data. |
static String |
PROPERTYROLE_INITIALIZATION
Value of a metdata StoredText's Role
attribute that designates that the text string is used for
initialization purposes. |
| Constructor Summary | |
protected |
AbstractServiceComponentConfig(String xmlDocument)
Constructs a default instance. |
protected |
AbstractServiceComponentConfig(String xmlDocument,
boolean isServiceConfigurationUpdateable)
Constructs an instance specifying whether or not a service manafactured by this factory has a configuration which may be updated in an additive manner. |
| Method Summary | |
protected abstract DocumentFragment |
appendDOM(Document document,
AbstractServiceComponentConfig serviceConfig)
Constructs a document object model representing the configuration data for a foundation service. |
protected abstract AbstractServiceComponentConfig |
getConfig(Document serviceConfigDocument)
Gets an object representing the service's configuration data obtained from the specified XML document. |
Document |
getDocument()
Gets an XML document representing the foundation service component's configuration. |
protected String[] |
getServiceClassIdentifiers()
Gets an the service's class identifiers that are valid for this configuration. |
static TextStore |
getServiceComponentConfigTextStore(ServiceComponent serviceComponent)
Gets the service component's configuration. |
String |
getServiceComponentConfiguration(ServiceComponent serviceComponent)
Gets the service component's configuration. |
static String |
getServiceComponentConfigurationFromTextStore(ServiceComponent serviceComponent)
Gets the service component's configuration from the service's text store. |
protected static Property |
getServiceConfigProperty(ServiceComponent serviceComponent)
Gets the service component's property that represents the service's configuration data. |
protected abstract String |
getServiceFactoryClassName()
Gets the service factory's fully-qualified Java class name. |
protected static Document |
getTextStoreServiceConfig(ServiceComponent serviceComponent)
Gets an XML document representation of the service's configuration. |
boolean |
isConfigurationUpdateable()
Determines whether or not a foundation services configuration may be updated in an additive manner. |
void |
mergeConfig(ServiceComponent serviceComponent,
Document serviceConfiguration)
Merges the service's configuration by adding new service configuration to the pre-existing configuration. |
void |
mergeConfigFromDocument(ServiceComponent serviceComponent,
Document serviceConfiguration)
Merges the service's configuration by adding new service configuration to the pre-existing configuration. |
void |
mergeConfigFromFile(ServiceComponent serviceComponent,
File file)
Updates the service's configuration by adding new service configuration read from the specified file to the service component's pre-existing configuration. |
protected abstract void |
mergeConfiguration(AbstractServiceComponentConfig currentConfig,
AbstractServiceComponentConfig newConfig)
Merges the new user service configuration into the current configuration. |
Document |
readServiceConfigFromFile(File file)
Read the service's configuration from the specified file. |
protected static void |
setTextStoreServiceConfig(ServiceComponent serviceComponent,
Document serviceConfigDocument)
Updates the service component's text store with the specified service configuration. |
protected void |
validateServiceComponent(ServiceComponent serviceComponent)
Determines whether or not the service component is valid. |
protected void |
validateServiceConfiguration(Node serviceConfiguration)
Determines whether or not the service configuration is valid for this service component. |
protected abstract void |
validateServiceConfigurationCustom(Node serviceConfiguration)
Determines whether or not the service configuration is valid for this service component. |
void |
writeServiceConfigToFile(File file,
ServiceComponent serviceComponent)
Write the service's configuration to the specified file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String ENCODING
public static final String PROPERTY_NAME_INIT_DATA
public static final String PROPERTYROLE_INITIALIZATION
StoredText's Role
attribute that designates that the text string is used for
initialization purposes. This value is "initialization"| Constructor Detail |
protected AbstractServiceComponentConfig(String xmlDocument)
Use this constructor if the service manufactured by the service factory does not permit is configuration to be updated in an additive manner.
Use AbstractServiceComponentConfig(String xmlDocument, boolean isServiceConfigurationUpdateable)
to construct an instance specifying whether or not the
service's configuration may be updated in an additive manner.
xmlDocument - The XML document used to represent the service component's configuration.IllegalArgumentException - if a null XML document
string is specified.
protected AbstractServiceComponentConfig(String xmlDocument,
boolean isServiceConfigurationUpdateable)
Use AbstractServiceComponentConfig(String xmlDocument)
to construct an instance of a factory which manufactures
a service whose configuration may not be updated in an additive manner.
xmlDocument - The XML document used to represent the service component's configuration.isServiceConfigurationUpdateable - true if the foundation service's configuration
may be updated by appending new configuration data which does not
conflict with the pre-existing configuration.IllegalArgumentException - if a null XML document
string is specified.| Method Detail |
protected static final Property getServiceConfigProperty(ServiceComponent serviceComponent)
throws ServiceException
serviceComponent - Service component whose configuration data property is desired.null if a property is not defined.ServiceException - if unable to query the service component's properties.public boolean isConfigurationUpdateable()
isConfigurationUpdateable in interface ServiceComponentConfigInterfacetrue if the foundation service's configuration
may be updated by appending new configuration data which does not
conflict with the pre-existing configuration.
protected final void validateServiceComponent(ServiceComponent serviceComponent)
throws ServiceConfigurationException,
IllegalArgumentException
serviceComponent - The service component whose configuration data is to be updated.ServiceConfigurationException - if an invalid service component is specified.IllegalArgumentException - if a null service component
is specified.
protected final void validateServiceConfiguration(Node serviceConfiguration)
throws ServiceException,
IllegalArgumentException
serviceConfiguration - The service component's configuration.ServiceException - if an invalid configuration is specified.IllegalArgumentException - if a null service configuration
is specified.protected String[] getServiceClassIdentifiers()
RemoteServiceInterface.CLASS_IDENTIFIER is employed.
public final void mergeConfigFromDocument(ServiceComponent serviceComponent,
Document serviceConfiguration)
throws ServiceException
A subclass should override this method if it allows configuration data to be merged into a pre-existing configuration.
serviceComponent - The service whose configuration is to be updated.serviceConfiguration - The service configuration to be added to the service's
current configuration. Note that only configuration data
that is additive in nature can be appended. Configuration
data that is non-additive will be ignored.ServiceException - if unable to update the service's configuration.IllegalArgumentException - if a null service component
or service configuration is specified.
protected abstract void mergeConfiguration(AbstractServiceComponentConfig currentConfig,
AbstractServiceComponentConfig newConfig)
throws ServiceConfigurationException,
IllegalArgumentException
currentConfig - The current configuration into which the new configuration is to be merged.newConfig - The new configuration which is to be merged into the current configuration.ServiceConfigurationException - if unable to merge the service configuration.IllegalArgumentException - if a null current or new configuration
is specified.
protected abstract DocumentFragment appendDOM(Document document,
AbstractServiceComponentConfig serviceConfig)
throws ServiceConfigurationException,
IllegalArgumentException
document - XML document to which the service's configuration is to be appended.serviceConfig - Service configuration which is to be converted to an XML document.null since no child document fragments are to be
added to the document.ServiceConfigurationException - if unable to create an XML representation
of the service's configuration.IllegalArgumentException - if a null document or
service configuration is specified.
protected abstract void validateServiceConfigurationCustom(Node serviceConfiguration)
throws ServiceException
serviceConfiguration - The service component's configuration.ServiceException - if an invalid configuration is specified.
public Document getDocument()
throws ServiceException
ServiceException - if unable to create a document.protected abstract String getServiceFactoryClassName()
protected abstract AbstractServiceComponentConfig getConfig(Document serviceConfigDocument)
throws ServiceConfigurationException,
IllegalArgumentException
serviceConfigDocument - Service configuration represented as an XML document.ServiceConfigurationException - if unable to obtain a configuration
from the specified XML document.IllegalArgumentException - if a null document is specified.
public void mergeConfig(ServiceComponent serviceComponent,
Document serviceConfiguration)
throws ServiceException
serviceComponent - The service whose configuration is to be merged with the
specified configuration.serviceConfiguration - The service configuration to be added to the service's
current configuration. Note that only configuration data
that is additive in nature can be appended. Configuration
data that is non-additive will be ignored.ServiceException - if unable to update the service's configuration.IllegalArgumentException - if a null service component
or service configuration is specified.
public void mergeConfigFromFile(ServiceComponent serviceComponent,
File file)
throws ServiceException
mergeConfigFromFile in interface ServiceComponentConfigInterfaceserviceComponent - The service whose configuration is to be updated.file - File containing the service configuration which is
to be added to the service component's current configuration.
Note that only configuration data
that is additive in nature can be appended. Configuration
data that is non-additive will be ignored.ServiceException - if unable to update the service's configuration.IllegalArgumentException - if a null service component
or file is specified.
public Document readServiceConfigFromFile(File file)
throws ServiceException
file - File to which the service's configuration is to be written
using UTF-8 encoding.ServiceException - if an exception was encountered persisting the
service's configuration to a file.IllegalArgumentException - if a null file is specified.
public void writeServiceConfigToFile(File file,
ServiceComponent serviceComponent)
throws ServiceException
writeServiceConfigToFile in interface ServiceComponentConfigInterfacefile - File to which the service's configuration is to be written
using UTF-8 encoding.serviceComponent - Service component whose configuration is to be written to the
specified file.ServiceException - if an exception was encountered persisting the
service's configuration to a file.IllegalArgumentException - if a null service component
or file is specified.
public String getServiceComponentConfiguration(ServiceComponent serviceComponent)
throws ServiceException
This implementation locates the service component's
property named PROPERTY_NAME_INIT_DATA, verifies
that the property's text role is PROPERTYROLE_INITIALIZATION,
and then obtains the property's stored text configuration.
If a service persists its configuration data in another manner, then this method should be overridden to provide an appropriate mechanism to obtain the service's configuration.
serviceComponent - Service whose configuration is to be obtained.ServiceException - if unable to obtain the service's configuration.
public static final String getServiceComponentConfigurationFromTextStore(ServiceComponent serviceComponent)
throws ServiceException
This implementation locates the service component's
property named PROPERTY_NAME_INIT_DATA, verifies
that the property's text role is PROPERTYROLE_INITIALIZATION,
and then obtains the property's stored text configuration.
serviceComponent - Service whose configuration is to be obtained.ServiceException - if unable to obtain the service's configuration.
public static final TextStore getServiceComponentConfigTextStore(ServiceComponent serviceComponent)
throws ServiceException
This implementation locates the service component's
property named PROPERTY_NAME_INIT_DATA, verifies
that the property's text role is PROPERTYROLE_INITIALIZATION,
and then obtains the property's stored text configuration.
If a service persists its configuration data in another manner, then this method should be overridden to provide an appropriate mechanism to obtain the service's configuration.
serviceComponent - Service whose configuration is to be obtained.ServiceException - if unable to obtain the service's configuration.
protected static Document getTextStoreServiceConfig(ServiceComponent serviceComponent)
throws ServiceException
PROPERTY_NAME_INIT_DATA.
A subclass should override this method if it does not persist its
configuration using the PROPERTY_NAME_INIT_DATA property of
the service component.
serviceComponent - The service component from which an XML document representation of
its configuration is to be obtained.ServiceException - if unable to obtain an XML document representation of
the service's configuration.
protected static final void setTextStoreServiceConfig(ServiceComponent serviceComponent,
Document serviceConfigDocument)
throws ServiceException
serviceComponent - Service component's whose text store is to be updated.serviceConfigDocument - Service's configuration data which will be used to update
the text store.ServiceException - if unable to update the text store.
|
| Services |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||