diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java index 742222d73e6..715572dd6e0 100644 --- a/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java +++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java @@ -446,6 +446,7 @@ public final Promise enable(final boolean async) long count = taskCounter.incrementAndGet(); + @Override public void run() { try @@ -537,6 +538,7 @@ public final Promise disable(final boolean async) long count = taskCounter.incrementAndGet(); + @Override public void run() { try @@ -591,6 +593,7 @@ void registerMissingDependency(DependencyManager dm, ServiceReference< //---------- Component interface ------------------------------------------ + @Override public long getId() { return m_componentId; @@ -969,6 +972,11 @@ protected boolean unregisterService() return true; } + protected ServiceRegistration getServiceRegistration() + { + return registrationManager.getServiceRegistration(); + } + AtomicInteger getTrackingCount() { return m_trackingCount; @@ -1085,6 +1093,7 @@ synchronized void clear() /** * Returns true if logging for the given level is enabled. */ + @Override public boolean isLogEnabled(int level) { ComponentActivator activator = getActivator(); @@ -1095,6 +1104,7 @@ public boolean isLogEnabled(int level) return false; } + @Override public void log(int level, String message, Throwable ex) { ComponentActivator activator = getActivator(); @@ -1104,6 +1114,7 @@ public void log(int level, String message, Throwable ex) } } + @Override public void log(int level, String message, Object[] arguments, Throwable ex) { ComponentActivator activator = getActivator(); @@ -1227,6 +1238,7 @@ else if (!dm.isSatisfied()) return m_dependencyManagers; } + @Override public List> getReferenceManagers() { return m_dependencyManagers; @@ -1279,6 +1291,7 @@ private void disableDependencyManagers() /* (non-Javadoc) * @see org.apache.felix.scr.impl.manager.ComponentManager#getProperties() */ + @Override public abstract Map getProperties(); public abstract void setServiceProperties(Dictionary serviceProperties); @@ -1401,6 +1414,7 @@ public ComponentMetadata getComponentMetadata() return m_container.getComponentMetadata(); } + @Override public int getSpecState() { return getState().getSpecState(); diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java index 7c8f817891f..ad6495041f9 100644 --- a/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java +++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/SingleComponentManager.java @@ -30,6 +30,7 @@ import org.apache.felix.scr.impl.helper.ComponentMethod; import org.apache.felix.scr.impl.helper.ComponentMethods; import org.apache.felix.scr.impl.helper.MethodResult; +import org.apache.felix.scr.impl.metadata.DSVersion; import org.apache.felix.scr.impl.metadata.TargetedPID; import org.osgi.framework.Bundle; import org.osgi.framework.Constants; @@ -108,12 +109,14 @@ private boolean createComponent(ComponentContextImpl componentContext) { S tmpComponent = createImplementationObject( null, new SetImplementationObject() { + @Override public void presetComponentContext( ComponentContextImpl componentContext ) { m_componentContext = componentContext; } + @Override public void resetImplementationObject( S implementationObject ) { m_componentContext = null; @@ -515,7 +518,7 @@ void preDeregister() if (m_componentContext != null) { m_componentContext.unsetServiceRegistration(); - } + } } @Override @@ -528,9 +531,14 @@ public Dictionary getServiceProperties() return super.getServiceProperties(); } - final ServiceRegistration getServiceRegistration() + @Override + protected ServiceRegistration getServiceRegistration() { - return m_componentContext == null? null: m_componentContext.getServiceRegistration(); + if ( getComponentMetadata().getDSVersion() == DSVersion.DS12Felix ) + { + return m_componentContext != null ? m_componentContext.getServiceRegistration() : null; + } + return super.getServiceRegistration(); } @@ -801,6 +809,7 @@ private boolean servicePropertiesMatches( ServiceRegistration reg, Dictionary return regProps.equals( props ); } + @Override public S getService( Bundle bundle, ServiceRegistration serviceRegistration ) { if ( getActivator().enterCreate( serviceRegistration.getReference() ) ) @@ -838,7 +847,7 @@ public S getService( Bundle bundle, ServiceRegistration serviceRegistration ) //This is backup. Normally done in createComponent. getActivator().leaveCreate(serviceRegistration.getReference()); } - + } finally { @@ -930,6 +939,7 @@ private S getService(ComponentContextImpl componentContext) } + @Override public void ungetService( Bundle bundle, ServiceRegistration serviceRegistration, S o ) { obtainStateLock( );