public SnapshotVersion(Version version) { super(version.toString()); }
public File getLocation(Artifact artifact) { if(!artifact.isResolved()) { throw new IllegalArgumentException("Artifact "+artifact+" is not fully resolved"); } File path = new File(rootFile, artifact.getGroupId().replace('.', File.separatorChar)); path = new File(path, artifact.getArtifactId()); path = new File(path, artifact.getVersion().toString()); path = new File(path, artifact.getArtifactId() + "-" + artifact.getVersion() + "." + artifact.getType()); return path; }
public void installLibrary(File libFile, Artifact artifact) throws IOException { if (artifact == null || !artifact.isResolved()) throw new IllegalArgumentException("Artifact is not valid when install library"); if (identifyOSGiBundle(libFile) != null) { writeableRepo.copyToRepository(libFile, artifact, new RepoFileWriteMonitor()); } else { // convert to osgi bundle jars using wrap url handler URL wrap = new URL("wrap", null, libFile.toURI().toURL().toExternalForm() + "$Bundle-SymbolicName=" + artifact.getArtifactId() + "&Bundle-Version=" + artifact.getVersion().toString().replace("-", ".")+"&DynamicImport-Package=*"); //need improve the version processing InputStream in = null; try { in = wrap.openStream(); writeableRepo.copyToRepository(in, (int) libFile.getTotalSpace(), artifact, new RepoFileWriteMonitor()); } finally { if (in != null) in.close(); } } }
if (versionDir.canRead() && versionDir.isDirectory()) { String version = versionDir.getName(); if(query.getVersion() != null && !query.getVersion().toString().equals(version)) { continue; return listInternal(query.getArtifactId(), query.getType(), query.getVersion() == null ? null : query.getVersion().toString());
private URL getURL(Artifact configId) throws MalformedURLException { String qualifiedVersion = configId.getVersion().toString(); if (configId.getVersion() instanceof SnapshotVersion) { SnapshotVersion ssVersion = (SnapshotVersion) configId.getVersion(); String timestamp = ssVersion.getTimestamp(); int buildNumber = ssVersion.getBuildNumber(); if (timestamp != null && buildNumber != 0) { qualifiedVersion = qualifiedVersion.replaceAll("SNAPSHOT", timestamp + "-" + buildNumber); } } return base.resolve(configId.getGroupId().replace('.', '/') + "/" + configId.getArtifactId() + "/" + configId.getVersion() + "/" + configId.getArtifactId() + "-" + qualifiedVersion + "." + configId.getType()).toURL(); }
public JpaPluginInstance(String artifactUri) { Artifact artifact = Artifact.create(artifactUri); this.groupId = artifact.getGroupId(); this.artifactId = artifact.getArtifactId(); this.version = artifact.getVersion().toString(); this.type = artifact.getType(); }
String version = fileName.substring(query.getArtifactId().length() + 1); version = version.substring(0, version.length() - 1 - query.getType().length()); if(query.getVersion() != null && !query.getVersion().toString().equals(version)) { continue;
@Override protected Name createBindingName(AbstractName abstractName, Object value) throws NamingException { String name = abstractName.getNameProperty("name"); if (namePattern != null) { Matcher matcher = namePattern.matcher(name); if (!matcher.matches()) { return null; } } Map<String, String> map = new HashMap<String, String>(abstractName.getName()); Artifact artifact = abstractName.getArtifact(); map.put("groupId", artifact.getGroupId()); map.put("artifactId", artifact.getArtifactId()); map.put("version", artifact.getVersion().toString()); map.put("type", artifact.getType()); String fullName = format(format, map); Name parsedName = getContext().getNameParser("").parse(getNameInNamespace()+"/" + fullName); // create intermediate contexts for (int i = 1; i < parsedName.size(); i++) { Name contextName = parsedName.getPrefix(i); if (!bindingExists(getContext(), contextName)) { getContext().createSubcontext(contextName); } } return parsedName; }
if (version.toString().indexOf("SNAPSHOT") >= 0 && !(version instanceof SnapshotVersion)) {
private void populateDependency(DependencyType dep, String dependencyString) { Artifact artifact = Artifact.create(dependencyString.trim()); dep.setArtifactId(artifact.getArtifactId()); if (artifact.getGroupId() != null) { dep.setGroupId(artifact.getGroupId()); } if (artifact.getType() != null) { dep.setType(artifact.getType()); } if (artifact.getVersion() != null) { dep.setVersion(artifact.getVersion().toString()); } }
public PluginType getPlugin(Artifact sourceArtifact) { PluginType plugin = new PluginType(); PluginArtifactType pluginArtifact = new PluginArtifactType(); ArtifactType artifact = new ArtifactType(); artifact.setGroupId(sourceArtifact.getGroupId()); artifact.setArtifactId(sourceArtifact.getArtifactId()); artifact.setVersion(sourceArtifact.getVersion().toString()); artifact.setType(sourceArtifact.getType()); pluginArtifact.setModuleId(artifact); plugin.getPluginArtifact().add(pluginArtifact); return plugin; }
public void parseEnvironment(Environment env) { ArtifactType moduleId = environment.addNewModuleId(); Artifact configId = env.getConfigId(); moduleId.setGroupId(configId.getGroupId()); moduleId.setArtifactId(configId.getArtifactId()); moduleId.setVersion(configId.getVersion().toString()); moduleId.setType(configId.getType()); //List<Dependency> deps = env.getDependencies(); //for (int i = 0; i < deps.size(); i++) { // String depString = deps.get(i).toString(); // dependenciesSet.add(depString.substring(6, depString.length() - 1)); //} }
public static ArtifactType toArtifactType(Artifact id) { ArtifactType artifact = new ArtifactType(); artifact.setGroupId(id.getGroupId()); artifact.setArtifactId(id.getArtifactId()); artifact.setVersion(id.getVersion() == null ? null : id.getVersion().toString()); artifact.setType(id.getType()); return artifact; }
public static DependencyType toDependencyType(Dependency dep, boolean includeVersion) { Artifact id = dep.getArtifact(); DependencyType dependency = new DependencyType(); dependency.setGroupId(id.getGroupId()); dependency.setArtifactId(id.getArtifactId()); if (includeVersion) { dependency.setVersion(id.getVersion() == null ? null : id.getVersion().toString()); } dependency.setType(id.getType()); return dependency; }
private static void fillArtifactType(Artifact artifact, ArtifactType artifactType) { if (artifact.getGroupId() != null) { artifactType.setGroupId(artifact.getGroupId()); } if (artifact.getArtifactId() != null) { artifactType.setArtifactId(artifact.getArtifactId()); } if (artifact.getVersion() != null) { artifactType.setVersion(artifact.getVersion().toString()); } if (artifact.getType() != null) { artifactType.setType(artifact.getType()); } }
dep.setVersion(artifact.getVersion().toString());
type.setGroupId(configId.getGroupId()); type.setType(configId.getType()); type.setVersion(configId.getVersion().toString()); Environment environment = EnvironmentBuilder.buildEnvironment(moduleType.getEnvironment(), defaultEnvironment); if(!environment.getConfigId().isResolved()) {