1 26 package org.objectweb.openccm.explorer.Components; 27 28 29 import org.omg.Components.CCMObject; 30 import org.omg.Components.ComponentPortDescription; 31 import org.omg.Components.FacetDescription; 32 import org.omg.Components.ReceptacleDescription; 33 import org.omg.Components.ConsumerDescription; 34 import org.omg.Components.EmitterDescription; 35 import org.omg.Components.PublisherDescription; 36 import org.objectweb.openccm.explorer.CORBA.CORBAContext; 37 import org.objectweb.util.explorer.api.Entry; 38 import org.objectweb.util.explorer.core.naming.lib.DefaultEntry; 39 40 48 public class ComponentContext 49 extends CORBAContext { 50 51 57 63 69 75 public Entry[] getEntries(Object object) { 76 CCMObject component = (CCMObject)object; 77 78 ComponentPortDescription cpd = ((CCMObject)component).get_all_ports(); 79 java.util.List v = new java.util.Vector (); 80 81 Entry[] attributes = super.getEntries(object); 82 for (int i = 0; i < attributes.length; i++) 83 v.add(attributes[i]); 84 85 FacetDescription[] fd = cpd.facets; 86 for (int i = 0; i < fd.length; i++) 87 v.add(new DefaultEntry(fd[i].name, fd[i])); 88 89 ConsumerDescription[] cd = cpd.consumers; 90 for (int i = 0; i < cd.length; i++) 91 v.add(new DefaultEntry(cd[i].name, cd[i])); 92 93 ReceptacleDescription[] rd = cpd.receptacles; 94 for (int i = 0; i < rd.length; i++) { 95 ReceptacleContainer rc = new ReceptacleContainer(); 96 rc.setComponent((CCMObject)component); 97 rc.setReceptacle(rd[i]); 98 v.add(new DefaultEntry(rd[i].name, rc)); 99 } 100 101 EmitterDescription[] ed = cpd.emitters; 102 for (int i = 0; i < ed.length; i++) { 103 EmitterContainer ec = new EmitterContainer(); 104 ec.setComponent((CCMObject)component); 105 ec.setEmitter(ed[i]); 106 v.add(new DefaultEntry(ed[i].name, ec)); 107 } 108 109 PublisherDescription[] pd = cpd.publishers; 110 for (int i = 0; i < pd.length; i++) { 111 PublisherContainer pc = new PublisherContainer(); 112 pc.setComponent((CCMObject)component); 113 pc.setPublisher(pd[i]); 114 v.add(new DefaultEntry(pd[i].name, pc)); 115 } 116 117 return (Entry[]) v.toArray(new Entry[0]); 118 } 119 120 } 121 | Popular Tags |