Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2010-03-26 20:26:49 +0000
committerAndrew Niefer2010-03-26 20:26:49 +0000
commitda6a59e31131354342828aa534428d2d66a7d411 (patch)
treef43bc0fb4608cbc39eb0e0cc1f59d25394a45b28 /bundles
parent5f5a6c25f61cb04862b50d0e61ec6788b1c8f679 (diff)
downloadrt.equinox.p2-da6a59e31131354342828aa534428d2d66a7d411.tar.gz
rt.equinox.p2-da6a59e31131354342828aa534428d2d66a7d411.tar.xz
rt.equinox.p2-da6a59e31131354342828aa534428d2d66a7d411.zip
bug 272061 - context repositories for export
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java37
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryDescriptor.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryFileSet.java9
5 files changed, 43 insertions, 33 deletions
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF
index 56e0ed95b..c7a2d5d83 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@ Export-Package: org.eclipse.equinox.internal.p2.metadata.repository;
org.eclipse.equinox.p2.reconciler.dropins,
org.eclipse.equinox.p2.ui,
org.eclipse.equinox.p2.updatesite,
- org.eclipse.equinox.p2.extensionlocation",
+ org.eclipse.equinox.p2.extensionlocation,
+ org.eclipse.equinox.p2.repository.tools",
org.eclipse.equinox.internal.p2.metadata.repository.io;x-friends:="org.eclipse.equinox.p2.engine"
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)",
org.eclipse.equinox.registry,
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java
index aab938753..6f4db174f 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java
@@ -10,15 +10,14 @@
*******************************************************************************/
package org.eclipse.equinox.p2.internal.repository.tools;
-import java.net.*;
+import java.net.MalformedURLException;
+import java.net.URI;
import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
-import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepositoryFactory;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository;
-import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepositoryFactory;
import org.eclipse.equinox.internal.p2.repository.helpers.RepositoryHelper;
import org.eclipse.equinox.p2.core.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
@@ -110,8 +109,8 @@ public abstract class AbstractApplication {
IArtifactRepositoryManager artifactRepositoryManager = getArtifactRepositoryManager();
IMetadataRepositoryManager metadataRepositoryManager = getMetadataRepositoryManager();
URI curLocation = null;
- try {
- for (RepositoryDescriptor repo : sourceRepositories) {
+ for (RepositoryDescriptor repo : sourceRepositories) {
+ try {
curLocation = repo.getRepoLocation();
if (repo.isBoth()) {
addRepository(artifactRepositoryManager, curLocation, 0, progress);
@@ -122,12 +121,14 @@ public abstract class AbstractApplication {
addRepository(metadataRepositoryManager, curLocation, 0, progress);
else
throw new ProvisionException(NLS.bind(Messages.unknown_repository_type, repo.getRepoLocation()));
+ } catch (ProvisionException e) {
+ if (e.getCause() instanceof MalformedURLException) {
+ throw new ProvisionException(NLS.bind(Messages.exception_invalidSource, curLocation), e);
+ } else if (e.getStatus().getCode() == ProvisionException.REPOSITORY_NOT_FOUND && repo.isOptional()) {
+ continue;
+ }
+ throw e;
}
- } catch (ProvisionException e) {
- if (e.getCause() instanceof MalformedURLException) {
- throw new ProvisionException(NLS.bind(Messages.exception_invalidSource, curLocation), e);
- }
- throw e;
}
processDestinationRepos(artifactRepositoryManager, metadataRepositoryManager);
}
@@ -249,13 +250,7 @@ public abstract class AbstractApplication {
public IMetadataRepository getCompositeMetadataRepository() {
if (compositeMetadataRepository == null) {
- try {
- CompositeMetadataRepositoryFactory factory = new CompositeMetadataRepositoryFactory();
- factory.setAgent(agent);
- compositeMetadataRepository = (CompositeMetadataRepository) factory.create(new URI("memory:/composite"), "parent metadata repo", CompositeMetadataRepository.REPOSITORY_TYPE, null);//$NON-NLS-1$ //$NON-NLS-2$
- } catch (URISyntaxException e) {
- //Can't happen
- }
+ compositeMetadataRepository = CompositeMetadataRepository.createMemoryComposite(agent);
for (RepositoryDescriptor repo : sourceRepositories) {
if (repo.isMetadata())
compositeMetadataRepository.addChild(repo.getRepoLocation());
@@ -266,13 +261,7 @@ public abstract class AbstractApplication {
public IArtifactRepository getCompositeArtifactRepository() {
if (compositeArtifactRepository == null) {
- try {
- CompositeArtifactRepositoryFactory factory = new CompositeArtifactRepositoryFactory();
- factory.setAgent(agent);
- compositeArtifactRepository = (CompositeArtifactRepository) factory.create(new URI("memory:/composite"), "parent artifact repo", CompositeArtifactRepository.REPOSITORY_TYPE, null);//$NON-NLS-1$ //$NON-NLS-2$
- } catch (URISyntaxException e) {
- //Can't happen
- }
+ compositeArtifactRepository = CompositeArtifactRepository.createMemoryComposite(agent);
for (RepositoryDescriptor repo : sourceRepositories) {
if (repo.isArtifact())
compositeArtifactRepository.addChild(repo.getRepoLocation());
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryDescriptor.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryDescriptor.java
index f8c2ae76d..01dd76fb4 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryDescriptor.java
@@ -28,6 +28,7 @@ public class RepositoryDescriptor {
private URI format = null;
private int kind = TYPE_BOTH;
private URI originalLocation = null;
+ private boolean optional = false;
public void setCompressed(boolean compress) {
compressed = compress;
@@ -37,6 +38,14 @@ public class RepositoryDescriptor {
name = repoName;
}
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
+
+ public boolean isOptional() {
+ return optional;
+ }
+
public void setLocation(URI repoLocation) {
originalLocation = repoLocation;
location = RepositoryHelper.localRepoURIHelper(repoLocation);
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java
index a8d947303..bd9d05760 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java
@@ -34,17 +34,19 @@ public abstract class AbstractRepositoryTask extends Task {
protected List<FileSet> sourceRepos = new ArrayList<FileSet>();
protected List<DestinationRepository> destinations = new ArrayList<DestinationRepository>();
- protected void addMetadataSourceRepository(URI repoLocation) {
+ protected void addMetadataSourceRepository(URI repoLocation, boolean optional) {
RepositoryDescriptor source = new RepositoryDescriptor();
source.setLocation(repoLocation);
source.setKind(RepositoryDescriptor.KIND_METADATA);
+ source.setOptional(optional);
application.addSource(source);
}
- protected void addArtifactSourceRepository(URI repoLocation) {
+ protected void addArtifactSourceRepository(URI repoLocation, boolean optional) {
RepositoryDescriptor source = new RepositoryDescriptor();
source.setLocation(repoLocation);
source.setKind(RepositoryDescriptor.KIND_ARTIFACT);
+ source.setOptional(optional);
application.addSource(source);
}
@@ -138,9 +140,9 @@ public abstract class AbstractRepositoryTask extends Task {
if (fileset.getRepoLocation() != null) {
if (!fileset.getRepoLocation().startsWith(ANT_PREFIX)) {
if (fileset.isArtifact())
- addArtifactSourceRepository(fileset.getRepoLocationURI());
+ addArtifactSourceRepository(fileset.getRepoLocationURI(), fileset.isOptional());
if (fileset.isMetadata())
- addMetadataSourceRepository(fileset.getRepoLocationURI());
+ addMetadataSourceRepository(fileset.getRepoLocationURI(), fileset.isOptional());
}
} else if (fileset.getDir() != null) {
DirectoryScanner scanner = fileset.getDirectoryScanner(getProject());
@@ -154,12 +156,12 @@ public abstract class AbstractRepositoryTask extends Task {
uri = URIUtil.toJarURI(uri, null);
}
if (fileset.isBoth()) {
- addArtifactSourceRepository(uri);
- addMetadataSourceRepository(uri);
+ addArtifactSourceRepository(uri, fileset.isOptional());
+ addMetadataSourceRepository(uri, fileset.isOptional());
} else if (fileset.isArtifact())
- addArtifactSourceRepository(uri);
+ addArtifactSourceRepository(uri, fileset.isOptional());
else if (fileset.isMetadata())
- addMetadataSourceRepository(uri);
+ addMetadataSourceRepository(uri, fileset.isOptional());
else
throw new BuildException(NLS.bind(Messages.unknown_repository_type, uri));
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryFileSet.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryFileSet.java
index 79b16675c..2abccae3f 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryFileSet.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryFileSet.java
@@ -24,6 +24,7 @@ public class RepositoryFileSet extends FileSet {
public final static int TYPE_METADATA = IRepository.TYPE_METADATA;
private int kind = RepositoryDescriptor.TYPE_BOTH;
+ private boolean optional = false;
protected String myLocation = null;
public void setKind(String repoKind) {
@@ -34,6 +35,14 @@ public class RepositoryFileSet extends FileSet {
return kind;
}
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
+
+ public boolean isOptional() {
+ return optional;
+ }
+
public boolean isBoth() {
return kind == RepositoryDescriptor.TYPE_BOTH;
}

Back to the top