This subsystem provides a utility to create and customize a deployment descriptor file for inversion of control containers.
SAS Foundation Services which are configured to be accessed locally within a JVM may be deployed in the following inversion of control containers:
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.
A wizard will prompt one to specify the following information.
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.
To deploy services in a Spring Framework container, one must:
The following code example shows how an application can deploy services beans 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);
}
|