1 26 27 package org.objectweb.openccm.ast.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.DelegationList; 33 import org.objectweb.openccm.ast.api.StringList; 34 import org.objectweb.openccm.ast.api.HomeDecl; 35 import org.objectweb.openccm.ast.api.AbstractStorageHomeDecl; 36 import org.objectweb.openccm.ast.api.ExecutorDecl; 37 38 52 53 public class HomeExecutorDeclImpl 54 extends CidlScopeImpl 55 implements org.objectweb.openccm.ast.api.HomeExecutorDecl 56 { 57 63 64 private HomeDeclImpl home_; 65 66 67 private AbstractStorageHomeDeclImpl ashBinding_; 68 69 70 private AbstractStorageHomeDeclImpl ashPersistence_; 71 72 73 private DelegationListImpl ash_delegation_; 74 75 76 private DelegationListImpl executor_delegation_; 77 78 79 private StringListImpl operations_; 80 81 87 93 public 94 HomeExecutorDeclImpl(Repository rep, 95 ScopeImpl parent) 96 { 97 super(rep, parent); 99 100 home_ = null; 102 ashBinding_ = null; 103 ashPersistence_ = null; 104 ash_delegation_ = new DelegationListImpl(); 105 executor_delegation_ = new DelegationListImpl(); 106 operations_ = new StringListImpl(); 107 } 108 109 115 121 127 protected org.omg.CORBA.Contained 128 getContained() 129 { 130 return null; 131 } 132 133 139 145 protected org.omg.CORBA.Container 146 getContainer() 147 { 148 return null; 149 } 150 151 157 163 171 public Declaration[] 172 getDependencies() 173 { 174 if (dependencies_ != null) 175 return dependencies_; 176 177 java.util.List he_depend = new java.util.ArrayList (); 178 Declaration[] depend = null; 179 180 if ( he_depend.indexOf(getHomeType()) == -1 ) 182 he_depend.add( getHomeType() ); 183 depend = getHomeType().getDependencies(); 184 for (int j=0; j<depend.length; j++) 185 { 186 if ( (depend[j] != this) && 187 (he_depend.indexOf(depend[j]) == -1) ) 188 he_depend.add(depend[j]); 189 } 190 191 he_depend.add( getHomeType().getManagedComponent() ); 193 depend = getHomeType().getManagedComponent().getDependencies(); 194 for (int j=0; j<depend.length; j++) 195 { 196 if ( (depend[j] != this) && 197 (he_depend.indexOf(depend[j]) == -1) ) 198 he_depend.add(depend[j]); 199 } 200 201 if (getAbstractStorageHomeBinding() != null) 203 { 204 he_depend.add( getAbstractStorageHomeBinding() ); 205 depend = getAbstractStorageHomeBinding().getDependencies(); 206 for (int j=0; j<depend.length; j++) 207 { 208 if ( (depend[j] != this) && 209 (he_depend.indexOf(depend[j]) == -1) ) 210 he_depend.add(depend[j]); 211 } 212 } 213 214 if (getHomePersistence() != null) 216 { 217 he_depend.add( getHomePersistence() ); 218 depend = getHomePersistence().getDependencies(); 219 for (int j=0; j<depend.length; j++) 220 { 221 if ( (depend[j] != this) && 222 (he_depend.indexOf(depend[j]) == -1) ) 223 he_depend.add(depend[j]); 224 } 225 } 226 227 230 233 Declaration[] decls = getContents(true, DeclarationKind.dk_all); 235 for (int i=0; i<decls.length; i++) 236 { 237 depend = decls[i].getDependencies(); 238 for (int j=0; j<depend.length; j++) 239 { 240 if ( (!containsDecl(depend[j])) && 241 (depend[j] != this) && 242 (he_depend.indexOf(depend[j]) == -1) ) 243 { 244 he_depend.add(depend[j]); 245 } 246 } 247 } 248 249 dependencies_ = (Declaration[])he_depend.toArray(new Declaration[0]); 250 return dependencies_; 251 } 252 253 259 264 public long 265 getDeclKind() 266 { 267 return DeclarationKind.dk_home_executor; 268 } 269 270 273 public void 274 create() 275 { 276 super.create(); 278 279 } 281 282 288 294 299 public void 300 setHomeType(HomeDecl h) 301 { 302 home_ = (HomeDeclImpl)h; 303 } 304 305 310 public HomeDecl 311 getHomeType() 312 { 313 return home_; 314 } 315 316 321 public void 322 setAbstractStorageHomeBinding(AbstractStorageHomeDecl ash) 323 { 324 ashBinding_ = (AbstractStorageHomeDeclImpl)ash; 325 } 326 327 332 public AbstractStorageHomeDecl 333 getAbstractStorageHomeBinding() 334 { 335 return ashBinding_; 336 } 337 338 343 public void 344 setHomePersistence(AbstractStorageHomeDecl ash) 345 { 346 ashPersistence_ = (AbstractStorageHomeDeclImpl)ash; 347 } 348 349 354 public AbstractStorageHomeDecl 355 getHomePersistence() 356 { 357 return ashPersistence_; 358 } 359 360 365 public DelegationList 366 getAbstractStorageHomeDelegationList() 367 { 368 return ash_delegation_; 369 } 370 371 376 public DelegationList 377 getExecutorDelegationList() 378 { 379 return executor_delegation_; 380 } 381 382 387 public StringList 388 getAbstractOperationList() 389 { 390 return operations_; 391 } 392 393 400 public ExecutorDecl 401 startExecutor(String name) 402 { 403 ExecutorDecl decl = new ExecutorDeclImpl(getRepository(), this); 404 decl.setName(name); 405 return decl; 406 } 407 } 408 | Popular Tags |