Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Lippert2008-10-11 21:53:59 +0000
committerMartin Lippert2008-10-11 21:53:59 +0000
commit467bef683cd20c96cc038146c33c4ec9fb73fe07 (patch)
tree7f50c5130e4a8941f1db976cc27fdfb19371a6df /bundles/org.eclipse.equinox.weaving.hook
parent88c3ba594736f3d5ac6ed3771d1c95b9f2f656ee (diff)
downloadrt.equinox.bundles-467bef683cd20c96cc038146c33c4ec9fb73fe07.tar.gz
rt.equinox.bundles-467bef683cd20c96cc038146c33c4ec9fb73fe07.tar.xz
rt.equinox.bundles-467bef683cd20c96cc038146c33c4ec9fb73fe07.zip
interface for SupplementerRegistry extracted and first unit test cases built for supplementer registry and loader delegate hook implementation
Diffstat (limited to 'bundles/org.eclipse.equinox.weaving.hook')
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/ISupplementerRegistry.java36
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/IWeavingService.java2
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptorFactory.java6
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AbstractAspectJHook.java6
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJHook.java4
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJStorageHook.java8
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementBundleListener.java6
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java (renamed from bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/SupplementerRegistry.java)40
-rw-r--r--bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingLoaderDelegateHook.java6
10 files changed, 93 insertions, 24 deletions
diff --git a/bundles/org.eclipse.equinox.weaving.hook/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.weaving.hook/META-INF/MANIFEST.MF
index f2ade9230..f485b0191 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.weaving.hook/META-INF/MANIFEST.MF
@@ -4,5 +4,6 @@ Bundle-Name: Aspect Weaving Hooks Plug-in (Incubation)
Bundle-SymbolicName: org.eclipse.equinox.weaving.hook
Bundle-Version: 1.0.0.qualifier
Fragment-Host: org.eclipse.osgi;bundle-version="[3.2.0,4.0.0)"
-Export-Package: org.eclipse.equinox.service.weaving
+Export-Package: org.eclipse.equinox.service.weaving,
+ org.eclipse.equinox.weaving.hooks;x-friends:="org.eclipse.equinox.weaving.tests"
Bundle-RequiredExecutionEnvironment: J2SE-1.3
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/ISupplementerRegistry.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/ISupplementerRegistry.java
new file mode 100644
index 000000000..4645e7886
--- /dev/null
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/ISupplementerRegistry.java
@@ -0,0 +1,36 @@
+
+package org.eclipse.equinox.service.weaving;
+
+import java.util.List;
+
+import org.eclipse.osgi.util.ManifestElement;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+public interface ISupplementerRegistry {
+
+ public void addBundle(final Bundle bundle);
+
+ public void addSupplementedBundle(final Bundle bundle);
+
+ public void addSupplementer(final Bundle bundle, final boolean updateBundles);
+
+ public PackageAdmin getPackageAdmin();
+
+ public Bundle[] getSupplementers(final Bundle bundle);
+
+ public Bundle[] getSupplementers(final long bundleID);
+
+ public List getSupplementers(final String symbolicName,
+ final ManifestElement[] imports, final ManifestElement[] exports);
+
+ public void removeBundle(final Bundle bundle);
+
+ public void setBundleContext(final BundleContext context);
+
+ public void setPackageAdmin(final PackageAdmin packageAdmin);
+
+ public void updateInstalledBundle(final Bundle bundle);
+
+}
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/IWeavingService.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/IWeavingService.java
index 86ad6dbc7..b71711f47 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/IWeavingService.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/IWeavingService.java
@@ -26,7 +26,7 @@ public interface IWeavingService {
public IWeavingService getInstance(ClassLoader loader, Bundle bundle,
State resolverState, BundleDescription bundleDesciption,
- SupplementerRegistry supplementerRegistry);
+ ISupplementerRegistry supplementerRegistry);
public String getKey();
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptorFactory.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptorFactory.java
index 3218d02f7..96f3716a5 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptorFactory.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/adaptors/AspectJAdaptorFactory.java
@@ -22,8 +22,8 @@ import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.equinox.service.weaving.ICachingService;
+import org.eclipse.equinox.service.weaving.ISupplementerRegistry;
import org.eclipse.equinox.service.weaving.IWeavingService;
-import org.eclipse.equinox.service.weaving.SupplementerRegistry;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.loader.BaseClassLoader;
import org.eclipse.osgi.service.resolver.BundleDescription;
@@ -57,7 +57,7 @@ public class AspectJAdaptorFactory {
private StartLevel startLevelService;
- private SupplementerRegistry supplementerRegistry;
+ private ISupplementerRegistry supplementerRegistry;
private ServiceListener weavingServiceListener;
@@ -102,7 +102,7 @@ public class AspectJAdaptorFactory {
}
public void initialize(final BundleContext context,
- final SupplementerRegistry supplementerRegistry) {
+ final ISupplementerRegistry supplementerRegistry) {
if (Debug.DEBUG_GENERAL)
Debug.println("> AspectJAdaptorFactory.initialize() context="
+ context);
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AbstractAspectJHook.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AbstractAspectJHook.java
index 9600c542e..2396133aa 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AbstractAspectJHook.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AbstractAspectJHook.java
@@ -19,7 +19,7 @@ import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Properties;
-import org.eclipse.equinox.service.weaving.SupplementerRegistry;
+import org.eclipse.equinox.service.weaving.ISupplementerRegistry;
import org.eclipse.osgi.baseadaptor.BaseAdaptor;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.HookConfigurator;
@@ -56,7 +56,7 @@ public abstract class AbstractAspectJHook implements HookConfigurator,
public static boolean verbose = Boolean
.getBoolean("org.aspectj.osgi.verbose"); //$NON-NLS-1$
- private SupplementerRegistry supplementerRegistry;
+ private ISupplementerRegistry supplementerRegistry;
/**
* @see org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook#addClassPathEntry(java.util.ArrayList,
@@ -157,7 +157,7 @@ public abstract class AbstractAspectJHook implements HookConfigurator,
*
* @return The supplementer registry, guaranteed to be not null
*/
- public SupplementerRegistry getSupplementerRegistry() {
+ public ISupplementerRegistry getSupplementerRegistry() {
return this.supplementerRegistry;
}
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJHook.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJHook.java
index 83114b901..344cdec21 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJHook.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJHook.java
@@ -16,7 +16,7 @@ package org.eclipse.equinox.weaving.hooks;
import java.io.IOException;
import java.net.URL;
-import org.eclipse.equinox.service.weaving.SupplementerRegistry;
+import org.eclipse.equinox.service.weaving.ISupplementerRegistry;
import org.eclipse.equinox.weaving.adaptors.AspectJAdaptor;
import org.eclipse.equinox.weaving.adaptors.AspectJAdaptorFactory;
import org.eclipse.equinox.weaving.adaptors.Debug;
@@ -187,7 +187,7 @@ public class AspectJHook extends AbstractAspectJHook {
this.bundleContext = context;
- final SupplementerRegistry supplementerRegistry = getSupplementerRegistry();
+ final ISupplementerRegistry supplementerRegistry = getSupplementerRegistry();
adaptorFactory.initialize(context, supplementerRegistry);
final ServiceReference serviceReference = context
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJStorageHook.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJStorageHook.java
index 6b991073f..b7cd0bd74 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJStorageHook.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJStorageHook.java
@@ -21,7 +21,7 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.internal.adaptor.CachedManifest;
-import org.eclipse.equinox.service.weaving.SupplementerRegistry;
+import org.eclipse.equinox.service.weaving.ISupplementerRegistry;
import org.eclipse.equinox.weaving.adaptors.Debug;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.hooks.StorageHook;
@@ -52,10 +52,10 @@ public class AspectJStorageHook implements StorageHook {
private BaseData bundleData;
- private final SupplementerRegistry supplementerRegistry;
+ private final ISupplementerRegistry supplementerRegistry;
public AspectJStorageHook(final BaseData bd,
- final SupplementerRegistry supplementerRegistry) {
+ final ISupplementerRegistry supplementerRegistry) {
if (Debug.DEBUG_SUPPLEMENTS)
Debug.println("- AspectJStorageHook.AspectJStorageHook() baseDate="
+ bd);
@@ -63,7 +63,7 @@ public class AspectJStorageHook implements StorageHook {
this.supplementerRegistry = supplementerRegistry;
}
- public AspectJStorageHook(final SupplementerRegistry supplementerRegistry) {
+ public AspectJStorageHook(final ISupplementerRegistry supplementerRegistry) {
if (Debug.DEBUG_SUPPLEMENTS)
Debug.println("- AspectJStorageHook.AspectJStorageHook()");
this.supplementerRegistry = supplementerRegistry;
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementBundleListener.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementBundleListener.java
index f64c5106e..ab6a65838 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementBundleListener.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementBundleListener.java
@@ -11,17 +11,17 @@
package org.eclipse.equinox.weaving.hooks;
-import org.eclipse.equinox.service.weaving.SupplementerRegistry;
+import org.eclipse.equinox.service.weaving.ISupplementerRegistry;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.SynchronousBundleListener;
public class SupplementBundleListener implements SynchronousBundleListener {
- private final SupplementerRegistry supplementerRegistry;
+ private final ISupplementerRegistry supplementerRegistry;
public SupplementBundleListener(
- final SupplementerRegistry supplementerRegistry) {
+ final ISupplementerRegistry supplementerRegistry) {
this.supplementerRegistry = supplementerRegistry;
}
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/SupplementerRegistry.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java
index b042c5f32..110e10777 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/service/weaving/SupplementerRegistry.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/SupplementerRegistry.java
@@ -11,7 +11,7 @@
* Heiko Seeberger Enhancements for service dynamics
*******************************************************************************/
-package org.eclipse.equinox.service.weaving;
+package org.eclipse.equinox.weaving.hooks;
import java.util.ArrayList;
import java.util.Collections;
@@ -24,8 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.eclipse.equinox.weaving.hooks.AbstractAspectJHook;
-import org.eclipse.equinox.weaving.hooks.Supplementer;
+import org.eclipse.equinox.service.weaving.ISupplementerRegistry;
import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -33,7 +32,7 @@ import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.service.packageadmin.PackageAdmin;
-public class SupplementerRegistry {
+public class SupplementerRegistry implements ISupplementerRegistry {
//knibb
/**
@@ -99,6 +98,9 @@ public class SupplementerRegistry {
.add("org.eclipse.equinox.simpleconfigurator");
}
+ /**
+ * @see org.eclipse.equinox.service.weaving.ISupplementerRegistry#addBundle(org.osgi.framework.Bundle)
+ */
public void addBundle(final Bundle bundle) {
// First analyze which supplementers already exists for this bundle
addSupplementedBundle(bundle);
@@ -107,6 +109,9 @@ public class SupplementerRegistry {
addSupplementer(bundle, true);
}
+ /**
+ * @see org.eclipse.equinox.service.weaving.ISupplementerRegistry#addSupplementedBundle(org.osgi.framework.Bundle)
+ */
public void addSupplementedBundle(final Bundle bundle) {
try {
final Dictionary manifest = bundle.getHeaders();
@@ -125,6 +130,9 @@ public class SupplementerRegistry {
}
}
+ /**
+ * @see org.eclipse.equinox.service.weaving.ISupplementerRegistry#addSupplementer(org.osgi.framework.Bundle, boolean)
+ */
public void addSupplementer(final Bundle bundle, final boolean updateBundles) {
try {
final Dictionary manifest = bundle.getHeaders();
@@ -154,10 +162,16 @@ public class SupplementerRegistry {
}
}
+ /**
+ * @see org.eclipse.equinox.service.weaving.ISupplementerRegistry#getPackageAdmin()
+ */
public PackageAdmin getPackageAdmin() {
return packageAdmin;
}
+ /**
+ * @see org.eclipse.equinox.service.weaving.ISupplementerRegistry#getSupplementers(org.osgi.framework.Bundle)
+ */
public Bundle[] getSupplementers(final Bundle bundle) {
List result = Collections.EMPTY_LIST;
@@ -175,6 +189,9 @@ public class SupplementerRegistry {
return (Bundle[]) result.toArray(new Bundle[result.size()]);
}
+ /**
+ * @see org.eclipse.equinox.service.weaving.ISupplementerRegistry#getSupplementers(long)
+ */
public Bundle[] getSupplementers(final long bundleID) {
final Bundle bundle = this.context.getBundle(bundleID);
if (bundle != null) {
@@ -184,6 +201,9 @@ public class SupplementerRegistry {
}
}
+ /**
+ * @see org.eclipse.equinox.service.weaving.ISupplementerRegistry#getSupplementers(java.lang.String, org.eclipse.osgi.util.ManifestElement[], org.eclipse.osgi.util.ManifestElement[])
+ */
public List getSupplementers(final String symbolicName,
final ManifestElement[] imports, final ManifestElement[] exports) {
List result = Collections.EMPTY_LIST;
@@ -204,6 +224,9 @@ public class SupplementerRegistry {
return result;
}
+ /**
+ * @see org.eclipse.equinox.service.weaving.ISupplementerRegistry#removeBundle(org.osgi.framework.Bundle)
+ */
public void removeBundle(final Bundle bundle) {
// if this bundle is itself supplemented by others, remove the bundle from those lists
removeSupplementedBundle(bundle);
@@ -229,14 +252,23 @@ public class SupplementerRegistry {
}
}
+ /**
+ * @see org.eclipse.equinox.service.weaving.ISupplementerRegistry#setBundleContext(org.osgi.framework.BundleContext)
+ */
public void setBundleContext(final BundleContext context) {
this.context = context;
}
+ /**
+ * @see org.eclipse.equinox.service.weaving.ISupplementerRegistry#setPackageAdmin(org.osgi.service.packageadmin.PackageAdmin)
+ */
public void setPackageAdmin(final PackageAdmin packageAdmin) {
this.packageAdmin = packageAdmin;
}
+ /**
+ * @see org.eclipse.equinox.service.weaving.ISupplementerRegistry#updateInstalledBundle(org.osgi.framework.Bundle)
+ */
public void updateInstalledBundle(final Bundle bundle) {
if (AbstractAspectJHook.verbose)
System.err
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingLoaderDelegateHook.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingLoaderDelegateHook.java
index 8ced7ee0f..24f4b6e5b 100644
--- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingLoaderDelegateHook.java
+++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/WeavingLoaderDelegateHook.java
@@ -15,7 +15,7 @@ import java.io.FileNotFoundException;
import java.net.URL;
import java.util.Enumeration;
-import org.eclipse.equinox.service.weaving.SupplementerRegistry;
+import org.eclipse.equinox.service.weaving.ISupplementerRegistry;
import org.eclipse.osgi.framework.adaptor.BundleClassLoader;
import org.eclipse.osgi.framework.adaptor.BundleData;
import org.eclipse.osgi.framework.adaptor.ClassLoaderDelegateHook;
@@ -34,7 +34,7 @@ import org.osgi.framework.Bundle;
*/
public class WeavingLoaderDelegateHook implements ClassLoaderDelegateHook {
- private final SupplementerRegistry supplementerRegistry;
+ private final ISupplementerRegistry supplementerRegistry;
/**
* Create the hook instance for broaden the visibility according to the
@@ -45,7 +45,7 @@ public class WeavingLoaderDelegateHook implements ClassLoaderDelegateHook {
* by which other bundles (needs to not be null)
*/
public WeavingLoaderDelegateHook(
- final SupplementerRegistry supplementerRegistry) {
+ final ISupplementerRegistry supplementerRegistry) {
this.supplementerRegistry = supplementerRegistry;
}

Back to the top