public boolean isMasterConfigurationName(Artifact configId) { return configId.getArtifactId().endsWith(ARTIFACT_SUFFIX); }
private void removeArtifact(Artifact artifact) { List values = (List) artifactsByArtifact.get(artifact.getArtifactId()); if (values != null) { values.remove(artifact); if (values.isEmpty()) { artifactsByArtifact.remove(artifact.getArtifactId()); } } }
private void processArtifact(Artifact artifact) { List values = (List) artifactsByArtifact.get(artifact.getArtifactId()); if (values == null) { values = new ArrayList(); artifactsByArtifact.put(artifact.getArtifactId(), values); } values.add(artifact); }
public SortedSet getLoadedArtifacts(Artifact query) { List values = (List) artifactsByArtifact.get(query.getArtifactId()); SortedSet results = new TreeSet(); if (values != null) { for (int i = 0; i < values.size(); i++) { Artifact test = (Artifact) values.get(i); if(query.matches(test)) { results.add(test); } } } return results; }
private String getMvnLocationFromArtifact(Artifact artifact){ if (artifact == null) return null; StringBuilder bundleLocation = new StringBuilder(); bundleLocation.append("mvn:"); bundleLocation.append(artifact.getGroupId()).append('/').append(artifact.getArtifactId()).append('/').append(artifact.getVersion()); return bundleLocation.toString(); }
public Artifact buildMasterConfigurationName(Artifact configId) { return newArtifact(configId, configId.getArtifactId() + ARTIFACT_SUFFIX); }
public Artifact buildSlaveConfigurationName(Artifact configId) { if (!isMasterConfigurationName(configId)) { throw new IllegalArgumentException("[" + configId + "] is not a master configuration name"); } String artifactId = configId.getArtifactId(); return newArtifact(configId, artifactId.substring(0, artifactId.length() - ARTIFACT_SUFFIX.length())); }
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 File getLocation(Artifact artifact) { File path = new File(rootFile, artifact.getGroupId()); path = new File(path, artifact.getType() + "s"); String ext = artifact.getType(); if(ext.equals("ejb")) { ext = "jar"; } path = new File(path, artifact.getArtifactId() + "-" + artifact.getVersion() + "." + ext); return path; }
private WebModule getWebModule(Configuration config, Configuration child) { try { Map<String, String> query1 = new HashMap<String, String>(); String name = config.getId().getArtifactId(); query1.put("J2EEApplication", config.getId().toString()); query1.put("j2eeType", "WebModule"); query1.put("name", child.getId().getArtifactId().substring(name.length()+1)); AbstractName childName = new AbstractName(config.getAbstractName().getArtifact(), query1); return (WebModule)kernel.getGBean(childName); } catch(Exception h){ // No gbean found, will not happen // Except if module not started, ignored } return null; }
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 Artifact generateArtifact(Artifact source, String defaultType) { if(source.isResolved()) { Artifact deAliased = (Artifact) explicitResolution.get(source); if (deAliased != null) { return deAliased; } return source; } String groupId = source.getGroupId() == null ? Artifact.DEFAULT_GROUP_ID : source.getGroupId(); String artifactId = source.getArtifactId(); String type = source.getType() == null ? defaultType : source.getType(); Version version = source.getVersion() == null ? new Version(Long.toString(System.currentTimeMillis())) : source.getVersion(); return new Artifact(groupId, artifactId, version, type); }
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(); }
private void undeploy(ServiceUnitReference reference) { try { Component componentGBean = getComponentGBean( reference.getAssocialtedServiceUnitName().getArtifactId(), reference.getAssocialtedServiceUnitName()); ServiceUnitManager serviceUnitManager = componentGBean.getComponent().getServiceUnitManager(); serviceUnitManager.undeploy(reference.getServiceUnitName(), reference.getServiceUnitPath()); } catch (Exception e) { throw new RuntimeException(e); } }
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()); } }
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; }