geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: Dynamically creating datasources
Date Fri, 07 Jul 2006 22:47:24 GMT

On Jul 7, 2006, at 1:58 PM, wrote:

> *bump*
> I don't mind doing some more legwork, but I could really use a  
> nudge in the right direction. Aaron mentioned that I could use the  
> console code as a template for what I'm doing. Can someone point me  
> at the right place to look in the source tree? I did a little bit  
> of poking around, but I got a bit lost trying to figure out which  
> module to begin searching.

I think we already discussed that you are not going to be able to  
look up these datasources from jndi, so you'll have to provide your  
own access method.

I think what I would do is simply construct instances of the objects  
you need in code, and not even use gbeans for them  at all.   
Something like:

TransactionSupport transactionSupport = new XATransactions(....  
figure out what you want ...);
PoolingSupport poolingSupport = new SinglePool(... likewise);
ConnectionTracker connectionTracker = //look this up in the kernel or  
if this code is in a gbean use a reference
TransactionContextManager transactionContextManager = //likewise

GenericConnectionManager cm = new GenericConnectionManager 

cm.doStart();//this doesn't actually do anything, but you should shut  
it down when you are done.

ManagedConnectionFactoryWrapper mcfw = new  
     new String[] {},
     datasourceImplClass,  //this would be the tranql adapter  
datasource class if you are using tranql.  You can get it from the  
     abstractName, /I don't think this is needed if you don't  
serialize datasources.
     objectName,  //I don't think this is needed.


DataSource ds = (DataSource) mcfw.$getResource();

Hope this gives you some ideas on one possible way forward,

david jencks

> -- 
> Jimmy Wan
> Senior Technical Lead
> 21st Century Technologies, Inc.
> 4515 Seton Center Parkway Suite 320
> Austin, TX 78759
> Phone: 512-342-0010 x249
> Email:
> URL:
> The information in this email and in any attachments is  
> confidential and may be privileged. If you are not the intended  
> recipient, please destroy this message, delete any copies held on  
> your systems and notify the sender immediately. You should not  
> retain, copy or use this email for any purpose, nor disclose all or  
> any part of its content to any other person.
> wrote on 06/29/2006 12:14:59:
> > I gave this some more thought. I guess it doesn't matter if the
> > datasources are actually persisted or not. In theory, I could remove
> > or  update & redeploy all non-bootstrap datasources on startup,
> > correct? Can you point me at how to programmatically
> > add/remove/inspect datasources via a standard Geronimo deployment?
> > The key constraint is to avoid doing it through the UI and/or having
> > it be a manual deployment step.
> >
> > P.S. Thanks to the other suggestions, but I don't want to use Spring
> > at this time.
> >
> > --
> > Jimmy Wan
> >
> > Aaron Mulder wrote:
> > You can use a similar path to what the console does to create new
> > datasources.  That is to select a matching RAR (the tranql-connector
> > RAR for almost any non-XA data source) and then use JSR-88 to
> > construct a JavaBean tree representing the deployment plan, and then
> > more JSR-88 to actually deploy it.
> >
> > However, this is going to create a regular Geronimo deployment.   
> When
> > you say you don't want this to be persisted, you mean you want it to
> > be in-memory only and not started up again the next time the server
> > starts?  We don't have explicit support for running modules that are
> > in-memory only...  I'm not sure what you could do to get around  
> that.
> >
> > Thanks,
> >    Aaron
> >
> > On 6/25/06, Jimmy Wan <> wrote:
> > I'm trying to build an application where one of the necessary  
> operations
> > is the run-time creation of new datasources.
> >
> > The general idea is that on startup, there will be a single  
> datasource
> > registered with Geronimo, containing references to the database
> > containing connection information for other databases. If/when new
> > databases are registered in the application, the datasources  
> would be
> > dynamically added using the connection info that was placed into the
> > startup database. The startup database would be the single point of
> > configuration for this information. I do want connections to  
> these other
> > databases to be managed by Geronimo, but I don't want to manually  
> add
> > these connections to Geronimo. I also don't want this configuration
> > information to be persisted.
> >
> > I did something similar with JBoss, but it was a while ago and the
> > details are now a tad fuzzy on exactly how this was accomplished.
> >
> > I could use a nudge in the right direction. What's the best way  
> to do
> > this in Geronimo?
> >
> > --
> > Jimmy Wan

View raw message