You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Lazar Kirchev <la...@gmail.com> on 2016/07/13 14:02:02 UTC

Custom DynamicDeployer

Hello,

The OpenEJB's ConfigurationFactory supports providing a custom
DynamicDeployer to it. Does Tomee provide any means to configure such a
custom DynamicDeployer, or is this completely hidden?

Regards,
Lazar

Re: Custom DynamicDeployer

Posted by Lazar Kirchev <la...@gmail.com>.
Thanks Romain,

I cannot make it work without explicitly defining a Resource somewhere, now
I will give a try to the observers.


On Thu, Jul 14, 2016 at 2:45 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> Le 14 juil. 2016 13:11, "Lazar Kirchev" <la...@gmail.com> a écrit
> :
> >
> > a serviceId field in the create method of the service provider? I tried
> > this but the actual parameter value which was passed was an empty string.
>
> Probably a wording issue but to ensure it is clear it should be a field not
> a parameter of the method
>
> > In the AutoConfig.autoCreateResource() the custom provider is correctly
> > discovered, but then nowhere in the code the name from the ResourceRef is
> > passed to the logic which creates the ResourceInfo (line 2045) and then
> the
> > resource itself (line 2048). The code lines are from 7.0.0 branch.
> > Probably I am doing something wrong. I can attach a very simple service
> > provider and application which reproduce this behavior.
> >
>
> The properties provider injects the serviceid if there. That said an
> observer is surely the easiest to do what you want.
>
> You can openejb @Observes Object 1nd declare it as a Service in tomee.xml
> to spy them all
>
> > On Wed, Jul 13, 2016 at 5:44 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> >
> > wrote:
> >
> > > 2016-07-13 16:36 GMT+02:00 Lazar Kirchev <la...@gmail.com>:
> > >
> > > > I need to create resources on the fly based on ResourceRefs, without
> any
> > > > resource definition in resources.xml or context.xml. I could not find
> how
> > > > to achieve this with the current APIs. In this case the template API
> does
> > > > not help, as it needs an existing resource. It is similar with the
> > > > properties providers. With service providers if there is no resource
> > > > defined the attributes from the ResourceRef are not passed to the
> service
> > > > provider and in my case these attributes - e.g. the name - are
> important
> > > > for the creation of the particular instance. Having a custom
> > > > DynamicDeployer, which could access the resource refs and
> create/modify
> > > > resources before calling the service providers could help.
> > > >
> > > >
> > >
> > > you should be able to read the name declaring a field String serviceId;
> > >
> > >
> > > > On Wed, Jul 13, 2016 at 5:04 PM, Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > > >
> > > > wrote:
> > > >
> > > > > Short answer is no
> > > > >
> > > > > what do you want to achieve, there are events to change the app
> model
> > > > > before the deployment if that's the goal (look for BeforeApp*)
> > > > >
> > > > >
> > > > > Romain Manni-Bucau
> > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > > > > <http://rmannibucau.wordpress.com> | Github <
> > > > > https://github.com/rmannibucau> |
> > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > > <http://www.tomitribe.com> | JavaEE Factory
> > > > > <https://javaeefactory-rmannibucau.rhcloud.com>
> > > > >
> > > > > 2016-07-13 16:02 GMT+02:00 Lazar Kirchev <lazar.kirchev@gmail.com
> >:
> > > > >
> > > > > > Hello,
> > > > > >
> > > > > > The OpenEJB's ConfigurationFactory supports providing a custom
> > > > > > DynamicDeployer to it. Does Tomee provide any means to configure
> > > such a
> > > > > > custom DynamicDeployer, or is this completely hidden?
> > > > > >
> > > > > > Regards,
> > > > > > Lazar
> > > > > >
> > > > >
> > > >
> > >
>

Re: Custom DynamicDeployer

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 14 juil. 2016 13:11, "Lazar Kirchev" <la...@gmail.com> a écrit :
>
> a serviceId field in the create method of the service provider? I tried
> this but the actual parameter value which was passed was an empty string.

Probably a wording issue but to ensure it is clear it should be a field not
a parameter of the method

> In the AutoConfig.autoCreateResource() the custom provider is correctly
> discovered, but then nowhere in the code the name from the ResourceRef is
> passed to the logic which creates the ResourceInfo (line 2045) and then
the
> resource itself (line 2048). The code lines are from 7.0.0 branch.
> Probably I am doing something wrong. I can attach a very simple service
> provider and application which reproduce this behavior.
>

The properties provider injects the serviceid if there. That said an
observer is surely the easiest to do what you want.

You can openejb @Observes Object 1nd declare it as a Service in tomee.xml
to spy them all

> On Wed, Jul 13, 2016 at 5:44 PM, Romain Manni-Bucau <rmannibucau@gmail.com
>
> wrote:
>
> > 2016-07-13 16:36 GMT+02:00 Lazar Kirchev <la...@gmail.com>:
> >
> > > I need to create resources on the fly based on ResourceRefs, without
any
> > > resource definition in resources.xml or context.xml. I could not find
how
> > > to achieve this with the current APIs. In this case the template API
does
> > > not help, as it needs an existing resource. It is similar with the
> > > properties providers. With service providers if there is no resource
> > > defined the attributes from the ResourceRef are not passed to the
service
> > > provider and in my case these attributes - e.g. the name - are
important
> > > for the creation of the particular instance. Having a custom
> > > DynamicDeployer, which could access the resource refs and
create/modify
> > > resources before calling the service providers could help.
> > >
> > >
> >
> > you should be able to read the name declaring a field String serviceId;
> >
> >
> > > On Wed, Jul 13, 2016 at 5:04 PM, Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >
> > > wrote:
> > >
> > > > Short answer is no
> > > >
> > > > what do you want to achieve, there are events to change the app
model
> > > > before the deployment if that's the goal (look for BeforeApp*)
> > > >
> > > >
> > > > Romain Manni-Bucau
> > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > > > <http://rmannibucau.wordpress.com> | Github <
> > > > https://github.com/rmannibucau> |
> > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > <http://www.tomitribe.com> | JavaEE Factory
> > > > <https://javaeefactory-rmannibucau.rhcloud.com>
> > > >
> > > > 2016-07-13 16:02 GMT+02:00 Lazar Kirchev <la...@gmail.com>:
> > > >
> > > > > Hello,
> > > > >
> > > > > The OpenEJB's ConfigurationFactory supports providing a custom
> > > > > DynamicDeployer to it. Does Tomee provide any means to configure
> > such a
> > > > > custom DynamicDeployer, or is this completely hidden?
> > > > >
> > > > > Regards,
> > > > > Lazar
> > > > >
> > > >
> > >
> >

Re: Custom DynamicDeployer

Posted by Lazar Kirchev <la...@gmail.com>.
a serviceId field in the create method of the service provider? I tried
this but the actual parameter value which was passed was an empty string.
In the AutoConfig.autoCreateResource() the custom provider is correctly
discovered, but then nowhere in the code the name from the ResourceRef is
passed to the logic which creates the ResourceInfo (line 2045) and then the
resource itself (line 2048). The code lines are from 7.0.0 branch.
Probably I am doing something wrong. I can attach a very simple service
provider and application which reproduce this behavior.

On Wed, Jul 13, 2016 at 5:44 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> 2016-07-13 16:36 GMT+02:00 Lazar Kirchev <la...@gmail.com>:
>
> > I need to create resources on the fly based on ResourceRefs, without any
> > resource definition in resources.xml or context.xml. I could not find how
> > to achieve this with the current APIs. In this case the template API does
> > not help, as it needs an existing resource. It is similar with the
> > properties providers. With service providers if there is no resource
> > defined the attributes from the ResourceRef are not passed to the service
> > provider and in my case these attributes - e.g. the name - are important
> > for the creation of the particular instance. Having a custom
> > DynamicDeployer, which could access the resource refs and create/modify
> > resources before calling the service providers could help.
> >
> >
>
> you should be able to read the name declaring a field String serviceId;
>
>
> > On Wed, Jul 13, 2016 at 5:04 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > wrote:
> >
> > > Short answer is no
> > >
> > > what do you want to achieve, there are events to change the app model
> > > before the deployment if that's the goal (look for BeforeApp*)
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> > > https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > <http://www.tomitribe.com> | JavaEE Factory
> > > <https://javaeefactory-rmannibucau.rhcloud.com>
> > >
> > > 2016-07-13 16:02 GMT+02:00 Lazar Kirchev <la...@gmail.com>:
> > >
> > > > Hello,
> > > >
> > > > The OpenEJB's ConfigurationFactory supports providing a custom
> > > > DynamicDeployer to it. Does Tomee provide any means to configure
> such a
> > > > custom DynamicDeployer, or is this completely hidden?
> > > >
> > > > Regards,
> > > > Lazar
> > > >
> > >
> >
>

Re: Custom DynamicDeployer

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2016-07-13 16:36 GMT+02:00 Lazar Kirchev <la...@gmail.com>:

> I need to create resources on the fly based on ResourceRefs, without any
> resource definition in resources.xml or context.xml. I could not find how
> to achieve this with the current APIs. In this case the template API does
> not help, as it needs an existing resource. It is similar with the
> properties providers. With service providers if there is no resource
> defined the attributes from the ResourceRef are not passed to the service
> provider and in my case these attributes - e.g. the name - are important
> for the creation of the particular instance. Having a custom
> DynamicDeployer, which could access the resource refs and create/modify
> resources before calling the service providers could help.
>
>

you should be able to read the name declaring a field String serviceId;


> On Wed, Jul 13, 2016 at 5:04 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > Short answer is no
> >
> > what do you want to achieve, there are events to change the app model
> > before the deployment if that's the goal (look for BeforeApp*)
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2016-07-13 16:02 GMT+02:00 Lazar Kirchev <la...@gmail.com>:
> >
> > > Hello,
> > >
> > > The OpenEJB's ConfigurationFactory supports providing a custom
> > > DynamicDeployer to it. Does Tomee provide any means to configure such a
> > > custom DynamicDeployer, or is this completely hidden?
> > >
> > > Regards,
> > > Lazar
> > >
> >
>

Re: Custom DynamicDeployer

Posted by Lazar Kirchev <la...@gmail.com>.
I need to create resources on the fly based on ResourceRefs, without any
resource definition in resources.xml or context.xml. I could not find how
to achieve this with the current APIs. In this case the template API does
not help, as it needs an existing resource. It is similar with the
properties providers. With service providers if there is no resource
defined the attributes from the ResourceRef are not passed to the service
provider and in my case these attributes - e.g. the name - are important
for the creation of the particular instance. Having a custom
DynamicDeployer, which could access the resource refs and create/modify
resources before calling the service providers could help.

On Wed, Jul 13, 2016 at 5:04 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> Short answer is no
>
> what do you want to achieve, there are events to change the app model
> before the deployment if that's the goal (look for BeforeApp*)
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-07-13 16:02 GMT+02:00 Lazar Kirchev <la...@gmail.com>:
>
> > Hello,
> >
> > The OpenEJB's ConfigurationFactory supports providing a custom
> > DynamicDeployer to it. Does Tomee provide any means to configure such a
> > custom DynamicDeployer, or is this completely hidden?
> >
> > Regards,
> > Lazar
> >
>

Re: Custom DynamicDeployer

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Short answer is no

what do you want to achieve, there are events to change the app model
before the deployment if that's the goal (look for BeforeApp*)


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-07-13 16:02 GMT+02:00 Lazar Kirchev <la...@gmail.com>:

> Hello,
>
> The OpenEJB's ConfigurationFactory supports providing a custom
> DynamicDeployer to it. Does Tomee provide any means to configure such a
> custom DynamicDeployer, or is this completely hidden?
>
> Regards,
> Lazar
>