/** * Adds a component to this composite. * * @param component the component */ public void add(Component<? extends Implementation<?>> component) { component.setParent(this); componentsView.put(component.getName(), component); components.put(component.getName(), component); }
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; }