Lightweight Instance Initialization

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

Lightweight Instance Initialization

by Hugo Palma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is beta-1 supposed to have the lightweight instance initialization
feature implemented as described in
http://jakarta.apache.org/hivemind/instance-initialization.html ?

I'm asking because i want to use it but i get an error that indicates
that the class name parse isn't being donne correctly. I've tried
looking in the source files and couldn't find any code that would
implement this feature.

If it's not implemented, any predictions for when it will be ?



Cheers

Hugo

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


Re: Lightweight Instance Initialization

by Hugo Palma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I just saw in the change log that this is supposed to be implemented
since alpha-2.
What i'm trying to do is use this feature for a create-instance. So i have

<create-instance class="com.whatever.MyBean,testProperty=hi"/>


I always get the error:

Unable to process attribute class (of element
state-object/create-instance): Unable to convert type
'com.whatever.MyBean,testProperty=hi' to a Java class, either as is, or
in package com.whatever.

with the following stacktrace:

org.apache.hivemind.impl.ModuleImpl.resolveType(ModuleImpl.java:197)
org.apache.hivemind.schema.rules.ClassTranslator.translate(ClassTranslator.java:35)
org.apache.hivemind.schema.rules.ReadAttributeRule.begin(ReadAttributeRule.java:77)
org.apache.hivemind.parse.ConversionDescriptor.begin(ConversionDescriptor.java:141)
org.apache.hivemind.impl.SchemaElement.fireBegin(SchemaElement.java:228)
org.apache.hivemind.impl.SchemaProcessorImpl.processElement(SchemaProcessorImpl.java:255)
org.apache.hivemind.impl.SchemaProcessorImpl.processNestedElements(SchemaProcessorImpl.java:277)
org.apache.hivemind.impl.SchemaProcessorImpl.processElement(SchemaProcessorImpl.java:257)
org.apache.hivemind.impl.SchemaProcessorImpl.processRootElement(SchemaProcessorImpl.java:235)
org.apache.hivemind.impl.SchemaProcessorImpl.process(SchemaProcessorImpl.java:223)
org.apache.hivemind.impl.ConfigurationPointImpl.processContributionElements(ConfigurationPointImpl.java:268)
org.apache.hivemind.impl.ConfigurationPointImpl.constructMapElements(ConfigurationPointImpl.java:224)
org.apache.hivemind.impl.ElementsInnerProxyMap.inner(ElementsInnerProxyMap.java:54)
org.apache.hivemind.impl.ElementsInnerProxyMap.entrySet(ElementsInnerProxyMap.java:47)
org.apache.hivemind.impl.ElementsProxyMap.entrySet(ElementsProxyMap.java:55)
....(more).....


Any ideas that might help ?


Thanks

Hugo

Hugo Palma wrote:

> Is beta-1 supposed to have the lightweight instance initialization
> feature implemented as described in
> http://jakarta.apache.org/hivemind/instance-initialization.html ?
>
> I'm asking because i want to use it but i get an error that indicates
> that the class name parse isn't being donne correctly. I've tried
> looking in the source files and couldn't find any code that would
> implement this feature.
>
> If it's not implemented, any predictions for when it will be ?
>
>
>
> Cheers
>
> Hugo

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


Re: Lightweight Instance Initialization

by Eyon Land :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I tried to use the primitive model (as also mentioned
in http://issues.apache.org/jira/browse/HIVEMIND-120)
when creating a service with a Swing component
implementation called org.example.Main

Does anyone know a work-around that would allow
dependency injection on the org.example.Main?

Using ObjectProviders like...

    <service-point id="MainCntrl"
interface="org.example.Controller">
        <invoke-factory model="singleton">
            <construct
class="org.example.DefaultController"
                initialize-method="afterPropertiesSet"
autowire-services="false"
                service-id-property="serviceId" >
               <set-object property="view"
value="instance:org.example.Main"/>
            </construct>
        </invoke-factory>
        <interceptor
service-id="hivemind.LoggingInterceptor"/>
    </service-point>

...does not help if you want org.example.Main to get a
reference to yet another service point.

Thanks for the advice!


               
__________________________________
Discover Yahoo!
Stay in touch with email, IM, photo sharing and more. Check it out!
http://discover.yahoo.com/stayintouch.html

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


Re: Lightweight Instance Initialization

by Howard Lewis Ship :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That should be working for you; please double check your classpath,
make sure you have the right version of the JARs.  I just checked the
code and it should absolutely work for <create-instance>.

On 6/1/05, Hugo Palma <hpalma@...> wrote:

> Is beta-1 supposed to have the lightweight instance initialization
> feature implemented as described in
> http://jakarta.apache.org/hivemind/instance-initialization.html ?
>
> I'm asking because i want to use it but i get an error that indicates
> that the class name parse isn't being donne correctly. I've tried
> looking in the source files and couldn't find any code that would
> implement this feature.
>
> If it's not implemented, any predictions for when it will be ?
>
>
>
> Cheers
>
> Hugo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@...
> For additional commands, e-mail: hivemind-user-help@...
>
>


--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: Lightweight Instance Initialization

by Hugo Palma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I checked and i'm very sure i'm using hivemind-1.1-beta1 and
hivemind-lib-1.1-beta1.

Can you point out where in the source is this feature implemented so
that i can make sure that i have the correct version ?


Thanks

Hugo


Howard Lewis Ship wrote:

> That should be working for you; please double check your classpath,
> make sure you have the right version of the JARs.  I just checked the
> code and it should absolutely work for <create-instance>.
>
> On 6/1/05, Hugo Palma <hpalma@...> wrote:
>
>>Is beta-1 supposed to have the lightweight instance initialization
>>feature implemented as described in
>>http://jakarta.apache.org/hivemind/instance-initialization.html ?
>>
>>I'm asking because i want to use it but i get an error that indicates
>>that the class name parse isn't being donne correctly. I've tried
>>looking in the source files and couldn't find any code that would
>>implement this feature.
>>
>>If it's not implemented, any predictions for when it will be ?
>>
>>
>>
>>Cheers
>>
>>Hugo
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: hivemind-user-unsubscribe@...
>>For additional commands, e-mail: hivemind-user-help@...
>>
>>
>
>
>

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


Re: Lightweight Instance Initialization

by walmsul :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Has anyone reached a conclusion to this?  I'm having the same issue using hivemind 1.1.1.

It works fine if I don't specify the property, but as soon as I do I get the same error as Hugo.  So I know the classpath is fine.  I know I'm missing something, and I'd appreciate any help at all.

Here is the code.

My class:
public class Monkey {
    private String limb;
   
    public Monkey() {
       
    }
   
    public void setLimb(String s) { this.limb = s; }
    public String getLimb() { return this.limb; }
}

hivemodule.xml create-instance node (works):
<create-instance class="com.novantas.xml.Monkey"/>

hivemodule.xml create-instance node (doesn't work):
<create-instance class="com.novantas.xml.Monkey,limb=leg"/>

I have even tried putting 'limb' as a constructor argument to no avail.
Many Thanks

Clive

Hugo Palma wrote:
I checked and i'm very sure i'm using hivemind-1.1-beta1 and
hivemind-lib-1.1-beta1.

Can you point out where in the source is this feature implemented so
that i can make sure that i have the correct version ?


Thanks

Hugo


Howard Lewis Ship wrote:
> That should be working for you; please double check your classpath,
> make sure you have the right version of the JARs.  I just checked the
> code and it should absolutely work for <create-instance>.
>
> On 6/1/05, Hugo Palma <hpalma@digitalis.pt> wrote:
>
>>Is beta-1 supposed to have the lightweight instance initialization
>>feature implemented as described in
>>http://jakarta.apache.org/hivemind/instance-initialization.html ?
>>
>>I'm asking because i want to use it but i get an error that indicates
>>that the class name parse isn't being donne correctly. I've tried
>>looking in the source files and couldn't find any code that would
>>implement this feature.
>>
>>If it's not implemented, any predictions for when it will be ?
>>
>>
>>
>>Cheers
>>
>>Hugo
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>>
>>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org

RE: Lightweight Instance Initialization

by Jean-Francois Poilpret-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Clive,

If the problem cannot be solved I would suggest you take a look at HiveMind
Utilities project: in the hiveutils module, there is the "ObjectBuilder"
service that enables you to create (through configuration in hivemodule.xml)
any POJO (no need for interface, no limit on kind of POJO). The only
difference with HiveMind for POJO is that it does not allow you to set
interceptors (I use it mainly for "small" POJOs in my GUIs).

Cheers

Jean-Francois

-----Original Message-----
From: walmsul [mailto:cwalmsley@...]
Sent: Saturday, April 28, 2007 4:35 AM
To: user@...
Subject: Re: Lightweight Instance Initialization


Hi,

Has anyone reached a conclusion to this?  I'm having the same issue using
hivemind 1.1.1.

It works fine if I don't specify the property, but as soon as I do I get the
same error as Hugo.  So I know the classpath is fine.  I know I'm missing
something, and I'd appreciate any help at all.

Here is the code.

My class:
public class Monkey {
    private String limb;
   
    public Monkey() {
       
    }
   
    public void setLimb(String s) { this.limb = s; }
    public String getLimb() { return this.limb; }
}

hivemodule.xml create-instance node (works):
<create-instance class="com.novantas.xml.Monkey"/>

hivemodule.xml create-instance node (doesn't work):
<create-instance class="com.novantas.xml.Monkey,limb=leg"/>

I have even tried putting 'limb' as a constructor argument to no avail.
Many Thanks

Clive


Hugo Palma wrote:

>
> I checked and i'm very sure i'm using hivemind-1.1-beta1 and
> hivemind-lib-1.1-beta1.
>
> Can you point out where in the source is this feature implemented so
> that i can make sure that i have the correct version ?
>
>
> Thanks
>
> Hugo
>
>
> Howard Lewis Ship wrote:
>> That should be working for you; please double check your classpath,
>> make sure you have the right version of the JARs.  I just checked the
>> code and it should absolutely work for <create-instance>.
>>
>> On 6/1/05, Hugo Palma <hpalma@...> wrote:
>>
>>>Is beta-1 supposed to have the lightweight instance initialization
>>>feature implemented as described in
>>>http://jakarta.apache.org/hivemind/instance-initialization.html ?
>>>
>>>I'm asking because i want to use it but i get an error that indicates
>>>that the class name parse isn't being donne correctly. I've tried
>>>looking in the source files and couldn't find any code that would
>>>implement this feature.
>>>
>>>If it's not implemented, any predictions for when it will be ?
>>>
>>>
>>>
>>>Cheers
>>>
>>>Hugo
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: hivemind-user-unsubscribe@...
>>>For additional commands, e-mail: hivemind-user-help@...
>>>
>>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@...
> For additional commands, e-mail: hivemind-user-help@...
>
>
>

--
View this message in context:
http://www.nabble.com/Lightweight-Instance-Initialization-tf42092.html#a1022
6868
Sent from the Hivemind - User mailing list archive at Nabble.com.



       

       
               
___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com