You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2013/12/10 03:43:54 UTC
svn commit: r1549750 - in
/felix/trunk/framework/src/main/java/org/apache/felix/framework:
BundleImpl.java Felix.java
Author: cziegeler
Date: Tue Dec 10 02:43:54 2013
New Revision: 1549750
URL: http://svn.apache.org/r1549750
Log:
FELIX-4331 : [Core R5] Support BundleContext and Framework adaptations. Apply patch from David Bosschaert
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java?rev=1549750&r1=1549749&r2=1549750&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleImpl.java Tue Dec 10 02:43:54 2013
@@ -1044,7 +1044,11 @@ class BundleImpl implements Bundle, Bund
public synchronized <A> A adapt(Class<A> type)
{
checkAdapt(type);
- if (type == BundleStartLevel.class)
+ if (type == BundleContext.class)
+ {
+ return (A) m_context;
+ }
+ else if (type == BundleStartLevel.class)
{
return (A) getFramework().adapt(FrameworkStartLevelImpl.class)
.createBundleStartLevel(this);
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=1549750&r1=1549749&r2=1549750&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Tue Dec 10 02:43:54 2013
@@ -18,11 +18,11 @@
*/
package org.apache.felix.framework;
-import org.osgi.framework.launch.Framework;
import java.io.*;
import java.net.*;
import java.security.*;
import java.util.*;
+
import org.apache.felix.framework.BundleWiringImpl.BundleClassLoader;
import org.apache.felix.framework.ServiceRegistry.ServiceRegistryCallbacks;
import org.apache.felix.framework.cache.BundleArchive;
@@ -63,6 +63,7 @@ import org.osgi.framework.ServiceListene
import org.osgi.framework.ServicePermission;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.launch.Framework;
import org.osgi.framework.startlevel.FrameworkStartLevel;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRevision;
@@ -372,7 +373,7 @@ public class Felix extends BundleImpl im
}
// Read the security default policy property
- m_securityDefaultPolicy = "true".equals(getProperty(FelixConstants.SECURITY_DEFAULT_POLICY));
+ m_securityDefaultPolicy = "true".equals(getProperty(FelixConstants.SECURITY_DEFAULT_POLICY));
// Create default bundle stream handler.
m_bundleStreamHandler = new URLHandlersBundleStreamHandler(this);
@@ -484,7 +485,12 @@ public class Felix extends BundleImpl im
public <A> A adapt(Class<A> type)
{
checkAdapt(type);
- if ((type == FrameworkWiring.class)
+ if ((type == Framework.class)
+ || (type == Felix.class))
+ {
+ return (A) this;
+ }
+ else if ((type == FrameworkWiring.class)
|| (type == FrameworkWiringImpl.class))
{
return (A) m_fwkWiring;
@@ -4303,7 +4309,7 @@ public class Felix extends BundleImpl im
{
Bundle source = bundleProtectionDomain.getBundle();
- return (m_securityDefaultPolicy && (source == null || source.getBundleId() != 0)) ?
+ return (m_securityDefaultPolicy && (source == null || source.getBundleId() != 0)) ?
bundleProtectionDomain.superImplies(permission) : true;
}
}