1 26 package org.objectweb.openccm.explorer.DCI; 27 28 import org.ist.coach.DCI.AssemblyManager; 29 import org.ist.coach.DCI.DCIDeployment; 30 import org.ist.coach.DCI.UnknownAssembly; 31 import org.objectweb.util.explorer.api.Context; 32 import org.objectweb.util.explorer.api.Entry; 33 import org.objectweb.util.explorer.core.naming.lib.DefaultEntry; 34 35 42 public class AssemblyUUIDContext 43 implements Context 44 { 45 46 49 protected String getName(AssemblyManager assemblyManager){ 50 String returnedValue = "Assembly "; 51 String assemblyId = assemblyManager.ass_id(); 52 if(assemblyId.indexOf(":")!=-1) 53 returnedValue = assemblyId.substring(0,assemblyId.indexOf(":")); 54 return returnedValue; 55 } 56 57 60 public Entry[] getEntries(Object object) { 61 AssemblyUUIDWrapper assemblyUUIDWrapper = (AssemblyUUIDWrapper)object; 62 DCIDeployment DCIDeploy = assemblyUUIDWrapper.getDCIDeployment(); 63 String assemblyUUID = assemblyUUIDWrapper.getUUID(); 64 java.util.List v = new java.util.Vector (); 65 66 try { 67 String [] instanceUUID = DCIDeploy.get_assembly_instances(assemblyUUID); 68 for (int i = 0; i < instanceUUID.length; i++) { 69 AssemblyManager assemblyManager = DCIDeploy.get_assembly_manager(instanceUUID[i]); 70 AssemblyManagerWrapperWithDCIDeployment am = new AssemblyManagerWrapperWithDCIDeployment(); 71 am.setAssemblyManager(assemblyManager); 72 am.setDCIDeployment(DCIDeploy); 73 am.setUUID(instanceUUID[i]); 74 v.add(new DefaultEntry(getName(assemblyManager) + " (" + (i+1) + ")", am)); 75 } 76 } catch (UnknownAssembly e) { 77 e.printStackTrace(); 78 } 79 80 return (Entry[]) v.toArray(new Entry[0]); 82 } 83 84 } 85 | Popular Tags |