Author: rickhall
Date: Wed May 18 14:59:52 2011
New Revision: 1124294
URL: http://svn.apache.org/viewvc?rev=1124294&view=rev
Log:
Lazy activation was being handled in two places; related metadata
should be held in BundleRevisionImpl and class-loading tracking
should be handled in BundleWiringImpl. (FELIX-2950)
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java?rev=1124294&r1=1124293&r2=1124294&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
Wed May 18 14:59:52 2011
@@ -163,14 +163,33 @@ public class BundleRevisionImpl implemen
return m_declaredActivationPolicy;
}
- List<String> getActivationExcludes()
+ boolean isActivationTrigger(String pkgName)
{
- return m_activationExcludes;
- }
+ if ((m_activationIncludes == null) && (m_activationExcludes == null))
+ {
+ return true;
+ }
- List<String> getActivationIncludes()
- {
- return m_activationIncludes;
+ // If there are no include filters then all classes are included
+ // by default, otherwise try to find one match.
+ boolean included = (m_activationIncludes == null);
+ for (int i = 0;
+ (!included) && (m_activationIncludes != null) && (i <
m_activationIncludes.size());
+ i++)
+ {
+ included = m_activationIncludes.get(i).equals(pkgName);
+ }
+
+ // If there are no exclude filters then no classes are excluded
+ // by default, otherwise try to find one match.
+ boolean excluded = false;
+ for (int i = 0;
+ (!excluded) && (m_activationExcludes != null) && (i <
m_activationExcludes.size());
+ i++)
+ {
+ excluded = m_activationExcludes.get(i).equals(pkgName);
+ }
+ return included && !excluded;
}
URLStreamHandler getURLStreamHandler()
@@ -285,40 +304,6 @@ public class BundleRevisionImpl implemen
return m_declaredNativeLibs;
}
- synchronized boolean isActivationTriggered()
- {
- return m_isActivationTriggered;
- }
-
- boolean isActivationTrigger(String pkgName)
- {
- if ((m_activationIncludes == null) && (m_activationExcludes == null))
- {
- return true;
- }
-
- // If there are no include filters then all classes are included
- // by default, otherwise try to find one match.
- boolean included = (m_activationIncludes == null);
- for (int i = 0;
- (!included) && (m_activationIncludes != null) && (i <
m_activationIncludes.size());
- i++)
- {
- included = m_activationIncludes.get(i).equals(pkgName);
- }
-
- // If there are no exclude filters then no classes are excluded
- // by default, otherwise try to find one match.
- boolean excluded = false;
- for (int i = 0;
- (!excluded) && (m_activationExcludes != null) && (i <
m_activationExcludes.size());
- i++)
- {
- excluded = m_activationExcludes.get(i).equals(pkgName);
- }
- return included && !excluded;
- }
-
public String getId()
{
return m_id;
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
URL:
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java?rev=1124294&r1=1124293&r2=1124294&view=diff
==============================================================================
---
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
(original)
+++
felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
Wed May 18 14:59:52 2011
@@ -1188,38 +1188,6 @@ public class BundleWiringImpl implements
return m_isActivationTriggered;
}
- boolean isActivationTrigger(String pkgName)
- {
- List<String> activationIncludes = m_revision.getActivationIncludes();
- List<String> activationExcludes = m_revision.getActivationExcludes();
-
- if ((activationIncludes == null) && (activationExcludes == null))
- {
- return true;
- }
-
- // If there are no include filters then all classes are included
- // by default, otherwise try to find one match.
- boolean included = (activationIncludes == null);
- for (int i = 0;
- (!included) && (activationIncludes != null) && (i <
activationIncludes.size());
- i++)
- {
- included = activationIncludes.get(i).equals(pkgName);
- }
-
- // If there are no exclude filters then no classes are excluded
- // by default, otherwise try to find one match.
- boolean excluded = false;
- for (int i = 0;
- (!excluded) && (activationExcludes != null) && (i <
activationExcludes.size());
- i++)
- {
- excluded = activationExcludes.get(i).equals(pkgName);
- }
- return included && !excluded;
- }
-
static class ToLocalUrlEnumeration implements Enumeration
{
final Enumeration m_enumeration;
@@ -1385,7 +1353,7 @@ public class BundleWiringImpl implements
// circuit the trigger matching if the trigger is
already
// tripped.
boolean isTriggerClass = m_isActivationTriggered
- ? false : isActivationTrigger(pkgName);
+ ? false :
m_revision.isActivationTrigger(pkgName);
if (!m_isActivationTriggered
&& isTriggerClass
&& (activationPolicy ==
BundleRevisionImpl.LAZY_ACTIVATION)
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=1124294&r1=1124293&r2=1124294&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
Wed May 18 14:59:52 2011
@@ -1850,7 +1850,8 @@ public class Felix extends BundleImpl im
if (!bundle.isDeclaredActivationPolicyUsed()
|| (((BundleRevisionImpl) bundle.getCurrentRevision())
.getDeclaredActivationPolicy() !=
BundleRevisionImpl.LAZY_ACTIVATION)
- || ((BundleRevisionImpl)
bundle.getCurrentRevision()).isActivationTriggered())
+ || ((BundleWiringImpl) bundle.getCurrentRevision().getWiring())
+ .isActivationTriggered())
{
// Record the event type for the final event and activate.
eventType = BundleEvent.STARTED;