Versions Compared

Key

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

...

Code Block
xml
xml
<instance component="my-type"/>
<instance component="my.Implementation"/>
<instance component="my-type" name="my-instance"/>
<instance component="my-type" name="my-instance">
    <property name="property1" value="value1"/>
</instance>
</component>
Center

  • Instances can contains a configuration given under the key-value form. Properties can also by complex type (refer to How-to use iPOJO factories)

...

Code Block
java
java
titleAnnotations
@Component
public class Implementation {
    
    @Validate
    public void start() {
        
    }
    
    @Invalidate
    public void stop() {
        
    }
}

Declaring properties

Code Block
xml
xml
titleXML

<component classname="my.Implementation" name="my-impl">
    <properties propagation="true" managedservice="MyPID">
        <property name="boo" method="setBoo" />
	<property field="m_bar" mandatory="true"/>
	<property field="m_foo" value="4"/>
    </properties>
</component>
<instance component="my-impl">
    <property name="boo" value="..."/>
    <property name="m_bar" value="..."/>
</instance>
<instance component="my-impl">
    <property name="boo" value="..."/>
    <property name="m_bar" value="..."/>
    <property name="managed.service.pid" value="AnotherPID"/>
</instance>
Code Block
java
java
titleAnnotations

@Component(managedservice="MyPID", propagation=true)
public class Implementation {
    
    @Property(name="boo")
    public void setBoo(int boo) {
        //...
    }
        
    @Property(mandatory=true)
    public int m_bar;

    @Property(value="4")
    public int m_foo;
}
Center

Using 'arch'

  • Deploy the 'arch' command bundle (available for Felix and Equinox)
  • Launch the 'arch' command in the OSGi Framework Shell
    Code Block
    
    arch => displays instances name & state (equivalent to arch \-instances)
    arch -instance $instance_name => displays complete information about the instance $instance_name
    arch -factories => display the list of available factories
    arch -factory $factory_name => display complete information about the factory $factory_name
    arch -handlers => list available handlers