### Eclipse Workspace Patch 1.0 #P org.eclipse.equinox.p2.diagnostic Index: src/org/eclipse/equinox/p2/diagnostic/Activator.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/incubator/p2/bundles/org.eclipse.equinox.p2.diagnostic/src/org/eclipse/equinox/p2/diagnostic/Activator.java,v retrieving revision 1.2 diff -u -r1.2 Activator.java --- src/org/eclipse/equinox/p2/diagnostic/Activator.java 16 Sep 2009 22:05:56 -0000 1.2 +++ src/org/eclipse/equinox/p2/diagnostic/Activator.java 22 Feb 2010 20:08:53 -0000 @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ package org.eclipse.equinox.p2.diagnostic; import org.osgi.framework.BundleActivator; @@ -29,6 +39,7 @@ public static BundleContext getContext() { return context; } + /* * (non-Javadoc) * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) Index: src/org/eclipse/equinox/p2/diagnostic/DiagnosticComponent.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/incubator/p2/bundles/org.eclipse.equinox.p2.diagnostic/src/org/eclipse/equinox/p2/diagnostic/DiagnosticComponent.java,v retrieving revision 1.2 diff -u -r1.2 DiagnosticComponent.java --- src/org/eclipse/equinox/p2/diagnostic/DiagnosticComponent.java 13 Jan 2010 17:21:07 -0000 1.2 +++ src/org/eclipse/equinox/p2/diagnostic/DiagnosticComponent.java 22 Feb 2010 20:08:53 -0000 @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ package org.eclipse.equinox.p2.diagnostic; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; @@ -6,20 +16,19 @@ public class DiagnosticComponent { private RepositoryDumper repositoryDumper; - protected void activate(ComponentContext context) { - IMetadataRepositoryManager repoMgr = - (IMetadataRepositoryManager) context.locateService("repoMgr"); - repositoryDumper = new RepositoryDumper(); - repositoryDumper.setRepositoryManager(repoMgr); - - Activator.setComponentInstance(context.getComponentInstance()); - } - - protected void deactivate(ComponentContext context) { - repositoryDumper.setRepositoryManager(null); - } - - public RepositoryDumper getDumper() { - return repositoryDumper; - } + protected void activate(ComponentContext context) { + IMetadataRepositoryManager repoMgr = (IMetadataRepositoryManager) context.locateService("repoMgr"); + repositoryDumper = new RepositoryDumper(); + repositoryDumper.setRepositoryManager(repoMgr); + + Activator.setComponentInstance(context.getComponentInstance()); + } + + protected void deactivate(ComponentContext context) { + repositoryDumper.setRepositoryManager(null); + } + + public RepositoryDumper getDumper() { + return repositoryDumper; + } } Index: src/org/eclipse/equinox/p2/diagnostic/RepositoryDumper.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/incubator/p2/bundles/org.eclipse.equinox.p2.diagnostic/src/org/eclipse/equinox/p2/diagnostic/RepositoryDumper.java,v retrieving revision 1.4 diff -u -r1.4 RepositoryDumper.java --- src/org/eclipse/equinox/p2/diagnostic/RepositoryDumper.java 13 Jan 2010 17:21:07 -0000 1.4 +++ src/org/eclipse/equinox/p2/diagnostic/RepositoryDumper.java 22 Feb 2010 20:08:53 -0000 @@ -1,10 +1,18 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ package org.eclipse.equinox.p2.diagnostic; -import org.eclipse.equinox.p2.core.ProvisionException; - import java.net.URI; import java.util.HashMap; - +import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery; import org.eclipse.equinox.p2.query.IQueryResult; @@ -13,16 +21,16 @@ public class RepositoryDumper { IMetadataRepositoryManager mgr = null; - + public void setRepositoryManager(IMetadataRepositoryManager mgr) { this.mgr = mgr; } - + public void dump(URI targetRepository) throws ProvisionException { IMetadataRepository repo = mgr.createRepository(targetRepository, "Dumped repository", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, new HashMap()); mgr.removeRepository(targetRepository); IQueryResult c = mgr.query(InstallableUnitQuery.ANY, null); - repo.addInstallableUnits(c.toArray(IInstallableUnit.class)); + repo.addInstallableUnits(c.toSet()); } } Index: src/org/eclipse/equinox/p2/diagnostic/RepositoryDumpingApplication.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/incubator/p2/bundles/org.eclipse.equinox.p2.diagnostic/src/org/eclipse/equinox/p2/diagnostic/RepositoryDumpingApplication.java,v retrieving revision 1.1 diff -u -r1.1 RepositoryDumpingApplication.java --- src/org/eclipse/equinox/p2/diagnostic/RepositoryDumpingApplication.java 16 Sep 2009 18:38:16 -0000 1.1 +++ src/org/eclipse/equinox/p2/diagnostic/RepositoryDumpingApplication.java 22 Feb 2010 20:08:53 -0000 @@ -1,8 +1,17 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ package org.eclipse.equinox.p2.diagnostic; import java.io.File; import java.net.URI; - import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.app.IApplicationContext; Index: src/solution2/RepositoryDumpingApplication2.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/incubator/p2/bundles/org.eclipse.equinox.p2.diagnostic/src/solution2/RepositoryDumpingApplication2.java,v retrieving revision 1.3 diff -u -r1.3 RepositoryDumpingApplication2.java --- src/solution2/RepositoryDumpingApplication2.java 13 Jan 2010 17:21:06 -0000 1.3 +++ src/solution2/RepositoryDumpingApplication2.java 22 Feb 2010 20:08:53 -0000 @@ -1,9 +1,18 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ package solution2; import java.io.File; import java.net.URI; import java.util.Map; - import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.p2.diagnostic.RepositoryDumper; import org.osgi.service.application.ApplicationDescriptor; @@ -11,8 +20,7 @@ public class RepositoryDumpingApplication2 extends ApplicationHandle { - protected RepositoryDumpingApplication2(String instanceId, - ApplicationDescriptor descriptor) { + protected RepositoryDumpingApplication2(String instanceId, ApplicationDescriptor descriptor) { super(instanceId, descriptor); } @@ -30,7 +38,7 @@ @Override protected void destroySpecific() { // TODO Auto-generated method stub - + } @Override Index: src/solution2/RepositoryDumpingApplicationDescriptor.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/incubator/p2/bundles/org.eclipse.equinox.p2.diagnostic/src/solution2/RepositoryDumpingApplicationDescriptor.java,v retrieving revision 1.2 diff -u -r1.2 RepositoryDumpingApplicationDescriptor.java --- src/solution2/RepositoryDumpingApplicationDescriptor.java 13 Jan 2010 17:21:07 -0000 1.2 +++ src/solution2/RepositoryDumpingApplicationDescriptor.java 22 Feb 2010 20:08:53 -0000 @@ -1,7 +1,16 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ package solution2; import java.util.Map; - import org.eclipse.equinox.p2.diagnostic.Activator; import org.eclipse.equinox.p2.diagnostic.RepositoryDumper; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; @@ -9,14 +18,12 @@ import org.osgi.service.application.ApplicationHandle; import org.osgi.service.component.ComponentContext; -public class RepositoryDumpingApplicationDescriptor extends - ApplicationDescriptor { +public class RepositoryDumpingApplicationDescriptor extends ApplicationDescriptor { private RepositoryDumper repositoryDumper; protected void activate(ComponentContext context) { - IMetadataRepositoryManager repoMgr = (IMetadataRepositoryManager) context - .locateService("repoMgr"); + IMetadataRepositoryManager repoMgr = (IMetadataRepositoryManager) context.locateService("repoMgr"); repositoryDumper = new RepositoryDumper(); repositoryDumper.setRepositoryManager(repoMgr); @@ -49,8 +56,7 @@ @Override protected ApplicationHandle launchSpecific(Map arguments) throws Exception { - RepositoryDumpingApplication2 dump = new RepositoryDumpingApplication2( - "org.eclipse.equinox.p2.diagnostic.rd", this); + RepositoryDumpingApplication2 dump = new RepositoryDumpingApplication2("org.eclipse.equinox.p2.diagnostic.rd", this); arguments.put("repo_dumper", repositoryDumper); dump.start(arguments); return dump; Index: src/solution3/RepositoryDumper.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/incubator/p2/bundles/org.eclipse.equinox.p2.diagnostic/src/solution3/RepositoryDumper.java,v retrieving revision 1.4 diff -u -r1.4 RepositoryDumper.java --- src/solution3/RepositoryDumper.java 13 Jan 2010 17:21:08 -0000 1.4 +++ src/solution3/RepositoryDumper.java 22 Feb 2010 20:08:53 -0000 @@ -1,10 +1,18 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ package solution3; -import org.eclipse.equinox.p2.core.ProvisionException; - import java.net.URI; import java.util.HashMap; - +import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery; import org.eclipse.equinox.p2.query.IQueryResult; @@ -13,16 +21,16 @@ public class RepositoryDumper { IMetadataRepositoryManager mgr = null; - + public void setRepositoryManager(IMetadataRepositoryManager mgr) { this.mgr = mgr; } - + public void dump(URI targetRepository) throws ProvisionException { - IMetadataRepository repo = mgr.createRepository(targetRepository, "Dumped repository", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, new HashMap()); + IMetadataRepository repo = mgr.createRepository(targetRepository, "Dumped repository", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, new HashMap()); mgr.removeRepository(targetRepository); IQueryResult c = mgr.query(InstallableUnitQuery.ANY, null); - repo.addInstallableUnits(c.toArray(IInstallableUnit.class)); + repo.addInstallableUnits(c.toSet()); } } Index: src/solution3/RepositoryDumpingApplication.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/incubator/p2/bundles/org.eclipse.equinox.p2.diagnostic/src/solution3/RepositoryDumpingApplication.java,v retrieving revision 1.3 diff -u -r1.3 RepositoryDumpingApplication.java --- src/solution3/RepositoryDumpingApplication.java 13 Jan 2010 17:21:07 -0000 1.3 +++ src/solution3/RepositoryDumpingApplication.java 22 Feb 2010 20:08:53 -0000 @@ -1,9 +1,17 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ package solution3; - import java.io.File; import java.net.URI; - import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.app.IApplicationContext; import org.eclipse.equinox.p2.diagnostic.Activator; @@ -17,7 +25,7 @@ final BundleContext bundleContext = Activator.getContext(); System.out.println(IMetadataRepositoryManager.class.getName()); ServiceReference sr = bundleContext.getServiceReference(RepositoryDumper.class.getName()); - RepositoryDumper dumper = (RepositoryDumper)bundleContext.getService(sr); + RepositoryDumper dumper = (RepositoryDumper) bundleContext.getService(sr); new File("/Users/Pascal/tmp/allRepos").mkdirs(); dumper.dump(new URI("file:/Users/Pascal/tmp/allRepos")); bundleContext.ungetService(sr); #P org.eclipse.equinox.p2.directorywatcher Index: src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java,v retrieving revision 1.40 diff -u -r1.40 RepositoryListener.java --- src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java 22 Feb 2010 01:10:10 -0000 1.40 +++ src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java 22 Feb 2010 20:08:54 -0000 @@ -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 @@ final Collection 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 @@ IMatchQuery removeQuery = new ExpressionQuery(IInstallableUnit.class, // "$1.exists(x | properties[$0] == x)", FILE_NAME, removedFiles); //$NON-NLS-1$ IQueryResult 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 additions = iusToAdd.getIUs(null, null); additions.addAll(changes); if (!additions.isEmpty()) - metadataRepository.addInstallableUnits(additions.toArray(new IInstallableUnit[additions.size()])); + metadataRepository.addInstallableUnits(additions); } /** #P org.eclipse.equinox.p2.extensionlocation Index: src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java,v retrieving revision 1.32 diff -u -r1.32 ExtensionLocationMetadataRepository.java --- src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java 5 Feb 2010 22:06:23 -0000 1.32 +++ src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java 22 Feb 2010 20:08:54 -0000 @@ -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 @@ 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 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 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 query(IQuery query, IProgressMonitor monitor) { ensureInitialized(); @@ -177,15 +192,24 @@ /* (non-Javadoc) * @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#getProperties() */ + @Override public Map 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); #P org.eclipse.equinox.p2.metadata.generator Index: src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java,v retrieving revision 1.88 diff -u -r1.88 Generator.java --- src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java 19 Feb 2010 12:12:54 -0000 1.88 +++ src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java 22 Feb 2010 20:08:55 -0000 @@ -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 @@ 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 @@ 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 @@ 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); } } #P org.eclipse.equinox.p2.metadata.repository Index: src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java,v retrieving revision 1.17 diff -u -r1.17 CompositeMetadataRepository.java --- src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java 19 Feb 2010 19:58:37 -0000 1.17 +++ src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java 22 Feb 2010 20:08:56 -0000 @@ -123,6 +123,9 @@ 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 query(IQuery query, IProgressMonitor monitor) { if (monitor == null) monitor = new NullProgressMonitor(); @@ -161,10 +164,16 @@ } } + /* (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 @@ } } + /* (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 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 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 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 @@ } } + /* (non-Javadoc) + * @see org.eclipse.equinox.p2.repository.ICompositeRepository#getChildren() + */ public List getChildren() { List result = new ArrayList(); for (URI childURI : childrenURIs) Index: src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java,v retrieving revision 1.43 diff -u -r1.43 LocalMetadataRepository.java --- src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java 21 Feb 2010 16:18:33 -0000 1.43 +++ src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java 22 Feb 2010 20:08:56 -0000 @@ -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 @@ 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 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 getIndex(String memberName) { if (InstallableUnit.MEMBER_ID.equals(memberName)) { if (idIndex == null) @@ -121,7 +138,7 @@ } return null; } - + public synchronized Object getManagedProperty(Object client, String memberName, Object key) { if (!(client instanceof IInstallableUnit)) return null; @@ -134,6 +151,10 @@ 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 @@ 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 query(IQuery query, IProgressMonitor monitor) { return query instanceof IQueryWithIndex ? ((IQueryWithIndex) query).perform(this) : query.perform(units.iterator()); } + /* (non-Javadoc) + * @see org.eclipse.equinox.p2.metadata.index.IIndexProvider#everything() + */ public Iterator 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 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 @@ } } + /* (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 @@ manager.addRepository(this); return oldValue; } + } #P org.eclipse.equinox.p2.publisher Index: src/org/eclipse/equinox/p2/publisher/Publisher.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java,v retrieving revision 1.17 diff -u -r1.17 Publisher.java --- src/org/eclipse/equinox/p2/publisher/Publisher.java 15 Feb 2010 04:07:56 -0000 1.17 +++ src/org/eclipse/equinox/p2/publisher/Publisher.java 22 Feb 2010 20:08:57 -0000 @@ -252,7 +252,7 @@ IMetadataRepository metadataRepository = info.getMetadataRepository(); if (metadataRepository != null) { Collection ius = results.getIUs(null, null); - metadataRepository.addInstallableUnits(ius.toArray(new IInstallableUnit[ius.size()])); + metadataRepository.addInstallableUnits(ius); } return Status.OK_STATUS; } #P org.eclipse.equinox.p2.repository Index: src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java,v retrieving revision 1.2 diff -u -r1.2 IMetadataRepository.java --- src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java 13 Jan 2010 17:27:36 -0000 1.2 +++ src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepository.java 22 Feb 2010 20:08:57 -0000 @@ -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 @@ */ public interface IMetadataRepository extends IRepository { + /** + * @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 installableUnits); /** * Adds a reference to another repository to this repository. When a repository @@ -60,15 +67,18 @@ 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 null if progress - * reporting is not desired * @return true if any units were actually removed, and * false otherwise */ - public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor); + public boolean removeInstallableUnits(Collection installableUnits); /** * Remove all installable units from this repository. Index: src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java,v retrieving revision 1.3 diff -u -r1.3 AbstractMetadataRepository.java --- src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java 5 Feb 2010 22:06:38 -0000 1.3 +++ src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java 22 Feb 2010 20:08:57 -0000 @@ -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 @@ 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 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 installableUnits) { + assertModifiable(); + return false; + } + } #P org.eclipse.equinox.p2.repository.tools Index: src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java,v retrieving revision 1.14 diff -u -r1.14 MirrorApplication.java --- src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java 11 Feb 2010 01:27:57 -0000 1.14 +++ src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java 22 Feb 2010 20:08:58 -0000 @@ -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 @@ private void mirrorMetadata(IQueryable slice, IProgressMonitor monitor) { IQueryResult allIUs = slice.query(InstallableUnitQuery.ANY, monitor); - destinationMetadataRepository.addInstallableUnits(allIUs.toArray(IInstallableUnit.class)); + destinationMetadataRepository.addInstallableUnits(allIUs.toSet()); } /* Index: src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java,v retrieving revision 1.23 diff -u -r1.23 Repo2Runnable.java --- src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java 18 Feb 2010 15:20:23 -0000 1.23 +++ src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java 22 Feb 2010 20:08:58 -0000 @@ -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.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 @@ // publishing the metadata is optional if (destinationMetadataRepository == null) return; - destinationMetadataRepository.addInstallableUnits(processedIUs.toArray(new IInstallableUnit[processedIUs.size()])); + destinationMetadataRepository.addInstallableUnits(processedIUs); } /* Index: src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java,v retrieving revision 1.5 diff -u -r1.5 RemoveIUTask.java --- src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java 13 Jan 2010 17:27:29 -0000 1.5 +++ src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java 22 Feb 2010 20:08:58 -0000 @@ -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 @@ } if (toRemove.size() > 0) { - repository.removeInstallableUnits(toRemove.toArray(new IInstallableUnit[toRemove.size()]), null); + repository.removeInstallableUnits(toRemove); } } catch (ProvisionException e) { throw new BuildException(e); #P org.eclipse.equinox.p2.tests Index: src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java,v retrieving revision 1.23 diff -u -r1.23 TestMetadataRepository.java --- src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java 5 Feb 2010 22:06:50 -0000 1.23 +++ src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java 22 Feb 2010 20:08:59 -0000 @@ -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 @@ 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 installableUnits) { + units.addAll(installableUnits); } public IInstallableUnit find(String id, String versionString) { @@ -79,11 +89,20 @@ 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 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; } Index: src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java,v retrieving revision 1.8 diff -u -r1.8 MirrorTaskTest.java --- src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java 11 Feb 2010 01:27:59 -0000 1.8 +++ src/org/eclipse/equinox/p2/tests/ant/MirrorTaskTest.java 22 Feb 2010 20:09:00 -0000 @@ -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 @@ 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 @@ 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; } Index: src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java,v retrieving revision 1.18 diff -u -r1.18 CompositeMetadataRepositoryTest.java --- src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java 19 Feb 2010 12:12:57 -0000 1.18 +++ src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java 22 Feb 2010 20:09:00 -0000 @@ -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 @@ 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 @@ //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 Index: src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java,v retrieving revision 1.5 diff -u -r1.5 JarURLMetadataRepositoryTest.java --- src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java 11 Feb 2010 15:44:18 -0000 1.5 +++ src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java 22 Feb 2010 20:09:00 -0000 @@ -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 @@ 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 @@ 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()); Index: src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java,v retrieving revision 1.27 diff -u -r1.27 LocalMetadataRepositoryTest.java --- src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java 11 Feb 2010 15:44:18 -0000 1.27 +++ src/org/eclipse/equinox/p2/tests/metadata/repository/LocalMetadataRepositoryTest.java 22 Feb 2010 20:09:00 -0000 @@ -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 @@ 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 @@ 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 @@ 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 @@ 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; Index: src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java,v retrieving revision 1.11 diff -u -r1.11 SPIMetadataRepositoryTest.java --- src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java 13 Jan 2010 17:28:23 -0000 1.11 +++ src/org/eclipse/equinox/p2/tests/metadata/repository/SPIMetadataRepositoryTest.java 22 Feb 2010 20:09:00 -0000 @@ -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 @@ 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 @@ 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 @@ 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 @@ 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()); Index: src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java,v retrieving revision 1.2 diff -u -r1.2 MetadataRepositoryPerformanceTest.java --- src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java 13 Jan 2010 17:28:23 -0000 1.2 +++ src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java 22 Feb 2010 20:09:00 -0000 @@ -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 @@ 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 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); } #P org.eclipse.equinox.p2.updatesite Index: src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java,v retrieving revision 1.43 diff -u -r1.43 UpdateSiteMetadataRepository.java --- src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java 5 Feb 2010 22:06:28 -0000 1.43 +++ src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java 22 Feb 2010 20:09:01 -0000 @@ -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 @@ 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 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 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 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 @@ 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 query(IQuery query, IProgressMonitor monitor) { return delegate.query(query, monitor); } #P org.eclipse.pde.build Index: src_ant/org/eclipse/pde/internal/build/publisher/BrandP2Task.java =================================================================== RCS file: /cvsroot/eclipse/pde/build/org.eclipse.pde.build/src_ant/org/eclipse/pde/internal/build/publisher/BrandP2Task.java,v retrieving revision 1.15 diff -u -r1.15 BrandP2Task.java --- src_ant/org/eclipse/pde/internal/build/publisher/BrandP2Task.java 9 Feb 2010 00:31:26 -0000 1.15 +++ src_ant/org/eclipse/pde/internal/build/publisher/BrandP2Task.java 22 Feb 2010 20:09:02 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. All rights reserved. This + * 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 http://www.eclipse.org/legal/epl-v10.html @@ -224,7 +224,7 @@ newIUDescription.setArtifacts(new IArtifactKey[] {key}); IInstallableUnit newIU = MetadataFactory.createInstallableUnit(newIUDescription); - metadataRepo.addInstallableUnits(new IInstallableUnit[] {newIU}); + metadataRepo.addInstallableUnits(Arrays.asList(new IInstallableUnit[] {newIU})); ArtifactDescriptor descriptor = new ArtifactDescriptor(key); ZipOutputStream output = null;