Tuesday, July 2, 2013

How to get the list of partitions of em using java - SOA 11g



The following java code will  get all the partitions available in em


public static ArrayList getPartitions(String host,String port,String username,String password) throws Exception
{
 System.out.println("Trying list all partitions in "+host);
  ArrayList partitions = new ArrayList();
    boolean found = false;

String contextFactory = "weblogic.jndi.WLInitialContextFactory";

String mbeanRuntime = "weblogic.management.mbeanservers.runtime";
String jmxProtoProviderPackages = "weblogic.management.remote";

String mBeanNamePartition = "oracle.soa.config:Application=soa-infra,j2eeType=FolderLifecycleConfig,name=soa-infra";
MBeanServerConnection mbsc = TestComposite.getMbeanServerConnection(host, port, username, password,mbeanRuntime,jmxProtoProviderPackages);


ObjectName mbeanpartition = new ObjectName(mBeanNamePartition);

Object FolderArray = mbsc.getAttribute(mbeanpartition, "Folders");
System.out.println("FolderArray ="+FolderArray);
Folder[] folderData = (Folder[]) FolderArray;
for (int i = 0; i < folderData.length; i++) {
System.out.println("Folder Data"+folderData[i].getName());
partitions.add(folderData[i].getName());
}


System.out.println("partitions size"+partitions.size());
return partitions;

}

No comments:

Post a Comment