protected CompositeBuilder(QName name) { composite = new Composite(name); } }
/** * Creates a wrapper composite used to deploy the component to the domain. Also registers the wrapper with the Host contribution. * * @param name the composite name * @return the wrapping composite */ private Composite createWrapperComposite(String name) { QName compositeName = new QName(HostNamespaces.SYNTHESIZED, name); Composite wrapper = new Composite(compositeName); URI uri = ContributionResolver.getContribution(); wrapper.setContributionUri(uri); addCompositeToContribution(wrapper); return wrapper; }
/** * Creates a wrapper composite used to deploy the component to the domain. Also registers the wrapper with the Host contribution. * * @param name the composite name * @return the wrapping composite */ private Composite createWrapperComposite(String name) { QName compositeName = new QName(HostNamespaces.SYNTHESIZED, name); Composite wrapper = new Composite(compositeName); URI uri = ContributionResolver.getContribution(); wrapper.setContributionUri(uri); addCompositeToContribution(wrapper); return wrapper; }
/** * Creates a wrapper composite used to deploy the component to the domain. Also registers the wrapper with the Host contribution. * * @param name the composite name * @return the wrapping composite */ private Composite createWrapperComposite(String name) { QName compositeName = new QName(HostNamespaces.SYNTHESIZED, name); Composite wrapper = new Composite(compositeName); URI uri = ContributionResolver.getContribution(); wrapper.setContributionUri(uri); addCompositeToContribution(wrapper); return wrapper; }
/** * Synthesizes a composite from a collection of composites using inclusion. A counter is maintained for each include name and used to generate include * names in situations where they may clash, e.g. when two composites from different contributions with the same name are deployed together. * * @param composites the composites to synthesize * @return the synthesized composite */ private Composite synthesizeComposite(List<Composite> composites) { Composite synthesized = new Composite(SYNTHETIC_COMPOSITE); Map<QName, AtomicInteger> counters = new HashMap<>(); for (Composite composite : composites) { Include include = new Include(); QName name = composite.getName(); include.setName(name); include.setIncluded(composite); if (synthesized.getIncludes().containsKey(name)) { AtomicInteger counter = counters.get(name); if (counter == null) { counter = new AtomicInteger(); counters.put(name, counter); } include.setName(new QName(name.getNamespaceURI(), name.getLocalPart() + counter.incrementAndGet())); } synthesized.add(include); } return synthesized; }
/** * Synthesizes a composite from a collection of composites using inclusion. A counter is maintained for each include name and used to generate include * names in situations where they may clash, e.g. when two composites from different contributions with the same name are deployed together. * * @param composites the composites to synthesize * @return the synthesized composite */ private Composite synthesizeComposite(List<Composite> composites) { Composite synthesized = new Composite(SYNTHETIC_COMPOSITE); Map<QName, AtomicInteger> counters = new HashMap<>(); for (Composite composite : composites) { Include include = new Include(); QName name = composite.getName(); include.setName(name); include.setIncluded(composite); if (synthesized.getIncludes().containsKey(name)) { AtomicInteger counter = counters.get(name); if (counter == null) { counter = new AtomicInteger(); counters.put(name, counter); } include.setName(new QName(name.getNamespaceURI(), name.getLocalPart() + counter.incrementAndGet())); } synthesized.add(include); } return synthesized; }
private Composite createComposite(WebImplementation implementation, Contribution contribution) { URI contributionUri = contribution.getUri(); String localPart = createLocalPart(contributionUri); QName compositeName = new QName(HostNamespaces.SYNTHESIZED, localPart); Composite composite = new Composite(compositeName); composite.setContributionUri(contributionUri); Component<WebImplementation> component = new Component<>(localPart, implementation); component.setContributionUri(contributionUri); composite.add(component); return composite; }
private void initializeDomainComposite() { Composite type = new Composite(null); CompositeImplementation impl = new CompositeImplementation(); impl.setComponentType(type); Component<CompositeImplementation> definition = new Component<>(domainUri.toString()); definition.setImplementation(impl); definition.setContributionUri(Names.BOOT_CONTRIBUTION); domain = new LogicalCompositeComponent(domainUri, definition, autowire); domain.setState(LogicalState.PROVISIONED); }
private void initializeDomainComposite() { Composite type = new Composite(null); CompositeImplementation impl = new CompositeImplementation(); impl.setComponentType(type); Component<CompositeImplementation> definition = new Component<>(domainUri.toString()); definition.setImplementation(impl); definition.setContributionUri(Names.BOOT_CONTRIBUTION); domain = new LogicalCompositeComponent(domainUri, definition, autowire); domain.setState(LogicalState.PROVISIONED); }
private LogicalReference createReference(JavaServiceContract contract) { LogicalCompositeComponent domainComponent = lcm.getRootComponent(); int id = idCounter.getAndIncrement(); String name = "Synthetic" + id; URI componentUri = URI.create(domainComponent.getUri().toString() + "/" + name); URI referenceUri = URI.create(componentUri.toString() + "#reference"); QName qName = new QName(HostNamespaces.SYNTHESIZED, "SyntheticComposite" + id); Composite composite = new Composite(qName); ComponentDefinition<NonManagedImplementation> componentDefinition = new ComponentDefinition<>(name); componentDefinition.setParent(composite); NonManagedImplementation implementation = new NonManagedImplementation(); componentDefinition.setImplementation(implementation); ComponentReference reference = new ComponentReference("reference", Multiplicity.ONE_ONE); componentDefinition.add(reference); LogicalComponent<NonManagedImplementation> logicalComponent = new LogicalComponent<>(componentUri, componentDefinition, domainComponent); logicalComponent.setZone(info.getZoneName()); reference.setServiceContract(contract); LogicalReference logicalReference = new LogicalReference(referenceUri, reference, logicalComponent); logicalReference.setServiceContract(contract); logicalComponent.addReference(logicalReference); return logicalReference; }
private LogicalReference createReference(Class<?> interfaze) { LogicalCompositeComponent domainComponent = lcm.getDomainComposite(); int id = idCounter.getAndIncrement(); String name = "Synthetic" + id; URI componentUri = URI.create(domainComponent.getUri().toString() + "/" + name); URI referenceUri = URI.create(componentUri.toString() + "#reference"); QName qName = new QName(HostNamespaces.SYNTHESIZED, "SyntheticComposite" + id); Composite composite = new Composite(qName); Component<NonManagedImplementation> component = new Component<>(name); component.setParent(composite); component.setContributionUri(Names.HOST_CONTRIBUTION); NonManagedImplementation implementation = new NonManagedImplementation(); component.setImplementation(implementation); Reference<ComponentType> reference = new Reference<>("reference", Multiplicity.ONE_ONE); composite.add(reference); JavaServiceContract contract = introspector.introspect(interfaze); LogicalComponent<NonManagedImplementation> logicalComponent = new LogicalComponent<>(componentUri, component, domainComponent); reference.setServiceContract(contract); LogicalReference logicalReference = new LogicalReference(referenceUri, reference, logicalComponent); logicalReference.setServiceContract(contract); logicalComponent.addReference(logicalReference); return logicalReference; }
private LogicalReference createReference(Class<?> interfaze) { LogicalCompositeComponent domainComponent = lcm.getDomainComposite(); int id = idCounter.getAndIncrement(); String name = "Synthetic" + id; URI componentUri = URI.create(domainComponent.getUri().toString() + "/" + name); URI referenceUri = URI.create(componentUri.toString() + "#reference"); QName qName = new QName(HostNamespaces.SYNTHESIZED, "SyntheticComposite" + id); Composite composite = new Composite(qName); Component<NonManagedImplementation> component = new Component<>(name); component.setParent(composite); component.setContributionUri(Names.HOST_CONTRIBUTION); NonManagedImplementation implementation = new NonManagedImplementation(); component.setImplementation(implementation); Reference<ComponentType> reference = new Reference<>("reference", Multiplicity.ONE_ONE); composite.add(reference); JavaServiceContract contract = introspector.introspect(interfaze); LogicalComponent<NonManagedImplementation> logicalComponent = new LogicalComponent<>(componentUri, component, domainComponent); reference.setServiceContract(contract); LogicalReference logicalReference = new LogicalReference(referenceUri, reference, logicalComponent); logicalReference.setServiceContract(contract); logicalComponent.addReference(logicalReference); return logicalReference; }