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.util.explorer.api.Table; 37 import org.objectweb.util.explorer.api.TreeView; 38 import org.objectweb.util.explorer.core.naming.lib.DefaultEntry; 39 40 47 public class DCIInstalledAssembliesTable 48 implements Table 49 { 50 51 57 63 69 72 protected String getName(AssemblyManager assemblyManager){ 73 String returnedValue = "Assembly "; 74 String assemblyId = assemblyManager.ass_id(); 75 if(assemblyId.indexOf(":")!=-1) 76 returnedValue = assemblyId.substring(0,assemblyId.indexOf(":")); 77 return returnedValue; 78 } 79 80 83 protected String getName(String assemblyUUID){ 84 String returnedValue = "Assembly "; 85 if(assemblyUUID!=null && assemblyUUID.indexOf(":")!=-1) 86 returnedValue = assemblyUUID.substring(0,assemblyUUID.indexOf(":")) + " Assembly"; 87 return returnedValue; 88 } 89 90 96 99 public String [] getHeaders(TreeView treeView) { 100 return new String []{"Model","Assemblies"}; 101 } 102 103 106 public Object [][] getRows(TreeView treeView) { 107 DCIManager DCIManager_ = (DCIManager)treeView.getSelectedObject(); 108 DCIInformation DCIInfo = DCIManager_.provide_dci_information(); 109 DCIDeployment DCIDeploy = DCIManager_.provide_dci_deployment(); 110 String [] assemblyUUIDs = DCIDeploy.get_assemblies(); 111 112 Vector values = new Vector (); 113 for (int i = 0; i < assemblyUUIDs.length; i++){ 114 try{ 116 String [] instanceUUID = DCIDeploy.get_assembly_instances(assemblyUUIDs[i]); 117 if(instanceUUID.length>0){ 118 boolean isFirst = true; 119 for (int j = 0; j < instanceUUID.length; j++) { 120 AssemblyManager assemblyManager = DCIDeploy.get_assembly_manager(instanceUUID[j]); 121 AssemblyManagerWrapperWithDCIDeployment am = new AssemblyManagerWrapperWithDCIDeployment(); 122 am.setAssemblyManager(assemblyManager); 123 am.setDCIDeployment(DCIDeploy); 124 am.setUUID(instanceUUID[j]); 125 if(isFirst){ 126 isFirst = false; 127 values.add(new Object []{new DefaultEntry(getName(assemblyUUIDs[i]) + " (" + (i+1) + ")", new AssemblyUUIDWrapper(assemblyUUIDs[i],DCIDeploy)), new DefaultEntry(getName(assemblyManager) + " (" + (j+1) + ")", am)}); 128 } else { 129 values.add(new Object []{null,new DefaultEntry(getName(assemblyManager) + " (" + (j+1) + ")", am)}); 130 } 131 } 132 } else { 133 values.add(new Object []{new DefaultEntry(getName(assemblyUUIDs[i]) + " (" + (i+1) + ")", new AssemblyUUIDWrapper(assemblyUUIDs[i],DCIDeploy)),null}); 134 } 135 } catch (UnknownAssembly e) { 136 e.printStackTrace(); 137 } 138 } 139 140 Object [][] contenu = new Object [values.size()][2]; 141 for(int i=0 ; i<values.size() ; i++){ 142 contenu[i] = (Object [])values.get(i); 143 } 144 145 return contenu; 146 } 147 } 148 | Popular Tags |