You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2009/08/19 15:39:42 UTC
svn commit: r805803 -
/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/SimpleComponent.java
Author: fmeschbe
Date: Wed Aug 19 13:39:42 2009
New Revision: 805803
URL: http://svn.apache.org/viewvc?rev=805803&view=rev
Log:
Use component.id instead of service.pid as the key in the INSTANCES map
because the service.pid property may not always be present.
Modified:
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/SimpleComponent.java
Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/SimpleComponent.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/SimpleComponent.java?rev=805803&r1=805802&r2=805803&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/SimpleComponent.java (original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/SimpleComponent.java Wed Aug 19 13:39:42 2009
@@ -26,7 +26,7 @@
import java.util.Map;
import java.util.Set;
-import org.osgi.framework.Constants;
+import org.osgi.service.component.ComponentConstants;
import org.osgi.service.component.ComponentContext;
@@ -35,7 +35,7 @@
public static SimpleComponent INSTANCE;
- public static final Map<String, SimpleComponent> INSTANCES = new HashMap<String, SimpleComponent>();
+ public static final Map<Long, SimpleComponent> INSTANCES = new HashMap<Long, SimpleComponent>();
public static final Set<SimpleComponent> PREVIOUS_INSTANCES = new HashSet<SimpleComponent>();
@@ -46,7 +46,7 @@
private void activate( Map<?, ?> config )
{
INSTANCE = this;
- INSTANCES.put( config.get( Constants.SERVICE_PID ).toString(), this );
+ INSTANCES.put( ( Long ) config.get( ComponentConstants.COMPONENT_ID ), this );
setConfig( config );
if ( PREVIOUS_INSTANCES.contains( this ) )
@@ -74,7 +74,7 @@
@SuppressWarnings("unused")
private void deactivate()
{
- INSTANCES.remove( getProperty( Constants.SERVICE_PID ).toString() );
+ INSTANCES.remove( getProperty( ComponentConstants.COMPONENT_ID ) );
INSTANCE = null;
setConfig( new HashMap<Object, Object>() );
}