Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hallgren2010-02-05 22:07:01 +0000
committerThomas Hallgren2010-02-05 22:07:01 +0000
commit9faaed06625f31f3e4f26f65c3cffe4e947604fd (patch)
tree162a1267d4429ff85e188de84970455c138abfa6 /bundles/org.eclipse.equinox.p2.extensionlocation
parente640f35a91169ce4ad67d674ba7b150b42450478 (diff)
downloadrt.equinox.p2-9faaed06625f31f3e4f26f65c3cffe4e947604fd.tar.gz
rt.equinox.p2-9faaed06625f31f3e4f26f65c3cffe4e947604fd.tar.xz
rt.equinox.p2-9faaed06625f31f3e4f26f65c3cffe4e947604fd.zip
299987 : Removal of p2 services in favor of always using an agent.
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.extensionlocation')
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java5
6 files changed, 25 insertions, 28 deletions
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java
index e6011a608..c05ff6868 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java
@@ -64,19 +64,12 @@ public class Activator implements BundleActivator {
}
public static IProfile getCurrentProfile() {
- ServiceReference reference = bundleContext.getServiceReference(IProfileRegistry.SERVICE_NAME);
- if (reference == null)
- return null;
- IProfileRegistry profileRegistry = (IProfileRegistry) bundleContext.getService(reference);
- try {
- return profileRegistry.getProfile(IProfileRegistry.SELF);
- } finally {
- bundleContext.ungetService(reference);
- }
+ IProfileRegistry profileRegistry = (IProfileRegistry) getCurrentAgent().getService(IProfileRegistry.SERVICE_NAME);
+ return profileRegistry.getProfile(IProfileRegistry.SELF);
}
public static IProvisioningAgent getCurrentAgent() {
- ServiceReference reference = bundleContext.getServiceReference(IProvisioningAgent.class.getName());
+ ServiceReference reference = bundleContext.getServiceReference(IProvisioningAgent.SERVICE_NAME);
if (reference == null)
return null;
return (IProvisioningAgent) bundleContext.getService(reference);
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
index 9d3830a88..954bef02b 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
@@ -15,6 +15,7 @@ import java.io.*;
import java.net.URI;
import java.util.*;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.query.*;
@@ -49,8 +50,8 @@ public class ExtensionLocationArtifactRepository extends AbstractRepository<IArt
* Constructor for the class. Return a new extension location repository based on
* the given url and nested repository.
*/
- public ExtensionLocationArtifactRepository(URI location, IFileArtifactRepository repository, IProgressMonitor monitor) throws ProvisionException {
- super(Activator.getRepositoryName(location), TYPE, VERSION.toString(), location, null, null, null);
+ public ExtensionLocationArtifactRepository(IProvisioningAgent agent, URI location, IFileArtifactRepository repository, IProgressMonitor monitor) throws ProvisionException {
+ super(agent, Activator.getRepositoryName(location), TYPE, VERSION.toString(), location, null, null, null);
this.artifactRepository = repository;
this.base = getBaseDirectory(location);
}
@@ -65,7 +66,9 @@ public class ExtensionLocationArtifactRepository extends AbstractRepository<IArt
void reload() {
try {
- ExtensionLocationArtifactRepository repo = (ExtensionLocationArtifactRepository) new ExtensionLocationArtifactRepositoryFactory().load(getLocation(), 0, null);
+ ExtensionLocationArtifactRepositoryFactory factory = new ExtensionLocationArtifactRepositoryFactory();
+ factory.setAgent(agent);
+ ExtensionLocationArtifactRepository repo = (ExtensionLocationArtifactRepository) factory.load(getLocation(), 0, null);
artifactRepository = repo.artifactRepository;
base = repo.base;
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java
index 9abf2f37e..7b3574ca2 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java
@@ -51,7 +51,7 @@ public class ExtensionLocationArtifactRepositoryFactory extends ArtifactReposito
throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_EXISTS, msg, null));
}
IFileArtifactRepository repo = (IFileArtifactRepository) simpleFactory.create(repoLocation, name, type, properties);
- return new ExtensionLocationArtifactRepository(location, repo, null);
+ return new ExtensionLocationArtifactRepository(getAgent(), location, repo, null);
}
/* (non-Javadoc)
@@ -76,7 +76,7 @@ public class ExtensionLocationArtifactRepositoryFactory extends ArtifactReposito
final SimpleArtifactRepositoryFactory simpleFactory = new SimpleArtifactRepositoryFactory();
simpleFactory.setAgent(getAgent());
IFileArtifactRepository repo = (IFileArtifactRepository) simpleFactory.load(repoLocation, flags, null);
- return new ExtensionLocationArtifactRepository(location, repo, monitor);
+ return new ExtensionLocationArtifactRepository(getAgent(), location, repo, monitor);
} catch (ProvisionException e) {
return create(location, Activator.getRepositoryName(location), ExtensionLocationArtifactRepository.TYPE, null);
}
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 42a5d307a..d5b748288 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
@@ -16,6 +16,7 @@ import java.io.FilenameFilter;
import java.net.URI;
import java.util.*;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.IQuery;
@@ -49,8 +50,8 @@ public class ExtensionLocationMetadataRepository extends AbstractMetadataReposit
* Constructor for the class. Return a new extension location repository based on the
* given location and specified nested repo.
*/
- public ExtensionLocationMetadataRepository(URI location, IMetadataRepository repository, IProgressMonitor monitor) throws ProvisionException {
- super(Activator.getRepositoryName(location), TYPE, VERSION.toString(), location, null, null, null);
+ public ExtensionLocationMetadataRepository(IProvisioningAgent agent, URI location, IMetadataRepository repository, IProgressMonitor monitor) throws ProvisionException {
+ super(agent, Activator.getRepositoryName(location), TYPE, VERSION.toString(), location, null, null, null);
this.metadataRepository = repository;
this.base = getBaseDirectory(location);
}
@@ -65,7 +66,9 @@ public class ExtensionLocationMetadataRepository extends AbstractMetadataReposit
void reload() {
try {
- ExtensionLocationMetadataRepository repo = (ExtensionLocationMetadataRepository) new ExtensionLocationMetadataRepositoryFactory().load(getLocation(), 0, null);
+ ExtensionLocationMetadataRepositoryFactory factory = new ExtensionLocationMetadataRepositoryFactory();
+ factory.setAgent(agent);
+ ExtensionLocationMetadataRepository repo = (ExtensionLocationMetadataRepository) factory.load(getLocation(), 0, null);
metadataRepository = repo.metadataRepository;
base = repo.base;
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java
index 422a3a327..e8e02d309 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java
@@ -10,17 +10,14 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.extensionlocation;
-import org.eclipse.equinox.internal.p2.metadata.repository.SimpleMetadataRepositoryFactory;
-
-import org.eclipse.equinox.p2.repository.metadata.spi.MetadataRepositoryFactory;
-
-import org.eclipse.equinox.p2.core.ProvisionException;
-
import java.net.URI;
import java.util.Map;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.metadata.repository.SimpleMetadataRepositoryFactory;
+import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.repository.metadata.spi.MetadataRepositoryFactory;
import org.eclipse.osgi.util.NLS;
public class ExtensionLocationMetadataRepositoryFactory extends MetadataRepositoryFactory {
@@ -53,7 +50,7 @@ public class ExtensionLocationMetadataRepositoryFactory extends MetadataReposito
throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_EXISTS, msg, null));
}
IMetadataRepository repository = simpleFactory.create(repoLocation, name, null, properties);
- return new ExtensionLocationMetadataRepository(location, repository, null);
+ return new ExtensionLocationMetadataRepository(getAgent(), location, repository, null);
}
/* (non-Javadoc)
@@ -78,7 +75,7 @@ public class ExtensionLocationMetadataRepositoryFactory extends MetadataReposito
final SimpleMetadataRepositoryFactory simpleFactory = new SimpleMetadataRepositoryFactory();
simpleFactory.setAgent(getAgent());
IMetadataRepository repository = simpleFactory.load(repoLocation, flags, null);
- return new ExtensionLocationMetadataRepository(location, repository, monitor);
+ return new ExtensionLocationMetadataRepository(getAgent(), location, repository, monitor);
} catch (ProvisionException e) {
return create(location, Activator.getRepositoryName(location), ExtensionLocationMetadataRepository.TYPE, null);
}
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
index 4858af478..888b57b1a 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
@@ -11,8 +11,6 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.extensionlocation;
-import org.eclipse.equinox.p2.core.ProvisionException;
-
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
@@ -22,6 +20,7 @@ import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.publisher.eclipse.FeatureParser;
import org.eclipse.equinox.internal.p2.update.Site;
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.*;
+import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.publisher.eclipse.*;
import org.eclipse.osgi.service.resolver.BundleDescription;
@@ -74,10 +73,12 @@ public class SiteListener extends DirectoryChangeListener {
if (metadataRepository == null) {
artifactRepository.reload();
ExtensionLocationMetadataRepositoryFactory factory = new ExtensionLocationMetadataRepositoryFactory();
+ factory.setAgent(artifactRepository.getProvisioningAgent());
metadataRepository = (ExtensionLocationMetadataRepository) factory.load(artifactRepository.getLocation(), 0, null);
} else if (artifactRepository == null) {
metadataRepository.reload();
ExtensionLocationArtifactRepositoryFactory factory = new ExtensionLocationArtifactRepositoryFactory();
+ factory.setAgent(metadataRepository.getProvisioningAgent());
artifactRepository = (ExtensionLocationArtifactRepository) factory.load(metadataRepository.getLocation(), 0, null);
}
} catch (ProvisionException e) {

Back to the top