Note:

Extension of the classes in this package is prohibited unless otherwise documented. Similarly, extension or implementation of the interfaces in this package is prohibited except as documented.

Package com.sas.services.deployment.ioc


@CodeSet("sas.platform") @SASScope("ALL") package com.sas.services.deployment.ioc

This subsystem provides a utility to create and customize a deployment descriptor file for inversion of control containers.

Overview

SAS Foundation Services which are configured to be accessed locally within a JVM may be deployed in the following inversion of control containers:

  • Create a Deployment Configuration
  • Reconfigure a Deployment Configuration
  • Deploy SAS Foundation Services in a container

Create a Deployment Configuration

The Foundation Services Manager plug-in to the SAS Management Console provides a capability to export a services deployment to a container deployment file. If the deployment contains a service which can be accessed by a remote client, then a client deployment file will also be created.

Export services deployment to a container deployment file.

A wizard will prompt one to specify the following information.

  1. which services are to be deployed
    • all services
    • selected groups of services
  2. source from which services configuration data is to be queried
    • SAS Metadata Server
      • host
      • port
      • repository name
      • user logon ID
      • user logon password
    • URL to an services deployment XML file which has been exported from a SAS Metadata Server
      • URL to the exported services deployment XML file
  3. the output file

Reconfigure a Deployment Configuration

The utility provides a capability to reconfigure a container deployment file using a properties file that contains the name of a configuration property and the value that is to be substituted.

Deploying Beans in a Spring Framework container

To deploy services in a Spring Framework container, one must:

  1. install the spring-beans.xml file
  2. deploy the beans using the container

The following code example shows how an application can deploy services beans in a Spring Framework container.

Code Example: Deploy Services in a Spring Framework container
   package com.sas.xxx;
   import org.springframework.context.support.AbstractApplicationContext;
   import org.springframework.context.support.ClassPathXmlApplicationContext;
   import com.sas.services.discovery.DiscoveryService;
   import com.sas.services.discovery.ServiceTemplate;
   import com.sas.services.information.InformationServiceInterface;
   ...
   /**
    * Deploy foundation services defined in a beans file located in this package.
    * 
    * @param args
    *        The first argument specifies the name of the beans .xml file,
    *        located in package com.sas.xx of this .jar,
    *        that is to be deployed in the container.
    */
   pulic void test (String[] args) {
      // bootstrap the container
      String beansFile = args[0];
      FindServiceInterface discoveryService = deployServices(beansFile);
      if (discoveryService != null) {
         // use services which were deployed as beans within the container
         useDeployedServices(discoveryService);
      }
      
   }
   /**
    * Deploy foundation services defined in a beans file located in this package.
    *
    * @param beansFile 
    *        Name of the beans .xml file,
    *        located in package com.sas.xx of this .jar,
    *        that is to be deployed in the container.
    *
    * @return Discovery service which was deployed by the container.
    */
   public FindServiceInterface deployServices (String beansFile) {
       FindServiceInterface discoveryService = null;
       // define an application context for a beans file which is located
       // in the same place as this class
       AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(
          beansFile,
          getClass());
       ctx.registerShutdownHook();
       String beanName = DiscoveryService.class.getName();
       if (ctx.containsBean(beanName)) {
          discoveryService = DiscoveryServiceInterface discoverySvc = (DiscoveryServiceInterface) 
             ctx.getBean(
                beanName, 
                DiscoveryService.class);
       }
       return discoveryService;
    }
    /**
     * Use the discovery service to locate other services.
     * 
     * @param discoveryService
     *        Discovery service which can be used to locate other services by type.
     */
    public void useDeployedServices (FindServiceInterface discoveryService) {
       // you can now use the local DiscoveryService to locate
       // any services which were deployed in the container
       // (e.g. find the Information Service)
       ServiceTemplate serviceTemplate = new ServiceTemplate(
          new class[] {
             InformationServiceInterface.class
          });
       InformationServiceInterface informationService =
          (InformationServiceInterface) discoveryService.findService(
             serviceTemplate);
   }
 

References

  • Classes
    Class
    Description
    Factory used to create a DeploymentDescriptorContext which may be used to define a descriptor for foundation services which are to be deployed in a particular type of container.
    Context that describes how to query SAS Foundation Services metadata that is persisted in a SAS Metadata Repository.
    Context used to describes how to query SAS Foundation Services metadata using a URL that references a services deployment file that has been exported from a SAS Metadata Server.