You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by dj...@apache.org on 2011/11/10 09:41:07 UTC
svn commit: r1200216 - in /aries/trunk/util: ./
src/main/java/org/apache/aries/util/
src/main/java/org/apache/aries/util/internal/
src/main/java/org/apache/aries/util/tracker/
src/main/java/org/apache/aries/util/tracker/hook/
Author: djencks
Date: Thu Nov 10 08:41:06 2011
New Revision: 1200216
URL: http://svn.apache.org/viewvc?rev=1200216&view=rev
Log:
ARIES-777 ARIES-778 roll back last commits to fix build
Removed:
aries/trunk/util/src/main/java/org/apache/aries/util/internal/R43Worker.java
aries/trunk/util/src/main/java/org/apache/aries/util/tracker/hook/
Modified:
aries/trunk/util/pom.xml
aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java
aries/trunk/util/src/main/java/org/apache/aries/util/internal/DefaultWorker.java
aries/trunk/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java
Modified: aries/trunk/util/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/util/pom.xml?rev=1200216&r1=1200215&r2=1200216&view=diff
==============================================================================
--- aries/trunk/util/pom.xml (original)
+++ aries/trunk/util/pom.xml Thu Nov 10 08:41:06 2011
@@ -53,9 +53,7 @@
</aries.osgi.export.pkg>
<aries.osgi.import.pkg>
!org.apache.aries.util*,
- org.osgi.framework.hooks.bundle;resolution:=optional,
org.osgi.framework.launch;resolution:=optional,
- org.osgi.framework.wiring.*;resolution:=optional,
org.osgi.service.framework;resolution:=optional,
org.eclipse.osgi.internal.loader;resolution:=optional,
org.eclipse.osgi.framework.internal.core;resolution:=optional,
@@ -64,8 +62,7 @@
</aries.osgi.import.pkg>
<aries.osgi.private.pkg>
org.apache.aries.util.internal,
- org.apache.aries.util.filesystem.impl,
- org.apache.aries.util.tracker.hook
+ org.apache.aries.util.filesystem.impl
</aries.osgi.private.pkg>
</properties>
@@ -73,7 +70,6 @@
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
- <version>4.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Modified: aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java
URL: http://svn.apache.org/viewvc/aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java?rev=1200216&r1=1200215&r2=1200216&view=diff
==============================================================================
--- aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java (original)
+++ aries/trunk/util/src/main/java/org/apache/aries/util/AriesFrameworkUtil.java Thu Nov 10 08:41:06 2011
@@ -22,25 +22,20 @@ import org.apache.aries.util.internal.De
import org.apache.aries.util.internal.EquinoxWorker;
import org.apache.aries.util.internal.FelixWorker;
import org.apache.aries.util.internal.FrameworkUtilWorker;
-import org.apache.aries.util.internal.R43Worker;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceRegistration;
-public final class AriesFrameworkUtil
+public final class AriesFrameworkUtil
{
private static FrameworkUtilWorker worker;
static {
- try {
- worker = new R43Worker();
- } catch (Throwable e) {
- }
Bundle b = FrameworkUtil.getBundle(AriesFrameworkUtil.class);
- String bundleClassName = b == null? "": b.getClass().getName();
- if (worker == null && isEquinox(bundleClassName)) {
+ String bundleClassName = b.getClass().getName();
+ if (isEquinox(bundleClassName)) {
worker = new EquinoxWorker();
- } else if (worker == null && bundleClassName.startsWith("org.apache.felix")) {
+ } else if (bundleClassName.startsWith("org.apache.felix")) {
worker = new FelixWorker();
}
Modified: aries/trunk/util/src/main/java/org/apache/aries/util/internal/DefaultWorker.java
URL: http://svn.apache.org/viewvc/aries/trunk/util/src/main/java/org/apache/aries/util/internal/DefaultWorker.java?rev=1200216&r1=1200215&r2=1200216&view=diff
==============================================================================
--- aries/trunk/util/src/main/java/org/apache/aries/util/internal/DefaultWorker.java (original)
+++ aries/trunk/util/src/main/java/org/apache/aries/util/internal/DefaultWorker.java Thu Nov 10 08:41:06 2011
@@ -39,8 +39,7 @@ public class DefaultWorker implements Fr
static
{
- Bundle bundle = FrameworkUtil.getBundle(DefaultWorker.class);
- BundleContext myContext = bundle == null? null: bundle.getBundleContext();
+ BundleContext myContext = FrameworkUtil.getBundle(DefaultWorker.class).getBundleContext();
// This may be created during framework shutdown when the bundle context is null.
// So we need to cope and not NPE during construction.
@@ -57,7 +56,7 @@ public class DefaultWorker implements Fr
ClassLoader cl = get(b);
if (cl != null) return cl;
-
+
// so first off try to get the real classloader. We can do this by loading a known class
// such as the bundle activator. There is no guarantee this will work, so we have a back door too.
String activator = (String) b.getHeaders().get(Constants.BUNDLE_ACTIVATOR);
Modified: aries/trunk/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java
URL: http://svn.apache.org/viewvc/aries/trunk/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java?rev=1200216&r1=1200215&r2=1200216&view=diff
==============================================================================
--- aries/trunk/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java (original)
+++ aries/trunk/util/src/main/java/org/apache/aries/util/tracker/RecursiveBundleTracker.java Thu Nov 10 08:41:06 2011
@@ -18,7 +18,6 @@
*/
package org.apache.aries.util.tracker;
-import org.apache.aries.util.tracker.hook.BundleHookBundleTracker;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -30,68 +29,61 @@ import org.osgi.util.tracker.BundleTrack
* events related to framework bundles, as it will automatically handle these events. In
* order to use this class clients must create a subclass and implement the methods of the
* <code>BundleTrackerCustomizer</code> interface. In spite of this, instances of this class
- * MUST NOT be passed as a parameter to any <code>BundleTracker</code>.</p>
- * <p/>
+ * MUST NOT be passed as a parameter to any <code>BundleTracker</code>.</p>
+ *
* The model for using this is that classes should instantiate it
* and pass it a 'vanilla' bundle tracker.
- *
* @author pradine
+ *
*/
-public final class RecursiveBundleTracker {
- private static final int COMPOSITE_BUNDLE_MASK =
+public final class RecursiveBundleTracker {
+ private static final int COMPOSITE_BUNDLE_MASK =
Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING;
-
- private final BundleTracker tracker;
-
- /**
- * Constructor
- *
- * @param context - The <code>BundleContext</code> against which the tracking is done.
- * @param stateMask - The bit mask of the ORing of the bundle states to be tracked. The
- * mask must contain the flags <code>Bundle.INSTALLED | Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING</code>
- * as a minimum.
- * @throws IllegalArgumentException - If the provided bit mask does not contain required
- * flags
- */
- public RecursiveBundleTracker(BundleContext context, int stateMask, BundleTrackerCustomizer customizer) {
- // We always need INSTALLED events so we can recursively listen to the frameworks
- if ((stateMask & COMPOSITE_BUNDLE_MASK) != COMPOSITE_BUNDLE_MASK)
- throw new IllegalArgumentException();
-
- BundleTracker tracker = null;
- try {
- tracker = new BundleHookBundleTracker(context, stateMask, customizer);
- } catch (Throwable e) {
+
+ private final BundleTracker tracker;
+
+ /**
+ * Constructor
+ *
+ * @param context - The <code>BundleContext</code> against which the tracking is done.
+ * @param stateMask - The bit mask of the ORing of the bundle states to be tracked. The
+ * mask must contain the flags <code>Bundle.INSTALLED | Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING</code>
+ * as a minimum.
+ * @throws IllegalArgumentException - If the provided bit mask does not contain required
+ * flags
+ */
+ public RecursiveBundleTracker(BundleContext context, int stateMask, BundleTrackerCustomizer customizer) {
+ // We always need INSTALLED events so we can recursively listen to the frameworks
+ if ((stateMask & COMPOSITE_BUNDLE_MASK) != COMPOSITE_BUNDLE_MASK)
+ throw new IllegalArgumentException();
+ if (areMultipleFrameworksAvailable(context)) {
+ tracker = new InternalRecursiveBundleTracker(context, stateMask, customizer);
+ } else {
+ tracker = new BundleTracker(context, stateMask, customizer);
+ }
}
- if (tracker == null && areMultipleFrameworksAvailable(context)) {
- tracker = new InternalRecursiveBundleTracker(context, stateMask, customizer);
- } else {
- tracker = new BundleTracker(context, stateMask, customizer);
+
+ private static boolean areMultipleFrameworksAvailable(BundleContext context) {
+ ServiceReference sr = context.getServiceReference("org.osgi.service.framework.CompositeBundleFactory");
+ return sr != null;
+ }
+
+ /**
+ * Start tracking bundles that match the bit mask provided at creation time.
+ *
+ * @see BundleTracker#open()
+ */
+ public void open() {
+ tracker.open();
+ }
+
+ /**
+ * Stop the tracking of bundles
+ *
+ * @see BundleTracker#close()
+ */
+ public void close() {
+ tracker.close();
}
- this.tracker = tracker;
- }
-
- private static boolean areMultipleFrameworksAvailable(BundleContext context) {
- ServiceReference sr = context.getServiceReference("org.osgi.service.framework.CompositeBundleFactory");
- return sr != null;
- }
-
- /**
- * Start tracking bundles that match the bit mask provided at creation time.
- *
- * @see BundleTracker#open()
- */
- public void open() {
- tracker.open();
- }
-
- /**
- * Stop the tracking of bundles
- *
- * @see BundleTracker#close()
- */
- public void close() {
- tracker.close();
- }
}