Executing the Verification Scripts

Programmatically Managing SOA Composite Applications 10-3

10.3 Facade API Examples

This section provides several examples of using the Facade API to perform composite management. FaultRecoveryActionTy peConstants Provides action types such as terminating instances, marking a faulted activity as complete, storing the rejected message in a file, marking a faulted activity to be recovered, retrying an activity, and so on. FaultRecoveryResult Retrieves faults, errors, recoverable faults, nonrecoverable faults, and so on. FaultRecoveryServiceE ngine Provides the fault recovery service engine. ImportInfo Retrieves the location of the imported resource and the import type. InterfaceType Retrieves the callback interface and interface properties. Locator Exposes a method interface as an entry point for Facade API clients. Message Retrieves message details such as the component name, composite DN, content of the message, conversation ID, message storage location, message recoverable state, and so on. Partition Performs partitioning lifecycle management tasks such as starting, stopping, activating, and retiring all the composites in a partition. Property Retrieves property details such as the default value, name, override attribute value of the property, property value source, and so on. Reference Retrieves reference details such as the WSDL URL for the target service, properties for the reference, reference name, reference bindings, and so on. ReferenceInstance Retrieves the type of the binding. DN of the composite, composite instance ID, time of instance creation, and so on. ServerManager Gets and creates partitions. Service Retrieves service details such as bindings, composite DN, interface type, name, multiplicity, and so on. ServiceEngine Retrieves the list of deployed components in the service engine, engine type, and list of faults specified by the given fault filter. ServiceInstance Retrieves service instance details such as the type of the binding. DN of the composite, composite instance ID, time of creation, and so on. WebServiceBinding Retrieves the default address URI, endpoint address URI, port, transport type, and so on. WebServiceBindingPort Retrieves the port name, port URI, service name, and so on. WireInfo Retrieves the wire reference, wire service, source URI, and target URI. WSDLInterfaceBinding Retrieves the WSDL URL. Table 10–1 Cont. Facade API Interfaces Interface Description 10-4 Oracle Fusion Middleware Administrators Guide for Oracle SOA Suite and Oracle BPM Suite

10.3.1 Retrieving the State of a Composite

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, allowing call access invokecallback to the composite revision on or not allowing call access off. Use oracle.soa.management.facade.LocatorgetCompositecompositeDN 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

10.3.2 Finding Composite and Component Instances

You can find composite and component instances with the Facade API. Use the Locator interface to find a Composite locator.lookupCompositecompositeDN. Note that 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. Composite composite = locator.lookupCompositedefaultOrderBookingComposite1.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.setMinCreationDatenew java.util.DateSystem.currentTimeMillis - 20000; Get composite instances by filter List compositeInstances = composite.getInstancesfilter; 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.getChildComponentInstancescInstanceFilter; for ComponentInstance compInstance : componentInstances { String compName = compInstance.getComponentName; long compInstanceId = compInstance.getId;