org.apache.felix.ipojo.composite.util
Class SourceManager

java.lang.Object
  extended by org.apache.felix.ipojo.composite.util.SourceManager
All Implemented Interfaces:
org.apache.felix.ipojo.ContextListener

public class SourceManager
extends java.lang.Object
implements org.apache.felix.ipojo.ContextListener

This class manages context-source management.

Author:
Felix Project Team

Field Summary
static java.lang.String SOURCE_NAME
          Source Name service property.
 
Constructor Summary
SourceManager(java.lang.String sources, java.lang.String depfilter, org.apache.felix.ipojo.util.DependencyModel dependency, CompositeManager manager)
          Constructor.
 
Method Summary
static java.lang.String[] getProperties(java.lang.String str)
          Compute the properties (${name}) from the given filter.
 int getState()
          Get the state of this source manager.
 void start()
          Start the context management.
 void stop()
          Stop the context management.
static java.lang.String substitute(java.lang.String str, java.util.Dictionary values)
          This method substitute ${var} substring by values stored in a map.
 void update(org.apache.felix.ipojo.ContextSource source, java.lang.String property, java.lang.Object value)
          A context source has modified a monitored property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCE_NAME

public static final java.lang.String SOURCE_NAME
Source Name service property.

See Also:
Constant Field Values
Constructor Detail

SourceManager

public SourceManager(java.lang.String sources,
                     java.lang.String depfilter,
                     org.apache.felix.ipojo.util.DependencyModel dependency,
                     CompositeManager manager)
              throws org.apache.felix.ipojo.ConfigurationException
Constructor.

Parameters:
sources - : context-source attribute from the dependency metadata
depfilter - : original dependency filter
dependency - : dependency object
manager - : composite manager
Throws:
org.apache.felix.ipojo.ConfigurationException - : the sources are incorrect.
Method Detail

start

public void start()
Start the context management.


stop

public void stop()
Stop the context management.


getState

public int getState()
Get the state of this source manager.

Returns:
the state of this source manager.

substitute

public static java.lang.String substitute(java.lang.String str,
                                          java.util.Dictionary values)
This method substitute ${var} substring by values stored in a map.

Parameters:
str - : string with variables
values - : dictionary containing the variable name and the value.
Returns:
resulted string

getProperties

public static java.lang.String[] getProperties(java.lang.String str)
Compute the properties (${name}) from the given filter.

Parameters:
str - : string form of the filter.
Returns:
the list of found properties.

update

public void update(org.apache.felix.ipojo.ContextSource source,
                   java.lang.String property,
                   java.lang.Object value)
A context source has modified a monitored property.

Specified by:
update in interface org.apache.felix.ipojo.ContextListener
Parameters:
source - : source
property - : modified property
value - : new value.
See Also:
ContextListener.update(org.apache.felix.ipojo.ContextSource, java.lang.String, java.lang.Object)