Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2012-08-21 18:48:37 +0000
committerThomas Watson2012-10-02 18:54:42 +0000
commitf707c81b1bd1ba25b88badbd77de4046f3223be2 (patch)
tree3505e613d17b2ca0ff50b9c4777b06e413de46fb /bundles/org.eclipse.osgi.compatibility.state
parent272c74afa193ab09b3c288224e459c11de23a7b1 (diff)
downloadrt.equinox.framework-f707c81b1bd1ba25b88badbd77de4046f3223be2.tar.gz
rt.equinox.framework-f707c81b1bd1ba25b88badbd77de4046f3223be2.tar.xz
rt.equinox.framework-f707c81b1bd1ba25b88badbd77de4046f3223be2.zip
Initial checkin of PlatformAdmin service component
Diffstat (limited to 'bundles/org.eclipse.osgi.compatibility.state')
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/.project5
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/OSGI-INF/PlatformAdmin.xml4
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/build.properties5
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java80
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/ReadOnlySystemState.java308
5 files changed, 400 insertions, 2 deletions
diff --git a/bundles/org.eclipse.osgi.compatibility.state/.project b/bundles/org.eclipse.osgi.compatibility.state/.project
index 50487e24b..e50ba4495 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/.project
+++ b/bundles/org.eclipse.osgi.compatibility.state/.project
@@ -20,6 +20,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
diff --git a/bundles/org.eclipse.osgi.compatibility.state/OSGI-INF/PlatformAdmin.xml b/bundles/org.eclipse.osgi.compatibility.state/OSGI-INF/PlatformAdmin.xml
new file mode 100644
index 000000000..d3bb63080
--- /dev/null
+++ b/bundles/org.eclipse.osgi.compatibility.state/OSGI-INF/PlatformAdmin.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.osgi.compatibility.state">
+ <implementation class="org.eclipse.osgi.compatibility.state.PlatformAdminImpl"/>
+</scr:component>
diff --git a/bundles/org.eclipse.osgi.compatibility.state/build.properties b/bundles/org.eclipse.osgi.compatibility.state/build.properties
index 34d2e4d2d..dcc2d7c7a 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/build.properties
+++ b/bundles/org.eclipse.osgi.compatibility.state/build.properties
@@ -1,4 +1,5 @@
-source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ OSGI-INF/PlatformAdmin.xml
+source.. = src/
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java
new file mode 100644
index 000000000..af8682bbf
--- /dev/null
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java
@@ -0,0 +1,80 @@
+package org.eclipse.osgi.compatibility.state;
+
+import org.eclipse.osgi.container.ModuleContainer;
+import org.eclipse.osgi.container.ModuleDatabase;
+import org.eclipse.osgi.internal.framework.BundleContextImpl;
+import org.eclipse.osgi.internal.module.ResolverImpl;
+import org.eclipse.osgi.internal.resolver.StateHelperImpl;
+import org.eclipse.osgi.internal.resolver.StateObjectFactoryImpl;
+import org.eclipse.osgi.service.resolver.*;
+import org.eclipse.osgi.storage.Storage;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+public class PlatformAdminImpl implements PlatformAdmin {
+ private final StateHelper stateHelper = new StateHelperImpl();
+ private final StateObjectFactory factory = new StateObjectFactoryImpl();
+ private volatile ModuleContainer container;
+ private volatile ModuleDatabase database;
+
+ private void activate(BundleContext context) {
+ Storage storage = ((BundleContextImpl) context).getContainer().getStorage();
+ this.container = storage.getModuleContainer();
+ this.database = storage.getModuleDatabase();
+ context.registerService(PlatformAdmin.class, this, null);
+ }
+
+ @Override
+ public State getState() {
+ return getState(true);
+ }
+
+ @Override
+ public State getState(boolean mutable) {
+ if (mutable) {
+ return stateCopy();
+ }
+ return new ReadOnlySystemState(container, database);
+ }
+
+ private State stateCopy() {
+ // TODO
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StateHelper getStateHelper() {
+ return stateHelper;
+ }
+
+ @Override
+ public void commit(State state) throws BundleException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Resolver getResolver() {
+ return createResolver();
+ }
+
+ @Override
+ public Resolver createResolver() {
+ return new ResolverImpl(false);
+ }
+
+ @Override
+ public StateObjectFactory getFactory() {
+ return factory;
+ }
+
+ @Override
+ public void addDisabledInfo(DisabledInfo disabledInfo) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void removeDisabledInfo(DisabledInfo disabledInfo) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/ReadOnlySystemState.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/ReadOnlySystemState.java
new file mode 100644
index 000000000..dcd0ba82d
--- /dev/null
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/ReadOnlySystemState.java
@@ -0,0 +1,308 @@
+package org.eclipse.osgi.compatibility.state;
+
+import java.util.*;
+import org.eclipse.osgi.container.ModuleContainer;
+import org.eclipse.osgi.container.ModuleDatabase;
+import org.eclipse.osgi.service.resolver.*;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+import org.osgi.framework.hooks.resolver.ResolverHookFactory;
+
+public class ReadOnlySystemState implements State {
+
+ private final ModuleContainer container;
+ private final ModuleDatabase database;
+ private final StateDelta delta = new StateDelta() {
+ @Override
+ public State getState() {
+ // TODO Auto-generated method stub
+ return ReadOnlySystemState.this;
+ }
+
+ @Override
+ public ResolverHookException getResovlerHookException() {
+ return null;
+ }
+
+ @Override
+ public BundleDelta[] getChanges(int mask, boolean exact) {
+ return new BundleDelta[0];
+ }
+
+ @Override
+ public BundleDelta[] getChanges() {
+ return new BundleDelta[0];
+ }
+ };
+
+ public ReadOnlySystemState(ModuleContainer container, ModuleDatabase database) {
+ this.container = container;
+ this.database = database;
+ }
+
+ @Override
+ public boolean addBundle(BundleDescription description) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StateDelta compare(State baseState) throws BundleException {
+ return delta;
+ }
+
+ @Override
+ public BundleDescription removeBundle(long bundleId) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean removeBundle(BundleDescription bundle) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean updateBundle(BundleDescription newDescription) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StateDelta getChanges() {
+ return delta;
+ }
+
+ @Override
+ public BundleDescription[] getBundles() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BundleDescription getBundle(long id) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BundleDescription getBundle(String symbolicName, Version version) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BundleDescription getBundleByLocation(String location) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public long getTimeStamp() {
+ return database.getRevisionsTimestamp();
+ }
+
+ @Override
+ public void setTimeStamp(long newTimeStamp) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isResolved() {
+ return true;
+ }
+
+ @Override
+ public void resolveConstraint(VersionConstraint constraint, BaseDescription supplier) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, ExportPackageDescription[] substitutedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, ExportPackageDescription[] substitutedExports, GenericDescription[] selectedCapabilities, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports, GenericDescription[] resolvedCapabilities, Map<String, List<StateWire>> resolvedWires) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void removeBundleComplete(BundleDescription bundle) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void addResolverError(BundleDescription bundle, int type, String data, VersionConstraint unsatisfied) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void removeResolverErrors(BundleDescription bundle) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public ResolverError[] getResolverErrors(BundleDescription bundle) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Resolver getResolver() {
+ return null;
+ }
+
+ @Override
+ public void setResolver(Resolver value) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StateDelta resolve(boolean incremental) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StateDelta resolve() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StateDelta resolve(BundleDescription[] discard) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StateDelta resolve(BundleDescription[] resolve, boolean discard) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setOverrides(Object value) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public BundleDescription[] getResolvedBundles() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BundleDescription[] getRemovalPending() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Collection<BundleDescription> getDependencyClosure(Collection<BundleDescription> bundles) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public ExportPackageDescription[] getExportedPackages() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BundleDescription[] getBundles(String symbolicName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public StateObjectFactory getFactory() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ExportPackageDescription linkDynamicImport(BundleDescription importingBundle, String requestedPackage) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void addDynamicImportPackages(BundleDescription importingBundle, ImportPackageSpecification[] dynamicImports) {
+ throw new UnsupportedOperationException();
+
+ }
+
+ @Override
+ public boolean setPlatformProperties(Dictionary<?, ?> platformProperties) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean setPlatformProperties(Dictionary<?, ?>[] platformProperties) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Dictionary[] getPlatformProperties() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ExportPackageDescription[] getSystemPackages() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public StateHelper getStateHelper() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public long getHighestBundleId() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public void setNativePathsInvalid(NativeCodeDescription nativeCodeDescription, boolean hasInvalidNativePaths) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public BundleDescription[] getDisabledBundles() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void addDisabledInfo(DisabledInfo disabledInfo) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void removeDisabledInfo(DisabledInfo disabledInfo) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public DisabledInfo[] getDisabledInfos(BundleDescription bundle) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public DisabledInfo getDisabledInfo(BundleDescription bundle, String policyName) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setResolverHookFactory(ResolverHookFactory hookFactory) {
+ throw new UnsupportedOperationException();
+ }
+
+}

Back to the top