public String getLabel(Object o) { return key.getId() + " [" + key.getClassifier() + "]"; //$NON-NLS-1$//$NON-NLS-2$ }
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 OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException { IArtifactKey artifactKey = descriptor.getArtifactKey(); if (artifactKey != null && PublisherHelper.BINARY_ARTIFACT_CLASSIFIER.equals(artifactKey.getClassifier())) { try { return createRootfileOutputStream(artifactKey); } catch (IOException e) { throw new ProvisionException(e.getMessage(), e); } } return super.getOutputStream(descriptor); }
private void addArtifactFile(DefaultP2ResolutionResult result, IInstallableUnit iu, IArtifactKey key, File artifactLocation) { String id = iu.getId(); String version = iu.getVersion().toString(); String mavenClassifier = null; if (PublisherHelper.OSGI_BUNDLE_CLASSIFIER.equals(key.getClassifier())) { result.addArtifact(ArtifactType.TYPE_ECLIPSE_PLUGIN, id, version, artifactLocation, mavenClassifier, iu); } else if (PublisherHelper.ECLIPSE_FEATURE_CLASSIFIER.equals(key.getClassifier())) { String featureId = getFeatureId(iu); if (featureId != null) { result.addArtifact(ArtifactType.TYPE_ECLIPSE_FEATURE, featureId, version, artifactLocation, mavenClassifier, iu); } } // ignore other/unknown artifacts, like binary blobs for now. // throw new IllegalArgumentException(); }
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); }