relationship.getOtherAttributes().put(UNRESOLVED_REF, name); relationship.getOtherAttributes().put(UNRESOLVED_REF, "class:" + node.getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$ relationship.getOtherAttributes().put(UNRESOLVED_REF, "bean:" + node.getAttribute("bean")); //$NON-NLS-1$ //$NON-NLS-2$
if (node.hasAttribute("class")) { //$NON-NLS-1$ Relationship relationship = SrampModelUtils.addGenericRelationship(transformerArtifact, SwitchYardModel.REL_IMPLEMENTED_BY, null); relationship.getOtherAttributes().put(UNRESOLVED_REF, "class:" + node.getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$ relationship.getOtherAttributes().put(UNRESOLVED_REF, "bean:" + node.getAttribute("bean")); //$NON-NLS-1$ //$NON-NLS-2$ relationship.getOtherAttributes().put(UNRESOLVED_REF, "xslt:" + node.getAttribute("xsltFile")); //$NON-NLS-1$ //$NON-NLS-2$ relationship.getOtherAttributes().put(UNRESOLVED_REF, "smooks:" + node.getAttribute("config")); //$NON-NLS-1$ //$NON-NLS-2$ relationship.getOtherAttributes().put(UNRESOLVED_REF, node.getAttribute("from")); //$NON-NLS-1$ relationship.getOtherAttributes().put(UNRESOLVED_REF, node.getAttribute("to")); //$NON-NLS-1$
String ifaceName = iface.getAttribute("interface"); //$NON-NLS-1$ Relationship relationship = SrampModelUtils.addGenericRelationship(serviceArtifact, SwitchYardModel.REL_IMPLEMENTS, null); relationship.getOtherAttributes().put(UNRESOLVED_REF, "java:" + ifaceName); //$NON-NLS-1$ String wsdlInfo = iface.getAttribute("interface"); //$NON-NLS-1$ Relationship relationship = SrampModelUtils.addGenericRelationship(serviceArtifact, SwitchYardModel.REL_IMPLEMENTS, null); relationship.getOtherAttributes().put(UNRESOLVED_REF, "wsdl:" + wsdlInfo); //$NON-NLS-1$
/** * Updates the generic artifact relationships. * @param artifact * @throws Exception */ private void updateGenericRelationships(BaseArtifactType artifact) throws Exception { for (Relationship relationship : artifact.getRelationship()) { if (relationship.getRelationshipTarget().size() > 0) { setRelationships(relationship.getRelationshipType(), RelationshipType.GENERIC, relationship.getRelationshipTarget(), relationship.getOtherAttributes()); } } }
/** * @see org.overlord.sramp.integration.switchyard.model.SwitchYardArtifactVisitor#visitService(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.ExtendedArtifactType) */ @Override public void visitService(ExtendedArtifactType artifact) { // Handle unresolved "implements" relationships Relationship relationship = SrampModelUtils.getGenericRelationship(artifact, SwitchYardModel.REL_IMPLEMENTS); if (relationship != null && relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)) { String ref = relationship.getOtherAttributes().remove(SwitchYardXmlDeriver.UNRESOLVED_REF); if (ref.startsWith("java:")) { //$NON-NLS-1$ String refInterfaceName = ref.substring(5); BaseArtifactType artifactRef = findJavaInterfaceArtifact(refInterfaceName); if (artifactRef != null) { Target target = new Target(); target.setValue(artifactRef.getUuid()); relationship.getRelationshipTarget().add(target); } } else if (ref.startsWith("wsdl:")) { //$NON-NLS-1$ String refWsdl = ref.substring(5); BaseArtifactType artifactRef = findWsdlArtifact(refWsdl); if (artifactRef != null) { Target target = new Target(); target.setValue(artifactRef.getUuid()); relationship.getRelationshipTarget().add(target); } } } }
/** * @see org.overlord.sramp.integration.switchyard.model.SwitchYardArtifactVisitor#visitComponentService(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.ExtendedArtifactType) */ @Override public void visitComponentService(ExtendedArtifactType artifact) { // Handle unresolved "implements" relationships Relationship relationship = SrampModelUtils.getGenericRelationship(artifact, SwitchYardModel.REL_IMPLEMENTS); if (relationship != null && relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)) { String ref = relationship.getOtherAttributes().remove(SwitchYardXmlDeriver.UNRESOLVED_REF); if (ref.startsWith("java:")) { //$NON-NLS-1$ String refInterfaceName = ref.substring(5); BaseArtifactType artifactRef = findJavaInterfaceArtifact(refInterfaceName); if (artifactRef != null) { Target target = new Target(); target.setValue(artifactRef.getUuid()); relationship.getRelationshipTarget().add(target); } } else if (ref.startsWith("wsdl:")) { //$NON-NLS-1$ String refWsdl = ref.substring(5); BaseArtifactType artifactRef = findWsdlArtifact(refWsdl); if (artifactRef != null) { Target target = new Target(); target.setValue(artifactRef.getUuid()); relationship.getRelationshipTarget().add(target); } } } }
if (relationship != null && relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)) { String ref = relationship.getOtherAttributes().remove(SwitchYardXmlDeriver.UNRESOLVED_REF); if (ref.startsWith("class:")) { //$NON-NLS-1$ String refClassName = ref.substring(6); if (relationship != null && relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)) { String ref = relationship.getOtherAttributes().remove(SwitchYardXmlDeriver.UNRESOLVED_REF); if (ref.startsWith("java:")) { //$NON-NLS-1$ String refInterfaceName = ref.substring(5);
String implClassName = implBean.getAttribute("class"); //$NON-NLS-1$ Relationship relationship = SrampModelUtils.addGenericRelationship(componentArtifact, SwitchYardModel.REL_IMPLEMENTED_BY, null); relationship.getOtherAttributes().put(UNRESOLVED_REF, "class:" + implClassName); //$NON-NLS-1$ String path = xml.getAttribute("path"); //$NON-NLS-1$ Relationship relationship = SrampModelUtils.addGenericRelationship(componentArtifact, SwitchYardModel.REL_IMPLEMENTED_BY, null); relationship.getOtherAttributes().put(UNRESOLVED_REF, "camel:" + path); //$NON-NLS-1$ String ifaceName = iface.getAttribute("interface"); //$NON-NLS-1$ Relationship relationship = SrampModelUtils.addGenericRelationship(componentArtifact, SwitchYardModel.REL_REFERENCES, null); relationship.getOtherAttributes().put(UNRESOLVED_REF, "java:" + ifaceName); //$NON-NLS-1$ String wsdlInfo = iface.getAttribute("interface"); //$NON-NLS-1$ Relationship relationship = SrampModelUtils.addGenericRelationship(componentArtifact, SwitchYardModel.REL_REFERENCES, null); relationship.getOtherAttributes().put(UNRESOLVED_REF, "wsdl:" + wsdlInfo); //$NON-NLS-1$ String ifaceName = iface.getAttribute("interface"); //$NON-NLS-1$ Relationship relationship = SrampModelUtils.addGenericRelationship(componentServiceArtifact, SwitchYardModel.REL_IMPLEMENTS, null); relationship.getOtherAttributes().put(UNRESOLVED_REF, "java:" + ifaceName); //$NON-NLS-1$ String wsdlInfo = iface.getAttribute("interface"); //$NON-NLS-1$ Relationship relationship = SrampModelUtils.addGenericRelationship(componentServiceArtifact, SwitchYardModel.REL_IMPLEMENTS, null); relationship.getOtherAttributes().put(UNRESOLVED_REF, "wsdl:" + wsdlInfo); //$NON-NLS-1$
if (relationship != null && relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)) { String ref = relationship.getOtherAttributes().remove(SwitchYardXmlDeriver.UNRESOLVED_REF); if (ref.startsWith("class:")) { //$NON-NLS-1$ String refClassName = ref.substring(6); if (relationship != null && relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)) { String ref = relationship.getOtherAttributes().remove(SwitchYardXmlDeriver.UNRESOLVED_REF); if (ref.startsWith("java:")) { // java class //$NON-NLS-1$ String refClassName = ref.substring(5);
relationship.getOtherAttributes().putAll(relationshipOtherAttributes);
private void visitGenericRelationships(BaseArtifactType srampArtifact) throws Exception { for (ArtificerRelationship artificerRelationship : artificerArtifact.getRelationships()) { if (artificerRelationship.getType() == RelationshipType.GENERIC) { Relationship srampRelationship = new Relationship(); srampRelationship.setRelationshipType(artificerRelationship.getName()); for (ArtificerTarget artificerTarget : artificerRelationship.getTargets()) { Target srampTarget = createTarget(Target.class, artificerTarget); srampRelationship.getRelationshipTarget().add(srampTarget); } setOtherAttributes(artificerRelationship.getOtherAttributes(), srampRelationship.getOtherAttributes()); srampArtifact.getRelationship().add(srampRelationship); } } }
if (relationship != null && relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)) { String ref = relationship.getOtherAttributes().remove(SwitchYardXmlDeriver.UNRESOLVED_REF); if (ref.startsWith("class:")) { //$NON-NLS-1$ String refClassName = ref.substring(6); if (relationship != null && relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)) { String ref = relationship.getOtherAttributes().remove(SwitchYardXmlDeriver.UNRESOLVED_REF); if (ref.startsWith("java:")) { // java class //$NON-NLS-1$ String refClassName = ref.substring(5); if (relationship != null && relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)) { String ref = relationship.getOtherAttributes().remove(SwitchYardXmlDeriver.UNRESOLVED_REF); if (ref.startsWith("java:")) { // java class //$NON-NLS-1$ String refClassName = ref.substring(5);
Relationship relationship = SrampModelUtils.getGenericRelationship(orderService, SwitchYardModel.REL_IMPLEMENTS); Assert.assertNotNull(relationship); Assert.assertTrue(relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)); Assert.assertEquals("wsdl:wsdl/OrderService.wsdl#wsdl.porttype(OrderService)", relationship.getOtherAttributes().get(SwitchYardXmlDeriver.UNRESOLVED_REF)); //$NON-NLS-1$ Assert.assertNotNull(relationship); Assert.assertTrue(relationship.getRelationshipTarget().isEmpty()); Assert.assertTrue(relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)); relationship = SrampModelUtils.getGenericRelationship(inventoryServiceComponent, SwitchYardModel.REL_REFERENCES); Assert.assertNull(relationship); Assert.assertNotNull(relationship); Assert.assertTrue(relationship.getRelationshipTarget().isEmpty()); Assert.assertTrue(relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)); relationship = SrampModelUtils.getGenericRelationship(orderServiceComponent, SwitchYardModel.REL_REFERENCES); Assert.assertNotNull(relationship); Assert.assertTrue(relationship.getRelationshipTarget().isEmpty()); Assert.assertTrue(relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)); relationship = SrampModelUtils.getGenericRelationship(orderService, SwitchYardModel.REL_PROMOTES); Assert.assertNotNull(relationship); Assert.assertNotNull(relationship); Assert.assertTrue(relationship.getRelationshipTarget().isEmpty()); Assert.assertTrue(relationship.getOtherAttributes().containsKey(SwitchYardXmlDeriver.UNRESOLVED_REF)); relationship = SrampModelUtils.getGenericRelationship(camelServiceComponent, SwitchYardModel.REL_REFERENCES); Assert.assertNull(relationship); relationship = SrampModelUtils.getGenericRelationship(inventoryServiceComponentSvc, SwitchYardModel.REL_IMPLEMENTS); Assert.assertNotNull(relationship);