Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
<instance component="...FooProviderType1" name="myFooServiceProvider">
            <property name="foo" value="baz"/>
            <property name="intProps" value="2"/>
</instance>

Properties can be map of methods too. When a property receive a new value, this method is called with the new value in parameter. For example, when the foo property receive a new value (at instance creation or when the instance is reconfigured), the fooMethod is called. The fooMethod must have only one argument of the Foo type (String in the example).

Code Block
xml
xml

<component className="...FooProviderType1">
            <provides>
                        <property name="foo" method="fooMethod" value="Foo">
                        <property name="intProps" type="int" value="5">
            </provides>
</component>
Code Block

public class FooProviderType1 implements FooService {
	private String m_foo;
	public void foo() {
		System.out.println("foo  " + m_foo);
	}	void fooMethod(String newFoo) {
		m_foo = newFoo;
	} 

A property can declare both a field and a method. In this case, the field receive the value and then the method is called. 

Code Block

<component className="...FooProviderType1">
            <provides>
                        <property name="foo" method="fooMethod" field="m_foo" value="Foo">
                        <property name="intProps" type="int" value="5">
            </provides>
</component> 
Code Block

public class FooProviderType1 implements FooService {
	private String m_foo;
	public void foo() {
		System.out.println("foo  " + m_foo);
	}	void fooMethod(String newFoo) {
		System.out.println("Update foo : " + m_foo);
	}

Advanced features

Service Serving & Object Creation

...

The configuration handler has the possibility to propagate received properties to service publication. So, when the propagation is activated, all properties received by the configuration handler will be propagated to all published service. If some properties are mapped on methods, these methods are invoked with the new value in argument.

Instance reconfiguration

The handler supports instance reconfiguration. When an instance is dynamically reconfigured, if the new configuration updates property values, these value are take into account (both for field, and service publication). If some of these properties have methods, these methods are invoked with the new value in argument.