FELIX-1185 Make getSatisfiedState() final in the AbstractComponentManager
and remove all getSatisfiedState() methods from extensions and replace
m_state my m_name field in log messages of the State class.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@781316 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java
index 30ee2df..32160ca 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java
@@ -115,42 +115,42 @@
void enableInternal( AbstractComponentManager acm )
{
acm.log( LogService.LOG_DEBUG,
- "Current state: " + m_state + ", Event: enable",
+ "Current state: " + m_name + ", Event: enable",
acm.getComponentMetadata(), null );
}
void disableInternal( AbstractComponentManager acm )
{
acm.log( LogService.LOG_DEBUG,
- "Current state: " + m_state + ", Event: disable",
+ "Current state: " + m_name + ", Event: disable",
acm.getComponentMetadata(), null );
}
void activateInternal( AbstractComponentManager acm )
{
acm.log(LogService.LOG_DEBUG,
- "Current state: " + m_state + ", Event: activate",
+ "Current state: " + m_name + ", Event: activate",
acm.getComponentMetadata(), null);
}
void deactivateInternal( AbstractComponentManager acm )
{
acm.log( LogService.LOG_DEBUG,
- "Current state: " + m_state + ", Event: deactivate",
+ "Current state: " + m_name + ", Event: deactivate",
acm.getComponentMetadata(), null );
}
void disposeInternal( AbstractComponentManager acm )
{
acm.log( LogService.LOG_DEBUG,
- "Current state: " + m_state + ", Event: dispose",
+ "Current state: " + m_name + ", Event: dispose",
acm.getComponentMetadata(), null );
}
Object getService( DelayedComponentManager dcm )
{
dcm.log( LogService.LOG_DEBUG,
- "Current state: " + m_state + ", Event: getService",
+ "Current state: " + m_name + ", Event: getService",
dcm.getComponentMetadata(), null );
return null;
}
@@ -649,7 +649,23 @@
*/
protected abstract Object getService();
- protected abstract State getSatisfiedState();
+
+ final State getSatisfiedState()
+ {
+ if ( m_componentMetadata.isFactory() )
+ {
+ return Factory.getInstance();
+ }
+ else if ( m_componentMetadata.isImmediate() )
+ {
+ return Active.getInstance();
+ }
+ else
+ {
+ return Registered.getInstance();
+ }
+ }
+
protected ServiceRegistration registerService()
{
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ComponentFactoryImpl.java b/scr/src/main/java/org/apache/felix/scr/impl/ComponentFactoryImpl.java
index 163c65c..b7f0a78 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/ComponentFactoryImpl.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/ComponentFactoryImpl.java
@@ -81,9 +81,6 @@
// nothing to delete
}
- protected State getSatisfiedState() {
- return Factory.getInstance();
- }
protected ServiceRegistration registerService()
{
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/DelayedComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/DelayedComponentManager.java
index e2abdf3..ae36600 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/DelayedComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/DelayedComponentManager.java
@@ -41,12 +41,6 @@
}
- protected State getSatisfiedState()
- {
- return Registered.getInstance();
- }
-
-
protected boolean createComponent()
{
// nothing to do here for a delayed component, will be done in the
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
index 68f73fd..662538e 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
@@ -152,11 +152,6 @@
m_properties = null;
}
- protected State getSatisfiedState()
- {
- return Active.getInstance();
- }
-
//**********************************************************************************************************
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ServiceFactoryComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/ServiceFactoryComponentManager.java
index 8cdf007..fc79eb8 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/ServiceFactoryComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/ServiceFactoryComponentManager.java
@@ -52,12 +52,6 @@
}
- protected State getSatisfiedState()
- {
- return Factory.getInstance();
- }
-
-
/* (non-Javadoc)
* @see org.apache.felix.scr.AbstractComponentManager#createComponent()
*/