You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Igor Laberov <ig...@qlusters.com> on 2005/05/02 13:16:10 UTC

Descriptor validation

Hi all,
Is it possible to perform validation of defined descriptor?
Here some problematic flows:
1) At registry construct time: References to another modules are wrong
2) At service construction time: Service implementation class doesn't
have setter method according to declared property in <set-object>, for
example.

Thank you,
Igor Laberov
Qlusters, Inc.



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


Re: Descriptor validation

Posted by Igor Laberov <ig...@qlusters.com>.
Thanks :)

On Mon, 2005-05-02 at 17:10, Johan Lindquist wrote:
> You can use the "StrictErrorHandler" when creating your servvice (as a  
> property of the builder factory parameters in the hivemodule for your  
> service).  This willt thrown an exception instead of simply logging the  
> error.
> 
> Cheers,
> 
> johan
> 
> On Mon, 02 May 2005 15:13:26 +0200, Igor Laberov <ig...@qlusters.com>  
> wrote:
> 
> > Is it possible make validation programatically, like calling validate()
> > function and/or throw an (optional) exception on processModule() /
> > getService()?
> > Should I open JIRA on this request?
> >
> > On Mon, 2005-05-02 at 15:08, Johan Lindquist wrote:
> >> Igor, hivemind should already be reporting errors like the ones you are
> >> describing - down to the line in the XML that contains the bad element  
> >> ...
> >>
> >> Look in your logs for something like this:
> >>
> >> org.apache.hivemind.ApplicationRuntimeException: Class test.XYZ does not
> >> contain a property named 'foo'.
> >>
> >> If not, it is probably a bug and if you wouldn't mind raising an issue  
> >> in
> >> the jira about so someone will have a look .
> >>
> >> Johan
> >>
> >> On Mon, 02 May 2005 13:16:10 +0200, Igor Laberov <ig...@qlusters.com>
> >> wrote:
> >>
> >> > Hi all,
> >> > Is it possible to perform validation of defined descriptor?
> >> > Here some problematic flows:
> >> > 1) At registry construct time: References to another modules are wrong
> >> > 2) At service construction time: Service implementation class doesn't
> >> > have setter method according to declared property in <set-object>, for
> >> > example.
> >> >
> >> > Thank you,
> >> > Igor Laberov
> >> > Qlusters, Inc.
> >> >
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> >> > For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> you too?
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
> 
> 
> 
> -- 
> you too?
> 
> ---------------------------------------------------------------------
> 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: Descriptor validation

Posted by Johan Lindquist <jo...@kawoo.co.uk>.
You can use the "StrictErrorHandler" when creating your servvice (as a  
property of the builder factory parameters in the hivemodule for your  
service).  This willt thrown an exception instead of simply logging the  
error.

Cheers,

johan

On Mon, 02 May 2005 15:13:26 +0200, Igor Laberov <ig...@qlusters.com>  
wrote:

> Is it possible make validation programatically, like calling validate()
> function and/or throw an (optional) exception on processModule() /
> getService()?
> Should I open JIRA on this request?
>
> On Mon, 2005-05-02 at 15:08, Johan Lindquist wrote:
>> Igor, hivemind should already be reporting errors like the ones you are
>> describing - down to the line in the XML that contains the bad element  
>> ...
>>
>> Look in your logs for something like this:
>>
>> org.apache.hivemind.ApplicationRuntimeException: Class test.XYZ does not
>> contain a property named 'foo'.
>>
>> If not, it is probably a bug and if you wouldn't mind raising an issue  
>> in
>> the jira about so someone will have a look .
>>
>> Johan
>>
>> On Mon, 02 May 2005 13:16:10 +0200, Igor Laberov <ig...@qlusters.com>
>> wrote:
>>
>> > Hi all,
>> > Is it possible to perform validation of defined descriptor?
>> > Here some problematic flows:
>> > 1) At registry construct time: References to another modules are wrong
>> > 2) At service construction time: Service implementation class doesn't
>> > have setter method according to declared property in <set-object>, for
>> > example.
>> >
>> > Thank you,
>> > Igor Laberov
>> > Qlusters, Inc.
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>> >
>> >
>>
>>
>>
>> --
>> you too?
>>
>> ---------------------------------------------------------------------
>> 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
>
>



-- 
you too?

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


Re: Swap implementation during program running

Posted by Johan Lindquist <jo...@kawoo.co.uk>.
Now it is a bit clearer - if you  re-create the registry between the  
calls, you will get the behaviour you ask for - the "singleton" in the  
hivemind world is a single "newed" instance of the implementation.  If  
thread-1 holds on to its registry it will keep calling the "old" version,  
while thread 2 would get the new one.  As long as they don't share the  
registry instance of course ...

Johan

On Mon, 02 May 2005 16:21:58 +0200, Igor Laberov <ig...@qlusters.com>  
wrote:

> Hi Johan, I'm not sure that I understood you.
> Lets see in example:
> Let's say that I have service that defined by interface MyInterface. So
> the scenario is following:
>
> Thread 1:
> MyInterface my =
> registry.getService(MyInterface.class,"myModule.impl1");
> my.invoke1();
> ...
> Here I want to replace the implementation ("myModule.impl1") of
> MyInterface by new jar that contains next version. After that I suppose
> that should be called something like builder.processModule()(?) that
> will re-read the descriptor file
>
> Then,in Thread 2:
> MyInterface my =
> registry.getService(MyInterface.class,"myModule.impl1");
> Now the question: is it possible to get here object that is created on
> new-version class? (event if this service was defined as singleton)
>
> (When Thread 1 continues to invoke 'my' it will continue to use old
> version)
>
> I hope my question is bit clear now,
> Thanks,
> Igor
>
> On Mon, 2005-05-02 at 17:03, Johan Lindquist wrote:
>> Igor, no way of doing that unfortunately - all setup is done at registry
>> time.  You could use your own proxy that relies on you setting up the
>> instance you want to invoke i guess ..
>>
>> johan
>>
>> On Mon, 02 May 2005 16:00:17 +0200, Igor Laberov <ig...@qlusters.com>
>> wrote:
>>
>> > Hi all,
>> > What is the way to replace service implementation without application
>> > restart, i.e. how to replace service implementation in the registry,  
>> so
>> > next time when I request the service, new implementation object will  
>> be
>> > created (even if was defined as singleton)?
>> >
>> > Thank you,
>> > Igor Laberov
>> > Qlusters, Inc.
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>> >
>> >
>>
>>
>>
>> --
>> you too?
>>
>> ---------------------------------------------------------------------
>> 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
>
>



-- 
you too?

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


Re: Swap implementation during program running

Posted by Igor Laberov <ig...@qlusters.com>.
Hi Johan, I'm not sure that I understood you. 
Lets see in example:
Let's say that I have service that defined by interface MyInterface. So
the scenario is following:

Thread 1:
MyInterface my =
registry.getService(MyInterface.class,"myModule.impl1");
my.invoke1();
...
Here I want to replace the implementation ("myModule.impl1") of
MyInterface by new jar that contains next version. After that I suppose
that should be called something like builder.processModule()(?) that
will re-read the descriptor file

Then,in Thread 2:
MyInterface my =
registry.getService(MyInterface.class,"myModule.impl1");
Now the question: is it possible to get here object that is created on
new-version class? (event if this service was defined as singleton)

(When Thread 1 continues to invoke 'my' it will continue to use old
version)

I hope my question is bit clear now,
Thanks,
Igor

 
On Mon, 2005-05-02 at 17:03, Johan Lindquist wrote:
> Igor, no way of doing that unfortunately - all setup is done at registry  
> time.  You could use your own proxy that relies on you setting up the  
> instance you want to invoke i guess ..
> 
> johan
> 
> On Mon, 02 May 2005 16:00:17 +0200, Igor Laberov <ig...@qlusters.com>  
> wrote:
> 
> > Hi all,
> > What is the way to replace service implementation without application
> > restart, i.e. how to replace service implementation in the registry, so
> > next time when I request the service, new implementation object will be
> > created (even if was defined as singleton)?
> >
> > Thank you,
> > Igor Laberov
> > Qlusters, Inc.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> >
> >
> 
> 
> 
> -- 
> you too?
> 
> ---------------------------------------------------------------------
> 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: Swap implementation during program running

Posted by Johan Lindquist <jo...@kawoo.co.uk>.
Igor, no way of doing that unfortunately - all setup is done at registry  
time.  You could use your own proxy that relies on you setting up the  
instance you want to invoke i guess ..

johan

On Mon, 02 May 2005 16:00:17 +0200, Igor Laberov <ig...@qlusters.com>  
wrote:

> Hi all,
> What is the way to replace service implementation without application
> restart, i.e. how to replace service implementation in the registry, so
> next time when I request the service, new implementation object will be
> created (even if was defined as singleton)?
>
> Thank you,
> Igor Laberov
> Qlusters, Inc.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>



-- 
you too?

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


Swap implementation during program running

Posted by Igor Laberov <ig...@qlusters.com>.
Hi all,
What is the way to replace service implementation without application
restart, i.e. how to replace service implementation in the registry, so
next time when I request the service, new implementation object will be
created (even if was defined as singleton)?

Thank you,
Igor Laberov
Qlusters, Inc.



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


Re: Descriptor validation

Posted by Igor Laberov <ig...@qlusters.com>.
Is it possible make validation programatically, like calling validate()
function and/or throw an (optional) exception on processModule() /
getService()?
Should I open JIRA on this request?

On Mon, 2005-05-02 at 15:08, Johan Lindquist wrote:
> Igor, hivemind should already be reporting errors like the ones you are  
> describing - down to the line in the XML that contains the bad element ...
> 
> Look in your logs for something like this:
> 
> org.apache.hivemind.ApplicationRuntimeException: Class test.XYZ does not  
> contain a property named 'foo'.
> 
> If not, it is probably a bug and if you wouldn't mind raising an issue in  
> the jira about so someone will have a look .
> 
> Johan
> 
> On Mon, 02 May 2005 13:16:10 +0200, Igor Laberov <ig...@qlusters.com>  
> wrote:
> 
> > Hi all,
> > Is it possible to perform validation of defined descriptor?
> > Here some problematic flows:
> > 1) At registry construct time: References to another modules are wrong
> > 2) At service construction time: Service implementation class doesn't
> > have setter method according to declared property in <set-object>, for
> > example.
> >
> > Thank you,
> > Igor Laberov
> > Qlusters, Inc.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> >
> >
> 
> 
> 
> -- 
> you too?
> 
> ---------------------------------------------------------------------
> 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: Descriptor validation

Posted by Johan Lindquist <jo...@kawoo.co.uk>.
Igor, hivemind should already be reporting errors like the ones you are  
describing - down to the line in the XML that contains the bad element ...

Look in your logs for something like this:

org.apache.hivemind.ApplicationRuntimeException: Class test.XYZ does not  
contain a property named 'foo'.

If not, it is probably a bug and if you wouldn't mind raising an issue in  
the jira about so someone will have a look .

Johan

On Mon, 02 May 2005 13:16:10 +0200, Igor Laberov <ig...@qlusters.com>  
wrote:

> Hi all,
> Is it possible to perform validation of defined descriptor?
> Here some problematic flows:
> 1) At registry construct time: References to another modules are wrong
> 2) At service construction time: Service implementation class doesn't
> have setter method according to declared property in <set-object>, for
> example.
>
> Thank you,
> Igor Laberov
> Qlusters, Inc.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>



-- 
you too?

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