/** * Instantiates and optionally deploys deployables from a set of contributions. Deployment is performed if recovery mode is false or the runtime is * operating in single VM mode. When recovering in a distributed domain, the components contained in the deployables will be instantiated but not deployed * to zones. This is because the domain can run headless (i.e. without a controller) and may already be hosting deployed components. * * @param deployables the deployables * @param contributions the contributions to deploy * @param recover true if recovery mode is enabled * @throws Fabric3Exception if an error occurs during instantiation or deployment */ private void instantiateAndDeploy(List<Composite> deployables, Set<Contribution> contributions, boolean recover) throws Fabric3Exception { LogicalCompositeComponent domain = logicalComponentManager.getDomainComposite(); for (Contribution contribution : contributions) { if (ContributionState.STORED == contribution.getState()) { throw new Fabric3Exception("Contribution is not installed: " + contribution.getUri()); } } InstantiationContext context = logicalModelInstantiator.include(deployables, domain); if (context.hasErrors()) { throw new AssemblyException(context.getErrors()); } if (!recover || RuntimeMode.VM == info.getRuntimeMode()) { // in single VM mode, recovery includes deployment deploy(domain); } else { collector.markAsProvisioned(domain); } contributions.forEach(Contribution::deploy); }
/** * Instantiates and optionally deploys deployables from a set of contributions. Deployment is performed if recovery mode is false or the runtime is * operating in single VM mode. When recovering in a distributed domain, the components contained in the deployables will be instantiated but not deployed * to zones. This is because the domain can run headless (i.e. without a controller) and may already be hosting deployed components. * * @param deployables the deployables * @param contributions the contributions to deploy * @param recover true if recovery mode is enabled * @throws Fabric3Exception if an error occurs during instantiation or deployment */ private void instantiateAndDeploy(List<Composite> deployables, Set<Contribution> contributions, boolean recover) throws Fabric3Exception { LogicalCompositeComponent domain = logicalComponentManager.getDomainComposite(); for (Contribution contribution : contributions) { if (ContributionState.STORED == contribution.getState()) { throw new Fabric3Exception("Contribution is not installed: " + contribution.getUri()); } } InstantiationContext context = logicalModelInstantiator.include(deployables, domain); if (context.hasErrors()) { throw new AssemblyException(context.getErrors()); } if (!recover || RuntimeMode.VM == info.getRuntimeMode()) { // in single VM mode, recovery includes deployment deploy(domain); } else { collector.markAsProvisioned(domain); } contributions.forEach(Contribution::deploy); }
/** * Instantiates and deploys the given composite. * * @param composite the composite to instantiate and deploy * @throws Fabric3Exception if a deployment error occurs */ private void instantiateAndDeploy(Composite composite) throws Fabric3Exception { LogicalCompositeComponent domain = logicalComponentManager.getDomainComposite(); QName name = composite.getName(); QNameSymbol symbol = new QNameSymbol(name); ResourceElement<QNameSymbol, Composite> element = metadataStore.find(Composite.class, symbol); if (element == null) { throw new Fabric3Exception("Composite not found in metadata store: " + name); } Contribution contribution = element.getResource().getContribution(); if (ContributionState.STORED == contribution.getState()) { throw new Fabric3Exception("Contribution is not installed: " + contribution.getUri()); } InstantiationContext context = logicalModelInstantiator.include(composite, domain); if (context.hasErrors()) { throw new AssemblyException(context.getErrors()); } deploy(domain); contribution.deploy(); }
/** * Instantiates and deploys the given composite. * * @param composite the composite to instantiate and deploy * @throws Fabric3Exception if a deployment error occurs */ private void instantiateAndDeploy(Composite composite) throws Fabric3Exception { LogicalCompositeComponent domain = logicalComponentManager.getDomainComposite(); QName name = composite.getName(); QNameSymbol symbol = new QNameSymbol(name); ResourceElement<QNameSymbol, Composite> element = metadataStore.find(Composite.class, symbol); if (element == null) { throw new Fabric3Exception("Composite not found in metadata store: " + name); } Contribution contribution = element.getResource().getContribution(); if (ContributionState.STORED == contribution.getState()) { throw new Fabric3Exception("Contribution is not installed: " + contribution.getUri()); } InstantiationContext context = logicalModelInstantiator.include(composite, domain); if (context.hasErrors()) { throw new AssemblyException(context.getErrors()); } deploy(domain); contribution.deploy(); }