This chapter describes the Facade API, which exposes operations and attributes such as composites, components, services, and references for programmatically managing SOA composite applications during runtime. The Facade API is part of Oracle SOA Suite's Infrastructure Management Java API.
This chapter includes the following sections:
For more information about the Infrastructure Management Java API, see Oracle Fusion Middleware Infrastructure Management Java API Reference for Oracle SOA Suite.
You can programmatically manage your SOA composite applications during runtime with the Facade API. The Facade API is part of Oracle SOA Suite's Infrastructure Management Java API. The Facade API exposes operations and attributes of composites, components, services, references and so on. The Facade API provides an alternative to managing composites with Oracle Enterprise Manager Fusion Middleware Control.
The oracle.soa.management.facade.Locator
interface exposes a method interface as the top level entry point for most Facade APIs. The oracle.soa.management.facade.Locator
interface exposes a method, createConnection
, which returns a DirectConnection
to a composite. You can use the LocatorFactory
implementation to obtain the DirectConnection
. For more information about the LocatorFactory
and DirectConnection
, see section "Introduction to the Direct Binding Invocation API" of Oracle Fusion Middleware Developer's Guide for Oracle SOA Suite. The DirectConnection
and DirectConnectionFactory
(for creating direct binding connections) classes are in the oracle.soa.api.invocation
package.
Partition management APIs are not exposed by the Locator
. Instead, the top level entry point for partition management APIs is the ServerManager
. You use the ServerManagerFactory
implementation shown in Example 11-1 to create ServerManager
objects for managing the SOA server.
Example 11-1 ServerManagerFactory
ServerManagerFactory smf = ServerManagerFactory.getInstance(); Hashtable jndiProps = new Hashtable(); jndiProps.put(Context.PROVIDER_URL, "server_JNDI_provider_url"); jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "server_initial_context_factory_ classname"); jndiProps.put(Context.SECURITY_PRINCIPAL, "jndi_user"); jndiProps.put(Context.SECURITY_CREDENTIALS, "jndi_password"); ServerManager sm = smf.createInstance(jndiProps);
For more information about the Facade API, see Oracle Fusion Middleware Infrastructure Management Java API Reference for Oracle SOA Suite.
Note:
The Infrastructure Management Java API also includes the Direct Binding Invocation API for inbound invocation of SOA composite applications and outbound invocations of Oracle Service Bus (OSB) or another SOA composite application. For information on using the Direct Binding Invocation API, see Oracle Fusion Middleware Developer's Guide for Oracle SOA Suite.
Starting with 11g Release 1 (11.1.1.7), you must set the subject credential or have a valid subject established in the invocation context when creating the locator
object. Example 11-2 shows how to create a locator
object.
Example 11-2 Security Credentials for Creating the Locator Object
Hashtable<String, String> jndiProps = new Hashtable<String, String>(); jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,initialContextFactory); jndiProps.put(Context.PROVIDER_URL, providerURL); jndiProps.put(Context.SECURITY_PRINCIPAL, principal); jndiProps.put(Context.SECURITY_CREDENTIALS, creds); Locator locator = LocatorFactory.createLocator(jndiProps);
If you do not specify the user credentials with jndiProps.put
, a locator
object is created, but when this object is used to invoke a method in the locator
, a runtime exception is displayed because the caller does not have enough permissions to call the method:
Exception in thread "Main Thread" java.lang.RuntimeException
Table 11-1 provides an overview of the Facade API interfaces.
Table 11-1 Facade API Interfaces
This section provides several examples of using the Facade API to perform composite management.
You can retrieve the state of a composite with the Facade API.
Mode: active | retired
This setting decides whether new instances can be created (active) or old ones are allowed to finish without new ones being allowed to be created (retired).
State: on | off
This setting is the composite state and overrides the active or retired composite modes in either, which allows call access (invoke/callback) to the composite revision (on) or not allowing call access (off).
Use oracle.soa.management.facade.Locator#getComposite(compositeDN)
to get a reference to a composite of interest.
From the composite reference, you can query the mode and state using the following methods:
String
getMode()
String
getState()
You can find composite and component instances with the Facade API.
Use the Locator
interface to find a Composite
(locator.lookupComposite(compositeDN))
. If the composite has not yet been invoked, there are no instances.
You can then find its instances and get related information (for example, the instance ID, which components were executed, and so on).
Example 11-3 provides details.
Example 11-3 Finding Composite and Component Instances
Composite composite = locator.lookupComposite("default/OrderBookingComposite!1.0"); // The context is already the composite, so there is no need to set the DN as a filter criterion CompositeInstanceFilter filter = new CompositeInstanceFilter(); filter.setMinCreationDate(new java.util.Date((System.currentTimeMillis() - 20000))); // Get composite instances by filter List compositeInstances = composite.getInstances(filter); // for each of the returned composite instances.. for (CompositeInstance instance : compositeInstances) { long instanceId = instance.getId(); Date created = instance.getCreationDate(); String state = instance.getState(); // Configure a component instance filter ComponentInstanceFilter cInstanceFilter = new ComponentInstanceFilter (); // Get the child component instances List componentInstances = instance.getChildComponentInstances(cInstanceFilter); for (ComponentInstance compInstance : componentInstances) { String compName = compInstance.getComponentName(); long compInstanceId = compInstance.getId(); String type = compInstance.getServiceEngine().getEngineType(); // State values correspond to constants defined by the ComponentInstance interface int state = compInstance.getState(); } // Retrieve composite sensors List sensorData = instance.getSensorData(); }