Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Kaegi2009-03-06 06:20:58 +0000
committerSimon Kaegi2009-03-06 06:20:58 +0000
commit709420bc4ee00f61fee9dbf2da278ad6acb80f54 (patch)
tree7b31adb1353ec53fb741163a1334cb7098302ef4 /bundles
parent1961693ea5ac42d0bc6bb59ef0d3761b7a22543a (diff)
downloadrt.equinox.p2-709420bc4ee00f61fee9dbf2da278ad6acb80f54.tar.gz
rt.equinox.p2-709420bc4ee00f61fee9dbf2da278ad6acb80f54.tar.xz
rt.equinox.p2-709420bc4ee00f61fee9dbf2da278ad6acb80f54.zip
Bug 218564 [engine] Removing Metadata Cache
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MetadataCache.java91
-rw-r--r--bundles/org.eclipse.equinox.p2.exemplarysetup/src/org/eclipse/equinox/internal/p2/exemplarysetup/Activator.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java3
4 files changed, 0 insertions, 103 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MetadataCache.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MetadataCache.java
deleted file mode 100644
index 1aa15abc2..000000000
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MetadataCache.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.internal.p2.engine;
-
-import java.net.URI;
-import java.util.*;
-import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
-import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
-import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
-import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.p2.engine.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
-import org.osgi.framework.ServiceReference;
-
-public class MetadataCache {
- static final private String REPOSITORY_NAME = "Agent Metadata Cache"; //$NON-NLS-1$
- private ServiceReference busReference;
- private IProvisioningEventBus bus;
- private URI location;
- //tracks the IUs that have been installed but not yet committed
- //TODO: This will work if a single profile is being modified but we should consider how to handle multiple concurrent profile changes.
- final ArrayList toAdd = new ArrayList();
- private final IMetadataRepositoryManager manager;
-
- public MetadataCache(IMetadataRepositoryManager manager) {
- this.manager = manager;
- AgentLocation agentLocation = (AgentLocation) ServiceHelper.getService(EngineActivator.getContext(), AgentLocation.class.getName());
- location = (agentLocation != null ? agentLocation.getMetadataRepositoryURI() : null);
- hookListener();
- }
-
- IMetadataRepository getRepository() {
- try {
- return manager.loadRepository(location, null);
- } catch (ProvisionException e) {
- //fall through and create a new repository
- }
- try {
- Map properties = new HashMap(1);
- properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString());
- return manager.createRepository(location, REPOSITORY_NAME, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
- } catch (ProvisionException e) {
- LogHelper.log(e);
- throw new IllegalStateException(Messages.failed_creating_metadata_cache);
- }
- }
-
- private void hookListener() {
- // TODO: We should check for writing permission here, otherwise it may be too late
- busReference = EngineActivator.getContext().getServiceReference(IProvisioningEventBus.SERVICE_NAME);
- bus = (IProvisioningEventBus) EngineActivator.getContext().getService(busReference);
- bus.addListener(new ProvisioningListener() {
- public void notify(EventObject o) {
- if (o instanceof InstallableUnitEvent) { //TODO This dependency on InstallableUnitEvent is not great
- InstallableUnitEvent event = (InstallableUnitEvent) o;
- if (event.isPre())
- return;
- // TODO: what about uninstall??
- if (event.isPost() && event.getResult().isOK() && event.isInstall()) {
- IInstallableUnit installedIU = event.getOperand().second();
- if (installedIU != null)
- toAdd.add(installedIU.unresolved());
- return;
- }
- }
- if (o instanceof CommitOperationEvent) {
- IInstallableUnit[] toAddArray = (IInstallableUnit[]) toAdd.toArray(new IInstallableUnit[toAdd.size()]);
- toAdd.clear();
- if (toAddArray.length > 0)
- getRepository().addInstallableUnits(toAddArray);
- }
- if (o instanceof RollbackOperationEvent)
- toAdd.clear();
- }
- });
- }
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.exemplarysetup/src/org/eclipse/equinox/internal/p2/exemplarysetup/Activator.java b/bundles/org.eclipse.equinox.p2.exemplarysetup/src/org/eclipse/equinox/internal/p2/exemplarysetup/Activator.java
index a4364d261..03abdfe9a 100644
--- a/bundles/org.eclipse.equinox.p2.exemplarysetup/src/org/eclipse/equinox/internal/p2/exemplarysetup/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.exemplarysetup/src/org/eclipse/equinox/internal/p2/exemplarysetup/Activator.java
@@ -13,7 +13,6 @@ package org.eclipse.equinox.internal.p2.exemplarysetup;
import org.eclipse.equinox.internal.p2.core.ProvisioningEventBus;
import org.eclipse.equinox.internal.p2.director.SimpleDirector;
import org.eclipse.equinox.internal.p2.director.SimplePlanner;
-import org.eclipse.equinox.internal.p2.engine.MetadataCache;
import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry;
import org.eclipse.equinox.internal.p2.garbagecollector.GarbageCollector;
import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager;
@@ -54,7 +53,6 @@ public class Activator implements BundleActivator {
//create the profile registry
registerProfileRegistry();
registerMetadataRepositoryManager();
- registerMetadataCache();
//create the director and planner. The planner must be
//registered first because the director finds it in its constructor.
@@ -141,10 +139,6 @@ public class Activator implements BundleActivator {
}
}
- private void registerMetadataCache() {
- new MetadataCache(((IMetadataRepositoryManager) context.getService(metadataRepositoryReference)));
- }
-
private void registerEventBus() {
bus = new ProvisioningEventBus();
registrationBus = context.registerService(IProvisioningEventBus.SERVICE_NAME, bus, null);
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java
index ce7a747c8..b123f4d62 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java
@@ -305,9 +305,6 @@ public class MetadataRepositoryIO {
//can't create repository if missing type - this is already logged when parsing attributes
if (state.Type == null)
return;
- //migration support for change to MetadataCache (bug 211934)
- if (state.Type.equals("org.eclipse.equinox.internal.p2.installregistry.MetadataCache")) //$NON-NLS-1$
- state.Type = "org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository"; //$NON-NLS-1$
Class clazz = Class.forName(state.Type);
Object repositoryObject = clazz.newInstance();
if (repositoryObject instanceof AbstractMetadataRepository) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
index c59a7b7e2..4fdd015cd 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
@@ -788,9 +788,6 @@ public abstract class AbstractProvisioningTest extends TestCase {
profileRegistry.removeProfile(toRemove);
}
profilesToRemove.clear();
- //See bug 209069 - currently no way to persist install registry changes or clear the metadata cache
- // IMetadataRepository cache = MetadataCache.getCacheInstance((MetadataRepositoryManager) repoMan);
- // cache.removeAll();
}
/*

Back to the top