@Override public Object clone() throws CloneNotSupportedException { ComponentImpl clone = (ComponentImpl)super.clone(); clone.properties = new ArrayList<ComponentProperty>(); for (ComponentProperty property : getProperties()) { clone.properties.add((ComponentProperty)property.clone()); } clone.references = new ArrayList<ComponentReference>(); for (ComponentReference reference : getReferences()) { clone.references.add((ComponentReference)reference.clone()); } clone.services = new ArrayList<ComponentService>(); for (ComponentService service : getServices()) { clone.services.add((ComponentService)service.clone()); } // Clone the implementation.composite if(implementation instanceof Composite) { clone.implementation = (Composite) ((Composite) implementation).clone(); } // Clone the Lists for intents and policySets clone.requiredIntents = new ArrayList<Intent>(getRequiredIntents()); clone.policySets = new ArrayList<PolicySet>(getPolicySets()); return clone; }
@Override public Object clone() throws CloneNotSupportedException { ComponentImpl clone = (ComponentImpl)super.clone(); clone.properties = new ArrayList<ComponentProperty>(); for (ComponentProperty property : getProperties()) { clone.properties.add((ComponentProperty)property.clone()); } clone.references = new ArrayList<ComponentReference>(); for (ComponentReference reference : getReferences()) { clone.references.add((ComponentReference)reference.clone()); } clone.services = new ArrayList<ComponentService>(); for (ComponentService service : getServices()) { clone.services.add((ComponentService)service.clone()); } // Clone the implementation.composite if(implementation instanceof Composite) { clone.implementation = (Composite) ((Composite) implementation).clone(); } // Clone the Lists for intents and policySets clone.requiredIntents = new ArrayList<Intent>(getRequiredIntents()); clone.policySets = new ArrayList<PolicySet>(getPolicySets()); return clone; }
private Composite wrap(EndpointReference endpointReference) { try { Composite composite = assemblyFactory.createComposite(); composite.setName(ENDPOINT_REFERENCE_QNAME); composite.setLocal(false); Component component = (Component)endpointReference.getComponent().clone(); composite.getComponents().add(component); component.getReferences().clear(); component.getServices().clear(); ComponentReference reference = (ComponentReference)endpointReference.getReference().clone(); component.getReferences().add(reference); reference.getBindings().clear(); Binding binding = (Binding)endpointReference.getBinding().clone(); reference.getBindings().add(binding); //reference.setInterfaceContract(endpointReference.getInterfaceContract()); if (endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING){ ComponentService service = assemblyFactory.createComponentService(); service.setName(endpointReference.getTargetEndpoint().getURI()); reference.getTargets().clear(); reference.getTargets().add(service); } return composite; } catch (CloneNotSupportedException e) { return null; } }
private Composite wrap(EndpointReference endpointReference) { try { Composite composite = assemblyFactory.createComposite(); composite.setName(ENDPOINT_REFERENCE_QNAME); composite.setLocal(false); Component component = (Component)endpointReference.getComponent().clone(); composite.getComponents().add(component); component.getReferences().clear(); component.getServices().clear(); ComponentReference reference = (ComponentReference)endpointReference.getReference().clone(); component.getReferences().add(reference); reference.getBindings().clear(); Binding binding = (Binding)endpointReference.getBinding().clone(); reference.getBindings().add(binding); //reference.setInterfaceContract(endpointReference.getInterfaceContract()); if (endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING){ ComponentService service = assemblyFactory.createComponentService(); service.setName(endpointReference.getTargetEndpoint().getURI()); reference.getTargets().clear(); reference.getTargets().add(service); } return composite; } catch (CloneNotSupportedException e) { return null; } }