commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Lear <r...@zopyra.com>
Subject Re: [HiveMind] Question about DAO creation
Date Fri, 03 Oct 2003 14:53:29 GMT
On Friday, October 3, 2003 at 16:45:42 (+0200) Christian Essl writes:
>Sorry I wrote my answer send it and than just saw that Harish was faster 
>(and better). Maybe the only thing you should keep from my anser that you 
>should shutdown the registry (the pool may need it, because HiveMind now 
>supports a shut-down event).

No reason to apologize --- very helpful stuff, except I'm not sure
I understand the need to shut down the registry.

I've refactored a bit, now my Global is simpler:

public class Global {
    private DAO dao;

    public Global() throws DAOException {
        Services services = new Services();
        DAOFactory factory =
            (DAOFactory) services.getService(DAOFactory.class);
        dao = factory.createDAO();
    }

    public DAO getDAO() {
        return dao;
    }
}

as is my Services class:

public class Services {
    private Registry registry;

    public Services() {
        ClassResolver resolver = new DefaultClassResolver();
        RegistryBuilder builder = new RegistryBuilder();

        builder.processModules(resolver);

        Registry registry = builder.constructRegistry(Locale.getDefault());
    }

    public Object getService(Class theClass) {
        return registry.getService(theClass.getName(), theClass);
    }
}

Now I need to see about incorporating the other ideas about
connections, shutting down the registry (again, is this really
needed?)  etc.


Bill

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


Mime
View raw message