public Reference getReference(String name){ Reference reference = null; for (Reference tmp : getReferences()){ if (tmp.getName().equals(name)){ reference = tmp; break; } } return reference; }
public Reference getReference(String name){ Reference reference = null; for (Reference tmp : getReferences()){ if (tmp.getName().equals(name)){ reference = tmp; break; } } return reference; }
/** * * @param ref * @param type * @return */ private static boolean removeReference(JavaElementImpl ref, JavaImplementation type) { if (ref == null) { return false; } List<org.apache.tuscany.sca.assembly.Reference> refs = type.getReferences(); for (int i = 0; i < refs.size(); i++) { if (refs.get(i).getName().equals(ref.getName())) { refs.remove(i); return true; } } return false; }
/** * Use preProcess to validate and map the references and properties dynamically */ public void build(Component component) { for (Reference reference : component.getReferences()) { if (unresolvedBeanRef.containsKey(reference.getName())) { Reference ref = unresolvedBeanRef.get(reference.getName()); componentType.getReferences().add(createReference(reference, ref.getInterfaceContract())); unresolvedBeanRef.remove(reference.getName()); } } for (Property property : component.getProperties()) { if (unresolvedBeanRef.containsKey(property.getName())) { componentType.getProperties().add(createProperty(property)); this.setPropertyClass(property.getName(), property.getClass()); unresolvedBeanRef.remove(property.getName()); } } }
/** * ASM50042 - Checks that if a component reference with multiplicity="1..1" is marked * as nonOveridable then there are no composite references that promote it * * @param componentType * @param compositeReference * @param promotedComponentReference * @param monitor */ private void validateNonOverridable(ComponentType componentType, Reference compositeReference, Reference promotedComponentReference, Monitor monitor){ if ((promotedComponentReference.getMultiplicity() == Multiplicity.ONE_ONE) && (((ComponentReference)promotedComponentReference)).isNonOverridable() == true) { Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "CompositeReferencePromotesNonOverridableReference", componentType.getURI(), compositeReference.getName(), promotedComponentReference.getName()); } }
String referenceName = reference.getName(); stream.println( INVOKE_ELEMENT_START + referenceName + INVOKE_ELEMENT_END );
/** * ASM50042 - Checks that if a component reference with multiplicity="1..1" is marked * as nonOveridable then there are no composite references that promote it * * @param componentType * @param compositeReference * @param promotedComponentReference * @param monitor */ private void validateNonOverridable(ComponentType componentType, Reference compositeReference, Reference promotedComponentReference, Monitor monitor){ if ((promotedComponentReference.getMultiplicity() == Multiplicity.ONE_ONE) && (((ComponentReference)promotedComponentReference)).isNonOverridable() == true) { Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "CompositeReferencePromotesNonOverridableReference", componentType.getURI(), compositeReference.getName(), promotedComponentReference.getName()); } }
private void addReferencesFromComponentType(Component component, Monitor monitor) { // Create a component reference for each reference if (component.getImplementation() != null) { for (Reference reference : component.getImplementation().getReferences()) { // check for duplicate reference names in implementation if (reference != component.getImplementation().getReference(reference.getName())){ Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "DuplicateImplementationReferenceName", component.getName(), reference.getName()); } ComponentReference componentReference = (ComponentReference)component.getReference(reference.getName()); // if the component doesn't have a reference with the same name as the // component type reference then create one if (componentReference == null) { componentReference = assemblyFactory.createComponentReference(); componentReference.setForCallback(reference.isForCallback()); componentReference.setName(reference.getName()); componentReference.setReference(reference); component.getReferences().add(componentReference); } } } }
private void addReferencesFromComponentType(Component component, Monitor monitor) { // Create a component reference for each reference if (component.getImplementation() != null) { for (Reference reference : component.getImplementation().getReferences()) { // check for duplicate reference names in implementation if (reference != component.getImplementation().getReference(reference.getName())){ Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "DuplicateImplementationReferenceName", component.getName(), reference.getName()); } ComponentReference componentReference = (ComponentReference)component.getReference(reference.getName()); // if the component doesn't have a reference with the same name as the // component type reference then create one if (componentReference == null) { componentReference = assemblyFactory.createComponentReference(); componentReference.setForCallback(reference.isForCallback()); componentReference.setName(reference.getName()); componentReference.setReference(reference); component.getReferences().add(componentReference); } } } }
private void reconcileReferenceMultiplicity(ComponentType componentType, Reference compositeReference, Reference promotedComponentReference, Monitor monitor) { if (compositeReference.getMultiplicity() != null) { if (!isValidMultiplicityOverride(promotedComponentReference.getTargets().size() > 0, promotedComponentReference.getMultiplicity(), compositeReference.getMultiplicity())) { Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "CompositeReferenceIncompatibleMultiplicity", componentType.getURI(), compositeReference.getName(), promotedComponentReference.getName()); } } else { compositeReference.setMultiplicity(promotedComponentReference.getMultiplicity()); } }
private void reconcileReferenceMultiplicity(ComponentType componentType, Reference compositeReference, Reference promotedComponentReference, Monitor monitor) { if (compositeReference.getMultiplicity() != null) { if (!isValidMultiplicityOverride(promotedComponentReference.getTargets().size() > 0, promotedComponentReference.getMultiplicity(), compositeReference.getMultiplicity())) { Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "CompositeReferenceIncompatibleMultiplicity", componentType.getURI(), compositeReference.getName(), promotedComponentReference.getName()); } } else { compositeReference.setMultiplicity(promotedComponentReference.getMultiplicity()); } }
referenceMap.put(ref.getName(), ref);
/** * Use preProcess to add any references and properties dynamically * TODO: also support introspection and handle WEB-INF/web.componentType (spec line 503) */ public void build(Component component) { if (!(component instanceof RuntimeComponent)) { return; } RuntimeComponent rtc = (RuntimeComponent) component; for (Reference reference : rtc.getReferences()) { if (getReference(reference.getName()) == null) { getReferences().add(createReference(reference)); } } for (Property property : rtc.getProperties()) { if (getProperty(property.getName()) == null) { getProperties().add(createProperty(property)); } } }
private void reconcileReferenceMultiplicity(Component component, Reference componentReference, Reference componentTypeReference, Monitor monitor) { if (componentReference.getMultiplicity() != null) { if (!isValidMultiplicityOverride(componentTypeReference.getMultiplicity(), componentReference .getMultiplicity())) { Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "ReferenceIncompatibleMultiplicity", component.getName(), componentReference.getName()); } } else { componentReference.setMultiplicity(componentTypeReference.getMultiplicity()); } }
private void reconcileReferenceMultiplicity(Component component, Reference componentReference, Reference componentTypeReference, Monitor monitor) { if (componentReference.getMultiplicity() != null) { if (!isValidMultiplicityOverride(componentTypeReference.getMultiplicity(), componentReference .getMultiplicity())) { Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "ReferenceIncompatibleMultiplicity", component.getName(), componentReference.getName()); } } else { componentReference.setMultiplicity(componentTypeReference.getMultiplicity()); } }
Messages.ASSEMBLY_VALIDATION, "ReferenceInterfaceNotSubSet", topContract.getName(), incompatibilityReason);
Messages.ASSEMBLY_VALIDATION, "ReferenceInterfaceNotSubSet", topContract.getName(), incompatibilityReason);