1 26 27 package org.objectweb.openccm.ast.utils.lib; 28 29 import org.objectweb.openccm.ast.api.CompositionDecl; 31 import org.objectweb.openccm.ast.api.HomeDecl; 32 import org.objectweb.openccm.ast.api.HomeExecutorDecl; 33 import org.objectweb.openccm.ast.api.ProxyHomeDecl; 34 import org.objectweb.openccm.ast.api.ComponentDecl; 35 import org.objectweb.openccm.ast.api.ExecutorDecl; 36 import org.objectweb.openccm.ast.api.SegmentDecl; 37 import org.objectweb.openccm.ast.api.DeclarationKind; 38 import org.objectweb.openccm.ast.api.Declaration; 39 40 47 48 public class CompositionInfo 49 implements org.objectweb.openccm.ast.utils.api.CompositionInfo 50 { 51 57 58 private CompositionDecl composition_; 59 60 61 private HomeDecl home_; 62 63 64 private HomeExecutorDecl home_exec_; 65 66 67 private ProxyHomeDecl proxy_home_; 68 69 70 private ComponentDecl comp_; 71 72 73 private ExecutorDecl comp_exec_; 74 75 76 private SegmentDecl[] segments_; 77 78 84 89 public CompositionInfo(CompositionDecl composition) 90 { 91 Declaration[] decls = null; 92 93 composition_ = composition; 94 95 96 decls = composition.getContents(true, DeclarationKind.dk_home_executor); 97 home_exec_ = (HomeExecutorDecl) decls[0]; 99 100 101 decls = composition.getContents(true, DeclarationKind.dk_proxy_home); 102 proxy_home_ = null; 104 if (decls.length == 1) 105 { 106 proxy_home_ = (ProxyHomeDecl) decls[0]; 107 } 108 109 110 decls = home_exec_.getContents(true, DeclarationKind.dk_executor); 111 comp_exec_ = (ExecutorDecl) decls[0]; 113 114 115 comp_ = home_exec_.getHomeType().getManagedComponent(); 116 117 118 home_ = home_exec_.getHomeType(); 119 120 121 decls = comp_exec_.getContents(true, DeclarationKind.dk_segment); 122 segments_ = new SegmentDecl[decls.length]; 123 for (int i=0; i<decls.length; i++) 124 { 125 segments_[i] = (SegmentDecl)decls[i]; 126 } 127 } 128 129 135 141 146 public CompositionDecl 147 getComposition() 148 { 149 return composition_; 150 } 151 152 157 public HomeDecl 158 getHome() 159 { 160 return home_; 161 } 162 163 168 public HomeExecutorDecl 169 getHomeExecutor() 170 { 171 return home_exec_; 172 } 173 174 179 public ProxyHomeDecl 180 getProxyHome() 181 { 182 return proxy_home_; 183 } 184 185 190 public ComponentDecl 191 getComponent() 192 { 193 return comp_; 194 } 195 196 201 public ExecutorDecl 202 getComponentExecutor() 203 { 204 return comp_exec_; 205 } 206 207 212 public SegmentDecl[] 213 getSegments() 214 { 215 return segments_; 216 } 217 218 224 } 225 | Popular Tags |