diff options
author | Mykola Nikishov | 2017-04-06 02:48:00 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-06-27 18:48:20 +0000 |
commit | e6b5b61fec7dd14f5b66575d00604747e546ea82 (patch) | |
tree | 8eedbd617675b51c0ce6888ce46959f35b980469 | |
parent | a96d75268bfed5d13c8af53af3d26d1a134c60fe (diff) | |
download | rt.equinox.p2-e6b5b61fec7dd14f5b66575d00604747e546ea82.tar.gz rt.equinox.p2-e6b5b61fec7dd14f5b66575d00604747e546ea82.tar.xz rt.equinox.p2-e6b5b61fec7dd14f5b66575d00604747e546ea82.zip |
Bug 518850 - Replace RepositoryDescriptor with repository locationI20170702-2000I20170701-2000I20170630-2000I20170630-0410I20170629-2000I20170629-0425I20170629-0210I20170628-2000I20170628-0310I20170627-2000
RecreateRepositoryApplication needs location of the repository only
and don't use any other fields of RepositoryDescriptor.
Change-Id: I2e933ed9dab02e231009c1d7cce31dd6c4f95e70
Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
2 files changed, 10 insertions, 15 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java index fbd0cb0bf..01df3ce23 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java @@ -32,7 +32,7 @@ import org.eclipse.osgi.util.NLS; public class RecreateRepositoryApplication extends AbstractApplication { static final private String PUBLISH_PACK_FILES_AS_SIBLINGS = "publishPackFilesAsSiblings"; //$NON-NLS-1$ - private RepositoryDescriptor descriptor; + private URI repoLocation; private String repoName = null; boolean removeArtifactRepo = true; private Map<String, String> repoProperties = null; @@ -46,22 +46,22 @@ public class RecreateRepositoryApplication extends AbstractApplication { } finally { if (removeArtifactRepo) { IArtifactRepositoryManager repositoryManager = getArtifactRepositoryManager(); - repositoryManager.removeRepository(descriptor.getRepoLocation()); + repositoryManager.removeRepository(repoLocation); } } return Status.OK_STATUS; } - public void setArtifactRepository(RepositoryDescriptor descriptor) { - this.descriptor = descriptor; + public void setArtifactRepository(URI repository) { + this.repoLocation = repository; } private IArtifactRepository initialize(IProgressMonitor monitor) throws ProvisionException { IArtifactRepositoryManager repositoryManager = getArtifactRepositoryManager(); - removeArtifactRepo = !repositoryManager.contains(descriptor.getRepoLocation()); + removeArtifactRepo = !repositoryManager.contains(repoLocation); - IArtifactRepository repository = repositoryManager.loadRepository(descriptor.getRepoLocation(), IRepositoryManager.REPOSITORY_HINT_MODIFIABLE, monitor); + IArtifactRepository repository = repositoryManager.loadRepository(repoLocation, IRepositoryManager.REPOSITORY_HINT_MODIFIABLE, monitor); if (repository == null || !repository.isModifiable()) throw new ProvisionException(NLS.bind(Messages.exception_destinationNotModifiable, repository.getLocation())); @@ -99,7 +99,7 @@ public class RecreateRepositoryApplication extends AbstractApplication { //add pack200 mappings, the existing repoProperties is not modifiable Map<String, String> newProperties = new HashMap<String, String>(repoProperties); newProperties.put(PUBLISH_PACK_FILES_AS_SIBLINGS, "true"); //$NON-NLS-1$ - IArtifactRepository repository = manager.createRepository(descriptor.getRepoLocation(), repoName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, newProperties); + IArtifactRepository repository = manager.createRepository(repoLocation, repoName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, newProperties); if (!(repository instanceof IFileArtifactRepository)) throw new ProvisionException(NLS.bind(Messages.exception_notLocalFileRepo, repository.getLocation())); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ProcessRepoTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ProcessRepoTask.java index 3e85194c9..ae4298449 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ProcessRepoTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ProcessRepoTask.java @@ -20,7 +20,8 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.URIUtil; import org.eclipse.equinox.internal.p2.jarprocessor.ant.JarProcessorTask; import org.eclipse.equinox.p2.core.ProvisionException; -import org.eclipse.equinox.p2.internal.repository.tools.*; +import org.eclipse.equinox.p2.internal.repository.tools.Messages; +import org.eclipse.equinox.p2.internal.repository.tools.RecreateRepositoryApplication; import org.eclipse.osgi.util.NLS; public class ProcessRepoTask extends Task { @@ -91,14 +92,8 @@ public class ProcessRepoTask extends Task { } private void recreateRepository() { - RepositoryDescriptor descriptor = new RepositoryDescriptor(); - descriptor.setAppend(true); - descriptor.setFormat(null); - descriptor.setKind("artifact"); //$NON-NLS-1$ - descriptor.setLocation(repository); - RecreateRepositoryApplication application = new RecreateRepositoryApplication(); - application.setArtifactRepository(descriptor); + application.setArtifactRepository(repository); try { application.run(new NullProgressMonitor()); } catch (ProvisionException e) { |