Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Declarative Services (DS) do not work as expected
icon9.gif  Declarative Services (DS) do not work as expected [message #512933] Mon, 08 February 2010 06:54 Go to next message
Bjoern Berg is currently offline Bjoern Berg
Messages: 41
Registered: November 2009
Location: Essen
Member
Hi,

I have a very interesting problem while using declarative services in an Eclipse application. I created two Interfaces IDataLoader and IListChangeListener; services implement these interfaces and are automatically bind / unbind to Lists of my own type of IList.

The problem is: Registering services implementig IDataLoader works without problems, but the services implementig IListChangeListener are not called or better the binding method is not called.

To make it more clear, here is the definition for a List binding IDataLoader and IListChangeListener:

modemlist.xml
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" enabled="true" immediate="true" name="de.genesys_e.modem.modemList">
   <implementation class="de.genesys_e.modem.impl.ModemListImpl"/>
   <service>
      <provide interface="de.genesys_e.datamodell.lists.IList"/>
   </service>
   <reference bind="addListener" cardinality="0..n" interface="de.genesys_e.datamodell.lists.IListChangeListener" name="IListChangeListener" policy="dynamic" unbind="removeListener"/>
   <reference bind="addLoader" cardinality="0..n" interface="de.genesys_e.datamodell.lists.IDataLoader" name="IDataLoader" policy="dynamic" unbind="removeLoader"/>
</scr:component>


The definition for services implementing IDataLoader or IListChangeListener look like this:

modemloader.xml
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="de.genesys_e.modem.registry.modemLoader">
   <implementation class="de.genesys_e.modem.registry.ModemRegistryLoader"/>
   <service>
      <provide interface="de.genesys_e.datamodell.lists.IDataLoader"/>
   </service>
</scr:component>


modemwriter.xml
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="de.genesys_e.modem.registry.modemWriter">
   <implementation class="de.genesys_e.modem.registry.ModemRegistryWriter"/>
   <service>
      <provide interface="de.genesys_e.datamodell.lists.IListChangeListener"/>
   </service>
</scr:component>


To see whats happening behind, I have activated tracing for DS and can see that the services implementing IChangeListener and IDataLoader are build and that the service knows where it has to bind / unbind the bundles, but the appropriate bind-method for IChangeListener is not called. The log looks like this:

DEBUG 49 ServiceComponentProp.bindReference(): component de.genesys_e.modem.modemList -> Reference[name = IListChangeListener, interface = de.genesys_e.datamodell.lists.IListChangeListener, policy = dynamic, cardinality = 0..n, target = null, bind = addListener, unbind = removeListener]
DEBUG 49 ServiceComponentProp.bindReference(): The service is not yet registered, but it is already instantiated
DEBUG 49 ServiceComponentProp.bindReference(): component de.genesys_e.modem.modemList -> Reference[name = IDataLoader, interface = de.genesys_e.datamodell.lists.IDataLoader, policy = dynamic, cardinality = 0..n, target = null, bind = addLoader, unbind = removeLoader]
DEBUG 49 ServiceComponentProp.bindReference(): The service is not yet registered, but it is already instantiated
DEBUG 49 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ServiceComponentProp.activat e(): name: de.genesys_e.modem.modemList
DEBUG 49 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ServiceComponentProp.activat e(): using bundle: null
DEBUG 49 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ServiceComponentProp.activat e(): instance: org.eclipse.equinox.internal.ds.impl.ComponentInstanceImpl@63a1ae
DEBUG 49 ServiceComponent.getMethod(): activate
[...]
DEBUG 49 ComponentStorage.parseXMLDeclaration(): loading bundleentry://16.fwk23103355/OSGI-INF/modemloader.xml
DEBUG 49 ComponentStorage.parseXMLDeclaration(): loading bundleentry://16.fwk23103355/OSGI-INF/protocolloader.xml
DEBUG 49 ComponentStorage.parseXMLDeclaration(): loading bundleentry://16.fwk23103355/OSGI-INF/modemwriter.xml
DEBUG 49 ComponentStorage.parseXMLDeclaration(): loading bundleentry://16.fwk23103355/OSGI-INF/protocolwriter.xml
INFO 49 [DS perf] The components of bundle de.genesys_e.modem.registry_1.0.1.qualifier [16] are parsed for 15 ms
DEBUG 49 WorkThread.run(): object to process [QueuedJob] WorkPerformer: org.eclipse.equinox.internal.ds.SCRManager@1751a9e; actionType 1
DEBUG 49 [SCR] WorkThread.run(): Timer service is not available! Skipping timeout check
DEBUG 49 Resolver.enableComponents(): [Component[
name = de.genesys_e.modem.registry.modemLoader
activate = activate
deactivate = deactivate
modified =
configuration-policy = optional
factory = null
autoenable = true
immediate = true
implementation = de.genesys_e.modem.registry.ModemRegistryLoader
properties = null
serviceFactory = false
serviceInterface = [de.genesys_e.datamodell.lists.IDataLoader]
references = null
located in bundle = de.genesys_e.modem.registry_1.0.1.qualifier [16]
], Component[
name = de.genesys_e.modem.registry.protocolLoader
activate = activate
deactivate = deactivate
modified =
configuration-policy = optional
factory = null
autoenable = true
immediate = true
implementation = de.genesys_e.modem.registry.ProtocolRegistryLoader
properties = null
serviceFactory = false
serviceInterface = [de.genesys_e.datamodell.lists.IDataLoader]
references = null
located in bundle = de.genesys_e.modem.registry_1.0.1.qualifier [16]
], Component[
name = de.genesys_e.modem.registry.modemWriter
activate = activate
deactivate = deactivate
modified =
configuration-policy = optional
factory = null
autoenable = true
immediate = true
implementation = de.genesys_e.modem.registry.ModemRegistryWriter
properties = null
serviceFactory = false
serviceInterface = [de.genesys_e.datamodell.lists.IListChangeListener]
references = null
located in bundle = de.genesys_e.modem.registry_1.0.1.qualifier [16]
], Component[
name = de.genesys_e.modem.registry.protocolWriter
activate = activate
deactivate = deactivate
modified =
configuration-policy = optional
factory = null
autoenable = true
immediate = true
implementation = de.genesys_e.modem.registry.ProtocolRegistryWriter
properties = null
serviceFactory = false
serviceInterface = [de.genesys_e.datamodell.lists.IListChangeListener]
references = null
located in bundle = de.genesys_e.modem.registry_1.0.1.qualifier [16]
]]
DEBUG 49 Resolver.map(): Creating SCP for component de.genesys_e.modem.registry.modemLoader
DEBUG 49 Resolver.map(): Creating SCP for component de.genesys_e.modem.registry.protocolLoader
DEBUG 49 Resolver.map(): Creating SCP for component de.genesys_e.modem.registry.modemWriter
DEBUG 49 Resolver.map(): Creating SCP for component de.genesys_e.modem.registry.protocolWriter
DEBUG 49 Resolver:resolveEligible(): resolved components = [org.eclipse.update.configurator.bundlegroup, de.genesys_e.modem.modemList, de.genesys_e.modem.hayesList, de.genesys_e.modem.registry.modemLoader, de.genesys_e.modem.registry.protocolLoader, de.genesys_e.modem.registry.modemWriter, de.genesys_e.modem.registry.protocolWriter]
INFO 49 [DS perf] Start building component de.genesys_e.modem.registry.modemLoader
DEBUG 49 InstanceProcess.buildComponents(): building immediate component de.genesys_e.modem.registry.modemLoader
DEBUG 49 InstanceProcess.buildComponent(): building component de.genesys_e.modem.registry.modemLoader
INFO 49 [DS perf] Start building instance of component de.genesys_e.modem.registry.modemLoader
[...]
INFO 49 [DS perf] Start building component de.genesys_e.modem.registry.modemWriter
DEBUG 49 InstanceProcess.buildComponents(): building immediate component de.genesys_e.modem.registry.modemWriter
DEBUG 49 InstanceProcess.buildComponent(): building component de.genesys_e.modem.registry.modemWriter
INFO 49 [DS perf] Start building instance of component de.genesys_e.modem.registry.modemWriter
DEBUG 49 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ServiceComponentProp.activat e(): name: de.genesys_e.modem.registry.modemWriter
DEBUG 49 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ServiceComponentProp.activat e(): using bundle: null
DEBUG 49 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ServiceComponentProp.activat e(): instance: org.eclipse.equinox.internal.ds.impl.ComponentInstanceImpl@18b3e62
DEBUG 49 ServiceComponent.getMethod(): activate
INFO 49 [DS perf] The instance of component de.genesys_e.modem.registry.modemWriter is built for 0ms
DEBUG 49 Resolver.getEligible(): processing service event org.osgi.framework.ServiceEvent[source={de.genesys_e.datamod ell.lists.IListChangeListener}={component.name=de.genesys_e. modem.registry.modemWriter, component.id=5, service.id=41}]
DEBUG 49 Service event type: REGISTERED
DEBUG 49 Resolver:resolveEligible(): resolved components = [org.eclipse.update.configurator.bundlegroup, de.genesys_e.modem.modemList, de.genesys_e.modem.hayesList, de.genesys_e.modem.registry.modemLoader, de.genesys_e.modem.registry.protocolLoader, de.genesys_e.modem.registry.modemWriter, de.genesys_e.modem.registry.protocolWriter]
DEBUG 49 Resolver.selectDynamicBind(): selected = [org.eclipse.equinox.internal.ds.Reference@ac97cc, org.eclipse.equinox.internal.ds.Reference@121f653]
DEBUG 49 ServiceComponentProp.bindReference(): component de.genesys_e.modem.modemList -> Reference[name = IListChangeListener, interface = de.genesys_e.datamodell.lists.IListChangeListener, policy = dynamic, cardinality = 0..n, target = null, bind = addListener, unbind = removeListener]
DEBUG 49 InstanceProcess.buildComponent(): building component de.genesys_e.modem.registry.modemWriter
INFO 49 [DS perf] Start building instance of component de.genesys_e.modem.registry.modemWriter
INFO 49 [DS perf] The instance of component de.genesys_e.modem.registry.modemWriter is built for 0ms
DEBUG 49 ServiceReg.getService(): service 'de.genesys_e.modem.registry.modemWriter' is used 1 time(s), object = de.genesys_e.modem.registry.ModemRegistryWriter@8497f6
DEBUG 49 InstanceProcess.registerService(): de.genesys_e.modem.registry.modemWriter registered as *service*
INFO 49 [DS perf] The component de.genesys_e.modem.registry.modemWriter is built for 0ms


Any idea, what's going wrong?
Re: Declarative Services (DS) do not work as expected [message #513116 is a reply to message #512933] Mon, 08 February 2010 17:32 Go to previous messageGo to next message
Phil Denis is currently offline Phil Denis
Messages: 26
Registered: October 2009
Junior Member
Try turning on the console with the commandline -console option. Then, find your bundle by typing status (or ss) and make note of the id assigned to your bundle.

Now enter the command:
ls -c <bundle id>

This will give you more information about the services your bundle has declared, whether their requirements are satisfied, and whether any instances have been created. If you post the results of those commands, I might be able to help you further ...

Note: I have recently solved a similar problem, but my service had references to other services and it turned out I was missing getter/setter methods in the implementation of my service. The framework told me all my constraints were satisfied and that my service was created, but my activate/deactivate methods were never called...

Phil
Re: Declarative Services (DS) do not work as expected [message #513120 is a reply to message #512933] Mon, 08 February 2010 17:51 Go to previous messageGo to next message
Phil Denis is currently offline Phil Denis
Messages: 26
Registered: October 2009
Junior Member
Sorry, I should say
*I was missing set/unset methods*
not getters/setters...
Re: Declarative Services (DS) do not work as expected [message #513163 is a reply to message #513116] Tue, 09 February 2010 02:24 Go to previous messageGo to next message
Bjoern Berg is currently offline Bjoern Berg
Messages: 41
Registered: November 2009
Location: Essen
Member
Phil,

thank you for your message. I have started the console, typing "status" I get the following (shortened):

9	reference:file:/D:/gasbuild/Eclipse-RCP/de.genesys_e.datamodell/
  ACTIVE      de.genesys_e.datamodell_1.0.0.qualifier
15	reference:file:/D:/gasbuild/Eclipse-RCP/de.genesys_e.modem/
  ACTIVE      de.genesys_e.modem_1.0.0
16	reference:file:/D:/gasbuild/Eclipse-RCP/de.genesys_e.modem.registry/
  <<LAZY>>    de.genesys_e.modem.registry_1.0.1.qualifier
17	reference:file:/D:/gasbuild/Eclipse-RCP/de.genesys_e.modem.ui/
  ACTIVE      de.genesys_e.modem.ui_0.9.0
[...]
{de.genesys_e.datamodell.lists.IList}={component.name=de.genesys_e.modem.modemList, component.id=1, service.id=37}
{de.genesys_e.datamodell.lists.IList}={component.name=de.genesys_e.modem.hayesList, component.id=2, service.id=38}
{de.genesys_e.datamodell.lists.IDataLoader}={component.name=de.genesys_e.modem.registry.modemLoader, component.id=3, service.id=39}
{de.genesys_e.datamodell.lists.IDataLoader}={component.name=de.genesys_e.modem.registry.protocolLoader, component.id=4, service.id=40}
{de.genesys_e.datamodell.lists.IListChangeListener}={component.name=de.genesys_e.modem.registry.modemWriter, component.id=5, service.id=41}
{de.genesys_e.datamodell.lists.IListChangeListener}={component.name=de.genesys_e.modem.registry.protocolWriter, component.id=6, service.id=42}



And ls commands say the follwoing:
osgi> ls -c 15
Components in bundle de.genesys_e.modem: 
ID	Component details
1	Component[
	name = de.genesys_e.modem.modemList
	activate = activate
	deactivate = deactivate
	modified = 
	configuration-policy = optional
	factory = null
	autoenable = true
	immediate = false
	implementation = de.genesys_e.modem.impl.ModemListImpl
	properties = null
	serviceFactory = false
	serviceInterface = [de.genesys_e.datamodell.lists.IList]
	references = {
		Reference[name = IListChangeListener, interface = de.genesys_e.datamodell.lists.IListChangeListener, policy = dynamic, cardinality = 0..n, target = null, bind = addChangeListener, unbind = removeChangeListener]
		Reference[name = IDataLoader, interface = de.genesys_e.datamodell.lists.IDataLoader, policy = dynamic, cardinality = 0..n, target = null, bind = addLoader, unbind = removeLoader]
	}
	located in bundle = de.genesys_e.modem_1.0.0 [15]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
    Configuration properties:
      component.name = de.genesys_e.modem.modemList
      component.id = 1
      objectClass = Object[de.genesys_e.datamodell.lists.IList]
    Instances:

2	Component[
	name = de.genesys_e.modem.hayesList
	activate = activate
	deactivate = deactivate
	modified = 
	configuration-policy = optional
	factory = null
	autoenable = true
	immediate = false
	implementation = de.genesys_e.modem.impl.HayesProtocolListImpl
	properties = null
	serviceFactory = false
	serviceInterface = [de.genesys_e.datamodell.lists.IList]
	references = {
		Reference[name = IListChangeListener, interface = de.genesys_e.datamodell.lists.IListChangeListener, policy = dynamic, cardinality = 0..n, target = null, bind = addChangeListener, unbind = removeChangeListener]
		Reference[name = IDataLoader, interface = de.genesys_e.datamodell.lists.IDataLoader, policy = dynamic, cardinality = 0..n, target = null, bind = addLoader, unbind = removeLoader]
	}
	located in bundle = de.genesys_e.modem_1.0.0 [15]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
    Configuration properties:
      component.name = de.genesys_e.modem.hayesList
      component.id = 2
      objectClass = Object[de.genesys_e.datamodell.lists.IList]
    Instances:


osgi> ls -c 16
Components in bundle de.genesys_e.modem.registry: 
ID	Component details
3	Component[
	name = de.genesys_e.modem.registry.modemLoader
	activate = activate
	deactivate = deactivate
	modified = 
	configuration-policy = optional
	factory = null
	autoenable = true
	immediate = false
	implementation = de.genesys_e.modem.registry.ModemRegistryLoader
	properties = null
	serviceFactory = false
	serviceInterface = [de.genesys_e.datamodell.lists.IDataLoader]
	references = null
	located in bundle = de.genesys_e.modem.registry_1.0.1.qualifier [16]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
    Configuration properties:
      component.name = de.genesys_e.modem.registry.modemLoader
      component.id = 3
      objectClass = Object[de.genesys_e.datamodell.lists.IDataLoader]
    Instances:

4	Component[
	name = de.genesys_e.modem.registry.protocolLoader
	activate = activate
	deactivate = deactivate
	modified = 
	configuration-policy = optional
	factory = null
	autoenable = true
	immediate = false
	implementation = de.genesys_e.modem.registry.ProtocolRegistryLoader
	properties = null
	serviceFactory = false
	serviceInterface = [de.genesys_e.datamodell.lists.IDataLoader]
	references = null
	located in bundle = de.genesys_e.modem.registry_1.0.1.qualifier [16]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
    Configuration properties:
      component.name = de.genesys_e.modem.registry.protocolLoader
      component.id = 4
      objectClass = Object[de.genesys_e.datamodell.lists.IDataLoader]
    Instances:

5	Component[
	name = de.genesys_e.modem.registry.modemWriter
	activate = activate
	deactivate = deactivate
	modified = 
	configuration-policy = optional
	factory = null
	autoenable = true
	immediate = false
	implementation = de.genesys_e.modem.registry.ModemRegistryWriter
	properties = null
	serviceFactory = false
	serviceInterface = [de.genesys_e.datamodell.lists.IListChangeListener]
	references = null
	located in bundle = de.genesys_e.modem.registry_1.0.1.qualifier [16]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
    Configuration properties:
      component.name = de.genesys_e.modem.registry.modemWriter
      component.id = 5
      objectClass = Object[de.genesys_e.datamodell.lists.IListChangeListener]
    Instances:

6	Component[
	name = de.genesys_e.modem.registry.protocolWriter
	activate = activate
	deactivate = deactivate
	modified = 
	configuration-policy = optional
	factory = null
	autoenable = true
	immediate = false
	implementation = de.genesys_e.modem.registry.ProtocolRegistryWriter
	properties = null
	serviceFactory = false
	serviceInterface = [de.genesys_e.datamodell.lists.IListChangeListener]
	references = null
	located in bundle = de.genesys_e.modem.registry_1.0.1.qualifier [16]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
    Configuration properties:
      component.name = de.genesys_e.modem.registry.protocolWriter
      component.id = 6
      objectClass = Object[de.genesys_e.datamodell.lists.IListChangeListener]
    Instances:


For me everything looks pretty good. Do you have an idea?

Bjoern
Re: Declarative Services (DS) do not work as expected [message #513169 is a reply to message #513163] Tue, 09 February 2010 02:55 Go to previous messageGo to next message
Bjoern Berg is currently offline Bjoern Berg
Messages: 41
Registered: November 2009
Location: Essen
Member
In my last posting there was an error: In the meanwhile I had done some trial and error with the options for loading the service and I removed "immediate=true". With the flag set, status and ls -c look like following:

15	reference:file:/D:/gasbuild/Eclipse-RCP/de.genesys_e.modem/
  ACTIVE      de.genesys_e.modem_1.0.0
16	reference:file:/D:/gasbuild/Eclipse-RCP/de.genesys_e.modem.registry/
  ACTIVE      de.genesys_e.modem.registry_1.0.1.qualifier
[...]
{de.genesys_e.datamodell.lists.IList}={component.name=de.genesys_e.modem.modemList, component.id=1, service.id=37}
{de.genesys_e.datamodell.lists.IList}={component.name=de.genesys_e.modem.hayesList, component.id=2, service.id=38}
{de.genesys_e.datamodell.lists.IDataLoader}={component.name=de.genesys_e.modem.registry.modemLoader, component.id=3, service.id=39}
{org.eclipse.equinox.internal.util.threadpool.ThreadPoolManager, org.eclipse.equinox.internal.util.threadpool.ThreadPoolFactory}={service.id=40}
{de.genesys_e.datamodell.lists.IDataLoader}={component.name=de.genesys_e.modem.registry.protocolLoader, component.id=4, service.id=41}
{de.genesys_e.datamodell.lists.IListChangeListener}={component.name=de.genesys_e.modem.registry.modemWriter, component.id=5, service.id=42}
{de.genesys_e.datamodell.lists.IListChangeListener}={component.name=de.genesys_e.modem.registry.protocolWriter, component.id=6, service.id=43}


osgi> ls -c 16
Components in bundle de.genesys_e.modem.registry: 
ID	Component details
3	Component[
	name = de.genesys_e.modem.registry.modemLoader
	activate = activate
	deactivate = deactivate
	modified = 
	configuration-policy = optional
	factory = null
	autoenable = true
	immediate = true
	implementation = de.genesys_e.modem.registry.ModemRegistryLoader
	properties = null
	serviceFactory = false
	serviceInterface = [de.genesys_e.datamodell.lists.IDataLoader]
	references = null
	located in bundle = de.genesys_e.modem.registry_1.0.1.qualifier [16]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
    Configuration properties:
      component.name = de.genesys_e.modem.registry.modemLoader
      component.id = 3
      objectClass = Object[de.genesys_e.datamodell.lists.IDataLoader]
    Instances:
      org.eclipse.equinox.internal.ds.impl.ComponentInstanceImpl@6c2a78

4	Component[
	name = de.genesys_e.modem.registry.protocolLoader
	activate = activate
	deactivate = deactivate
	modified = 
	configuration-policy = optional
	factory = null
	autoenable = true
	immediate = true
	implementation = de.genesys_e.modem.registry.ProtocolRegistryLoader
	properties = null
	serviceFactory = false
	serviceInterface = [de.genesys_e.datamodell.lists.IDataLoader]
	references = null
	located in bundle = de.genesys_e.modem.registry_1.0.1.qualifier [16]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
    Configuration properties:
      component.name = de.genesys_e.modem.registry.protocolLoader
      component.id = 4
      objectClass = Object[de.genesys_e.datamodell.lists.IDataLoader]
    Instances:
      org.eclipse.equinox.internal.ds.impl.ComponentInstanceImpl@15863e4

5	Component[
	name = de.genesys_e.modem.registry.modemWriter
	activate = activate
	deactivate = deactivate
	modified = 
	configuration-policy = optional
	factory = null
	autoenable = true
	immediate = true
	implementation = de.genesys_e.modem.registry.ModemRegistryWriter
	properties = null
	serviceFactory = false
	serviceInterface = [de.genesys_e.datamodell.lists.IListChangeListener]
	references = null
	located in bundle = de.genesys_e.modem.registry_1.0.1.qualifier [16]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
    Configuration properties:
      component.name = de.genesys_e.modem.registry.modemWriter
      component.id = 5
      objectClass = Object[de.genesys_e.datamodell.lists.IListChangeListener]
    Instances:
      org.eclipse.equinox.internal.ds.impl.ComponentInstanceImpl@6270b

6	Component[
	name = de.genesys_e.modem.registry.protocolWriter
	activate = activate
	deactivate = deactivate
	modified = 
	configuration-policy = optional
	factory = null
	autoenable = true
	immediate = true
	implementation = de.genesys_e.modem.registry.ProtocolRegistryWriter
	properties = null
	serviceFactory = false
	serviceInterface = [de.genesys_e.datamodell.lists.IListChangeListener]
	references = null
	located in bundle = de.genesys_e.modem.registry_1.0.1.qualifier [16]
]
Dynamic information :
  The component is satisfied
  All component references are satisfied
  Component configurations :
    Configuration properties:
      component.name = de.genesys_e.modem.registry.protocolWriter
      component.id = 6
      objectClass = Object[de.genesys_e.datamodell.lists.IListChangeListener]
    Instances:
      org.eclipse.equinox.internal.ds.impl.ComponentInstanceImpl@1ed54a0


Could it be a sync problem? As far as I know the services are build in not sequentiell way. When I debugged a session I have seen that only modemLoader is registered with modemList and when hayesList is build it registers modemLoader and protocolLoader with hayesList.
Re: Declarative Services (DS) do not work as expected [message #513382 is a reply to message #512933] Tue, 09 February 2010 17:23 Go to previous messageGo to next message
Bruce Kelly is currently offline Bruce Kelly
Messages: 63
Registered: July 2009
Member
"Bjoern Berg" <rollin.hand@gmx.de> wrote in message
news:hkou11$n7h$1@build.eclipse.org...
> Hi,
>
> I have a very interesting problem while using declarative services in an
> Eclipse application. I created two Interfaces IDataLoader and
> IListChangeListener; services implement these interfaces and are
> automatically bind / unbind to Lists of my own type of IList.
>
> The problem is: Registering services implementig IDataLoader works without
> problems, but the services implementig IListChangeListener are not called
> or better the binding method is not called.
>

Have you checked the signature of the addListener method on the
de.genesys_e.modem.impl.ModemListImpl class?

We have had problems where the bind method specified the wrong Type for the
parameter. In this situation DS doesn't say anything. It would be nice if it
reported that it couldn't find the specified method.

Namaste, Bruce
Re: Declarative Services (DS) do not work as expected [message #513434 is a reply to message #513382] Wed, 10 February 2010 03:37 Go to previous messageGo to next message
Bjoern Berg is currently offline Bjoern Berg
Messages: 41
Registered: November 2009
Location: Essen
Member
Bruce,

checking the signature of the bind-/unbind-methods was the first thing I did before I posted, because I also had this problem before. The methods look like this (shortened):

public void addChangeListener(IListChangeListener listener) {}
public void removeChangeListener(IListChangeListener listener) {}


I can't see a problem with it. I think the problem lies somewhat deeper, because modemList registers only one Loader therefore hayesList registers two Loaders although the binding methods are the same and the Lists also implement the same interface (and both don't register any ChangeListener).

This circumstance is very confusing to me.

Is there a tool which helps to analyze what's going on in the background?
icon10.gif  Re: Declarative Services (DS) do not work as expected [message #513575 is a reply to message #513434] Wed, 10 February 2010 10:44 Go to previous message
Bjoern Berg is currently offline Bjoern Berg
Messages: 41
Registered: November 2009
Location: Essen
Member
I found the problem. I have forgotten to implement the methods activate and deactivate in the different bundles. So the DS-Service could not register the bundles correctly.
I don't know why it worked temporarily or in some cases but now with the two former missing methods everything is fine...

Shame on me...
Previous Topic:how to install my RCP app as a bundle in equinox?
Next Topic:obtaining a reference to EventAdmin too complex
Goto Forum:
  


Current Time: Tue Sep 02 00:23:28 EDT 2014

Powered by FUDForum. Page generated in 0.02081 seconds