public void removeDescriptor(IArtifactKey key, IProgressMonitor monitor) { for (IArtifactDescriptor nextDescriptor : artifactDescriptors) { if (key.equals(nextDescriptor.getArtifactKey())) artifactDescriptors.remove(nextDescriptor); } if (keysToLocations.containsKey(key)) { URI theLocation = keysToLocations.get(key); locationsToContents.remove(theLocation); keysToLocations.remove(key); } }
public IStatus getArtifact( IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { ProcessingStepHandler handler = new ProcessingStepHandler(); destination = handler.createAndLink( getProvisioningAgent(), descriptor.getProcessingSteps(), null, destination, monitor); testhandler.download(keysToLocations.get(descriptor.getArtifactKey()), destination, monitor); return Status.OK_STATUS; }
public IStatus download(URI toDownload, OutputStream target, IProgressMonitor pm) { byte[] contents = locationsToContents.get(toDownload); if (contents == null) Assert.fail( "Attempt to download missing artifact in TestArtifactRepository: " + toDownload); try { target.write(contents); } catch (IOException e) { e.printStackTrace(); Assert.fail("Unexpected exception in TestArtifactRepository" + e.getMessage()); } return Status.OK_STATUS; }
public void removeAll(IProgressMonitor monitor) { artifactDescriptors.clear(); keysToLocations.clear(); locationsToContents.clear(); }
public void addDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) { ((ArtifactDescriptor) descriptor).setRepository(this); artifactDescriptors.add(descriptor); keysToLocations.put(descriptor.getArtifactKey(), null); }
public IStatus getRawArtifact( IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { return testhandler.download( keysToLocations.get(descriptor.getArtifactKey()), destination, monitor); }
public boolean contains(IArtifactKey key) { return keysToLocations.get(key) != null; }
public boolean contains(IArtifactDescriptor descriptor) { return keysToLocations.get(descriptor.getArtifactKey()) != null; }
public URI getArtifact(IArtifactKey key) { return keysToLocations.get(key); }
public void addArtifact(IArtifactKey key, byte[] contents) { URI keyLocation = locationFor(key); keysToLocations.put(key, keyLocation); locationsToContents.put(keyLocation, contents); }