1 26 27 package org.objectweb.openccm.explorer.DCI; 28 29 import java.util.Vector ; 30 31 import org.ist.coach.DCI.AssemblyManager; 32 import org.ist.coach.DCI.DCIDeployment; 33 import org.ist.coach.DCI.DCIInformation; 34 import org.ist.coach.DCI.DCIManager; 35 import org.ist.coach.DCI.UnknownAssembly; 36 import org.objectweb.openccm.explorer.CORBA.TypageCORBA; 37 import org.objectweb.util.explorer.api.Table; 38 import org.objectweb.util.explorer.api.TreeView; 39 import org.objectweb.util.explorer.core.naming.lib.DefaultEntry; 40 import org.omg.Components.Deployment.Assembly; 41 42 49 public class DCIRunningAssembliesTable 50 implements Table 51 { 52 53 59 65 71 protected String getName(org.omg.CORBA.Object o) { 72 TypageCORBA tc = new TypageCORBA(o, org.objectweb.openccm.corba.TheORB.getORB()); 73 return tc.getTypeID(); 74 } 75 76 79 protected String getName(AssemblyManager assemblyManager){ 80 String returnedValue = "Assembly "; 81 String assemblyId = assemblyManager.ass_id(); 82 if(assemblyId.indexOf(":")!=-1) 83 returnedValue = assemblyId.substring(0,assemblyId.indexOf(":")); 84 return returnedValue; 85 } 86 87 protected boolean isStarted(AssemblyManager assemblyManager){ 88 Assembly assembly = assemblyManager.provide_assembly(); 89 return assembly.get_state().equals(org.omg.Components.Deployment.AssemblyState.INSERVICE); 90 } 91 92 98 101 public String [] getHeaders(TreeView treeView) { 102 return new String []{"Assemblies"}; 103 } 104 105 108 public Object [][] getRows(TreeView treeView) { 109 DCIManager DCIManager_ = (DCIManager)treeView.getSelectedObject(); 110 DCIInformation DCIInfo = DCIManager_.provide_dci_information(); 111 DCIDeployment DCIDeploy = DCIManager_.provide_dci_deployment(); 112 String [] assemblyUUIDs = DCIDeploy.get_assemblies(); 113 Vector values = new Vector (); 114 115 for (int i = 0; i < assemblyUUIDs.length; i++) { 116 try{ 117 String [] instanceUUID = DCIDeploy.get_assembly_instances(assemblyUUIDs[i]); 118 for (int j = 0; j < instanceUUID.length; j++) { 119 AssemblyManager assemblyManager = DCIDeploy.get_assembly_manager(instanceUUID[j]); 120 AssemblyManagerWrapperWithDCIDeployment am = new AssemblyManagerWrapperWithDCIDeployment(); 121 am.setAssemblyManager(assemblyManager); 122 am.setDCIDeployment(DCIDeploy); 123 am.setUUID(instanceUUID[j]); 124 if(isStarted(assemblyManager)) 125 values.add(new DefaultEntry(getName(assemblyManager) + " (" + (j+1) + ")", am)); 126 } 127 } catch (UnknownAssembly e) { 128 e.printStackTrace(); 129 } 130 } 131 132 Object [][] contenu = new Object [values.size()][1]; 133 for(int i=0 ; i<values.size() ; i++){ 134 contenu[i][0] = values.get(i); 135 } 136 137 return contenu; 138 } 139 } 140 | Popular Tags |