Wednesday, September 28, 2011

Manage SOA Composites with Fusion Middleware Java API

You can programmatically manage your SOA composite applications during runtime with the Facades API. The Facades API is part of Oracle SOA Suite's Infrastructure Management Java API. The Facades API exposes operations and attributes of composites, components, services, references and so on. The Facades 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 an entry point for Facades API clients.

Getting the Locator Information
            Hashtable jndiProps = new Hashtable();
         jndiProps.put(Context.PROVIDER_URL,
                          "t3://" + "hostname" + ':' + "portNumber" + "/soa-infra");
         jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,
                          "weblogic.jndi.WLInitialContextFactory");
         jndiProps.put(Context.SECURITY_PRINCIPAL, "weblogic");
         jndiProps.put(Context.SECURITY_CREDENTIALS, "welcome1");
         jndiProps.put("dedicated.connection", "true");
         locator = LocatorFactory.createLocator(jndiProps);
 


 
Getting the Composite Details

            Composite composite = locator.lookupComposite("poc/CompositeName!1.0");
            CompositeInstanceFilter filter = new CompositeInstanceFilter();
            List <CompositeInstance> obInstances = composite.getInstances(filter);
            // for each of the returned composite instances..
            for (CompositeInstance instance : obInstances) {
                System.out.println(" DN: " + instance.getCompositeDN() +
                                   "Instance: " + instance.getId() +
                                   " creation-date: " +
                                   instance.getCreationDate() + " state (" +
                                   instance.getState() + "): " +
                                   getStateAsString(instance.getState()));

                // setup a component filter
                ComponentInstanceFilter cInstanceFilter =
                    new ComponentInstanceFilter();

                // get child component instances ..
                List <ComponentInstance> childComponentInstances =
                    instance.getChildComponentInstances(cInstanceFilter);

                // for each child component instance (e.g. a bpel process)
                for (ComponentInstance cInstance : childComponentInstances) {
                    System.out.println(" -> componentinstance: " +
                                       cInstance.getComponentName() +
                                       " type: " +
                                       cInstance.getServiceEngine().getEngineType() +
                                       " state: " +
                                       getStateAsString(cInstance.getState()));
                }

                // retrieve composite sensors
                List <SensorData> sensorData = instance.getSensorData();
                for (SensorData data : sensorData) {
                    System.out.println(" -> Sensor: " +
                                       data.getSensor().getName() + " data: " +
                                       data.getData());
                }
            }


For questions, comments and feedback  please contact:
 Harvinder Singh Saluja

1 comment:

  1. How can I get from reference to service so i can move from instance to instance returning all audit trails

    ReplyDelete

SOA Cloud 12c GIT Repository

When a project is created, you can choose to initialize the project with one project Git repository for the project. A Maven repository is a...