Index Changes
ESB Console Home

Test List Service Assemblies In Java

package org.glassfish.extended.management.sample.impl.runtime;

import com.sun.esb.management.api.runtime.RuntimeManagementService;
import com.sun.esb.management.common.ManagementRemoteException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.glassfish.openesb.extended.management.client.ExtendedManagementClient;
import org.glassfish.openesb.extended.management.client.ExtendedManagementClientFactory;
import org.glassfish.openesb.extended.management.common.ExtendedManagementRemoteException;
import org.glassfish.openesb.extended.management.common.jbi.ServiceAssemblyInfo;
import org.glassfish.openesb.extended.management.common.jbi.ServiceUnitInfo;
import org.glassfish.openesb.management.ServerConnectionFactory;

/**
 *
 * @author gopalan
 */
public class TestListServiceAssemblies {

    /**
     * @param args
     */
    public static void main(String[] args) {

        String hostName = ServerConnectionFactory.LOCALHOST, // "localhost";
                userName = ServerConnectionFactory.ADMIN_USERNAME, // "admin";
                password = ServerConnectionFactory.ADMINADMIN_PASSWORD; // "adminadmin";
        int portNumber = ServerConnectionFactory.RMI_ADMIN_PORT;        // 8686; 4848;
        String targetName = ServerConnectionFactory.SERVER_TARGET;      // "server";


        ExtendedManagementClient client = null;
        RuntimeManagementService runtimeManagementService = null;
        String listXML = "";
        List<ServiceAssemblyInfo> assemblyList = null;
        try {
            client = ExtendedManagementClientFactory.getInstance(hostName, portNumber, userName, password);
        } catch (ExtendedManagementRemoteException ex) {
            Logger.getLogger(TestListServiceAssemblies.class.getName()).log(Level.SEVERE, null, ex);
        }

        try {
            runtimeManagementService = client.getRuntimeManagementService();
        } catch (ManagementRemoteException ex) {
            Logger.getLogger(TestListServiceAssemblies.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            listXML = runtimeManagementService.listServiceAssemblies(targetName);
        } catch (ManagementRemoteException ex) {
            Logger.getLogger(TestListServiceAssemblies.class.getName()).log(Level.SEVERE, null, ex);
        }
        assemblyList = ServiceAssemblyInfo.readFromXmlTextWithProlog(listXML);
        for (ServiceAssemblyInfo element : assemblyList) {
            System.out.println("Assembly Name: " + element.getName());
            System.out.println("Assembly Description: " + element.getDescription());
            System.out.println("Assembly State: " + element.getState());
            List<ServiceUnitInfo> unitList = element.getServiceUnitInfoList();
            for (ServiceUnitInfo unitElement : unitList) {
                System.out.println("  Unit Name: " + unitElement.getName());
                System.out.println("  Unit Description: " + unitElement.getDescription());
                System.out.println("  Unit Deployed On: " + unitElement.getDeployedOn());
                System.out.println("  Unit State: " + unitElement.getState());
                System.out.println("");
            }
        }
    }
}






Number of visits: 12

JSPWiki v2.4.100
[RSS]
« Home Index Changes Prefs
This page (revision-1) was last changed on 13-Nov-09 08:27 AM, -0800 by Gopalan Suresh Raj