public void releaseLocks(Set<Contribution> contributions) { for (Contribution contribution : contributions) { for (Deployable deployable : contribution.getManifest().getDeployables()) { QName name = deployable.getName(); if (contribution.getLockOwners().contains(name)) { contribution.releaseLock(name); } } } }
public void lock(Set<Contribution> contributions) throws CompositeAlreadyDeployedException { for (Contribution contribution : contributions) { for (Deployable deployable : contribution.getManifest().getDeployables()) { QName name = deployable.getName(); // check if the deployable has already been deployed by querying the lock owners if (contribution.getLockOwners().contains(name)) { throw new CompositeAlreadyDeployedException("Composite has already been deployed: " + name); } contribution.acquireLock(name); } } }
@ManagementOperation(description = "Returns metadata for all contributions deployed in a domain") public Set<ContributionInfo> getContributions() { Set<Contribution> contributions = metaDataStore.getContributions(); Set<ContributionInfo> infos = new TreeSet<ContributionInfo>(); for (Contribution contribution : contributions) { URI uri = contribution.getUri(); String state = contribution.getState().toString(); long timestamp = contribution.getTimestamp(); List<QName> deployables = new ArrayList<QName>(); for (Deployable deployable : contribution.getManifest().getDeployables()) { deployables.add(deployable.getName()); } ContributionInfo info = new ContributionInfo(uri, state, deployables, timestamp); infos.add(info); } return infos; }
public List<Composite> getDeployables(Set<Contribution> contributions) { List<Composite> deployables = new ArrayList<Composite>(); for (Contribution contribution : contributions) { for (Resource resource : contribution.getResources()) { for (ResourceElement<?, ?> entry : resource.getResourceElements()) { if (!(entry.getValue() instanceof Composite)) { continue; } @SuppressWarnings({"unchecked"}) ResourceElement<QNameSymbol, Composite> element = (ResourceElement<QNameSymbol, Composite>) entry; QName name = element.getSymbol().getKey(); Composite composite = element.getValue(); for (Deployable deployable : contribution.getManifest().getDeployables()) { if (deployable.getName().equals(name)) { List<RuntimeMode> deployableModes = deployable.getRuntimeModes(); // only add deployables that are set to boot in the current runtime mode and where the environment matches if (deployableModes.contains(hostInfo.getRuntimeMode())) { List<String> environments = deployable.getEnvironments(); if (environments.isEmpty() || environments.contains(hostInfo.getEnvironment())) { deployables.add(composite); } } break; } } } } } return deployables; }
ListIterator<Deployable> iter = deployables.listIterator(deployables.size()); while (iter.hasPrevious()) { names.add(iter.previous().getName());
QName name = deployable.getName(); try { if (plan == null) {