All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Foundation |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

*** This class provides Binary Compatibility only, not Source Compatibility ***

## com.sas.services.deployment
Class AbstractDeploymentStrategy

    com.sas.services.deployment.AbstractDeploymentStrategy

All Implemented Interfaces:
  DeploymentStrategyInterface

    public abstract class AbstractDeploymentStrategy

implements DeploymentStrategyInterface

The class `DeploymentDescriptorStrategy` is the abstract superclass of classes representing strategies.

## Creating a Deployment File

A SAS Foundation Services deployment may be exported from a SAS Metadata Server to a deployment file where each SAS Foundation Service will be represented as a bean. Service configurations may be queried from either a SAS Metadata Server or from a URL that designates a services deployment XML file which has been exported from a Server.

### Example 1: Create a Deployment File

This example creates a deployment file by representing a SAS Foundation Services deployment as beans within a container deployment file.

Code Example: Create a deployment file

###

###

       import com.sas.metadata.SoftwareComponent;

       // configure a deployment context (OMRDeploymentContext or URLDeploymentContext)
       DeploymentContext context = createDeploymentContext();

       // the file to which the beans are to be written
       File file = getOutputFile();

       // the SAS Foundation Services deployment that is to be
       // represented as beans in the file
       SoftwareComponent softwareComponent = getSoftwareComponent();

       // create a file that represents SAS Foundation Services
       // for the specified services deployment (i.e. SoftwareComponent)
       // using the strategy obtained from the configured context
       DeploymentDescriptorStrategy strategy = context.getStrategy();

       strategy.createFile(
          softwareComponent,
          file);

     Reconfiguring a XML file

     A deployment file may be reconfigured by specifying substitution
     properties and invoking the reconfigure method on a configured strategy object.

     Code samples are provided for the following substitution scenarios. Refer to
     the documentation for
     OMRDeploymentContext and
     URLDeploymentContext
     for a summary of valid properties for each type of deployment context.

     URL to the exported services deployment XML file
     Metadata Server host and port
     Metadata Server repository name
     Metadata Server user ID and password
     SoftwareComponent (services deployment) name

     Example 2: Reconfigure the URL specified in a Deployment File

     This example reconfigures a deployment file that is configured
     to query its services configurations from a URL.

       Code Example: Reconfigure the URL specified in a deployment file

###

       // specify the file that contains beans which are to be reconfigured
       File inputFile = getInputFile();

       // specify the file to which the reconfigured beans should be written
       File outputFile = getOutputFile();

       // define properties and values which should be substituted
       Properties properties = new Properties();
       properties.put(
          MetadataSourceFactory.PROPERTY_URL,
          "file:///C:/xxx/local_services_NEW.xml");

       strategy.reconfigure(
          properties,
          inputFile,
          outputFile);

     Example 3: Reconfigure the host and port specified in a Deployment File

     This example reconfigures a deployment file to change the host and port
     for the SAS Metadata Server.

       Code Example: Reconfigure the host and port specified in a deployment file

###

       // specify the file that contains beans which are to be reconfigured
       File inputFile = getInputFile();

       // specify the file to which the reconfigured beans should be written
       File outputFile = getOutputFile();

       // define properties and values which should be substituted
       Properties properties = new Properties();
       properties.put(
          MetadataSourceFactory.PROPERTY_METADATASERVER_HOST,
          "com.newhost");
       properties.put(
          MetadataSourceFactory.PROPERTY_METADATASERVER_PORT,
          "9999");

       strategy.reconfigure(
          properties,
          inputFile,
          outputFile);

     Example 4: Reconfigure the SoftwareComponent specified in a Deployment File

     This example reconfigures a deployment file to change the SoftwareComponent
     (i.e. the SAS Foundation Services deployment).

       Code Example: Reconfigure the SoftwareComponent specified in a deployment file

###

       // specify the file that contains beans which are to be reconfigured
       File inputFile = getInputFile();

       // specify the file to which the reconfigured beans should be written
       File outputFile = getOutputFile();

       // define properties and values which should be substituted
       Properties properties = new Properties();
       properties.put(
          MetadataSourceFactory.PROPERTY_SOFTWARECOMPONENT,
          "New Local Services");

       strategy.reconfigure(
          properties,
          inputFile,
          outputFile);

     Example 5: Reconfigure the SAS Metadata Repository specified in a Deployment File

     This example reconfigures a deployment file to change the SAS Metadata Repository
     (i.e. the SAS Foundation Services deployment).

       Code Example: Reconfigure the SAS Metadata Repository specified in a deployment file

###

       // specify the file that contains beans which are to be reconfigured
       File inputFile = getInputFile();

       // specify the file to which the reconfigured beans should be written
       File outputFile = getOutputFile();

       // define properties and values which should be substituted
       Properties properties = new Properties();
       properties.put(
          MetadataSourceFactory.PROPERTY_METADATASERVER_REPOSITORY,
          "New Foundation Repository");

       strategy.reconfigure(
          properties,
          inputFile,
          outputFile);

     Example 6: Reconfigure the user ID and password specified in a Deployment File

     This example reconfigures a deployment file to change the user ID and password.

       Code Example: Reconfigure the user ID and password specified in a deployment file

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

       // specify the file that contains beans which are to be reconfigured
       File inputFile = getInputFile();

       // specify the file to which the reconfigured beans should be written
       File outputFile = getOutputFile();

       // define properties and values which should be substituted
       Properties properties = new Properties();
       properties.put(
          MetadataSourceFactory.PROPERTY_METADATASERVER_USERID,
          "NewUserID");
       properties.put(
          MetadataSourceFactory.PROPERTY_METADATASERVER_USERPASSWORD,
          "NewUserPassword");

       strategy.reconfigure(
          properties,
          inputFile,
          outputFile);

    Since:
      9.2

    Constructor Summary

    AbstractDeploymentStrategy(java.util.Properties properties)

              Constructs a deployment strategy for the specified properties.

    Method Summary

    protected  void
    configureBuilder(javax.xml.parsers.DocumentBuilder builder)

              A subclass should implement this method if it needs to
     configure the document builder.

    protected abstract  void
    configureDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory factory)

              Configures the document builder factory.

    protected  org.w3c.dom.Document
    createClientDocument(java.util.Map configProperties)

              Creates an XML document that represents a deployment a client would
     use to access foundation services which have been deployed in a
     remote JVM.

    protected abstract  org.w3c.dom.Element
    createDiscoveryServiceBean(org.w3c.dom.Document document)

              Creates an XML element representing the Discovery Service bean and
     adds it to the document.

    protected  org.w3c.dom.Document
    createDocument()

              Creates an XML document representing SAS Foundation services
     beans that are to be deployed in an IOC container.

    protected abstract  org.w3c.dom.Document
    createDocument(javax.xml.parsers.DocumentBuilder builder)

              Creates an XML document using the specified document builder.

     org.w3c.dom.Document
    createDocument(com.sas.metadata.remote.SoftwareComponent softwareComponent,
                   java.util.Map configProperties)

              Creates an XML document representing SAS Foundation services
     beans that are to be deployed in an IOC container.

     void
    createFile(com.sas.metadata.remote.SoftwareComponent softwareComponent,
               java.io.File file)

              Creates a deployment file which represents SAS Foundation Services as
     beans which can be deployed in an Inversion of Control (IOC) container.

     void
    createFiles(com.sas.metadata.remote.SoftwareComponent softwareComponent,
                java.io.File file,
                java.io.File clientFile)

              Creates deployment files which represents SAS Foundation Services as
     beans which can be deployed and looked up by applications using
     an Inversion of Control (IOC) container.

    protected abstract  void
    createServiceBeans(org.w3c.dom.Document document,
                       com.sas.metadata.remote.SoftwareComponent softwareComponent,
                       java.util.Map configProperties)

              Creates beans representing the service components.

    protected abstract  void
    createServiceConfigFactory(org.w3c.dom.Document document)

              Creates an XML element representing a factory which can be used
     to create service configurations.

    protected  java.lang.String
    getBeanIdService(com.sas.metadata.remote.CMetadata cMetadata)

              Gets the ID for the service that is to be represented as a bean.

    protected static java.lang.String
    getBeanNameConnection()

              Gets the name of the bean that represents the connection.

    protected static java.lang.String
    getBeanNameConnectionFactory()

              Gets the name of the bean that represents the connection factory.

    protected static java.lang.String
    getBeanNameDiscoveryService()

              Gets the name of the bean the represents the discovery service.

    protected  java.lang.String
    getBeanNameMetadataSource()

              Gets the name of the bean that represents the metadata source.

    protected  java.lang.String
    getBeanNameMetadataSourceProperties()

              Gets the name of the bean that represents the configuration
     for the metadata source.

    protected static java.lang.String
    getBeanNameRMIConfiguration()

              Gets the name of the bean the represents the RMIConfiguration bean.

    protected static java.lang.String
    getBeanNameRMIRegistry()

              Gets the name of the bean the represents the RMIRegistry bean.

    protected static java.lang.String
    getBeanNameRMIRegistryDiscoveryService()

              Gets the bean name "com.sas.services.discovery.RegistryDiscoveryService"
     representing a discovery service which can locate foundation services
     which have been bound to an RMI registry.

    protected  java.lang.String
    getBeanNameService(com.sas.metadata.remote.CMetadata cMetadata)

              Gets the name for the service that is to be represented as a bean.

    protected  java.lang.String
    getBeanNameServiceConfigFactory()

              Gets the name of the bean that represents the connection.

    protected  java.lang.String
    getBeanNameServiceMetadataFactory()

              Gets the name of the bean that represents the factory which
     processes the configuration properties to determine the
     object that will be used to query a service's configuration.

    protected static java.lang.String
    getBeanNameSSLRMISocketFactories()

              Gets the name of the bean the represents the SSLRMISocketFactories bean.

    protected static java.lang.String
    getMethodNameCreateService()

              Gets the method name "createService".

    protected static java.lang.String
    getMethodNameGetInstance()

              Gets the method name "getInstance".

    protected static java.lang.String
    getMethodNameGetRMIRegistry()

              Gets the method name "getRMIRegistry".

    protected  java.util.Properties
    getOutputFormatProperties(org.w3c.dom.Document document)

              Gets properties which will be used to configure an output format
     that employs indentation.

    protected  java.util.Properties
    getProperties()

              Gets the configuration properties which define the
     foundation services deployment.

     java.lang.String
    getProperty(java.lang.String key)

              Gets the value of the property associated with the specified key.

    protected  java.lang.String
    getReconfigurationXSLT()

              Gets an XSLT that can be used to reconfigure the services deployment.

     void
    reconfigure(java.util.Properties properties,
                java.io.File inputFile,
                java.io.File outputFile)

              Reconfigures the deployment using the specified properties that
     describe the services deployment.

     void
    setProperty(java.lang.String key,
                java.lang.String value)

              Sets a property for the specified key/value.

    protected abstract  void
    setServiceDependencies(org.w3c.dom.Document document,
                           org.w3c.dom.Element element,
                           com.sas.metadata.remote.ServiceComponent serviceComponent)

              Specify dependencies upon other services.

    protected  void
    writeFile(java.io.File file,
              java.lang.String xml)

              Writes the XML to the specified file using UTF-8 encoding.

    Constructor Detail

    AbstractDeploymentStrategy

    public AbstractDeploymentStrategy(java.util.Properties properties)

    Constructs a deployment strategy for the specified properties.

    Parameters:properties - Configuration properties.

    Method Detail

    createDocument

    public org.w3c.dom.Document createDocument(com.sas.metadata.remote.SoftwareComponent softwareComponent,
                                               java.util.Map configProperties)
                                        throws ServiceException

    Creates an XML document representing SAS Foundation services
     beans that are to be deployed in an IOC container.

    Parameters:softwareComponent - The SAS Foundation Services deployment.configProperties - Configuration properties.
    Returns:XML document representation of a foundation services deployment.
    Throws:
    ServiceException - if unable to create the document.

    createDocument

    protected org.w3c.dom.Document createDocument()
                                           throws ServiceException

    Creates an XML document representing SAS Foundation services
     beans that are to be deployed in an IOC container.

    Returns:XML document representation of a foundation services deployment.
    Throws:
    ServiceException - if unable to create the document.

    createFile

    public void createFile(com.sas.metadata.remote.SoftwareComponent softwareComponent,
                           java.io.File file)
                    throws ServiceException

    Creates a deployment file which represents SAS Foundation Services as
     beans which can be deployed in an Inversion of Control (IOC) container.}

    Specified by:createFile in interface DeploymentStrategyInterface

    Parameters:softwareComponent - The software component that represents a foundation services deployment.file - The output file to which the service deployment metadata will be written.
    Throws:
    ServiceException - if unable to create a document.

    createFiles

    public void createFiles(com.sas.metadata.remote.SoftwareComponent softwareComponent,
                            java.io.File file,
                            java.io.File clientFile)
                     throws ServiceException

    Creates deployment files which represents SAS Foundation Services as
     beans which can be deployed and looked up by applications using
     an Inversion of Control (IOC) container.}

    Specified by:createFiles in interface DeploymentStrategyInterface

    Parameters:softwareComponent - The software component that represents a foundation services deployment.file - The output file to which beans will be written describing a
            services deployment from the perspective of an
            application that is deploying the services.clientFile - The output file to which beans will be written describing a
            services deployment from the perspective of an
            application that is looking up remote services remotely.
    Throws:
    ServiceException - if unable to create a document.

    reconfigure

    public void reconfigure(java.util.Properties properties,
                            java.io.File inputFile,
                            java.io.File outputFile)
                     throws ServiceException

    Reconfigures the deployment using the specified properties that
     describe the services deployment.}

    Specified by:reconfigure in interface DeploymentStrategyInterface

    Parameters:properties - Properties whose values should be substituted in order
            to reconfigure the deployment.inputFile - The input file containing the deployment which is to be reconfigured.outputFile - The output file to which the reconfigured deployment will
            be written.
    Throws:
    ServiceException - if unable to reconfigure the deployment file.

    getOutputFormatProperties

    protected java.util.Properties getOutputFormatProperties(org.w3c.dom.Document document)

    Gets properties which will be used to configure an output format
     that employs indentation.

    Parameters:document - Document which will be output.
    Returns:Output format properties.See Also:OutputKeys

    getProperties

    protected final java.util.Properties getProperties()

    Gets the configuration properties which define the
     foundation services deployment.

    Returns:Configuration properties which define the foundation services deployment.
     An Properties object containing no elements will be returned if no properties
     are configured.

    setProperty

    public final void setProperty(java.lang.String key,
                                  java.lang.String value)

    Sets a property for the specified key/value.

    Parameters:key - Key which will be used to lookup a value.value - Value associated with the key.

    getProperty

    public final java.lang.String getProperty(java.lang.String key)

    Gets the value of the property associated with the specified key.

    Parameters:key - Key used to lookup a property.
    Returns:Value associated with the key or null.

    writeFile

    protected final void writeFile(java.io.File file,
                                   java.lang.String xml)
                            throws ServiceException

    Writes the XML to the specified file using UTF-8 encoding.

    Parameters:file - Output file.xml - XML that is to be written to the file.
    Throws:
    ServiceException - if unable to write the XML to the file.

    createClientDocument

    protected org.w3c.dom.Document createClientDocument(java.util.Map configProperties)
                                                 throws ServiceException

    Creates an XML document that represents a deployment a client would
     use to access foundation services which have been deployed in a
     remote JVM.

    Parameters:configProperties - Properties that describe how a client configuration for
            remotely accessing a discovery service.
    Returns:XML document representing the services a client would use
     to access the remotely accessible foundation services or null
     if creation of a client document is unsupported.
    Throws:
    ServiceException - if unable to create the client document.

    getBeanNameConnectionFactory

    protected static java.lang.String getBeanNameConnectionFactory()

    Gets the name of the bean that represents the connection factory.

    Returns:Name of the bean that represents the connection factory.

    getBeanNameConnection

    protected static final java.lang.String getBeanNameConnection()

    Gets the name of the bean that represents the connection.

    Returns:Name of the bean that represents the connection.

    getBeanNameServiceConfigFactory

    protected java.lang.String getBeanNameServiceConfigFactory()

    Gets the name of the bean that represents the connection.

    Returns:Name of the bean that represents the connection.

    getBeanNameServiceMetadataFactory

    protected java.lang.String getBeanNameServiceMetadataFactory()

    Gets the name of the bean that represents the factory which
     processes the configuration properties to determine the
     object that will be used to query a service's configuration.

    Returns:Name of the bean that represents the factory which
     processes the configuration properties to determine the
     object that will be used to query a service's configuration.

    getBeanNameMetadataSourceProperties

    protected java.lang.String getBeanNameMetadataSourceProperties()

    Gets the name of the bean that represents the configuration
     for the metadata source.

    Returns:Name of the bean that represents the configuration properties.

    getBeanNameMetadataSource

    protected java.lang.String getBeanNameMetadataSource()

    Gets the name of the bean that represents the metadata source.

    Returns:Name of the bean that represents the metadata source.

    getBeanNameSSLRMISocketFactories

    protected static final java.lang.String getBeanNameSSLRMISocketFactories()

    Gets the name of the bean the represents the SSLRMISocketFactories bean.

    Returns:Name of the bean that represents the SSLRMISocketFactories bean.

    getBeanNameRMIConfiguration

    protected static final java.lang.String getBeanNameRMIConfiguration()

    Gets the name of the bean the represents the RMIConfiguration bean.

    Returns:Name of the bean that represents the RMIConfiguration bean.

    getBeanNameRMIRegistry

    protected static final java.lang.String getBeanNameRMIRegistry()

    Gets the name of the bean the represents the RMIRegistry bean.

    Returns:Name of the bean that represents the RMIRegistry bean.

    getBeanNameDiscoveryService

    protected static final java.lang.String getBeanNameDiscoveryService()

    Gets the name of the bean the represents the discovery service.

    Returns:Name of the bean that represents the discovery service.

    getMethodNameGetInstance

    protected static final java.lang.String getMethodNameGetInstance()

    Gets the method name "getInstance".

    Returns:Method name "getInstance".

    getMethodNameCreateService

    protected static final java.lang.String getMethodNameCreateService()

    Gets the method name "createService".

     Each service factory must implement the following method.
     public static createService(com.sas.services.ServiceConfigurationInterface, com.sas.services.discovery.DiscoveryServiceInterface).

    Returns:Method name "createService".

    getMethodNameGetRMIRegistry

    protected static final java.lang.String getMethodNameGetRMIRegistry()

    Gets the method name "getRMIRegistry".

    Returns:Method name "getRMIRegistry".

    getBeanNameRMIRegistryDiscoveryService

    protected static final java.lang.String getBeanNameRMIRegistryDiscoveryService()

    Gets the bean name "com.sas.services.discovery.RegistryDiscoveryService"
     representing a discovery service which can locate foundation services
     which have been bound to an RMI registry.

    Returns:Bean name "com.sas.services.discovery.RegistryDiscoveryService".

    getBeanIdService

    protected java.lang.String getBeanIdService(com.sas.metadata.remote.CMetadata cMetadata)
                                         throws ServiceException

    Gets the ID for the service that is to be represented as a bean.

    Parameters:cMetadata - ServiceComponent metadata representing a service.
    Returns:Id of the bean that represents a service.
    Throws:
    ServiceException - if unable to determine the service's ID.

    getBeanNameService

    protected java.lang.String getBeanNameService(com.sas.metadata.remote.CMetadata cMetadata)
                                           throws ServiceException

    Gets the name for the service that is to be represented as a bean.

    Parameters:cMetadata - ServiceComponent metadata representing a service.
    Returns:Name of the bean that represents a service.
    Throws:
    ServiceException - if unable to determine the name of the service.

    configureBuilder

    protected void configureBuilder(javax.xml.parsers.DocumentBuilder builder)

    A subclass should implement this method if it needs to
     configure the document builder.

     This implementation registers
     a SAXErrorHandler which will log exceptions.

    Parameters:builder -

    setServiceDependencies

    protected abstract void setServiceDependencies(org.w3c.dom.Document document,
                                                   org.w3c.dom.Element element,
                                                   com.sas.metadata.remote.ServiceComponent serviceComponent)
                                            throws ServiceException

    Specify dependencies upon other services.

    Parameters:document - element - serviceComponent -
    Throws:
    ServiceException

    getReconfigurationXSLT

    protected java.lang.String getReconfigurationXSLT()

    Gets an XSLT that can be used to reconfigure the services deployment.

     A sub-class should must override this method in order to transform
     XML using XSLT.

    Returns:XSLT to reconfigure the services deployment or null
     if an XSLT is not used to reconfigure the deployment.

    configureDocumentBuilderFactory

    protected abstract void configureDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory factory)
                                                     throws ServiceException

    Configures the document builder factory.

    Parameters:factory - Document builder factory that is to be configured.
    Throws:
    ServiceException

    createDocument

    protected abstract org.w3c.dom.Document createDocument(javax.xml.parsers.DocumentBuilder builder)
                                                    throws ServiceException

    Creates an XML document using the specified document builder.

    Parameters:builder - Document builder.
    Returns:XML document.
    Throws:
    ServiceException - if unable to create an XML document.

    createDiscoveryServiceBean

    protected abstract org.w3c.dom.Element createDiscoveryServiceBean(org.w3c.dom.Document document)
                                                               throws ServiceException

    Creates an XML element representing the Discovery Service bean and
     adds it to the document.

    Parameters:document - XML document for which a document fragment should be created.
    Returns:Element representing the discovery service bean which has
     been added to the document.
    Throws:
    ServiceException - if unable to create a bean that represents
             the Discovery Service.

    createServiceConfigFactory

    protected abstract void createServiceConfigFactory(org.w3c.dom.Document document)
                                                throws ServiceException

    Creates an XML element representing a factory which can be used
     to create service configurations.

    Parameters:document - XML document for which a document fragment should be created.
    Throws:
    ServiceException - if unable to create a factory which can
             be used to create service configurations.

    createServiceBeans

    protected abstract void createServiceBeans(org.w3c.dom.Document document,
                                               com.sas.metadata.remote.SoftwareComponent softwareComponent,
                                               java.util.Map configProperties)
                                        throws ServiceException

    Creates beans representing the service components.

    Parameters:document - softwareComponent - configProperties -
    Throws:
    ServiceException

    ***  This class provides Binary Compatibility only, not Source Compatibility  ***

           All Libraries
           This Library
          Package
        Class
          Use
          Tree
          Deprecated
          Index
    		    Grand Index
          Help

      Foundation

     PREV CLASS
     NEXT CLASS

      FRAMES
     NO FRAMES

      SUMMARY: NESTED | FIELD | CONSTR | METHOD

    DETAIL: FIELD | CONSTR | METHOD

    Copyright © 2009 SAS Institute Inc. All Rights Reserved.