cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <mgen...@masslight.net>
Subject Re: Cayenne 3.1 DI - binding
Date Wed, 28 Mar 2012 18:27:43 GMT
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 <brunorene@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 <johnthuss@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

Mime
View raw message