2016-06-27 16:23 GMT+02:00 Svetlin Zarev <[email protected]>:

> HI,
>
> Are there any resources for the Template API ? I was not able to find any.
>
>
Javadoc mainly:
https://github.com/apache/tomee/blob/master/container/openejb-api/src/main/java/org/apache/openejb/api/resource/Template.java

here is a sample
https://github.com/apache/tomee/blob/master/container/openejb-core/src/test/java/org/apache/openejb/resource/TemplateTest.java#L54
and here how to configure it
https://github.com/apache/tomee/blob/master/container/openejb-core/src/test/java/org/apache/openejb/resource/TemplateTest.java#L46


>
> > your custom tomee.xml you would write in this observer
> Generating a tomee.xml on the fly (or any other declaration of the
> resources) is not an option, because the resources are not known at that
> time.  I cannot know what resources they have declared in their
> web.xml/web-fragment.xmls or through annotations.
>
> Basically I need a mechanism to tell tomee to create a resource using a
> "default" object factory/service provider for every resource that does not
> have an explicit one set.
>
>
Oh I see, then Template can be set as a component using the fully qualified
name:

org.apache.openejb.api.resource.Template = com.foo.MyTemplate

Note: it will also affects datasources, queues etc...


> Kind regards,
> Svetlin
>
>
>
> 2016-06-27 15:33 GMT+03:00 Romain Manni-Bucau <[email protected]>:
>
> > Hi
> >
> > there are two things:
> >
> > 1. being able to inherit from default to auto configure a declared object
> > (this is doable using plain new Template API or old service-provider)
> > 2. being able to declare on the fly resources (this requires you to
> write a
> > small openejb observer to add resources before they get created. this can
> > be done observing AssemblerCreated event and overriding openejb.conf.file
> > to point on your custom tomee.xml you would write in this observer,
> > alternative is to set system properties for resources using properties
> > syntax)
> >
> >
> >
> >
> > 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-06-27 14:19 GMT+02:00 Svetlin Zarev <
> [email protected]
> > >:
> >
> > > Hello,
> > >
> > >
> > >
> > > Let’s assume that I have an object: org.example.ExampleObject and a
> > service
> > > provider: org.example.ExampleObjectProvider
> > >
> > > The service provider has a service-jar.xml:
> > >
> > >
> > >
> > > <ServiceJar>
> > >     <ServiceProvider id=
> > > *"Default ExampleObject Provider"                      *service=
> > > *"Resource"                      *types=
> > > *"org.example.ExampleObject"                      *class-name=
> > > *"org.example.ExampleObjectProvider"
> *factory-name=
> > > *"provide"                      *constructor=*"ServiceId"*>
> > >     </ServiceProvider>
> > > </ServiceJar>
> > >
> > >
> > >
> > > Can I register that service provider to be the *default* service
> provider
> > > for ExampleObject objects without having to declare every single
> > > ExampleObject resource in tome.xml/resource.xml ? In other words – I
> want
> > > it to behave exactly like the default service-providers (for instance
> > like
> > > the javax.sql.DataSource provider) declared in
> > > org.apache.openejb/service-jar.xml.
> > >
> > >
> > >
> > > Kind regards,
> > >
> > > Svetlin
> > >
> >
>

Reply via email to