org.apache.felix.ipojo.composite.util

## Class SourceManager

- java.lang.Object
- - org.apache.felix.ipojo.composite.util.SourceManager

All Implemented Interfaces:
  ContextListener

    public class SourceManager
    extends java.lang.Object
    implements ContextListener

This class manages context-source management.

Author:
  Felix Project Team

### Field Summary

Fields
`static java.lang.String` `SOURCE_NAME` Source Name service property.

### Constructor Summary

Constructors
Constructor and Description
`SourceManager(java.lang.String sources, java.lang.String depfilter, DependencyModel dependency, CompositeManager manager)` Constructor.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`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(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,
                         DependencyModel dependency,
                         CompositeManager manager)
                  throws ConfigurationException

Constructor.

Parameters:
  `sources` - : context-source attribute from the dependency metadata
  `depfilter` - : original dependency filter
  `dependency` - : dependency object
  `manager` - : composite manager
Throws:
  `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(ContextSource source,
                       java.lang.String property,
                       java.lang.Object value)

A context source has modified a monitored property.

Specified by:
  `update` in interface `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)`