Multi inherited service interfaces - iPojo

View: New views
6 Messages — Rating Filter:   Alert me  

Multi inherited service interfaces - iPojo

by joels@navsys.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm having a problem where the service interface that I'm trying to use extends a second service interface. The extended interface methods are not available, I get a NoSuchMethodError even though the implementation does implement the underlying interface as well as the direct interface (it must, otherwise it wouldn't compile).

It seems that iPojo doesn't search down the inheritance tree for underlying interfaces. Is this true? Is this a bug?

The alternative is to have my implementation implement both interfaces independently. However, then my @Requires doesn't work as I need access to both interfaces and I can only specify one or the other in the type. Everything works fine if I specify the exact implementation type, but this defeats the purpose of using interfaces in the first place.

Thoughts?

________________________________

Joel Schuster
Senior Software Engineer
NAVSYS Corporation
14960 Woodcarver Road, Colorado Springs, CO 80921
719-481-4877




RE: Multi inherited service interfaces - iPojo

by joels@navsys.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It seems that a full clean of the felix-cache fixed the second of these issues... the first still stands.

- Joel

> -----Original Message-----
> From: Joel Schuster [mailto:joels@...]
> Sent: Thursday, November 05, 2009 12:01 PM
> To: 'users@...'
> Subject: Multi inherited service interfaces - iPojo
>
> I'm having a problem where the service interface that I'm trying to use
> extends a second service interface. The extended interface methods are not
> available, I get a NoSuchMethodError even though the implementation does
> implement the underlying interface as well as the direct interface (it
> must, otherwise it wouldn't compile).
>
> It seems that iPojo doesn't search down the inheritance tree for
> underlying interfaces. Is this true? Is this a bug?
>
> The alternative is to have my implementation implement both interfaces
> independently. However, then my @Requires doesn't work as I need access to
> both interfaces and I can only specify one or the other in the type.
> Everything works fine if I specify the exact implementation type, but this
> defeats the purpose of using interfaces in the first place.
>
> Thoughts?
>
> ________________________________
>
> Joel Schuster
> Senior Software Engineer
> NAVSYS Corporation
> 14960 Woodcarver Road, Colorado Springs, CO 80921
> 719-481-4877
>
>


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


Re: Multi inherited service interfaces - iPojo

by clement escoffier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Normally, iPOJO analyses all the implemented interfaces (parent  
interfaces too) and publishes them. Then, (when required) iPOJO  
creates the service object and returns it. So if the pojo class  
contains the methods, they should be available.

Can you give me a little bit more information ?

Regards,

Clement

On 05.11.2009, at 20:11, Joel Schuster wrote:

> It seems that a full clean of the felix-cache fixed the second of  
> these issues... the first still stands.
>
> - Joel
>
>> -----Original Message-----
>> From: Joel Schuster [mailto:joels@...]
>> Sent: Thursday, November 05, 2009 12:01 PM
>> To: 'users@...'
>> Subject: Multi inherited service interfaces - iPojo
>>
>> I'm having a problem where the service interface that I'm trying to  
>> use
>> extends a second service interface. The extended interface methods  
>> are not
>> available, I get a NoSuchMethodError even though the implementation  
>> does
>> implement the underlying interface as well as the direct interface  
>> (it
>> must, otherwise it wouldn't compile).
>>
>> It seems that iPojo doesn't search down the inheritance tree for
>> underlying interfaces. Is this true? Is this a bug?
>>
>> The alternative is to have my implementation implement both  
>> interfaces
>> independently. However, then my @Requires doesn't work as I need  
>> access to
>> both interfaces and I can only specify one or the other in the type.
>> Everything works fine if I specify the exact implementation type,  
>> but this
>> defeats the purpose of using interfaces in the first place.
>>
>> Thoughts?
>>
>> ________________________________
>>
>> Joel Schuster
>> Senior Software Engineer
>> NAVSYS Corporation
>> 14960 Woodcarver Road, Colorado Springs, CO 80921
>> 719-481-4877
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>


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


RE: Multi inherited service interfaces - iPojo

by joels@navsys.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sure! Thanks for asking... the following pseudocode should give you the details you need.

// bundle A

interface iA {
        String methOne();
}

// bundle B

interface iB extends iA {
        String methTwo();
}

// bundle C

@Provides
@Component
class C implements iB {
        String methOne() { return "one";}
        String methTwo() { return "two";}
}

// bundle D

@Component
class D {
        @Requires
        private iB[] cImpls;
        private iB cImplDesired;

        // works if I use following instead and cast to C type below
        // in for loop
        // but this creates dependency on bundle C instead of just
        // the interface bundles A & B
        // @Requires(default-implementation=C)
        // private iB[] cImpls;
        // private C cImplDesired;

        @Validate
        start() {
                for( iB iimpl : cImpls) {

                        // works just fine
                        logger.log( iimpl.methTwo());

                        // following produces
                        // invalid D instance with NoMethodFoundError
                        // unless I cast to C instead of iA
                        if( ((iA) iimpl).methOne().equals( "one")) {
                                cImplDesired = iimpl;
                        }
                }
        }
}


> -----Original Message-----
> From: Clement Escoffier [mailto:clement.escoffier@...]
> Sent: Thursday, November 05, 2009 3:10 PM
> To: users@...
> Subject: Re: Multi inherited service interfaces - iPojo
>
> Hi,
>
> Normally, iPOJO analyses all the implemented interfaces (parent
> interfaces too) and publishes them. Then, (when required) iPOJO
> creates the service object and returns it. So if the pojo class
> contains the methods, they should be available.
>
> Can you give me a little bit more information ?
>
> Regards,
>
> Clement
>
> On 05.11.2009, at 20:11, Joel Schuster wrote:
>
> > It seems that a full clean of the felix-cache fixed the second of
> > these issues... the first still stands.
> >
> > - Joel
> >
> >> -----Original Message-----
> >> From: Joel Schuster [mailto:joels@...]
> >> Sent: Thursday, November 05, 2009 12:01 PM
> >> To: 'users@...'
> >> Subject: Multi inherited service interfaces - iPojo
> >>
> >> I'm having a problem where the service interface that I'm trying to
> >> use
> >> extends a second service interface. The extended interface methods
> >> are not
> >> available, I get a NoSuchMethodError even though the implementation
> >> does
> >> implement the underlying interface as well as the direct interface
> >> (it
> >> must, otherwise it wouldn't compile).
> >>
> >> It seems that iPojo doesn't search down the inheritance tree for
> >> underlying interfaces. Is this true? Is this a bug?
> >>
> >> The alternative is to have my implementation implement both
> >> interfaces
> >> independently. However, then my @Requires doesn't work as I need
> >> access to
> >> both interfaces and I can only specify one or the other in the type.
> >> Everything works fine if I specify the exact implementation type,
> >> but this
> >> defeats the purpose of using interfaces in the first place.
> >>
> >> Thoughts?
> >>
> >> ________________________________
> >>
> >> Joel Schuster
> >> Senior Software Engineer
> >> NAVSYS Corporation
> >> 14960 Woodcarver Road, Colorado Springs, CO 80921
> >> 719-481-4877
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@...
> > For additional commands, e-mail: users-help@...
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...


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


Re: Multi inherited service interfaces - iPojo

by clement escoffier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I reproduce your case and didn't have the issue:
http://svn.apache.org/repos/asf/felix/trunk/ipojo/tests/core/service-providing-inheritance/

The only difference might be the import/export package.
A exports the package containing IA
B exports the package containing IB and imports the package containing  
IA
C imports the package containing IA and the package containing IB  
(respectively from A and B)
D imports the package containing IA and the package containing IB  
(respectively from A and B)

Could you check the configuration that I wrote and tell me if I miss  
something ?
http://svn.apache.org/repos/asf/felix/trunk/ipojo/tests/core/service-providing-inheritance/src/test/java/org/apache/felix/ipojo/tests/inheritance/InheritanceTest.java

Thanks and Regards,

Clement



On 05.11.2009, at 23:29, Joel Schuster wrote:

> Sure! Thanks for asking... the following pseudocode should give you  
> the details you need.
>
> // bundle A
>
> interface iA {
> String methOne();
> }
>
> // bundle B
>
> interface iB extends iA {
> String methTwo();
> }
>
> // bundle C
>
> @Provides
> @Component
> class C implements iB {
> String methOne() { return "one";}
> String methTwo() { return "two";}
> }
>
> // bundle D
>
> @Component
> class D {
> @Requires
> private iB[] cImpls;
> private iB cImplDesired;
>
> // works if I use following instead and cast to C type below
> // in for loop
> // but this creates dependency on bundle C instead of just
> // the interface bundles A & B
> // @Requires(default-implementation=C)
> // private iB[] cImpls;
> // private C cImplDesired;
>
> @Validate
> start() {
> for( iB iimpl : cImpls) {
>
> // works just fine
> logger.log( iimpl.methTwo());
>
> // following produces
> // invalid D instance with NoMethodFoundError
> // unless I cast to C instead of iA
> if( ((iA) iimpl).methOne().equals( "one")) {
> cImplDesired = iimpl;
> }
> }
> }
> }
>
>
>> -----Original Message-----
>> From: Clement Escoffier [mailto:clement.escoffier@...]
>> Sent: Thursday, November 05, 2009 3:10 PM
>> To: users@...
>> Subject: Re: Multi inherited service interfaces - iPojo
>>
>> Hi,
>>
>> Normally, iPOJO analyses all the implemented interfaces (parent
>> interfaces too) and publishes them. Then, (when required) iPOJO
>> creates the service object and returns it. So if the pojo class
>> contains the methods, they should be available.
>>
>> Can you give me a little bit more information ?
>>
>> Regards,
>>
>> Clement
>>
>> On 05.11.2009, at 20:11, Joel Schuster wrote:
>>
>>> It seems that a full clean of the felix-cache fixed the second of
>>> these issues... the first still stands.
>>>
>>> - Joel
>>>
>>>> -----Original Message-----
>>>> From: Joel Schuster [mailto:joels@...]
>>>> Sent: Thursday, November 05, 2009 12:01 PM
>>>> To: 'users@...'
>>>> Subject: Multi inherited service interfaces - iPojo
>>>>
>>>> I'm having a problem where the service interface that I'm trying to
>>>> use
>>>> extends a second service interface. The extended interface methods
>>>> are not
>>>> available, I get a NoSuchMethodError even though the implementation
>>>> does
>>>> implement the underlying interface as well as the direct interface
>>>> (it
>>>> must, otherwise it wouldn't compile).
>>>>
>>>> It seems that iPojo doesn't search down the inheritance tree for
>>>> underlying interfaces. Is this true? Is this a bug?
>>>>
>>>> The alternative is to have my implementation implement both
>>>> interfaces
>>>> independently. However, then my @Requires doesn't work as I need
>>>> access to
>>>> both interfaces and I can only specify one or the other in the  
>>>> type.
>>>> Everything works fine if I specify the exact implementation type,
>>>> but this
>>>> defeats the purpose of using interfaces in the first place.
>>>>
>>>> Thoughts?
>>>>
>>>> ________________________________
>>>>
>>>> Joel Schuster
>>>> Senior Software Engineer
>>>> NAVSYS Corporation
>>>> 14960 Woodcarver Road, Colorado Springs, CO 80921
>>>> 719-481-4877
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>


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


RE: Multi inherited service interfaces - iPojo

by joels@navsys.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'll take a look. Thanks!

> -----Original Message-----
> From: Clement Escoffier [mailto:clement.escoffier@...]
> Sent: Saturday, November 07, 2009 3:11 AM
> To: users@...
> Subject: Re: Multi inherited service interfaces - iPojo
>
> Hi,
>
> I reproduce your case and didn't have the issue:
> http://svn.apache.org/repos/asf/felix/trunk/ipojo/tests/core/service-
> providing-inheritance/
>
> The only difference might be the import/export package.
> A exports the package containing IA
> B exports the package containing IB and imports the package containing
> IA
> C imports the package containing IA and the package containing IB
> (respectively from A and B)
> D imports the package containing IA and the package containing IB
> (respectively from A and B)
>
> Could you check the configuration that I wrote and tell me if I miss
> something ?
> http://svn.apache.org/repos/asf/felix/trunk/ipojo/tests/core/service-
> providing-
> inheritance/src/test/java/org/apache/felix/ipojo/tests/inheritance/Inherit
> anceTest.java
>
> Thanks and Regards,
>
> Clement
>
>
>
> On 05.11.2009, at 23:29, Joel Schuster wrote:
>
> > Sure! Thanks for asking... the following pseudocode should give you
> > the details you need.
> >
> > // bundle A
> >
> > interface iA {
> > String methOne();
> > }
> >
> > // bundle B
> >
> > interface iB extends iA {
> > String methTwo();
> > }
> >
> > // bundle C
> >
> > @Provides
> > @Component
> > class C implements iB {
> > String methOne() { return "one";}
> > String methTwo() { return "two";}
> > }
> >
> > // bundle D
> >
> > @Component
> > class D {
> > @Requires
> > private iB[] cImpls;
> > private iB cImplDesired;
> >
> > // works if I use following instead and cast to C type below
> > // in for loop
> > // but this creates dependency on bundle C instead of just
> > // the interface bundles A & B
> > // @Requires(default-implementation=C)
> > // private iB[] cImpls;
> > // private C cImplDesired;
> >
> > @Validate
> > start() {
> > for( iB iimpl : cImpls) {
> >
> > // works just fine
> > logger.log( iimpl.methTwo());
> >
> > // following produces
> > // invalid D instance with NoMethodFoundError
> > // unless I cast to C instead of iA
> > if( ((iA) iimpl).methOne().equals( "one")) {
> > cImplDesired = iimpl;
> > }
> > }
> > }
> > }
> >
> >
> >> -----Original Message-----
> >> From: Clement Escoffier [mailto:clement.escoffier@...]
> >> Sent: Thursday, November 05, 2009 3:10 PM
> >> To: users@...
> >> Subject: Re: Multi inherited service interfaces - iPojo
> >>
> >> Hi,
> >>
> >> Normally, iPOJO analyses all the implemented interfaces (parent
> >> interfaces too) and publishes them. Then, (when required) iPOJO
> >> creates the service object and returns it. So if the pojo class
> >> contains the methods, they should be available.
> >>
> >> Can you give me a little bit more information ?
> >>
> >> Regards,
> >>
> >> Clement
> >>
> >> On 05.11.2009, at 20:11, Joel Schuster wrote:
> >>
> >>> It seems that a full clean of the felix-cache fixed the second of
> >>> these issues... the first still stands.
> >>>
> >>> - Joel
> >>>
> >>>> -----Original Message-----
> >>>> From: Joel Schuster [mailto:joels@...]
> >>>> Sent: Thursday, November 05, 2009 12:01 PM
> >>>> To: 'users@...'
> >>>> Subject: Multi inherited service interfaces - iPojo
> >>>>
> >>>> I'm having a problem where the service interface that I'm trying to
> >>>> use
> >>>> extends a second service interface. The extended interface methods
> >>>> are not
> >>>> available, I get a NoSuchMethodError even though the implementation
> >>>> does
> >>>> implement the underlying interface as well as the direct interface
> >>>> (it
> >>>> must, otherwise it wouldn't compile).
> >>>>
> >>>> It seems that iPojo doesn't search down the inheritance tree for
> >>>> underlying interfaces. Is this true? Is this a bug?
> >>>>
> >>>> The alternative is to have my implementation implement both
> >>>> interfaces
> >>>> independently. However, then my @Requires doesn't work as I need
> >>>> access to
> >>>> both interfaces and I can only specify one or the other in the
> >>>> type.
> >>>> Everything works fine if I specify the exact implementation type,
> >>>> but this
> >>>> defeats the purpose of using interfaces in the first place.
> >>>>
> >>>> Thoughts?
> >>>>
> >>>> ________________________________
> >>>>
> >>>> Joel Schuster
> >>>> Senior Software Engineer
> >>>> NAVSYS Corporation
> >>>> 14960 Woodcarver Road, Colorado Springs, CO 80921
> >>>> 719-481-4877
> >>>>
> >>>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@...
> >>> For additional commands, e-mail: users-help@...
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@...
> >> For additional commands, e-mail: users-help@...
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@...
> > For additional commands, e-mail: users-help@...
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...


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