Author: djencks
Date: Mon Sep 16 07:39:37 2013
New Revision: 1523554
URL: http://svn.apache.org/r1523554
Log:
FELIX-4223 minor cleanups
Modified:
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
Modified:
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
URL:
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java?rev=1523554&r1=1523553&r2=1523554&view=diff
==============================================================================
---
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
(original)
+++
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentHolder.java
Mon Sep 16 07:39:37 2013
@@ -70,7 +70,7 @@ public interface ComponentHolder
* @param pid The PID of the configuration used to configure the component.
* @param props the property dictionary from the configuration.
* @param changeCount change count of the configuration, or R4 imitation.
- * @param targetedPid TODO
+ * @param targetedPid Targeted PID for the configuration
* @return true if a new component is created for a factory PID, false if
an existing factory pid configuration is updated or
* we have no factory pid
*/
@@ -78,14 +78,15 @@ public interface ComponentHolder
/**
* Change count (or fake R4 imitation)
+ * @param pid PID of the component we are interested in.
* @return the last change count from a configurationUpdated call for the
given pid.
*/
long getChangeCount( String pid );
/**
* Returns the targeted PID used to configure this component
- * @param pid TODO
- * @return
+ * @param pid a targetedPID containing the service pid for the component
desired (the rest of the targeted pid is ignored)
+ * @return the complete targeted pid actually used to configure the
comonent.
*/
TargetedPID getConfigurationTargetedPID(TargetedPID pid);
Modified:
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
URL:
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java?rev=1523554&r1=1523553&r2=1523554&view=diff
==============================================================================
---
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
(original)
+++
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ConfigurationSupport.java
Mon Sep 16 07:39:37 2013
@@ -513,7 +513,7 @@ public class ConfigurationSupport implem
*
* @param ca Configuration Admin service
* @param pid Pid for desired configuration
- * @param bundle TODO
+ * @param bundle bundle of the component we are configuring (used in
targeted pids)
* @return configuration with the specified Pid
*/
public Configuration findSingletonConfiguration(final ConfigurationAdmin
ca, final String pid, Bundle bundle)
Modified:
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
URL:
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java?rev=1523554&r1=1523553&r2=1523554&view=diff
==============================================================================
---
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
(original)
+++
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
Mon Sep 16 07:39:37 2013
@@ -91,7 +91,7 @@ public class DependencyManager<S, T> imp
/**
* Constructor that receives several parameters.
* @param dependency An object that contains data about the dependency
- * @param index TODO
+ * @param index index of the dependency manager in the metadata
*/
DependencyManager( AbstractComponentManager<S> componentManager,
ReferenceMetadata dependency, int index )
{
@@ -272,7 +272,7 @@ public class DependencyManager<S, T> imp
{
boolean success = m_dependencyMetadata.isOptional() ||
!getTracker().isEmpty();
AtomicInteger trackingCount = new AtomicInteger( );
- getTracker().getTracked( true, trackingCount ); //TODO activate
method??
+ getTracker().getTracked( true, trackingCount );
return success;
}
@@ -1395,7 +1395,7 @@ public class DependencyManager<S, T> imp
/**
* initializes a dependency. This method binds all of the service
* occurrences to the instance object
- * @param edgeInfo TODO
+ * @param edgeInfo Edge info for the combination of this component
instance and this dependency manager.
*
* @return true if the dependency is satisfied and at least the minimum
* number of services could be bound. Otherwise false is returned.
@@ -1457,7 +1457,8 @@ public class DependencyManager<S, T> imp
/**
* Revoke the given bindings. This method cannot throw an exception since
* it must try to complete all that it can
- * @param edgeInfo TODO
+ * @param componentInstance instance we are unbinding from.
+ * @param edgeInfo EdgeInfo for the combination of this component instance
and this dependency manager.
*/
void close( S componentInstance, EdgeInfo edgeInfo )
{
@@ -1534,10 +1535,10 @@ public class DependencyManager<S, T> imp
*
*
*
- * @param componentInstance
+ * @param componentInstance instance we are binding to
* @param refPair the service reference, service object tuple.
- * @param trackingCount
- * @param edgeInfo TODO
+ * @param trackingCount service event counter for this service.
+ * @param edgeInfo EdgeInfo for the combination of this instance and this
dependency manager.
* @return true if the service should be considered bound. If no bind
* method is found or the method call fails, <code>true</code> is
* returned. <code>false</code> is only returned if the service must
@@ -1587,9 +1588,9 @@ public class DependencyManager<S, T> imp
/**
* Calls the updated method.
*
- * @param componentInstance
+ * @param componentInstance instance we are calling updated on.
* @param refPair A service reference corresponding to the service whose
service
- * @param edgeInfo TODO
+ * @param edgeInfo EdgeInfo for the comibination of this instance and this
dependency manager.
*/
void invokeUpdatedMethod( S componentInstance, final RefPair<T> refPair,
int trackingCount, EdgeInfo info )
{
@@ -1669,10 +1670,10 @@ public class DependencyManager<S, T> imp
* to the component this method has no effect and just returns
* <code>true</code>.
*
- * @param componentInstance
- * @param refPair A service reference corresponding to the service that
will be
- * @param trackingCount
- * @param info TODO
+ * @param componentInstance instance we are unbinding from
+ * @param refPair A service reference, service pair that will be unbound
+ * @param trackingCount service event count for this reference
+ * @param info EdgeInfo for the combination of this instance and this
dependency manager
*/
void invokeUnbindMethod( S componentInstance, final RefPair<T> refPair,
int trackingCount, EdgeInfo info )
{
@@ -1680,8 +1681,12 @@ public class DependencyManager<S, T> imp
// null. This is valid for both immediate and delayed components
if ( componentInstance != null )
{
- //TODO needs sync on getTracker().tracked()
- if (info.outOfRange( trackingCount ) )
+ boolean outOfRange;
+ synchronized ( m_tracker.tracked() )
+ {
+ outOfRange = info.outOfRange( trackingCount );
+ }
+ if ( outOfRange )
{
//wait for unbinds to complete
if (info.getCloseLatch() != null)
@@ -1906,8 +1911,19 @@ public class DependencyManager<S, T> imp
{
m_componentManager.log( LogService.LOG_ERROR, "Invalid syntax
in target property for dependency {0} to {1}", new Object[]
{getName(), target}, null );
- // TODO this is an error, how do we recover?
- return; //avoid an NPE
+
+ //create a filter that will never be satisfied
+ filterString = "(component.id=-1)";
+ try
+ {
+ m_targetFilter = bundleContext.createFilter( filterString
);
+ }
+ catch ( InvalidSyntaxException e )
+ {
+ //this should not happen
+ return;
+ }
+
}
}
else
Modified:
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
URL:
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java?rev=1523554&r1=1523553&r2=1523554&view=diff
==============================================================================
---
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
(original)
+++
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
Mon Sep 16 07:39:37 2013
@@ -529,8 +529,8 @@ public class ImmediateComponentManager<S
* @param configuration The configuration properties for the component from
* the Configuration Admin Service or
<code>null</code> if there is
* no configuration or if the configuration has just
been deleted.
- * @param changeCount TODO
- * @param targetedPID TODO
+ * @param changeCount Change count for the configuration
+ * @param targetedPID TargetedPID for the configuration
*/
public void reconfigure( Dictionary<String, Object> configuration, long
changeCount, TargetedPID targetedPID )
{