2008/11/17 Richard S. Hall <[EMAIL PROTECTED]>

> Brad Cox wrote:
>
>> Totally confused now; that seems to be saying the LogTransform factory
>> (service) produces instances of itself. Or was that a typo.
>>
>> I thought I understood before but maybe not. The pattern I'm following is
>> that each component X needs for classes:
>>
>>    XService (factory interface)
>>    XServiceImpl (factory implementation)
>>    X (instance interface)
>>    XImpl (instance implementation)
>>
>> And that manifest declares what kind of instance the factory creates. By
>> that understanding it would look what I have
>>
>> <ipojo>
>>    <component classname="com.gestalt.soakit.core.XService">
>>        <provides/>
>>    </component>
>>    <instance component="com.gestalt.soakit.core.X"/>
>> </ipojo>
>>
>> Might giving an interface where an impl is expected might cause that class
>> loader problem. Will try that.
>>
>
> I don't think so.
>
> Clearly, I don't really know what you are doing, so I may be off base.
>
> I believe I do know how the iPOJO descriptor works, but even then I could
> be wrong about that since I don't use it regularly, so Clement can correct
> me if I am wrong.
>
> From my recollection, in the iPOJO descriptor you define a component which
> has a concrete class (i.e., the Impl class). iPOJO automatically creates a
> factory service for that component from which it creates instances. The name
> of the factory, by default, is the name of the component impl class (you can
> specify a different name if you want). So, when you declare the <instance
> ...> tag you have to specify the name of the factory, which is the name of
> the component impl class in this case.
>
> If your component implements a service, you generally don't need to specify
> the service interface itself in the component descriptor, since iPOJO
> determines that automatically. You just need to specify the Impl class.


Hi,

Richard is correct. iPOJO does not impose any "pattern". So, a <component>
has a classname and can have a name attribute. The name is the factory name
(is not specified, the class name is used). The implementation class
(specified in the classname attribute) must implement interfaces if the
component has a <provides> element.

Then, when you declare an <instance>, you target (thanks to the 'component'
attribute) a factory (either by their 'name' or the 'className'). This will
create an instance with the factory (not an instance of the implementation
class). If the <component> has a <provides> element and the instance is
valid (service dependencies are fulfilled), the service is published. Then,
according to the building policy, an instance of the implementation class
can be created (immediate component, lifecycle callback ...). If you're
providing a service, by default, the creation of the instance of the
implementation class is delayed until a client uses the service.

Regards,

Clement






>
>
> -> richard
>
>
>>
>>
>> Richard S. Hall wrote:
>>
>>> Brad Cox wrote:
>>> I am a little confused, it seems there are lots of types involved here.
>>>
>>> In your activator you seem to be creating a LogTransformServiceImpl, but
>>> you are registering it as a ComponentService. In your iPOJO descriptor it
>>> appears you have the service interface as the component implementation class
>>> (i.e., LogTransformService instead of LogTransformServiceImpl) and then you
>>> are trying to create an instance of "LogTransform", which is something else
>>> altogether.
>>>
>>> I would guess your iPOJO descriptor should look something like this:
>>>
>>> <ipojo>
>>>   <component
>>> classname="com.gestalt.soakit.transform.log.LogTransformServiceImpl">
>>>       <provides/>
>>>   </component>
>>>   <instance
>>> component="com.gestalt.soakit.transform.log.LogTransformServiceImpl"/>
>>> </ipojo>
>>>
>>> I don't think this will fix the class format exception, though.
>>>
>>>
>>
>> ------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to