public ExternalComponentInstanceGroup onlyExternals() { final ExternalComponentInstanceGroup externalInstances = new ExternalComponentInstanceGroup(); for (final T instance: this) { if (instance.isExternal()) { externalInstances.add(instance.asExternal()); } } return externalInstances; }
public String toString(){ String result=" Component instances:\n"; for(ComponentInstance c: components){ if(c.isExternal()){ if(c.asExternal().isVM()){ result+=" VM-> "+c.asExternal().asVM().getId()+"::"+c.getName()+"\n"; }else{ result+=" External component-> "+c.getQualifiedName()+"\n"; } }else{ result+=" Instance component-> "+c.getQualifiedName()+"\n"; } } return result; } }
/** * Extract the tag that can be identified on the given component instance. * * @param componentInstance the component whose tags are needed * @param tagged the already initialised maps of tags, to be filled in */ private void extractTags(ComponentInstance componentInstance, Map<String, List<String>> tagged) { assert componentInstance != null: "Unable to extract tags from 'null'"; assert !tagged.isEmpty(): "The map of tag must have been initialized"; if (componentInstance.isExternal()) { tagged.get(EXTERNAL.getLabel()).add(componentInstance.getName()); if (componentInstance.asExternal().isVM()) { tagged.get(VM.getLabel()).add(componentInstance.getName()); } } if (componentInstance.isInternal()) { tagged.get(INTERNAL.getLabel()).add(componentInstance.getName()); } if (isService(componentInstance)) { tagged.get(SERVICE.getLabel()).add(componentInstance.getName()); } else { tagged.get(NOT_SERVICE.getLabel()).add(componentInstance.getName()); } }
public VMInstanceGroup onlyVMs() { final VMInstanceGroup selection = new VMInstanceGroup(); for (final T instance: this) { if (instance.isExternal()) { final ExternalComponentInstance<? extends ExternalComponent> external = instance.asExternal(); if (external.isVM()) { selection.add(external.asVM()); } } } return selection; }
/** * @return the external component at the bottom of the underlying software * stack. For instance, if an application, is running on the top of a war * container, itself running on linux virtual machine, externalHost will * return the linux VM. */ public ExternalComponentInstance<? extends ExternalComponent> externalHost() { final ComponentInstance<? extends Component> directHost = getHost(); if(directHost != null){ if (directHost.isInternal()) { return directHost.asInternal().externalHost(); } return directHost.asExternal(); }else{ return null; } }
for(Property p : c.getProperties()){ if(p.getName().startsWith("env:")){ if(c.getHost().asExternal().isVM()){ prepareSetEnv(d,c,p);
.getComponentInstances() .firstNamed(sub) .asExternal(); ExternalComponent subEc = subEci.getType().asExternal(); String subEndPoint = subEc.getEndPoint();
/** * For each component, execute the puppet manifest associated * @param components */ private void configureWithPuppet(ComponentInstanceGroup<InternalComponentInstance> components){ unlessNotNull("Cannot configure null!", components); Connector jc; for (InternalComponentInstance ic : components) { if(ic.externalHost().isVM()){ for(Resource r: ic.getType().getResources()){ if(r instanceof PuppetResource){ PuppetResource pr=(PuppetResource)r; if(!pr.getConfigurationFile().isEmpty()){ journal.log(Level.INFO, ">> Using Puppet to configure the following component: "+ic.getName()); VMInstance n= ic.getHost().asExternal().asVM(); Provider p = n.getType().getProvider(); managePuppet(pr,n, pr.getName(),pr.getConfigurationFile()); } } } } } }
ci=lib.provision(targetModel,v).asExternal().asVM();
currentModel.getComponents().add(v); ci=lib.provision(currentModel,v).asExternal().asVM(); return v;
target.getComponents().add(v); VMInstance ci=lib.provision(target,v).asExternal().asVM(); return ci;