/** * Sets a property on the artifact. * @param artifact * @param propName * @param propValue */ private void setProperty(BaseArtifactType artifact, String propName, String propValue) { String propNameLC = propName.toLowerCase(); if (CORE_PROPERTIES.contains(propNameLC)) { if (propNameLC.equals("name")) { artifact.setName(propValue); } else if (propNameLC.equals("description")) { artifact.setDescription(propValue); } else if (propNameLC.equals("version")) { artifact.setVersion(propValue); } } else { ArtificerModelUtils.setCustomProperty(artifact, propName, propValue); } }
translatorArtifact.setName(name);
entryArtifact.setName(path);
/** * Adds some standard meta-data properties to the artifact instance. * @param discoveredArtifact * @param artifact */ protected void addStandardMetaData(DiscoveredArtifact discoveredArtifact, BaseArtifactType artifact) { artifact.setUuid(UUID.randomUUID().toString()); artifact.setName(discoveredArtifact.getName()); SrampModelUtils.setCustomProperty(artifact, "batch.archive-path", discoveredArtifact.getArchivePath()); //$NON-NLS-1$ if (this.context != null) { String parentUUID = (String) this.context.get(PARENT_UUID); if (parentUUID != null) SrampModelUtils.addGenericRelationship(artifact, "expandedFromDocument", parentUUID); //$NON-NLS-1$ } }
@Override public Collection<BaseArtifactType> findArtifacts(String model, String type, Map<String, String> criteria) { BaseArtifactType doc = new Document(); doc.setArtifactType(BaseArtifactEnum.DOCUMENT); doc.setName("Mock Artifact"); //$NON-NLS-1$ doc.setUuid(UUID.randomUUID().toString()); return Collections.singletonList(doc); } };
vdbImportArtifact.setName(name);
/** * @see org.overlord.sramp.common.derived.AbstractXmlDeriver#derive(java.util.Collection, org.oasis_open.docs.s_ramp.ns.s_ramp_v1.BaseArtifactType, org.overlord.sramp.common.derived.AbstractXmlDeriver.XmlDeriverContext) */ @Override protected void derive(Collection<BaseArtifactType> derivedArtifacts, BaseArtifactType artifact, XmlDeriverContext xmlDeriverContext) throws IOException { try { Element rootElement = xmlDeriverContext.getRootElement(); XPath xpath = xmlDeriverContext.getXpath(); // Pull out the target namespace and save it as a custom property String targetNS = rootElement.getAttribute("targetNamespace"); //$NON-NLS-1$ SrampModelUtils.setCustomProperty(artifact, "targetNamespace", targetNS); //$NON-NLS-1$ // Pull out the name and set it (unless the name has already been set) if ("switchyard.xml".equals(artifact.getName()) && rootElement.hasAttribute("name")) { //$NON-NLS-1$ //$NON-NLS-2$ String name = rootElement.getAttribute("name"); //$NON-NLS-1$ artifact.setName(name); } processComponents(derivedArtifacts, artifact, rootElement, xpath); // Note - process services after components so that components can be promoted easily. processServices(derivedArtifacts, artifact, rootElement, xpath); processTransformers(derivedArtifacts, artifact, rootElement, xpath); processValidators(derivedArtifacts, artifact, rootElement, xpath); } catch (XPathExpressionException e) { throw new IOException(e); } }
sourceArtifact.setName(name);
errorArtifact.setName(path);
@Override public BaseArtifactType createMetaData(DiscoveredArtifact artifact) { BaseArtifactType md = new Document(); md.setUuid(UUID.randomUUID().toString()); md.setName("custom-" + artifact.getName()); //$NON-NLS-1$ return md; } });
@Override protected CommandResult doExecute(CommandInvocation commandInvocation) throws Exception { if (CollectionUtils.isEmpty(arguments)) { return doHelp(commandInvocation); } String pathToContent = optionalArgument(arguments, 0); InputStream contentStream = null; try { ArtifactType artifactType = ArtifactType.valueOf(type); String name = new File(type).getName(); if (pathToContent != null) { File contentFile = new File(pathToContent); contentStream = FileUtils.openInputStream(contentFile); } BaseArtifactType artifact = artifactType.newArtifactInstance(); artifact.setName(name); currentArchive(commandInvocation).addEntry(entryPath, artifact, contentStream); commandInvocation.getShell().out().println(Messages.i18n.format("AddEntry.Added", entryPath)); } catch (ArtificerArchiveException e) { commandInvocation.getShell().out().println(Messages.i18n.format("AddEntry.ArtificerArchiveException", e.getLocalizedMessage())); } finally { IOUtils.closeQuietly(contentStream); } return CommandResult.SUCCESS; }
metaData.setName(propValArg); } else if ("description".equals(propNameArg)) { metaData.setDescription(propValArg);
schemaArtifact.setName(name);
/** * @see org.overlord.sramp.common.derived.ArtifactDeriver#derive(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.BaseArtifactType, java.io.InputStream) */ @Override public Collection<BaseArtifactType> derive(BaseArtifactType artifact, InputStream contentStream) throws IOException { List<BaseArtifactType> derivedArtifacts = new ArrayList<BaseArtifactType>(); ClassParser parser = new ClassParser(contentStream, artifact.getName()); JavaClass javaClass = parser.parse(); if (javaClass.isInterface()) { ((ExtendedDocument) artifact).setExtendedType(JavaModel.TYPE_JAVA_INTERFACE); } else if (javaClass.isClass()) { ((ExtendedDocument) artifact).setExtendedType(JavaModel.TYPE_JAVA_CLASS); } else if (javaClass.isEnum()) { ((ExtendedDocument) artifact).setExtendedType(JavaModel.TYPE_JAVA_ENUM); } String packageName = javaClass.getPackageName(); String className = javaClass.getClassName(); artifact.setName(className); String shortName = className; if (className.lastIndexOf('.') > 0) { shortName = className.substring(className.lastIndexOf('.') + 1); } SrampModelUtils.setCustomProperty(artifact, JavaModel.PROP_PACKAGE_NAME, packageName); SrampModelUtils.setCustomProperty(artifact, JavaModel.PROP_CLASS_NAME, shortName); return derivedArtifacts; }
protected CommandResult doExecute(CommandInvocation commandInvocation) throws Exception { ArtificerAtomApiClient client = client(commandInvocation); ArtifactType artifactType = ArtifactType.valueOf(type); if (artifactType.isExtendedType()) { artifactType = ArtifactType.ExtendedArtifactType(artifactType.getExtendedType(), false); } if (artifactType.isDerived()) { commandInvocation.getShell().out().println(Messages.i18n.format("ArtifactModel.isDerived")); return CommandResult.FAILURE; } else if (artifactType.isDocument()) { commandInvocation.getShell().out().println(Messages.i18n.format("ArtifactModel.isDocument")); return CommandResult.FAILURE; } else { BaseArtifactType artifact = artifactType.newArtifactInstance(); artifact.setName(name); artifact.setDescription(description); artifact = client.createArtifact(artifact); // Put the artifact in the session as the active artifact context(commandInvocation).setCurrentArtifact(artifact); } commandInvocation.getShell().out().println(Messages.i18n.format("CreateArtifactCommand.Successful", name)); return CommandResult.SUCCESS; }
if (artifact.getName()==null) artifact.setName(project.getName()); if (artifact.getVersion()==null) artifact.setVersion(project.getVersion());
is1 = this.getClass().getResourceAsStream("/sample-files/xsd/" + artifactFileName); //$NON-NLS-1$ BaseArtifactType metaData = new XsdDocument(); metaData.setName("PO.xsd"); //$NON-NLS-1$ metaData.setVersion("1.1"); //$NON-NLS-1$ metaData.setDescription("This is a test description (XSD)."); //$NON-NLS-1$ metaData.setName("PO.xml"); //$NON-NLS-1$ metaData.setVersion("1.2"); //$NON-NLS-1$ metaData.setDescription("This is a test description (XML)."); //$NON-NLS-1$
is1 = this.getClass().getResourceAsStream("/sample-files/xsd/" + artifactFileName); //$NON-NLS-1$ BaseArtifactType metaData = new XsdDocument(); metaData.setName("PO.xsd"); //$NON-NLS-1$ metaData.setVersion("1.1"); //$NON-NLS-1$ metaData.setDescription("This is a test description (XSD)."); //$NON-NLS-1$ is2 = this.getClass().getResourceAsStream("/sample-files/core/" + artifactFileName); //$NON-NLS-1$ metaData = new XsdDocument(); metaData.setName("PO.xml"); //$NON-NLS-1$ metaData.setVersion("1.2"); //$NON-NLS-1$ metaData.setDescription("This is a test description (XML)."); //$NON-NLS-1$
XMLGregorianCalendar modifiedTimestamp = HibernateEntityFactory.calendar(artificerArtifact.getModifiedBy().getLastActionTime()); srampArtifact.setLastModifiedTimestamp(modifiedTimestamp); srampArtifact.setName(artificerArtifact.getName()); srampArtifact.setUuid(artificerArtifact.getUuid()); srampArtifact.setVersion(artificerArtifact.getVersion());
artifact.setName("My PO"); //$NON-NLS-1$ artifact.setDescription("A new description of the PO.xsd artifact."); //$NON-NLS-1$ artifact.setVersion("2.0.13"); //$NON-NLS-1$