Re: default domain by app

Gene McCullough <[email protected]>
Newsgroups gmane.comp.java.keel.user
Message-ID <[email protected]>
i've tried and have lost.  I added the following in
myapp/conf/server/occa-jdbc-system.xconf:
<!-- Add any custom configuration for your models here. -->
<keel>
  <jdbc id="occa-dbpool" activation="request" logger="occa">
  	<pool-controller max="10" maxStrict="true" blocking="true"
timeout="-1" trim-interval="60000" auto-commit="true"
connection-class="org.apache.avalon.excalibur.datasource.JdbcConnection">
  		<keep-alive disable="false">select 1</keep-alive>
  	</pool-controller>
  	<driver>com.mysql.jdbc.Driver</driver>
  	<dburl>jdbc:mysql://127.0.0.1/occa</dburl>
  	<user>gene</user>
  	<password>blahblahbla</password>
  </jdbc>
  <mysql id="occa-dbtype" activation="startup" logger="occa">
		<type from="longvarchar" to="text" prefix="'" suffix="'"/>
		<type from="boolean" to="char(5)" prefix="" suffix=""/>
  </mysql>
  <default-persistent id="occa" name="default" security="default"
logger="persist-default">
  	<dbpool>occa-dbpool</dbpool>
  	<dbtype>occa-dbtype</dbtype>
  </default-persistent>
  
</keel>  

and, in my model, have this snippet:

//havent figured out config part yet, will hard code for now...
	private String myDB = "occa"; 
          (PersistentFactory) request.getService(
                PersistentFactory.ROLE,
                myDB);

//end snippet

and at getting to this model: i get this in the browser 
        null, Could not return a reference to the Component
        (Key='org.keel.services.persist.PersistentFactory/occa')
        
cant find anything more pertinent in any log files yet

Any ideas?  I tried to understand the info on doing this, but have
obviously failed.

gene

On Wed, 2004-04-14 at 14:36, Shash Chatterjee wrote:
> > I've set up keel's tables for authentication in a db: keel.  My
> > application data is stored in its own db: mydb.  I want to use the
> > applications that have already been developed by the community that
> use
> > those tables, but I don't want to combine the databases into one.  
> > I'd like my application to be configured to look at a default db,
> preferably
> > through configuration, without having to hard code a domain into all
> > models.  After writing this I see that I can configure a dbpool 
> > (don't know how exactly, docs scarce their also), and a simple 
> > search and replace on my application could get that code
> implemented,
> >  so I may now just need to figure out the svc-domain-config.
> > 
> 
> You don't need domains at all for this.  Simply setting up another
> dbpool is
> sufficient.  What you need is to override the configure() method (if
> you
> extend StandardLogEnabledModel, otherwise implement the Configurable
> interface), and add a configuration parameter for your model to take
> the name
> of a dbpool.  Then when you get your PersistentFactory, do it with the
> name of
> your dbpool:
>        String myDB = null;  //Set in configure() method
>        ....
>        PersistentFactory myFac =
> (PersistentFactory)request.getService(PersistentFactory.ROLE, myDB);
> 
> > I've followed Shash's posts on setting up multiple jdbc elements, my
> > one question now is exactly where do i put that (which file)?
> > 
> 
> Just put it in *any* file in the conf/server/ directory of your app
> with a
> name like <something>-system.xconf, and it'lll get picked up and
> merged.
> 
> > NOTE: I noticed in anon CVS that keel-server/sample-conf and all
> subdirs
> > are empty.  Is that correct?
> That's correct....got moved to service-persist-base/sample-conf
> 
> _______________________________________________
> User mailing list
> [email protected]
> http://lists.keelframework.org/listinfo.cgi/user-keelframework.org
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.