You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by fabiolf <fa...@gmail.com> on 2012/06/18 00:57:37 UTC

Problem with 'subservice action="instantiate"' in ipojo composite from trunk

Hello!

I was trying to use the subservice instantiate action using the
ipojo-composite jar from the trunk. I was having problems with my
composites. So I tried to test the composite-tutorial example, found in the
ipojo site.

When I run the example 5 of the tutorial with the preconfigured version of
felix that comes with it, everything was ok. But, when I installed and
started the same example 5 bundles using newer versions of the OSGI
framework (4.0.2) and ipojo-composite bundles (from the trunk), it didn't
work. It seems that iPOJO cannot find the spell.services.DictionaryService
service, required by the instance to be valid, as you can see in the lines
below:

-> arch -instance composition5-0
instance name="composition5-0" state="invalid" bundle="31"
component.type="composition5"
	handler name="org.apache.felix.ipojo:instance" state="invalid"
		instance factory="composition4" name="composition4-0" state="invalid"
		instance factory="my gui" name="my gui-0" state="invalid"
	handler name="org.apache.felix.ipojo:architecture" state="valid"
	services
		service architecture.instance="my gui-0" factory.name="architecture"
instance.name="architecture-9"
objectclass="[org.apache.felix.ipojo.architecture.Architecture]"
service.id="22"
		service architecture.instance="composition4-0" factory.name="architecture"
instance.name="architecture-10"
objectclass="[org.apache.felix.ipojo.architecture.Architecture]"
service.id="23"
	containedinstances
		instance name="my gui-0" state="invalid" bundle="30" component.type="my
gui"
			handler name="org.apache.felix.ipojo:requires" state="invalid"
				requires specification="spell.services.SpellChecker"
id="spell.services.SpellChecker" optional="false" aggregate="false"
proxy="true" binding-policy="dynamic" state="unresolved"
			handler name="org.apache.felix.ipojo:callback" state="valid"
			handler name="org.apache.felix.ipojo:architecture" state="valid"
		instance name="composition4-0" state="invalid" bundle="31"
component.type="composition4"
			handler name="org.apache.felix.ipojo:instance" state="invalid"
				instance factory="spell.checker.SpellCheck"
name="spell.checker.SpellCheck-0" state="invalid"
			handler name="org.apache.felix.ipojo:provides" state="invalid"
				exports specification="spell.services.SpellChecker"
filter="(objectClass=spell.services.SpellChecker)" state="unresolved"
			handler name="org.apache.felix.ipojo:subservice" state="invalid"
				service specification="spell.services.DictionaryService"
state="unresolved"
			handler name="org.apache.felix.ipojo:architecture" state="valid"
			services
				service architecture.instance="spell.checker.SpellCheck-0"
factory.name="architecture" instance.name="architecture-11"
objectclass="[org.apache.felix.ipojo.architecture.Architecture]"
service.id="22"
			containedinstances
				instance name="spell.checker.SpellCheck-0" state="invalid" bundle="29"
component.type="spell.checker.SpellCheck"
					handler name="org.apache.felix.ipojo:requires" state="invalid"
						requires specification="spell.services.DictionaryService"
id="spell.services.DictionaryService" optional="false" aggregate="false"
proxy="true" binding-policy="dynamic" state="unresolved"
					handler name="org.apache.felix.ipojo:provides" state="valid"
						provides specifications="[spell.services.SpellChecker]"
state="unregistered"
							property name="factory.name" value="spell.checker.SpellCheck"
							property name="instance.name" value="spell.checker.SpellCheck-0"
					handler name="org.apache.felix.ipojo:architecture" state="valid"

It seems that something changed in the subservice instantiate action
implementation from version 1.6.0 to the trunk version. Can anybody help me
here? Has the metadata changed? Or is it an unexpected behavior?

Thanks,
Fabio



--
View this message in context: http://apache-felix.18485.n6.nabble.com/Problem-with-subservice-action-instantiate-in-ipojo-composite-from-trunk-tp4998162.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Problem with 'subservice action="instantiate"' in ipojo composite from trunk

Posted by clement escoffier <cl...@gmail.com>.
Hi,

It looks good. Unfortunately I'm moving from Germany to France right
now. I will commit your patch as soon as I'm settled (so around
Tuesday).

Could you open a Jira issue and attach your patch ?

Regards,

Clement

Sent from my iPhone

On 14.07.2012, at 23:20, fabiolf <fa...@gmail.com> wrote:

> Hello,
>
> I did some debugging here and found a weird thing in the
> ServiceDependencyHandler.java, at the createServiceInstance method. Look:
>
>        while(keys.hasMoreElements()) {
>            String key = (String) keys.nextElement();
>            System.out.println("key: " + key);
> *            if (! key.equals("instance.name")
>                    || key.equals("component")) { // Remove instance.name and
> component
> *                toAppend.put(key, conf.get(key));
>            }
>        }
>
> The comment says that it need to remove the instance.name and the component
> keys, but the code only removes the instance.name key. Also the or operator
> and the other key.equals part are useless. I think there are some
> parenthesis missing, like below:
>
>
>        while(keys.hasMoreElements()) {
>            String key = (String) keys.nextElement();
>            System.out.println("key: " + key);
> *            if (! (key.equals("instance.name")
>                    || key.equals("component"))) { // Remove instance.name and
> component
> *                toAppend.put(key, conf.get(key));
>            }
>        }
>
> Now, it removes both instance.name and component keys. In fact, this
> modification solves the issue of this post. Now the subservice instantiate
> is working! Can somebody please validate if my modification is right?
>
> Thanks,
> Fabio
>
> --
> View this message in context: http://apache-felix.18485.n6.nabble.com/Problem-with-subservice-action-instantiate-in-ipojo-composite-from-trunk-tp4998162p4998546.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Problem with 'subservice action="instantiate"' in ipojo composite from trunk

Posted by fabiolf <fa...@gmail.com>.
Hello,

I did some debugging here and found a weird thing in the
ServiceDependencyHandler.java, at the createServiceInstance method. Look:

        while(keys.hasMoreElements()) {
        	String key = (String) keys.nextElement();
            System.out.println("key: " + key);
*        	if (! key.equals("instance.name")
        			|| key.equals("component")) { // Remove instance.name and
component
*        		toAppend.put(key, conf.get(key));
        	}
        }

The comment says that it need to remove the instance.name and the component
keys, but the code only removes the instance.name key. Also the or operator
and the other key.equals part are useless. I think there are some
parenthesis missing, like below:


        while(keys.hasMoreElements()) {
        	String key = (String) keys.nextElement();
            System.out.println("key: " + key);
*        	if (! (key.equals("instance.name")
        			|| key.equals("component"))) { // Remove instance.name and
component
*        		toAppend.put(key, conf.get(key));
        	}
        }

Now, it removes both instance.name and component keys. In fact, this
modification solves the issue of this post. Now the subservice instantiate
is working! Can somebody please validate if my modification is right?

Thanks,
Fabio

--
View this message in context: http://apache-felix.18485.n6.nabble.com/Problem-with-subservice-action-instantiate-in-ipojo-composite-from-trunk-tp4998162p4998546.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Problem with 'subservice action="instantiate"' in ipojo composite from trunk

Posted by fabiolf <fa...@gmail.com>.
Hello!

Any news for this composite problem? I have just downloaded the last version
from the trunk and the behavior is the same. Does anyone have any
suggestion?

Thanks!
Fabio

--
View this message in context: http://apache-felix.18485.n6.nabble.com/Problem-with-subservice-action-instantiate-in-ipojo-composite-from-trunk-tp4998162p4998472.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org