Introspection and Architecture

The architecture feature allows obtaining an architectural / component view of your systems. It exposes a snapshot of the present instances & factories, the state of these instances... Moreover; iPOJO defines an 'arch' command displaying this architecture in Felix. You need to install the arch command.

Reflection on component instances

The architecture feature does "reflection" on the iPOJO containers. It gathers information about the component (state, class name ...), requirement (state, multiple, optional ...), provided services (state, properties) ... Each handler can participate to the architecture. This information allows you to know why an instance does not start, or why the component does not publish / provide a service.

Metadata

The architecture (i.e. instance introspection) is activated by default. To disable it, you need to add an attribute architecture="false" to the component element:

<component classname="org.apache.felix.ipojo.hello.impl.HelloServiceImpl" architecture="false">

By default, the architecture feature is enabled.

The "arch" command

The Gogo commands are the following:

For example:

$ instances
Instance ArchCommand -> valid
Instance spell.english.EnglishDictionary-0 -> valid
Instance spell.checker.SpellCheck-0 -> valid
Instance spell.gui.SpellCheckerGui-0 -> valid

$ instance spell.checker.SpellCheck-0                                    
instance component.type="spell.checker.SpellCheck" state="valid" bundle="8" name="spell.checker.SpellCheck-0"
    handler state="valid" name="org.apache.felix.ipojo.handlers.dependency.DependencyHandler"
        requires optional="false" aggregate="false" state="resolved" binding-policy="dynamic" specification="spell.services.DictionaryService"
    handler state="valid" name="org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler"
        provides service.id="36" state="registered" specifications="[spell.services.SpellChecker]"
            property value="spell.checker.SpellCheck" name="factory.name"
            property value="spell.checker.SpellCheck-0" name="instance.name"
    handler state="valid" name="org.apache.felix.ipojo.handlers.architecture.ArchitectureHandler"

More info on the arch command are available here.

Technical information

In fact, when a component enables the architecture introspection, its container exposes an Architecture service. Any architecture requester can obtain information about the instance. For example, the arch command requests all the architecture services and prints the information.