/** * The query will match descriptors whose <code>id</code> and <code>versionRange</code> * match the supplied key * @param key the artifact key to match. Cannot be <code>null</code>. */ public ArtifactDescriptorQuery(IArtifactKey key) { super(IArtifactDescriptor.class, createExpression(key.getId(), new VersionRange(key.getVersion(), true, key.getVersion(), true), null, null)); }
/** * The query will match descriptors whose <code>id</code> and <code>versionRange</code> * match the supplied key * @param key the artifact key to match. Cannot be <code>null</code>. */ public ArtifactDescriptorQuery(IArtifactKey key) { super(IArtifactDescriptor.class, createExpression(key.getId(), new VersionRange(key.getVersion(), true, key.getVersion(), true), null, null)); }
public boolean equals(Object obj) { if (!(obj instanceof IArtifactKey)) return false; IArtifactKey ak = (IArtifactKey) obj; return ak.getId().equals(id) && ak.getVersion().equals(getVersion()) && ak.getClassifier().equals(classifier); }
public ArtifactKey(IArtifactKey artifactKey) { this.classifier = artifactKey.getClassifier(); this.id = artifactKey.getId(); this.version = artifactKey.getVersion(); }
@Override public String downloadOnlineExampleProject(IProject project, IProgressMonitor monitor) { String projectName = project.getName(); try { for (IInstallableUnit iu : getInstallableUnits()) { if (projectName.equals(iu.getId())) { for (IArtifactKey k : iu.getArtifacts()) { String filename = k.getId() + "_" + k.getVersion() + ".jar"; URL url = new URL(getRepositoryUrl() + "/plugins/" + filename); java.io.File jarFile = FileUtils.downloadFile(url, monitor); FileUtils.extractJarFile(jarFile, project, monitor); // delete this temporary file jarFile.delete(); project.refreshLocal(IProject.DEPTH_INFINITE, monitor); } } } } catch (Exception e) { e.printStackTrace(); return e.getMessage(); } return null; }
protected void writeArtifactKeys(Collection<IArtifactKey> artifactKeys) { if (artifactKeys != null && artifactKeys.size() > 0) { start(ARTIFACT_KEYS_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, artifactKeys.size()); for (IArtifactKey artifactKey : artifactKeys) { start(ARTIFACT_KEY_ELEMENT); attribute(ARTIFACT_KEY_CLASSIFIER_ATTRIBUTE, artifactKey.getClassifier()); attribute(ID_ATTRIBUTE, artifactKey.getId()); attribute(VERSION_ATTRIBUTE, artifactKey.getVersion()); end(ARTIFACT_KEY_ELEMENT); } end(ARTIFACT_KEYS_ELEMENT); } }
protected void writeArtifactKeys(Collection<IArtifactKey> artifactKeys) { if (artifactKeys != null && artifactKeys.size() > 0) { start(ARTIFACT_KEYS_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, artifactKeys.size()); for (IArtifactKey artifactKey : artifactKeys) { start(ARTIFACT_KEY_ELEMENT); attribute(ARTIFACT_KEY_CLASSIFIER_ATTRIBUTE, artifactKey.getClassifier()); attribute(ID_ATTRIBUTE, artifactKey.getId()); attribute(VERSION_ATTRIBUTE, artifactKey.getVersion()); end(ARTIFACT_KEY_ELEMENT); } end(ARTIFACT_KEYS_ELEMENT); } }
protected void writeArtifactKeys(Collection<IArtifactKey> artifactKeys) { if (artifactKeys != null && artifactKeys.size() > 0) { start(ARTIFACT_KEYS_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, artifactKeys.size()); for (IArtifactKey artifactKey : artifactKeys) { start(ARTIFACT_KEY_ELEMENT); attribute(ARTIFACT_KEY_CLASSIFIER_ATTRIBUTE, artifactKey.getClassifier()); attribute(ID_ATTRIBUTE, artifactKey.getId()); attribute(VERSION_ATTRIBUTE, artifactKey.getVersion()); end(ARTIFACT_KEY_ELEMENT); } end(ARTIFACT_KEYS_ELEMENT); } }
/** * @see #flatButPackedEnabled(IArtifactDescriptor) */ private URI getLocationForPackedButFlatArtifacts(IArtifactDescriptor descriptor) { IArtifactKey key = descriptor.getArtifactKey(); return mapper.map(getLocation(), key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT)); }
/** * @see #flatButPackedEnabled(IArtifactDescriptor) */ private URI getLocationForPackedButFlatArtifacts(IArtifactDescriptor descriptor) { IArtifactKey key = descriptor.getArtifactKey(); return mapper.map(getLocation(), key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT)); }
/** * @see #flatButPackedEnabled(IArtifactDescriptor) */ private URI getLocationForPackedButFlatArtifacts(IArtifactDescriptor descriptor) { IArtifactKey key = descriptor.getArtifactKey(); return mapper.map(getLocation(), key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT)); }
/** * @see #flatButPackedEnabled(IArtifactDescriptor) */ private URI getLocationForPackedButFlatArtifacts(IArtifactDescriptor descriptor) { IArtifactKey key = descriptor.getArtifactKey(); return mapper.map(getLocation(), key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT)); }
private void writeArtifacts(Set<SimpleArtifactDescriptor> artifactDescriptors) { start(ARTIFACTS_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, artifactDescriptors.size()); for (SimpleArtifactDescriptor descriptor : artifactDescriptors) { IArtifactKey key = descriptor.getArtifactKey(); start(ARTIFACT_ELEMENT); attribute(ARTIFACT_CLASSIFIER_ATTRIBUTE, key.getClassifier()); attribute(ID_ATTRIBUTE, key.getId()); attribute(VERSION_ATTRIBUTE, key.getVersion()); writeProcessingSteps(descriptor.getProcessingSteps()); writeProperties(descriptor.getProperties()); writeProperties(REPOSITORY_PROPERTIES_ELEMENT, descriptor.getRepositoryProperties()); end(ARTIFACT_ELEMENT); } end(ARTIFACTS_ELEMENT); }
private void writeArtifacts(Set<SimpleArtifactDescriptor> artifactDescriptors) { start(ARTIFACTS_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, artifactDescriptors.size()); for (SimpleArtifactDescriptor descriptor : artifactDescriptors) { IArtifactKey key = descriptor.getArtifactKey(); start(ARTIFACT_ELEMENT); attribute(ARTIFACT_CLASSIFIER_ATTRIBUTE, key.getClassifier()); attribute(ID_ATTRIBUTE, key.getId()); attribute(VERSION_ATTRIBUTE, key.getVersion()); writeProcessingSteps(descriptor.getProcessingSteps()); writeProperties(descriptor.getProperties()); writeProperties(REPOSITORY_PROPERTIES_ELEMENT, descriptor.getRepositoryProperties()); end(ARTIFACT_ELEMENT); } end(ARTIFACTS_ELEMENT); }
private void writeArtifacts(Set<SimpleArtifactDescriptor> artifactDescriptors) { start(ARTIFACTS_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, artifactDescriptors.size()); for (SimpleArtifactDescriptor descriptor : artifactDescriptors) { IArtifactKey key = descriptor.getArtifactKey(); start(ARTIFACT_ELEMENT); attribute(ARTIFACT_CLASSIFIER_ATTRIBUTE, key.getClassifier()); attribute(ID_ATTRIBUTE, key.getId()); attribute(VERSION_ATTRIBUTE, key.getVersion()); writeProcessingSteps(descriptor.getProcessingSteps()); writeProperties(descriptor.getProperties()); writeProperties(REPOSITORY_PROPERTIES_ELEMENT, descriptor.getRepositoryProperties()); end(ARTIFACT_ELEMENT); } end(ARTIFACTS_ELEMENT); }
private void writeArtifacts(Set<SimpleArtifactDescriptor> artifactDescriptors) { start(ARTIFACTS_ELEMENT); attribute(COLLECTION_SIZE_ATTRIBUTE, artifactDescriptors.size()); for (SimpleArtifactDescriptor descriptor : artifactDescriptors) { IArtifactKey key = descriptor.getArtifactKey(); start(ARTIFACT_ELEMENT); attribute(ARTIFACT_CLASSIFIER_ATTRIBUTE, key.getClassifier()); attribute(ID_ATTRIBUTE, key.getId()); attribute(VERSION_ATTRIBUTE, key.getVersion()); writeProcessingSteps(descriptor.getProcessingSteps()); writeProperties(descriptor.getProperties()); writeProperties(REPOSITORY_PROPERTIES_ELEMENT, descriptor.getRepositoryProperties()); end(ARTIFACT_ELEMENT); } end(ARTIFACTS_ELEMENT); }
public synchronized URI createLocation(ArtifactDescriptor descriptor) { if (flatButPackedEnabled(descriptor)) { return getLocationForPackedButFlatArtifacts(descriptor); } // if the descriptor is canonical, clear out any UUID that might be set and use the Mapper if (descriptor.getProcessingSteps().length == 0) { descriptor.setProperty(ARTIFACT_UUID, null); IArtifactKey key = descriptor.getArtifactKey(); URI result = mapper.map(getLocation(), key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT)); if (result != null) { if (isFolderBased(descriptor) && URIUtil.lastSegment(result).endsWith(JAR_EXTENSION)) { return URIUtil.removeFileExtension(result); } return result; } } // Otherwise generate a location by creating a UUID, remembering it in the properties // and computing the location byte[] bytes = new UniversalUniqueIdentifier().toBytes(); descriptor.setProperty(ARTIFACT_UUID, bytesToHexString(bytes)); return blobStore.fileFor(bytes); }
public synchronized URI createLocation(ArtifactDescriptor descriptor) { if (flatButPackedEnabled(descriptor)) { return getLocationForPackedButFlatArtifacts(descriptor); } // if the descriptor is canonical, clear out any UUID that might be set and use the Mapper if (descriptor.getProcessingSteps().length == 0) { descriptor.setProperty(ARTIFACT_UUID, null); IArtifactKey key = descriptor.getArtifactKey(); URI result = mapper.map(getLocation(), key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT)); if (result != null) { if (isFolderBased(descriptor) && URIUtil.lastSegment(result).endsWith(JAR_EXTENSION)) { return URIUtil.removeFileExtension(result); } return result; } } // Otherwise generate a location by creating a UUID, remembering it in the properties // and computing the location byte[] bytes = new UniversalUniqueIdentifier().toBytes(); descriptor.setProperty(ARTIFACT_UUID, bytesToHexString(bytes)); return blobStore.fileFor(bytes); }
public synchronized URI createLocation(ArtifactDescriptor descriptor) { if (flatButPackedEnabled(descriptor)) { return getLocationForPackedButFlatArtifacts(descriptor); } // if the descriptor is canonical, clear out any UUID that might be set and use the Mapper if (descriptor.getProcessingSteps().length == 0) { descriptor.setProperty(ARTIFACT_UUID, null); IArtifactKey key = descriptor.getArtifactKey(); URI result = mapper.map(getLocation(), key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT)); if (result != null) { if (isFolderBased(descriptor) && URIUtil.lastSegment(result).endsWith(JAR_EXTENSION)) { return URIUtil.removeFileExtension(result); } return result; } } // Otherwise generate a location by creating a UUID, remembering it in the properties // and computing the location byte[] bytes = new UniversalUniqueIdentifier().toBytes(); descriptor.setProperty(ARTIFACT_UUID, bytesToHexString(bytes)); return blobStore.fileFor(bytes); }
public synchronized URI createLocation(ArtifactDescriptor descriptor) { if (flatButPackedEnabled(descriptor)) { return getLocationForPackedButFlatArtifacts(descriptor); } // if the descriptor is canonical, clear out any UUID that might be set and use the Mapper if (descriptor.getProcessingSteps().length == 0) { descriptor.setProperty(ARTIFACT_UUID, null); IArtifactKey key = descriptor.getArtifactKey(); URI result = mapper.map(getLocation(), key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT)); if (result != null) { if (isFolderBased(descriptor) && URIUtil.lastSegment(result).endsWith(JAR_EXTENSION)) { return URIUtil.removeFileExtension(result); } return result; } } // Otherwise generate a location by creating a UUID, remembering it in the properties // and computing the location byte[] bytes = new UniversalUniqueIdentifier().toBytes(); descriptor.setProperty(ARTIFACT_UUID, bytesToHexString(bytes)); return blobStore.fileFor(bytes); }