You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Bruno René Santos <br...@holos.pt> on 2012/03/28 17:50:21 UTC
Cayenne 3.1 DI - binding
Hello all,
I am migrating my apps to cayenne 3.1 and I have some doubts:
I have already created a Module to bind implementations:
public class CayenneModule implements Module {
@Override
public void configure(Binder binder) {
binder.bind(ObjectContextFactory.class).toInstance(new
HolosContextFactory());
}
}
I noticed now that the 3.0 DBAdapters are gone from the Modeler and so How
can I:
1. Bind these adapters
2. Bind ExtendedTypes
Can I include these new bindings on the same Module?
Regards
Bruno Santos
--
Bruno René Santos | brunorene@holos.pt | Gestor de Projectos | Analista |
Programador | Investigador
Holos - Soluções Avançadas em Tecnologias de Informação S.A.
Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you are not the intended recipient or the person responsible for
delivering the email to the intended recipient, be advised that you have
received this email in error and that any use, dissemination, forwarding,
printing, or copying of this email is strictly prohibited. If you have
received this email in error please notify Bruno René Santos by telephone
on +351 210 438 686
Re: Cayenne 3.1 DI - binding
Posted by Michael Gentry <mg...@masslight.net>.
Hi Bruno,
Here is a snippet from when I was toying around with a new entity sorter:
import org.apache.cayenne.di.Binder;
import org.apache.cayenne.di.Module;
import org.apache.cayenne.map.EntitySorter;
public class CESTester
{
public static void main(String[] args)
{
ServerRuntime cayenneRuntime = new
ServerRuntime("cayenne-procurement.xml", new CayenneExtrasModule());
...
}
/**
* Cayenne DI module to inject our entity sorter into the mix.
*/
private static class CayenneExtrasModule implements Module
{
@Override
public void configure(Binder binder)
{
binder.bind(EntitySorter.class).to(CayenneEntitySorter.class);
}
}
}
mrg
On Wed, Mar 28, 2012 at 1:29 PM, Bruno René Santos <br...@holos.pt> wrote:
> Hi John,
>
> Ups I missed the Adapter Tab on the Node on Modeler... What about entity
> sorters? How can I put my own EntitySorter?
>
> Regards
> Bruno
>
> On Wed, Mar 28, 2012 at 5:38 PM, John Huss <jo...@gmail.com> wrote:
>
>> For extended types you can just do it in your application startup code, not
>> in the DI module. For me that's in the init method of my HessianServlet
>> subclass. I don't think there is any DI binding for it.
>>
>> For the adapters you could do the same thing. There is also a way to load
>> the adapter configuration from a properties file, but I don't have the
>> specifics right now since the property names changed recently. Or you can
>> set it in CayenneModeler.
>>
>> John
>>
>> On Wed, Mar 28, 2012 at 10:50 AM, Bruno René Santos <brunorene@holos.pt
>> >wrote:
>>
>> > Hello all,
>> >
>> > I am migrating my apps to cayenne 3.1 and I have some doubts:
>> >
>> > I have already created a Module to bind implementations:
>> >
>> > public class CayenneModule implements Module {
>> >
>> > @Override
>> > public void configure(Binder binder) {
>> > binder.bind(ObjectContextFactory.class).toInstance(new
>> > HolosContextFactory());
>> > }
>> > }
>> >
>> > I noticed now that the 3.0 DBAdapters are gone from the Modeler and so
>> How
>> > can I:
>> >
>> > 1. Bind these adapters
>> > 2. Bind ExtendedTypes
>> >
>> > Can I include these new bindings on the same Module?
>> >
>> > Regards
>> > Bruno Santos
>> >
>> > --
>> > Bruno René Santos | brunorene@holos.pt | Gestor de Projectos | Analista
>> |
>> > Programador | Investigador
>> >
>> > Holos - Soluções Avançadas em Tecnologias de Informação S.A.
>> > Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
>> > Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
>> > Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>> >
>> > This email and any files transmitted with it are confidential and
>> intended
>> > solely for the use of the individual or entity to whom they are
>> addressed.
>> > If you are not the intended recipient or the person responsible for
>> > delivering the email to the intended recipient, be advised that you have
>> > received this email in error and that any use, dissemination, forwarding,
>> > printing, or copying of this email is strictly prohibited. If you have
>> > received this email in error please notify Bruno René Santos by telephone
>> > on +351 210 438 686
>> >
>>
>
>
>
> --
> Bruno René Santos | brunorene@holos.pt | Gestor de Projectos | Analista |
> Programador | Investigador
>
> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you are not the intended recipient or the person responsible for
> delivering the email to the intended recipient, be advised that you have
> received this email in error and that any use, dissemination, forwarding,
> printing, or copying of this email is strictly prohibited. If you have
> received this email in error please notify Bruno René Santos by telephone
> on +351 210 438 686
Re: Cayenne 3.1 DI - binding
Posted by Bruno René Santos <br...@holos.pt>.
Hi John,
Ups I missed the Adapter Tab on the Node on Modeler... What about entity
sorters? How can I put my own EntitySorter?
Regards
Bruno
On Wed, Mar 28, 2012 at 5:38 PM, John Huss <jo...@gmail.com> wrote:
> For extended types you can just do it in your application startup code, not
> in the DI module. For me that's in the init method of my HessianServlet
> subclass. I don't think there is any DI binding for it.
>
> For the adapters you could do the same thing. There is also a way to load
> the adapter configuration from a properties file, but I don't have the
> specifics right now since the property names changed recently. Or you can
> set it in CayenneModeler.
>
> John
>
> On Wed, Mar 28, 2012 at 10:50 AM, Bruno René Santos <brunorene@holos.pt
> >wrote:
>
> > Hello all,
> >
> > I am migrating my apps to cayenne 3.1 and I have some doubts:
> >
> > I have already created a Module to bind implementations:
> >
> > public class CayenneModule implements Module {
> >
> > @Override
> > public void configure(Binder binder) {
> > binder.bind(ObjectContextFactory.class).toInstance(new
> > HolosContextFactory());
> > }
> > }
> >
> > I noticed now that the 3.0 DBAdapters are gone from the Modeler and so
> How
> > can I:
> >
> > 1. Bind these adapters
> > 2. Bind ExtendedTypes
> >
> > Can I include these new bindings on the same Module?
> >
> > Regards
> > Bruno Santos
> >
> > --
> > Bruno René Santos | brunorene@holos.pt | Gestor de Projectos | Analista
> |
> > Programador | Investigador
> >
> > Holos - Soluções Avançadas em Tecnologias de Informação S.A.
> > Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
> > Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
> > Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
> >
> > This email and any files transmitted with it are confidential and
> intended
> > solely for the use of the individual or entity to whom they are
> addressed.
> > If you are not the intended recipient or the person responsible for
> > delivering the email to the intended recipient, be advised that you have
> > received this email in error and that any use, dissemination, forwarding,
> > printing, or copying of this email is strictly prohibited. If you have
> > received this email in error please notify Bruno René Santos by telephone
> > on +351 210 438 686
> >
>
--
Bruno René Santos | brunorene@holos.pt | Gestor de Projectos | Analista |
Programador | Investigador
Holos - Soluções Avançadas em Tecnologias de Informação S.A.
Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you are not the intended recipient or the person responsible for
delivering the email to the intended recipient, be advised that you have
received this email in error and that any use, dissemination, forwarding,
printing, or copying of this email is strictly prohibited. If you have
received this email in error please notify Bruno René Santos by telephone
on +351 210 438 686
Re: Cayenne 3.1 DI - binding
Posted by Andrus Adamchik <an...@objectstyle.org>.
On Mar 28, 2012, at 7:38 PM, John Huss wrote:
> For extended types you can just do it in your application startup code, not
> in the DI module. For me that's in the init method of my HessianServlet
> subclass. I don't think there is any DI binding for it.
Actually there is. "cayenne.server.user_types" (aka Constants.SERVER_USER_TYPES_LIST) is a name of the List<ExtendedType> binding available. This is on trunk though. M3 doesn't support it yet.
Andrus
Re: Cayenne 3.1 DI - binding
Posted by John Huss <jo...@gmail.com>.
For extended types you can just do it in your application startup code, not
in the DI module. For me that's in the init method of my HessianServlet
subclass. I don't think there is any DI binding for it.
For the adapters you could do the same thing. There is also a way to load
the adapter configuration from a properties file, but I don't have the
specifics right now since the property names changed recently. Or you can
set it in CayenneModeler.
John
On Wed, Mar 28, 2012 at 10:50 AM, Bruno René Santos <br...@holos.pt>wrote:
> Hello all,
>
> I am migrating my apps to cayenne 3.1 and I have some doubts:
>
> I have already created a Module to bind implementations:
>
> public class CayenneModule implements Module {
>
> @Override
> public void configure(Binder binder) {
> binder.bind(ObjectContextFactory.class).toInstance(new
> HolosContextFactory());
> }
> }
>
> I noticed now that the 3.0 DBAdapters are gone from the Modeler and so How
> can I:
>
> 1. Bind these adapters
> 2. Bind ExtendedTypes
>
> Can I include these new bindings on the same Module?
>
> Regards
> Bruno Santos
>
> --
> Bruno René Santos | brunorene@holos.pt | Gestor de Projectos | Analista |
> Programador | Investigador
>
> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
>
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you are not the intended recipient or the person responsible for
> delivering the email to the intended recipient, be advised that you have
> received this email in error and that any use, dissemination, forwarding,
> printing, or copying of this email is strictly prohibited. If you have
> received this email in error please notify Bruno René Santos by telephone
> on +351 210 438 686
>