1 26 27 package org.objectweb.corba.generator.dependencies.lib; 28 29 import org.objectweb.openccm.ast.api.DeclarationKind; 31 import org.objectweb.openccm.ast.api.Declaration; 32 import org.objectweb.openccm.ast.api.CompositionDecl; 33 import org.objectweb.openccm.ast.api.ComponentDecl; 34 import org.objectweb.openccm.ast.api.HomeExecutorDecl; 35 import org.objectweb.openccm.ast.api.ExecutorDecl; 36 import org.objectweb.openccm.ast.api.SegmentDecl; 37 import org.objectweb.openccm.ast.utils.api.CompositionInfo; 38 import java.util.Set ; 39 40 41 48 49 public class CIDLDeclarationDependencies 50 extends IDL3DeclarationDependencies 51 implements org.objectweb.corba.generator.dependencies.api.CIDLDeclarationDependencies 52 { 53 59 65 68 public 69 CIDLDeclarationDependencies() 70 { 71 super(); 73 } 74 75 81 87 94 public Set 95 getDeclarationDependencies(Declaration decl) 96 { 97 Set files = null; 98 99 files = new java.util.HashSet (); 100 101 if (decl.getDeclKind() == DeclarationKind.dk_composition) 102 { 103 files.addAll( getCompositionDependencies((CompositionDecl) decl) ); 104 } 105 else if (decl.getDeclKind() == DeclarationKind.dk_home_executor) 106 { 107 files.addAll( getHomeExecutorDependencies((HomeExecutorDecl) decl) ); 108 } 109 else if (decl.getDeclKind() == DeclarationKind.dk_executor) 110 { 111 files.addAll( getExecutorDependencies((ExecutorDecl) decl) ); 112 } 113 else if (decl.getDeclKind() == DeclarationKind.dk_proxy_home) 114 { 115 } 117 else if (decl.getDeclKind() == DeclarationKind.dk_segment) 118 { 119 files.addAll( getSegmentDependencies((SegmentDecl) decl) ); 120 } 121 else 122 { 123 files.addAll( super.getDeclarationDependencies(decl, new java.util.HashSet ()) ); 125 } 126 135 136 return files; 137 } 138 139 146 public Set 147 getCompositionDependencies(CompositionDecl composition) 148 { 149 CompositionInfo comp = null; 150 Set files = null; 151 152 files = new java.util.TreeSet (); 153 comp = new org.objectweb.openccm.ast.utils.lib.CompositionInfo(composition); 154 155 files.addAll( getHomeExecutorDependencies(comp.getHomeExecutor()) ); 157 158 files.addAll( getExecutorDependencies(comp.getComponentExecutor()) ); 160 161 return files; 162 } 163 164 171 public Set 172 getHomeExecutorDependencies(HomeExecutorDecl home_exec) 173 { 174 Set files = null; 175 String path = null; 176 177 path = _translator.getAsDirectory(home_exec); 178 files = new java.util.TreeSet (); 179 180 addStantardIdlFiles(files, path + "CIF_" + home_exec.getName()); 182 addOperationsClass(files, path + "CIF_" + home_exec.getName()); 183 184 addObjectClass(files, path + home_exec.getName()); 186 187 files.addAll( getHomeDependencies( home_exec.getHomeType(), 189 new java.util.HashSet () ) 190 ); 191 192 return files; 193 } 194 195 202 public Set 203 getExecutorDependencies(ExecutorDecl exec) 204 { 205 Set files = null; 206 String path = null; 207 ComponentDecl comp = null; 208 HomeExecutorDecl home_exec = null; 209 Declaration[] decls = null; 210 211 path = _translator.getAsDirectory(exec.getParent()); 212 files = new java.util.TreeSet (); 213 214 addStantardIdlFiles(files, path + "CIF_" + exec.getName()); 216 addOperationsClass(files, path + "CIF_" + exec.getName()); 217 218 addStantardIdlFiles(files, path + "CIF_SegmentBase"); 220 addOperationsClass(files, path + "CIF_SegmentBase"); 221 222 addObjectClass(files, path + exec.getName()); 224 225 home_exec = (HomeExecutorDecl) exec.getParent(); 227 comp = home_exec.getHomeType().getManagedComponent(); 228 files.addAll( getComponentDependencies( comp, 229 new java.util.HashSet () ) 230 ); 231 232 decls = exec.getContents(true, DeclarationKind.dk_segment); 234 for (int i=0; i<decls.length; i++) 235 { 236 files.addAll( getSegmentDependencies((SegmentDecl) decls[i]) ); 237 } 238 239 return files; 240 } 241 242 249 public Set 250 getSegmentDependencies(SegmentDecl seg) 251 { 252 Set files = null; 253 String path = null; 254 255 path = _translator.getAsDirectory(seg.getParent().getParent()); 256 files = new java.util.TreeSet (); 257 258 addStantardIdlFiles(files, path + "CIF_" + seg.getName()); 260 addOperationsClass(files, path + "CIF_" + seg.getName()); 261 262 addObjectClass(files, path + seg.getName()); 264 265 return files; 266 } 267 268 274 } 275 | Popular Tags |