Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2010-02-22 15:10:37 -0500
committerDJ Houghton2010-02-22 15:10:37 -0500
commit15aa27467f64b7e9c70687cc58bf17b31c766160 (patch)
tree5fee81e8de249653d34efd3cb66bb2301d5f5248
parent6a9c28a2de409130ba25e58079543f038b632d4b (diff)
downloadrt.equinox.p2-15aa27467f64b7e9c70687cc58bf17b31c766160.tar.gz
rt.equinox.p2-15aa27467f64b7e9c70687cc58bf17b31c766160.tar.xz
rt.equinox.p2-15aa27467f64b7e9c70687cc58bf17b31c766160.zip
Bug 303269 - [repository] The method signatures on IMetadataRepository should take collections
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java47
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java60
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java67
19 files changed, 307 insertions, 77 deletions
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
index 3d7c91ba8..035b59409 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -212,7 +212,7 @@ public class RepositoryListener extends DirectoryChangeListener {
final Collection<IInstallableUnit> changes = iusToChange.getIUs(null, null);
// first remove any IUs that have changed or that are associated with removed files
if (!removedFiles.isEmpty() || !changes.isEmpty()) {
- metadataRepository.removeInstallableUnits(changes.toArray(new IInstallableUnit[changes.size()]), null);
+ metadataRepository.removeInstallableUnits(changes);
// create a query that will identify all ius related to removed files.
// It's safe to compare a String with a File since the auto coercion will
@@ -220,13 +220,13 @@ public class RepositoryListener extends DirectoryChangeListener {
IMatchQuery<IInstallableUnit> removeQuery = new ExpressionQuery<IInstallableUnit>(IInstallableUnit.class, //
"$1.exists(x | properties[$0] == x)", FILE_NAME, removedFiles); //$NON-NLS-1$
IQueryResult<IInstallableUnit> toRemove = metadataRepository.query(removeQuery, null);
- metadataRepository.removeInstallableUnits(toRemove.toArray(IInstallableUnit.class), null);
+ metadataRepository.removeInstallableUnits(toRemove.toSet());
}
// Then add all the new IUs as well as the new copies of the ones that have changed
Collection<IInstallableUnit> additions = iusToAdd.getIUs(null, null);
additions.addAll(changes);
if (!additions.isEmpty())
- metadataRepository.addInstallableUnits(additions.toArray(new IInstallableUnit[additions.size()]));
+ metadataRepository.addInstallableUnits(additions);
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
index d5b748288..d742fc6b4 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -82,29 +82,44 @@ public class ExtensionLocationMetadataRepository extends AbstractMetadataReposit
state = value;
}
+ // TODO remove
+ @Override
+ public void addInstallableUnits(IInstallableUnit[] installableUnits) {
+ throw new UnsupportedOperationException();
+ }
+
/* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository#addInstallableUnits(org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit[])
+ * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addInstallableUnits(java.util.Collection)
*/
- public void addInstallableUnits(IInstallableUnit[] installableUnits) {
+ @Override
+ public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
throw new UnsupportedOperationException();
}
/* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository#removeAll()
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeAll()
*/
+ @Override
public void removeAll() {
throw new UnsupportedOperationException();
}
+ // TODO remove
+ @Override
+ public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
+ throw new UnsupportedOperationException();
+ }
+
/* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository#removeInstallableUnits(org.eclipse.equinox.internal.provisional.p2.query.Query, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeInstallableUnits(java.util.Collection)
*/
- public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
+ @Override
+ public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
throw new UnsupportedOperationException();
}
/* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.query.IQueryable#query(org.eclipse.equinox.internal.provisional.p2.query.Query, org.eclipse.equinox.internal.provisional.p2.query.Collector, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.equinox.p2.query.IQueryable#query(org.eclipse.equinox.p2.query.IQuery, org.eclipse.core.runtime.IProgressMonitor)
*/
public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
ensureInitialized();
@@ -177,15 +192,24 @@ public class ExtensionLocationMetadataRepository extends AbstractMetadataReposit
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#getProperties()
*/
+ @Override
public Map<String, String> getProperties() {
ensureInitialized();
return metadataRepository.getProperties();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#initialize(org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository.RepositoryState)
+ */
+ @Override
public void initialize(RepositoryState repositoryState) {
//nothing to do
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#setProperty(java.lang.String, java.lang.String)
+ */
+ @Override
public String setProperty(String key, String value) {
ensureInitialized();
String oldValue = metadataRepository.setProperty(key, value);
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java
index 772f1887c..bd01ab034 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -369,7 +369,7 @@ public class Generator {
IMetadataRepository metadataRepository = info.getMetadataRepository();
if (metadataRepository != null) {
Set allGeneratedUnits = result.allGeneratedIUs();
- metadataRepository.addInstallableUnits((IInstallableUnit[]) allGeneratedUnits.toArray(new IInstallableUnit[allGeneratedUnits.size()]));
+ metadataRepository.addInstallableUnits(allGeneratedUnits);
}
return Status.OK_STATUS;
@@ -602,7 +602,7 @@ public class Generator {
IMetadataRepository metadataRepository = info.getMetadataRepository();
if (metadataRepository != null && !allCUs.isEmpty()) {
// Product Query will run against the repo later in createProductIU, make sure these CUs are in before then
- metadataRepository.addInstallableUnits((IInstallableUnit[]) allCUs.toArray(new IInstallableUnit[allCUs.size()]));
+ metadataRepository.addInstallableUnits(allCUs);
}
}
@@ -687,7 +687,7 @@ public class Generator {
IMetadataRepository metadataRepository = info.getMetadataRepository();
if (metadataRepository != null && !defaults.isEmpty()) {
// Product Query will run against the repo later in createProductIU, make sure these CUs are in before then
- metadataRepository.addInstallableUnits((IInstallableUnit[]) defaults.toArray(new IInstallableUnit[defaults.size()]));
+ metadataRepository.addInstallableUnits(defaults);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java
index dc29e772d..1d99055a5 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java
@@ -123,6 +123,9 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
return result;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.query.IQueryable#query(org.eclipse.equinox.p2.query.IQuery, org.eclipse.core.runtime.IProgressMonitor)
+ */
public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
if (monitor == null)
monitor = new NullProgressMonitor();
@@ -161,10 +164,16 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.ICompositeRepository#addChild(java.net.URI)
+ */
public void addChild(URI childURI) {
addChild(childURI, true);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.ICompositeRepository#removeChild(java.net.URI)
+ */
public void removeChild(URI childURI) {
boolean removed = childrenURIs.remove(childURI);
// if the child wasn't there make sure and try the other permutation
@@ -189,22 +198,49 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.ICompositeRepository#removeAllChildren()
+ */
public void removeAllChildren() {
childrenURIs.clear();
loadedRepos.clear();
save();
}
+ // TODO remove
+ @Override
public synchronized void addInstallableUnits(IInstallableUnit[] installableUnits) {
- throw new UnsupportedOperationException("Cannot add IUs to a composite repository");
+ throw new UnsupportedOperationException("Cannot add IUs to a composite repository"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#addInstallableUnits(java.util.Collection)
+ */
+ @Override
+ public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
+ throw new UnsupportedOperationException("Cannot add IUs to a composite repository"); //$NON-NLS-1$
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeAll()
+ */
+ @Override
public synchronized void removeAll() {
- throw new UnsupportedOperationException("Cannot remove IUs to a composite repository");
+ throw new UnsupportedOperationException("Cannot remove IUs from a composite repository"); //$NON-NLS-1$
}
+ // TODO remove
+ @Override
public synchronized boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
- throw new UnsupportedOperationException("Cannot remove IUs to a composite repository");
+ throw new UnsupportedOperationException("Cannot remove IUs from a composite repository"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeInstallableUnits(java.util.Collection)
+ */
+ @Override
+ public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
+ throw new UnsupportedOperationException("Cannot remove IUs from a composite repository"); //$NON-NLS-1$
}
private static File getActualLocation(URI location, String extension) {
@@ -227,7 +263,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
}
public synchronized void addReference(URI repositoryLocation, int repositoryType, int options) {
- throw new UnsupportedOperationException("Cannot add References to a composite repository");
+ throw new UnsupportedOperationException("Cannot add References to a composite repository"); //$NON-NLS-1$
}
// caller should be synchronized
@@ -270,6 +306,9 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.ICompositeRepository#getChildren()
+ */
public List<URI> getChildren() {
List<URI> result = new ArrayList<URI>();
for (URI childURI : childrenURIs)
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java
index 81af4d7a0..244667576 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -94,19 +94,36 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen
save();
}
+ // TODO remove
+ @Override
public synchronized void addInstallableUnits(IInstallableUnit[] installableUnits) {
- if (installableUnits == null || installableUnits.length == 0)
+ addInstallableUnits(Arrays.asList(installableUnits));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#addInstallableUnits(java.util.Collection)
+ */
+ @Override
+ public synchronized void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
+ if (installableUnits == null || installableUnits.isEmpty())
return;
units.addAll(installableUnits);
capabilityIndex = null; // Generated, not backed by units
save();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#addReference(java.net.URI, java.lang.String, int, int)
+ */
+ @Override
public synchronized void addReference(URI repositoryLocation, String nickname, int repositoryType, int options) {
assertModifiable();
repositories.add(new RepositoryReference(repositoryLocation, nickname, repositoryType, options));
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.metadata.index.IIndexProvider#getIndex(java.lang.String)
+ */
public synchronized IIndex<IInstallableUnit> getIndex(String memberName) {
if (InstallableUnit.MEMBER_ID.equals(memberName)) {
if (idIndex == null)
@@ -121,7 +138,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen
}
return null;
}
-
+
public synchronized Object getManagedProperty(Object client, String memberName, Object key) {
if (!(client instanceof IInstallableUnit))
return null;
@@ -134,6 +151,10 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen
return null;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#initialize(org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository.RepositoryState)
+ */
+ @Override
public void initialize(RepositoryState state) {
synchronized (this) {
this.name = state.Name;
@@ -175,29 +196,53 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen
this.location = aLocation;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#isModifiable()
+ */
+ @Override
public boolean isModifiable() {
return true;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.query.IQueryable#query(org.eclipse.equinox.p2.query.IQuery, org.eclipse.core.runtime.IProgressMonitor)
+ */
public synchronized IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
return query instanceof IQueryWithIndex<?> ? ((IQueryWithIndex<IInstallableUnit>) query).perform(this) : query.perform(units.iterator());
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.metadata.index.IIndexProvider#everything()
+ */
public Iterator<IInstallableUnit> everything() {
return units.iterator();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeAll()
+ */
+ @Override
public synchronized void removeAll() {
units.clear();
capabilityIndex = null; // Generated, not backed by units.
save();
}
+ // TODO remove
+ @Override
public synchronized boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
+ return removeInstallableUnits(Arrays.asList(installableUnits));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeInstallableUnits(java.util.Collection)
+ */
+ @Override
+ public synchronized boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
boolean changed = false;
- if (installableUnits != null && installableUnits.length > 0) {
+ if (installableUnits != null && !installableUnits.isEmpty()) {
changed = true;
- units.removeAll(Arrays.asList(installableUnits));
+ units.removeAll(installableUnits);
capabilityIndex = null; // Generated, not backed by units.
}
if (changed)
@@ -243,6 +288,10 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#setProperty(java.lang.String, java.lang.String)
+ */
+ @Override
public String setProperty(String key, String newValue) {
String oldValue = null;
synchronized (this) {
@@ -257,4 +306,5 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen
manager.addRepository(this);
return oldValue;
}
+
}
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java
index fa7e29f2e..a2b23b058 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java
@@ -252,7 +252,7 @@ public class Publisher {
IMetadataRepository metadataRepository = info.getMetadataRepository();
if (metadataRepository != null) {
Collection<IInstallableUnit> ius = results.getIUs(null, null);
- metadataRepository.addInstallableUnits(ius.toArray(new IInstallableUnit[ius.size()]));
+ metadataRepository.addInstallableUnits(ius);
}
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
index 9f5665b82..e70468460 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -241,7 +241,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
private void mirrorMetadata(IQueryable<IInstallableUnit> slice, IProgressMonitor monitor) {
IQueryResult<IInstallableUnit> allIUs = slice.query(InstallableUnitQuery.ANY, monitor);
- destinationMetadataRepository.addInstallableUnits(allIUs.toArray(IInstallableUnit.class));
+ destinationMetadataRepository.addInstallableUnits(allIUs.toSet());
}
/*
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java
index cbf596f07..ef3b8b842 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009-2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,10 +11,6 @@
*******************************************************************************/
package org.eclipse.equinox.p2.internal.repository.tools;
-import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand;
-
-import org.eclipse.equinox.p2.planner.IPlanner;
-
import java.net.URISyntaxException;
import java.util.*;
import org.eclipse.core.runtime.*;
@@ -30,6 +26,7 @@ import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
+import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest;
@@ -193,7 +190,7 @@ public class Repo2Runnable extends AbstractApplication implements IApplication {
// publishing the metadata is optional
if (destinationMetadataRepository == null)
return;
- destinationMetadataRepository.addInstallableUnits(processedIUs.toArray(new IInstallableUnit[processedIUs.size()]));
+ destinationMetadataRepository.addInstallableUnits(processedIUs);
}
/*
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java
index 531134c24..566e522a1 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -103,7 +103,7 @@ public class RemoveIUTask extends AbstractRepositoryTask {
}
if (toRemove.size() > 0) {
- repository.removeInstallableUnits(toRemove.toArray(new IInstallableUnit[toRemove.size()]), null);
+ repository.removeInstallableUnits(toRemove);
}
} catch (ProvisionException e) {
throw new BuildException(e);
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java
index 88be97f9d..afdeb3278 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.p2.repository.metadata;
import java.net.URI;
+import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.repository.IRepository;
@@ -28,11 +29,17 @@ import org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository
*/
public interface IMetadataRepository extends IRepository<IInstallableUnit> {
+ /**
+ * @deprecated use {@link #addInstallableUnits(Collection)}
+ */
+ public void addInstallableUnits(IInstallableUnit[] installableUnits);
+
/**
- * Add the given installable units to this repository
+ * Add the given installable units to this repository.
+ *
* @param installableUnits the installable units to add
*/
- public void addInstallableUnits(IInstallableUnit[] installableUnits);
+ public void addInstallableUnits(Collection<IInstallableUnit> installableUnits);
/**
* Adds a reference to another repository to this repository. When a repository
@@ -60,15 +67,18 @@ public interface IMetadataRepository extends IRepository<IInstallableUnit> {
public void addReference(URI location, String nickname, int type, int options);
/**
- * Removes all installable units that match the given query from this repository.
+ * @deprecated use {@link #removeInstallableUnits(Collection)}
+ */
+ public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor);
+
+ /**
+ * Removes all installable units in the given collection from this repository.
*
* @param installableUnits the installable units to remove
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting is not desired
* @return <code>true</code> if any units were actually removed, and
* <code>false</code> otherwise
*/
- public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor);
+ public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits);
/**
* Remove all installable units from this repository.
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java
index 95565ec43..c66340643 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
package org.eclipse.equinox.p2.repository.metadata.spi;
import java.net.URI;
+import java.util.Collection;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
@@ -53,21 +54,44 @@ public abstract class AbstractMetadataRepository extends AbstractRepository<IIns
super(agent, name, type, version, location, description, provider, properties);
}
+ // TODO remove
public void addInstallableUnits(IInstallableUnit[] installableUnit) {
assertModifiable();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addInstallableUnits(java.util.Collection)
+ */
+ public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
+ assertModifiable();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addReference(java.net.URI, java.lang.String, int, int)
+ */
public void addReference(URI repositoryLocation, String nickname, int repositoryType, int options) {
assertModifiable();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeAll()
+ */
public void removeAll() {
assertModifiable();
}
+ // TODO remove
public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
assertModifiable();
return false;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeInstallableUnits(java.util.Collection)
+ */
+ public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
+ assertModifiable();
+ return false;
+ }
+
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java
index 5a8dfeb10..52ae7a134 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -55,8 +55,18 @@ public class TestMetadataRepository extends AbstractMetadataRepository {
units.addAll(Arrays.asList(ius));
}
+ // TODO remove
+ @Override
public void addInstallableUnits(IInstallableUnit[] toAdd) {
- units.addAll(Arrays.asList(toAdd));
+ addInstallableUnits(Arrays.asList(toAdd));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#addInstallableUnits(java.util.Collection)
+ */
+ @Override
+ public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
+ units.addAll(installableUnits);
}
public IInstallableUnit find(String id, String versionString) {
@@ -79,11 +89,20 @@ public class TestMetadataRepository extends AbstractMetadataRepository {
units.clear();
}
- public boolean removeInstallableUnits(IInstallableUnit[] toRemove) {
+ // TODO remove
+ @Override
+ public boolean removeInstallableUnits(IInstallableUnit[] toRemove, IProgressMonitor monitor) {
+ return removeInstallableUnits(Arrays.asList(toRemove));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeInstallableUnits(java.util.Collection)
+ */
+ @Override
+ public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
boolean modified = false;
- for (int i = 0; i < toRemove.length; i++) {
- modified |= units.remove(toRemove[i]);
- }
+ for (IInstallableUnit iu : installableUnits)
+ modified |= units.remove(iu);
return modified;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java
index 0d5416165..fd39a29ec 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,8 +13,7 @@ package org.eclipse.equinox.p2.tests.ant;
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.Iterator;
-import java.util.Properties;
+import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import org.eclipse.core.runtime.*;
@@ -807,7 +806,7 @@ public class MirrorTaskTest extends AbstractAntProvisioningTest {
iu.setId(descriptor.getArtifactKey().getId() + "IU");
iu.setVersion(descriptor.getArtifactKey().getVersion());
iu.setArtifacts(new IArtifactKey[] {descriptor.getArtifactKey()});
- metaRepo.addInstallableUnits(new IInstallableUnit[] {iu});
+ metaRepo.addInstallableUnits(Arrays.asList((IInstallableUnit) iu));
return artifactRepository;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java
index a4e2084c7..6273dfe8e 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -105,7 +105,7 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
descriptor.setId("testIuId");
descriptor.setVersion(Version.create("3.2.1"));
IInstallableUnit iu = MetadataFactory.createInstallableUnit(descriptor);
- compRepo.addInstallableUnits(new IInstallableUnit[] {iu});
+ compRepo.addInstallableUnits(Arrays.asList(iu));
fail("Should not be able to insert InstallableUnit");
} catch (UnsupportedOperationException e) {
//expected. fall through
@@ -119,7 +119,7 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
//Try to remove an InstallableUnit.
try {
IQueryResult queryResult = compRepo.query(InstallableUnitQuery.ANY, null);
- compRepo.removeInstallableUnits((IInstallableUnit[]) queryResult.toArray(IInstallableUnit.class), null);
+ compRepo.removeInstallableUnits(queryResult.toSet());
fail("Should not be able to remove InstallableUnit");
} catch (UnsupportedOperationException e) {
//expected. fall through
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java
index 6eb5ea559..1347978f0 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,8 +14,7 @@ package org.eclipse.equinox.p2.tests.metadata.repository;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription;
@@ -57,7 +56,7 @@ public class JarURLMetadataRepositoryTest extends AbstractProvisioningTest {
descriptor.setId("testIuId");
descriptor.setVersion(Version.create("3.2.1"));
IInstallableUnit iu = MetadataFactory.createInstallableUnit(descriptor);
- repo.addInstallableUnits(new IInstallableUnit[] {iu});
+ repo.addInstallableUnits(Arrays.asList(iu));
testRepoJar = new File(testRepo, "content.jar");
assertTrue(testRepoJar.exists());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java
index 0ed8485f9..e2482b192 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -60,7 +60,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest {
descriptor.setId("testIuId");
descriptor.setVersion(Version.create("3.2.1"));
IInstallableUnit iu = MetadataFactory.createInstallableUnit(descriptor);
- repo.addInstallableUnits(new IInstallableUnit[] {iu});
+ repo.addInstallableUnits(Arrays.asList(iu));
File[] files = repoLocation.listFiles();
boolean jarFilePresent = false;
@@ -122,7 +122,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest {
IMetadataRepositoryManager manager = getMetadataRepositoryManager();
IMetadataRepository repo = manager.createRepository(repoLocation.toURI(), "TestRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
IInstallableUnit iu = createIU("foo");
- repo.addInstallableUnits(new IInstallableUnit[] {iu});
+ repo.addInstallableUnits(Arrays.asList(iu));
IQueryResult result = repo.query(new InstallableUnitQuery((String) null), getMonitor());
assertEquals("1.0", 1, queryResultSize(result));
repo.removeAll();
@@ -135,13 +135,13 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest {
IMetadataRepository repo = manager.createRepository(repoLocation.toURI(), "TestRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
IInstallableUnit iu = createIU("foo");
IInstallableUnit iu2 = createIU("bar");
- repo.addInstallableUnits(new IInstallableUnit[] {iu, iu2});
+ repo.addInstallableUnits(Arrays.asList(iu, iu2));
IQueryResult result = repo.query(new InstallableUnitQuery((String) null), getMonitor());
assertEquals("1.0", 2, queryResultSize(result));
- repo.removeInstallableUnits(new IInstallableUnit[] {iu}, getMonitor());
+ repo.removeInstallableUnits(Arrays.asList(iu));
result = repo.query(new InstallableUnitQuery((String) null), getMonitor());
assertEquals("1.1", 1, queryResultSize(result));
- repo.removeInstallableUnits(new IInstallableUnit[] {iu2}, getMonitor());
+ repo.removeInstallableUnits(Arrays.asList(iu2));
result = repo.query(new InstallableUnitQuery((String) null), getMonitor());
assertTrue("1.2", result.isEmpty());
@@ -157,7 +157,7 @@ public class LocalMetadataRepositoryTest extends AbstractProvisioningTest {
descriptor.setId("testIuId");
descriptor.setVersion(Version.create("3.2.1"));
IInstallableUnit iu = MetadataFactory.createInstallableUnit(descriptor);
- repo.addInstallableUnits(new IInstallableUnit[] {iu});
+ repo.addInstallableUnits(Arrays.asList(iu));
File[] files = repoLocation.listFiles();
boolean jarFilePresent = false;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java
index 6d64263a4..5c17f7b4b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java
@@ -1,11 +1,12 @@
/*******************************************************************************
-* Copyright (c) 2008, 2009 EclipseSource and others. All rights reserved. This
+* Copyright (c) 2008, 2010 EclipseSource and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* EclipseSource - initial API and implementation
+* IBM - Ongoing development and bug fixes
******************************************************************************/
package org.eclipse.equinox.p2.tests.metadata.repository;
@@ -640,7 +641,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
properties.put(IRepository.PROP_COMPRESSED, "true");
IMetadataRepository repo = manager.createRepository(repoLocation.toURI(), "TestRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
- repo.addInstallableUnits(new IInstallableUnit[] {new SPIInstallableUnit("foo", Version.createOSGi(1, 1, 1))});
+ repo.addInstallableUnits(Arrays.asList((IInstallableUnit) new SPIInstallableUnit("foo", Version.createOSGi(1, 1, 1))));
IQueryResult queryResult = repo.query(new AllAcceptingQuery(), new NullProgressMonitor());
@@ -673,7 +674,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
SPIInstallableUnit spiInstallableUnit = new SPIInstallableUnit("foo", Version.createOSGi(1, 1, 1));
spiInstallableUnit.addProvidedCapability(providedCapability);
- repo.addInstallableUnits(new IInstallableUnit[] {spiInstallableUnit});
+ repo.addInstallableUnits(Arrays.asList((IInstallableUnit) spiInstallableUnit));
IQueryResult queryResult = repo.query(new AllAcceptingQuery(), new NullProgressMonitor());
@@ -716,7 +717,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
list.add(spiRequiredCapability);
iuDescription.addRequiredCapabilities(list);
- repo.addInstallableUnits(new IInstallableUnit[] {MetadataFactory.createInstallableUnit(iuDescription)});
+ repo.addInstallableUnits(Arrays.asList(MetadataFactory.createInstallableUnit(iuDescription)));
IQueryResult queryResult = repo.query(new AllAcceptingQuery(), new NullProgressMonitor());
@@ -781,7 +782,7 @@ public class SPIMetadataRepositoryTest extends AbstractProvisioningTest {
providedCapabilityList.add(spiProvidedCapability);
iuDescription.addProvidedCapabilities(providedCapabilityList);
- repo.addInstallableUnits(new IInstallableUnit[] {MetadataFactory.createInstallableUnit(iuDescription), MetadataFactory.createInstallableUnitPatch(iuPatchDescription)});
+ repo.addInstallableUnits(Arrays.asList(MetadataFactory.createInstallableUnit(iuDescription), MetadataFactory.createInstallableUnitPatch(iuPatchDescription)));
repo = manager.refreshRepository(repoLocation.toURI(), null);
IQueryResult queryResult = repo.query(new AllAcceptingQuery(), new NullProgressMonitor());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java
index fcda75acc..5301913b5 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,8 @@
package org.eclipse.equinox.p2.tests.perf;
import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.core.tests.harness.PerformanceTestRunner;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
@@ -48,10 +50,11 @@ public class MetadataRepositoryPerformanceTest extends ProvisioningPerformanceTe
IQuery[] queries = new IQuery[IU_COUNT];
protected void setUp() {
- IInstallableUnit[] ius = new IInstallableUnit[IU_COUNT];
- for (int i = 0; i < ius.length; i++) {
- ius[i] = generateIU(i);
- queries[i] = new InstallableUnitQuery(ius[i].getId(), ius[i].getVersion());
+ List<IInstallableUnit> ius = new ArrayList(IU_COUNT);
+ for (int i = 0; i < IU_COUNT; i++) {
+ IInstallableUnit iu = generateIU(i);
+ queries[i] = new InstallableUnitQuery(iu.getId(), iu.getVersion());
+ ius.add(iu);
}
repository.addInstallableUnits(ius);
}
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java
index 664369d24..b61c4e654 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
package org.eclipse.equinox.internal.p2.updatesite.metadata;
import java.net.URI;
+import java.util.Collection;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
@@ -32,70 +33,131 @@ public class UpdateSiteMetadataRepository implements IMetadataRepository {
this.delegate = repository;
}
+ // TODO remove
public void addInstallableUnits(IInstallableUnit[] installableUnits) {
throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addInstallableUnits(java.util.Collection)
+ */
+ public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
+ throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addReference(java.net.URI, java.lang.String, int, int)
+ */
public void addReference(URI location, String nickname, int type, int options) {
throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeAll()
+ */
public void removeAll() {
throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
}
+ // TODO remove
public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeInstallableUnits(java.util.Collection)
+ */
+ public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
+ throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#getDescription()
+ */
public String getDescription() {
return delegate.getDescription();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#getLocation()
+ */
public URI getLocation() {
return location;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#getName()
+ */
public String getName() {
return delegate.getName();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#getProperties()
+ */
public Map<String, String> getProperties() {
return delegate.getProperties();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#getProvider()
+ */
public String getProvider() {
return delegate.getProvider();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#getProvisioningAgent()
+ */
public IProvisioningAgent getProvisioningAgent() {
return delegate.getProvisioningAgent();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#getType()
+ */
public String getType() {
return TYPE;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#getVersion()
+ */
public String getVersion() {
return VERSION;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#isModifiable()
+ */
public boolean isModifiable() {
return false;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#setDescription(java.lang.String)
+ */
public void setDescription(String description) {
throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#setName(java.lang.String)
+ */
public void setName(String name) {
throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#setProperty(java.lang.String, java.lang.String)
+ */
public String setProperty(String key, String value) {
throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.repository.IRepository#setProvider(java.lang.String)
+ */
public void setProvider(String provider) {
throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
}
@@ -105,6 +167,9 @@ public class UpdateSiteMetadataRepository implements IMetadataRepository {
return delegate.getAdapter(adapter);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.query.IQueryable#query(org.eclipse.equinox.p2.query.IQuery, org.eclipse.core.runtime.IProgressMonitor)
+ */
public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
return delegate.query(query, monitor);
}

Back to the top