You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2012/10/19 22:19:59 UTC
svn commit: r1400265 -
/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
Author: pderop
Date: Fri Oct 19 20:19:59 2012
New Revision: 1400265
URL: http://svn.apache.org/viewvc?rev=1400265&view=rev
Log:
FELIX-3700: fixed a bug where target filters specified in component metadata may be ignored when configuration
is loaded from config admin. Refactored the code because since FELIX-3726, the target filters are always updated
from Unsatisfied.activate method: now, getProperties is returning the target filters specified
in both config admin or in metadata.
Modified:
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java?rev=1400265&r1=1400264&r2=1400265&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java Fri Oct 19 20:19:59 2012
@@ -81,7 +81,7 @@ public class ComponentFactoryImpl extend
private volatile Dictionary m_configuration;
/**
- * Flag telling if our component factory is configured.
+ * Flag telling if our component factory is configured from config admin.
* We are configured when configuration policy is required and we have received the
* config admin properties, or when configuration policy is optional or ignored.
*/
@@ -230,9 +230,18 @@ public class ComponentFactoryImpl extend
}
}
+ // add target properties from configuration (if we have one)
+ for ( Object key : Collections.list( m_configuration.keys() ) )
+ {
+ if ( key.toString().endsWith( ".target" ) )
+ {
+ props.put( key, m_configuration.get( key ) );
+ }
+ }
+
return props;
}
-
+
public void setServiceProperties( Dictionary serviceProperties )
{
throw new IllegalStateException( "ComponentFactory service properties are immutable" );
@@ -376,23 +385,22 @@ public class ComponentFactoryImpl extend
log( LogService.LOG_INFO, "Current ComponentFactory state={0}", new Object[]
{ getState() }, null );
-
- // Update our target filters.
- log( LogService.LOG_DEBUG, "Updating target filters", null );
- super.updateTargets( m_configuration );
// If we are active, but if some config target filters don't match anymore
// any required references, then deactivate.
if ( getState() == STATE_FACTORY )
{
+ log( LogService.LOG_INFO, "Verifying if Active Component Factory is still satisfied", null );
+
+ // First update target filters.
+ super.updateTargets( getProperties() );
+
+ // Next, verify dependencies
if ( !verifyDependencyManagers( m_configuration ) )
{
- if ( ( getState() & STATE_DISPOSED ) == 0 )
- {
- log( LogService.LOG_DEBUG,
- "Component Factory target filters not satisfied anymore: deactivating", null );
- deactivateInternal( ComponentConstants.DEACTIVATION_REASON_REFERENCE );
- }
+ log( LogService.LOG_DEBUG,
+ "Component Factory target filters not satisfied anymore: deactivating", null );
+ deactivateInternal( ComponentConstants.DEACTIVATION_REASON_REFERENCE );
return;
}
}