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.ComponentDecl; 33 import org.objectweb.openccm.ast.api.HomeDecl; 34 import org.objectweb.openccm.ast.api.InterfaceDecl; 35 import org.objectweb.openccm.ast.api.InterfacePortDecl; 36 import org.objectweb.openccm.ast.api.EventPortDecl; 37 import org.objectweb.openccm.ast.api.TypeRef; 38 import org.objectweb.openccm.ast.api.TypeKind; 39 import org.objectweb.openccm.ast.api.EventDecl; 40 import org.objectweb.openccm.ast.api.OperationDecl; 41 import java.util.Set ; 42 43 44 51 52 public class IDL3DeclarationDependencies 53 extends IDL2DeclarationDependencies 54 implements org.objectweb.corba.generator.dependencies.api.IDL3DeclarationDependencies 55 { 56 62 68 71 public 72 IDL3DeclarationDependencies() 73 { 74 super(); 76 } 77 78 84 90 99 public Set 100 getHomeDependencies(HomeDecl home, 101 Set visited) 102 { 103 Set files = null; 104 String path = null; 105 InterfaceDecl[] bases = null; 106 107 if ( visited.contains(home) ) 109 { 110 return files; 111 } 112 else 113 { 114 visited.add(home); 116 } 117 118 path = _translator.getAsDirectory(home); 119 files = new java.util.HashSet (); 120 121 addStantardIdlFiles(files, path + "CCM_" + home.getName() + "Explicit"); 123 addOperationsClass(files, path + "CCM_" + home.getName() + "Explicit"); 124 addStantardIdlFiles(files, path + "CCM_" + home.getName() + "Implicit"); 125 addOperationsClass(files, path + "CCM_" + home.getName() + "Implicit"); 126 addStantardIdlFiles(files, path + "CCM_" + home.getName()); 127 addOperationsClass(files, path + "CCM_" + home.getName()); 128 129 130 addStantardIdlFiles(files, path + home.getName() + "Explicit"); 132 addOperationsClass(files, path + home.getName() + "Explicit"); 133 addPoaIdlFiles(files, path + home.getName() + "Explicit"); 134 addStubClass(files, path + home.getName() + "Explicit"); 135 addStantardIdlFiles(files, path + home.getName() + "Implicit"); 136 addOperationsClass(files, path + home.getName() + "Implicit"); 137 addPoaIdlFiles(files, path + home.getName() + "Implicit"); 138 addStubClass(files, path + home.getName() + "Implicit"); 139 addStantardIdlFiles(files, path + home.getName()); 140 addOperationsClass(files, path + home.getName()); 141 addPoaIdlFiles(files, path + home.getName()); 142 addStubClass(files, path + home.getName()); 143 144 addObjectClass(files, path + home.getName() + "CCM"); 146 addObjectClass(files, path + home.getName() + "SkeletonInterceptor"); 147 addObjectClass(files, path + home.getName() + "StubInterceptor"); 148 149 addObjectClass(files, path + home.getName() + "_homeMI"); 151 addObjectClass(files, path + home.getName() + "_interfaceMI"); 152 153 bases = home.getSupportedInterfaceList().getInterfaces(); 155 for (int i=0; i<bases.length; i++) 156 { 157 files.addAll( getInterfaceDependencies(bases[i], true, visited) ); 158 } 159 160 if (home.getBaseHome() != null) 162 { 163 files.addAll( getHomeDependencies(home.getBaseHome(), visited) ); 164 } 165 166 files.addAll( getContentsDependencies(home, visited) ); 168 169 return files; 170 } 171 172 181 public Set 182 getComponentDependencies(ComponentDecl comp, 183 Set visited) 184 { 185 Set files = null; 186 String path = null; 187 InterfaceDecl[] bases = null; 188 189 files = new java.util.HashSet (); 190 191 if ( visited.contains(comp) ) 193 { 194 return files; 195 } 196 else 197 { 198 visited.add(comp); 200 } 201 202 path = _translator.getAsDirectory(comp); 203 204 addStantardIdlFiles(files, path + "CCM_" + comp.getName()); 206 addOperationsClass(files, path + "CCM_" + comp.getName()); 207 addStantardIdlFiles(files, path + "CCM_" + comp.getName() + "_Context"); 208 addOperationsClass(files, path + "CCM_" + comp.getName() + "_Context"); 209 addStantardIdlFiles(files, path + "CCM_" + comp.getName() + "_Executor"); 210 addOperationsClass(files, path + "CCM_" + comp.getName() + "_Executor"); 211 212 addStantardIdlFiles(files, path + comp.getName()); 214 addOperationsClass(files, path + comp.getName()); 215 addPoaIdlFiles(files, path + comp.getName()); 216 addStubClass(files, path + comp.getName()); 217 218 addObjectClass(files, path + comp.getName() + "CCM"); 220 addObjectClass(files, path + comp.getName() + "MonolithicWrapper"); 221 addObjectClass(files, path + comp.getName() + "SkeletonInterceptor"); 222 addObjectClass(files, path + comp.getName() + "StubInterceptor"); 223 224 addObjectClass(files, path + comp.getName() + "_componentMI"); 226 addObjectClass(files, path + comp.getName() + "_interfaceMI"); 227 228 bases = comp.getSupportedInterfaceList().getInterfaces(); 230 for (int i=0; i<bases.length; i++) 231 { 232 files.addAll( getInterfaceDependencies(bases[i], true, visited) ); 233 } 234 235 if (comp.getBaseComponent() != null) 237 { 238 files.addAll( getComponentDependencies(comp.getBaseComponent(), visited) ); 239 } 240 241 files.addAll( getContentsDependencies(comp, visited) ); 243 244 return files; 245 } 246 247 257 public Set 258 getInterfacePortDependencies(InterfacePortDecl itf_port, 259 boolean server, 260 Set visited) 261 { 262 Set files = null; 263 String path = null, 264 name = null; 265 266 if ( visited.contains(itf_port) ) 268 { 269 return files; 270 } 271 else 272 { 273 visited.add(itf_port); 275 } 276 277 path = _translator.getAsDirectory( itf_port.getParent() ); 278 files = new java.util.HashSet (); 279 name = itf_port.getInterface().getName(); 280 281 if (server) 283 { 284 addStantardIdlFiles( files, path + "CCM_" + name ); 285 addOperationsClass( files, path + "CCM_" + name ); 286 } 287 288 files.addAll( getInterfaceDependencies(itf_port.getInterface(), server, visited) ); 290 if (server) 291 { 292 addObjectClass(files, path + name + "SkeletonInterceptor"); 293 addObjectClass(files, path + name + "StubInterceptor"); 294 } 295 296 if (server) 298 { 299 addObjectClass(files, path + name + "_interfaceMI"); 300 } 301 302 return files; 303 } 304 305 315 public Set 316 getEventPortDependencies(EventPortDecl event_port, 317 boolean server, 318 Set visited) 319 { 320 Set files = null; 321 String path = null, 322 name = null; 323 324 if ( visited.contains(event_port) ) 326 { 327 return files; 328 } 329 else 330 { 331 visited.add(event_port); 333 } 334 335 path = _translator.getAsDirectory( event_port.getEvent() ); 336 name = event_port.getEvent().getName(); 337 files = new java.util.HashSet (); 338 339 if (server) 341 { 342 addStantardIdlFiles( files, path + "CCM_" + name + "Consumer" ); 343 addOperationsClass( files, path + "CCM_" + name + "Consumer" ); 344 } 345 346 addStantardIdlFiles( files, path + name + "Consumer" ); 348 addStubClass( files, path + name + "Consumer" ); 349 addOperationsClass( files, path + name + "Consumer" ); 350 if (server) 351 { 352 addPoaIdlFiles( files, path + name + "Consumer" ); 353 addObjectClass(files, path + name + "ConsumerSkeletonInterceptor"); 354 addObjectClass(files, path + name + "ConsumerStubInterceptor"); 355 addObjectClass(files, path + name + "ConsumerWrapper"); 356 } 357 358 files.addAll( getValueTypeDependencies(event_port.getEvent(), visited) ); 360 addObjectClass(files, path + name + "FactoryHelper"); 361 362 return files; 363 } 364 365 373 public Set 374 getDeclarationDependencies(Declaration decl, 375 Set visited) 376 { 377 Set files = null; 378 379 files = new java.util.HashSet (); 380 381 if ( visited.contains(decl) ) 383 { 384 return files; 385 } 386 387 if (decl.getDeclKind() == DeclarationKind.dk_component) 388 { 389 files.addAll( getComponentDependencies((ComponentDecl) decl, visited) ); 390 } 391 else if (decl.getDeclKind() == DeclarationKind.dk_consumes) 392 { 393 files.addAll( getEventPortDependencies((EventPortDecl) decl, true, visited) ); 394 } 395 else if ( (decl.getDeclKind() == DeclarationKind.dk_emits) 396 || (decl.getDeclKind() == DeclarationKind.dk_publishes) ) 397 { 398 files.addAll( getEventPortDependencies((EventPortDecl) decl, false, visited) ); 399 } 400 else if (decl.getDeclKind() == DeclarationKind.dk_provides) 401 { 402 files.addAll( getInterfacePortDependencies((InterfacePortDecl) decl, true, visited) ); 403 } 404 else if (decl.getDeclKind() == DeclarationKind.dk_uses) 405 { 406 files.addAll( getInterfacePortDependencies((InterfacePortDecl) decl, false, visited) ); 407 } 408 else if (decl.getDeclKind() == DeclarationKind.dk_home) 409 { 410 files.addAll( getHomeDependencies((HomeDecl) decl, visited) ); 411 } 412 else if (decl.getDeclKind() == DeclarationKind.dk_event) 413 { 414 files.addAll( getValueTypeDependencies((EventDecl) decl, visited) ); 415 } 416 else if ( (decl.getDeclKind() == DeclarationKind.dk_factory) 417 ||(decl.getDeclKind() == DeclarationKind.dk_finder) ) 418 { 419 files.addAll( getOperationDependencies((OperationDecl) decl, visited) ); 420 } 421 else 422 { 423 files.addAll( super.getDeclarationDependencies(decl, visited) ); 425 } 426 427 return files; 428 } 429 430 438 public Set 439 getTypeRefDependencies(TypeRef type, 440 Set visited) 441 { 442 TypeKind tk = null; 443 Set files = new java.util.HashSet (); 444 445 tk = type.getTypeKind(); 446 447 if (type.isDeclaration()) 449 { 450 Declaration decl = (Declaration) type; 451 452 if (tk == TypeKind.tk_component) 453 { 454 files.addAll( getComponentDependencies((ComponentDecl) decl, visited) ); 455 } 456 else if (tk == TypeKind.tk_home) 457 { 458 files.addAll( getHomeDependencies((HomeDecl) decl, visited) ); 459 } 460 else if (tk == TypeKind.tk_event) 461 { 462 files.addAll( getValueTypeDependencies((EventDecl) decl, visited) ); 463 } 464 else 465 { 466 files.addAll( super.getTypeRefDependencies(type, visited) ); 468 } 469 } 470 return files; 471 } 472 473 479 } 480 | Popular Tags |