@Override public Map<String, String> getArtifactProperties(IInstallableUnit iu, IArtifactDescriptor descriptor) { // workaround Bug 539672 // TODO this is a nasty hack, and it doesn't even work; see org.eclipse.equinox.p2.publisher.AbstractPublisherAction.processArtifactPropertiesAdvice(IInstallableUnit, IArtifactDescriptor, IPublisherInfo) for (Map.Entry<String, String> entry : properties.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); ((ArtifactDescriptor) descriptor).setProperty(key, value); } return null; }
protected IArtifactDescriptor createPack200ArtifactDescriptor(IArtifactKey key, File pathOnDisk, String installSize) { ArtifactDescriptor result = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info, key, pathOnDisk); //TODO this size calculation is bogus if (pathOnDisk != null) { result.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, installSize); // TODO - this is wrong but I'm testing a work-around for bug 205842 result.setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(pathOnDisk.length())); } IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] {new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true)}; //$NON-NLS-1$ result.setProcessingSteps(steps); result.setProperty(IArtifactDescriptor.FORMAT, IArtifactDescriptor.FORMAT_PACKED); return result; }
protected IArtifactDescriptor createPack200ArtifactDescriptor(IArtifactKey key, File pathOnDisk, String installSize) { ArtifactDescriptor result = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info, key, pathOnDisk); //TODO this size calculation is bogus if (pathOnDisk != null) { result.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, installSize); // TODO - this is wrong but I'm testing a work-around for bug 205842 result.setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(pathOnDisk.length())); } IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] {new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true)}; //$NON-NLS-1$ result.setProcessingSteps(steps); result.setProperty(IArtifactDescriptor.FORMAT, IArtifactDescriptor.FORMAT_PACKED); return result; }
protected IArtifactDescriptor createPack200ArtifactDescriptor(IArtifactKey key, File pathOnDisk, String installSize) { ArtifactDescriptor result = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info, key, pathOnDisk); //TODO this size calculation is bogus if (pathOnDisk != null) { result.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, installSize); // TODO - this is wrong but I'm testing a work-around for bug 205842 result.setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(pathOnDisk.length())); } IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] {new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true)}; //$NON-NLS-1$ result.setProcessingSteps(steps); result.setProperty(IArtifactDescriptor.FORMAT, IArtifactDescriptor.FORMAT_PACKED); return result; }
protected IArtifactDescriptor createPack200ArtifactDescriptor(IArtifactKey key, File pathOnDisk, String installSize) { ArtifactDescriptor result = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info, key, pathOnDisk); //TODO this size calculation is bogus if (pathOnDisk != null) { result.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, installSize); // TODO - this is wrong but I'm testing a work-around for bug 205842 result.setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(pathOnDisk.length())); } IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] {new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true)}; //$NON-NLS-1$ result.setProcessingSteps(steps); result.setProperty(IArtifactDescriptor.FORMAT, IArtifactDescriptor.FORMAT_PACKED); return result; }
@Override public Map<String, String> getArtifactProperties(IInstallableUnit iu, IArtifactDescriptor descriptor) { final StringBuilder builder = new StringBuilder(); builder.append(iu.getId()); builder.append('/'); builder.append(iu.getVersion()); // Workaround bug Bug 539672 ((ArtifactDescriptor) descriptor).setProperty(PROPERTY_NAME, builder.toString()); return null; }
private static IArtifactDescriptor createArtifactDescriptor(IPublisherInfo info, IArtifactRepository artifactRepo, IArtifactKey key, File pathOnDisk) { IArtifactDescriptor result = artifactRepo != null ? artifactRepo.createArtifactDescriptor(key) : new ArtifactDescriptor(key); if (result instanceof ArtifactDescriptor) { ArtifactDescriptor descriptor = (ArtifactDescriptor) result; if (pathOnDisk != null) { descriptor.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, Long.toString(pathOnDisk.length())); descriptor.setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(pathOnDisk.length())); } if (info == null || (info.getArtifactOptions() & IPublisherInfo.A_NO_MD5) == 0) { String md5 = computeMD5(pathOnDisk); if (md5 != null) descriptor.setProperty(IArtifactDescriptor.DOWNLOAD_MD5, md5); } } return result; }
private static IArtifactDescriptor createArtifactDescriptor(IPublisherInfo info, IArtifactRepository artifactRepo, IArtifactKey key, File pathOnDisk) { IArtifactDescriptor result = artifactRepo != null ? artifactRepo.createArtifactDescriptor(key) : new ArtifactDescriptor(key); if (result instanceof ArtifactDescriptor) { ArtifactDescriptor descriptor = (ArtifactDescriptor) result; if (pathOnDisk != null) { descriptor.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, Long.toString(pathOnDisk.length())); descriptor.setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(pathOnDisk.length())); } if (info == null || (info.getArtifactOptions() & IPublisherInfo.A_NO_MD5) == 0) { String md5 = computeMD5(pathOnDisk); if (md5 != null) descriptor.setProperty(IArtifactDescriptor.DOWNLOAD_MD5, md5); } } return result; }
private static IArtifactDescriptor createArtifactDescriptor(IPublisherInfo info, IArtifactRepository artifactRepo, IArtifactKey key, File pathOnDisk) { IArtifactDescriptor result = artifactRepo != null ? artifactRepo.createArtifactDescriptor(key) : new ArtifactDescriptor(key); if (result instanceof ArtifactDescriptor) { ArtifactDescriptor descriptor = (ArtifactDescriptor) result; if (pathOnDisk != null) { descriptor.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, Long.toString(pathOnDisk.length())); descriptor.setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(pathOnDisk.length())); } if (info == null || (info.getArtifactOptions() & IPublisherInfo.A_NO_MD5) == 0) { String md5 = ChecksumProducer.computeMD5(pathOnDisk); if (md5 != null) descriptor.setProperty(IArtifactDescriptor.DOWNLOAD_MD5, md5); } } return result; }
private static IArtifactDescriptor createArtifactDescriptor(IPublisherInfo info, IArtifactRepository artifactRepo, IArtifactKey key, File pathOnDisk) { IArtifactDescriptor result = artifactRepo != null ? artifactRepo.createArtifactDescriptor(key) : new ArtifactDescriptor(key); if (result instanceof ArtifactDescriptor) { if (pathOnDisk != null && pathOnDisk.isFile()) { ArtifactDescriptor descriptor = (ArtifactDescriptor) result; descriptor.setProperty(IArtifactDescriptor.ARTIFACT_SIZE, Long.toString(pathOnDisk.length())); descriptor.setProperty(IArtifactDescriptor.DOWNLOAD_SIZE, Long.toString(pathOnDisk.length())); boolean generateChecksums = info == null || (info.getArtifactOptions() & IPublisherInfo.A_NO_MD5) == 0; if (generateChecksums) { calculateChecksums(pathOnDisk, descriptor); } } } return result; }
@Override protected void publishFeatureArtifacts(Feature feature, IInstallableUnit featureIU, IPublisherInfo publisherInfo) { if (computer == null) return; // add all the artifacts associated with the feature Collection<IArtifactKey> artifacts = featureIU.getArtifacts(); if (artifacts.size() > 1) { //boo! } ArtifactDescriptor ad = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(publisherInfo, artifacts.iterator().next(), null); processArtifactPropertiesAdvice(featureIU, ad, publisherInfo); ad.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, IArtifactDescriptor.TYPE_ZIP); publishArtifact(ad, computer.getFiles(), null, publisherInfo, computer); }
@Override protected void publishFeatureArtifacts(Feature feature, IInstallableUnit featureIU, IPublisherInfo publisherInfo) { if (computer == null) return; // add all the artifacts associated with the feature Collection<IArtifactKey> artifacts = featureIU.getArtifacts(); if (artifacts.size() > 1) { //boo! } ArtifactDescriptor ad = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(publisherInfo, artifacts.iterator().next(), null); processArtifactPropertiesAdvice(featureIU, ad, publisherInfo); ad.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, IArtifactDescriptor.TYPE_ZIP); publishArtifact(ad, computer.getFiles(), null, publisherInfo, computer); }
@Override protected void publishFeatureArtifacts(Feature feature, IInstallableUnit featureIU, IPublisherInfo publisherInfo) { if (computer == null) return; // add all the artifacts associated with the feature Collection<IArtifactKey> artifacts = featureIU.getArtifacts(); if (artifacts.size() > 1) { //boo! } ArtifactDescriptor ad = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(publisherInfo, artifacts.iterator().next(), null); processArtifactPropertiesAdvice(featureIU, ad, publisherInfo); ad.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, IArtifactDescriptor.TYPE_ZIP); publishArtifact(ad, computer.getFiles(), null, publisherInfo, computer); }
protected void publishFeatureArtifacts(Feature feature, IInstallableUnit featureIU, IPublisherInfo publisherInfo) { // add all the artifacts associated with the feature // TODO this is a little strange. If there are several artifacts, how do we know which files go with // which artifacts when we publish them? For now it would be surprising to have more than one // artifact per feature IU. Collection<IArtifactKey> artifacts = featureIU.getArtifacts(); for (IArtifactKey artifactKey : artifacts) { File file = new File(feature.getLocation()); ArtifactDescriptor ad = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info, artifactKey, file); processArtifactPropertiesAdvice(featureIU, ad, publisherInfo); ad.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, IArtifactDescriptor.TYPE_ZIP); // if the artifact is a dir then zip it up. if (file.isDirectory()) publishArtifact(ad, new File[] {file}, null, publisherInfo, createRootPrefixComputer(file)); else publishArtifact(ad, file, publisherInfo); } }
protected void publishFeatureArtifacts(Feature feature, IInstallableUnit featureIU, IPublisherInfo publisherInfo) { // add all the artifacts associated with the feature // TODO this is a little strange. If there are several artifacts, how do we know which files go with // which artifacts when we publish them? For now it would be surprising to have more than one // artifact per feature IU. Collection<IArtifactKey> artifacts = featureIU.getArtifacts(); for (IArtifactKey artifactKey : artifacts) { File file = new File(feature.getLocation()); ArtifactDescriptor ad = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info, artifactKey, file); processArtifactPropertiesAdvice(featureIU, ad, publisherInfo); ad.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, IArtifactDescriptor.TYPE_ZIP); // if the artifact is a dir then zip it up. if (file.isDirectory()) publishArtifact(ad, new File[] {file}, null, publisherInfo, createRootPrefixComputer(file)); else publishArtifact(ad, file, publisherInfo); } }
protected void publishFeatureArtifacts(Feature feature, IInstallableUnit featureIU, IPublisherInfo publisherInfo) { // add all the artifacts associated with the feature // TODO this is a little strange. If there are several artifacts, how do we know which files go with // which artifacts when we publish them? For now it would be surprising to have more than one // artifact per feature IU. Collection<IArtifactKey> artifacts = featureIU.getArtifacts(); for (IArtifactKey artifactKey : artifacts) { File file = new File(feature.getLocation()); ArtifactDescriptor ad = (ArtifactDescriptor) PublisherHelper.createArtifactDescriptor(info, artifactKey, file); processArtifactPropertiesAdvice(featureIU, ad, publisherInfo); ad.setProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE, IArtifactDescriptor.TYPE_ZIP); // if the artifact is a dir then zip it up. if (file.isDirectory()) publishArtifact(ad, new File[] {file}, null, publisherInfo, createRootPrefixComputer(file)); else publishArtifact(ad, file, publisherInfo); } }
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); }