/** * @return the artifact model */ public String getModel() { return getArtifactType().getModel(); }
/** * Resolves the proper artifact model given an artifact type. * @param artifactType the S-RAMP artifact type */ private String resolveArtifactModel(String artifactType) { return ArtifactType.valueOf(artifactType).getArtifactType().getModel(); } }
/** * @see java.lang.Object#toString() */ @Override public String toString() { return String.format("/s-ramp/%1$s/%2$s (%3$s)", getArtifactType().getModel(), getArtifactType() .getType(), getMimeType()); }
protected void processImportedXsds(List<XsdDocumentTarget> targetCollection, Element schema, String targetNS) throws XPathExpressionException { NodeList nodes = (NodeList) query(schema, "./xsd:import", XPathConstants.NODESET); for (int idx = 0; idx < nodes.getLength(); idx++) { Element node = (Element) nodes.item(idx); if (node.hasAttribute("namespace") && node.hasAttribute("schemaLocation")) { String namespace = node.getAttribute("namespace"); String schemaLocation = node.getAttribute("schemaLocation"); stripPath(schemaLocation); XsdDocument xsdDocumentRef = derivedArtifacts.lookupXsdDocument(namespace, schemaLocation); XsdDocumentTarget xsdDocumentTarget = new XsdDocumentTarget(); xsdDocumentTarget.setArtifactType(XsdDocumentEnum.XSD_DOCUMENT); if (xsdDocumentRef != null) { xsdDocumentTarget.setValue(xsdDocumentRef.getUuid()); } else { relationshipSources.add(new NamespaceRelationshipSource(namespace, schemaLocation, xsdDocumentTarget, targetCollection, ArtifactTypeEnum.XsdDocument.getModel(), ArtifactTypeEnum.XsdDocument.getType())); } targetCollection.add(xsdDocumentTarget); } } }
try { String atomUrl = String.format("%1$s/%2$s/%3$s/%4$s/media", srampEndpoint, artifactType.getArtifactType().getModel(), artifactType.getArtifactType().getType(), artifactUuid);
protected void processRedefinedXsds(List<XsdDocumentTarget> targetCollection, Element schema, String targetNS) throws XPathExpressionException { NodeList nodes = (NodeList) query(schema, "./xsd:redefine", XPathConstants.NODESET); for (int idx = 0; idx < nodes.getLength(); idx++) { Element node = (Element) nodes.item(idx); if (node.hasAttribute("schemaLocation")) { String schemaLocation = node.getAttribute("schemaLocation"); stripPath(schemaLocation); XsdDocument xsdDocumentRef = derivedArtifacts.lookupXsdDocument(targetNS, schemaLocation); XsdDocumentTarget xsdDocumentTarget = new XsdDocumentTarget(); xsdDocumentTarget.setArtifactType(XsdDocumentEnum.XSD_DOCUMENT); if (xsdDocumentRef != null) { xsdDocumentTarget.setValue(xsdDocumentRef.getUuid()); } else { relationshipSources.add(new NamespaceRelationshipSource(targetNS, schemaLocation, xsdDocumentTarget, targetCollection, ArtifactTypeEnum.XsdDocument.getModel(), ArtifactTypeEnum.XsdDocument.getType())); } targetCollection.add(xsdDocumentTarget); } } }
protected void processIncludedXsds(List<XsdDocumentTarget> targetCollection, Element schema, String targetNS) throws XPathExpressionException { NodeList nodes = (NodeList) query(schema, "./xsd:include", XPathConstants.NODESET); for (int idx = 0; idx < nodes.getLength(); idx++) { Element node = (Element) nodes.item(idx); if (node.hasAttribute("schemaLocation")) { String schemaLocation = node.getAttribute("schemaLocation"); stripPath(schemaLocation); XsdDocument xsdDocumentRef = derivedArtifacts.lookupXsdDocument(targetNS, schemaLocation); XsdDocumentTarget xsdDocumentTarget = new XsdDocumentTarget(); xsdDocumentTarget.setArtifactType(XsdDocumentEnum.XSD_DOCUMENT); if (xsdDocumentRef != null) { xsdDocumentTarget.setValue(xsdDocumentRef.getUuid()); } else { relationshipSources.add(new NamespaceRelationshipSource(targetNS, schemaLocation, xsdDocumentTarget, targetCollection, ArtifactTypeEnum.XsdDocument.getModel(), ArtifactTypeEnum.XsdDocument.getType())); } targetCollection.add(xsdDocumentTarget); } } }
} else { relationshipSources.add(new QNameRelationshipSource(msgQname, target, null, ArtifactTypeEnum.Message.getModel(), ArtifactTypeEnum.Message.getType()));
private void processWsdlImports() throws XPathExpressionException { WsdlDocument wsdlDocument; if (getPrimaryArtifact() instanceof WsdlDocument) { wsdlDocument = (WsdlDocument) getPrimaryArtifact(); } else { return; } NodeList nodes = (NodeList) this.query(rootElement, ".//wsdl:import", XPathConstants.NODESET); for (int idx = 0; idx < nodes.getLength(); idx++) { Element node = (Element) nodes.item(idx); if (node.hasAttribute("namespace")) { String namespace = node.getAttribute("namespace"); String location = node.getAttribute("location"); stripPath(location); WsdlDocument wsdlDocumentRef = derivedArtifacts.lookupWsdlDocument(namespace); WsdlDocumentTarget wsdlDocumentTarget = new WsdlDocumentTarget(); wsdlDocumentTarget.setArtifactType(WsdlDocumentEnum.WSDL_DOCUMENT); if (wsdlDocumentRef != null) { wsdlDocumentTarget.setValue(wsdlDocumentRef.getUuid()); } else { relationshipSources.add(new NamespaceRelationshipSource(namespace, location, wsdlDocumentTarget, wsdlDocument.getImportedWsdls(), ArtifactTypeEnum.WsdlDocument.getModel(), ArtifactTypeEnum.WsdlDocument.getType())); } wsdlDocument.getImportedWsdls().add(wsdlDocumentTarget); } } }
public BaseArtifactType addComment(String uuid, ArtifactType type, String text) throws ArtificerClientException, ArtificerServerException { assertFeatureEnabled(type); ClientResponse<Entry> response = null; try { String artifactModel = type.getArtifactType().getModel(); String artifactType = type.getArtifactType().getType(); if ("ext".equals(type.getArtifactType().getModel()) && type.getExtendedType() != null) { artifactType = type.getExtendedType(); } String atomUrl = String.format("%1$s/%2$s/%3$s/%4$s/comment", srampEndpoint, artifactModel, artifactType, uuid); ClientRequest request = createClientRequest(atomUrl); request.body(MediaType.TEXT_PLAIN, text); response = request.post(Entry.class); Entry entry = response.getEntity(); return ArtificerAtomUtils.unwrapSrampArtifact(type, entry); } catch (ArtificerServerException e) { throw e; } catch (Throwable e) { throw new ArtificerClientException(e); } finally { closeQuietly(response); } }
} else { relationshipSources.add(new QNameRelationshipSource(msgQname, target, null, ArtifactTypeEnum.Message.getModel(), ArtifactTypeEnum.Message.getType()));
} else { relationshipSources.add(new QNameRelationshipSource(msgQname, target, null, ArtifactTypeEnum.Message.getModel(), ArtifactTypeEnum.Message.getType()));
} else { relationshipSources.add(new QNameRelationshipSource(qname, elementTarget, null, ArtifactTypeEnum.ElementDeclaration.getModel(), ArtifactTypeEnum.ElementDeclaration.getType())); } else { relationshipSources.add(new QNameRelationshipSource(qname, typeTarget, null, ArtifactTypeEnum.XsdType.getModel(), ArtifactTypeEnum.SimpleTypeDeclaration.getType(), ArtifactTypeEnum.ComplexTypeDeclaration.getType()));
/** * Gets the full meta-data listing for an Artifact in the S-RAMP repository. * @param artifactType * @param artifactUuid * @throws ArtificerClientException * @throws ArtificerServerException */ public BaseArtifactType getArtifactMetaData(ArtifactType artifactType, String artifactUuid) throws ArtificerClientException, ArtificerServerException { assertFeatureEnabled(artifactType); ClientResponse<Entry> response = null; try { String atomUrl = String.format("%1$s/%2$s/%3$s/%4$s", srampEndpoint, artifactType.getArtifactType().getModel(), artifactType.getArtifactType().getType(), artifactUuid); ClientRequest request = createClientRequest(atomUrl); response = request.get(Entry.class); Entry entry = response.getEntity(); return ArtificerAtomUtils.unwrapSrampArtifact(artifactType, entry); } catch (ArtificerServerException e) { throw e; } catch (Throwable e) { throw new ArtificerClientException(e); } finally { closeQuietly(response); } }
String type = artifactType.getType(); String atomUrl = String.format("%1$s/%2$s/%3$s", srampEndpoint, artifactType.getArtifactType().getModel(), type); ClientRequest request = createClientRequest(atomUrl); request.body(MediaType.TEXT_PLAIN, path);
String type = artifactType.getType(); String atomUrl = String.format("%1$s/%2$s/%3$s", srampEndpoint, artifactType.getArtifactType().getModel(), type); ClientRequest request = createClientRequest(atomUrl); if (artifactFileName != null)
else printProperty(Messages.i18n.format("PrintArtifact.Type"), artifactType.getArtifactType().getType()); printProperty(Messages.i18n.format("PrintArtifact.Model"), artifactType.getArtifactType().getModel()); printProperty(Messages.i18n.format("PrintArtifact.UUID"), artifact.getUuid()); printProperty(Messages.i18n.format("PrintArtifact.Name"), artifact.getName());
String type = artifactType.getType(); String atomUrl = String.format("%1$s/%2$s/%3$s", srampEndpoint, artifactType.getArtifactType().getModel(), type); ClientRequest request = createClientRequest(atomUrl);