You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by James Mitchell <jm...@apache.org> on 2004/02/06 14:40:09 UTC
[resources] new implementations [was: Re: cvs commit: jakart...]
P.S.
I'll be adding a few more items later tonight and/or this weekend:
- a build script in resources/contrib that let's us produce
a distribution of any single one of the implementations under
contrib
- a few docs
- tutorial on how to setup and use these impls.
- a plugin (location: jakarta-struts/contrib ????) that acts as
a wrapper to the current (Struts 1.1) message resources api.
This would let anyone use a current distribution of
commons-resources with Struts 1.1 (going for the
backwards-compatibility crowd)
Future:
- an iBatis implementation
- a Torque implementation
- a basic LDAP implementation
- a [?? enter your choice ??] implementation
- mods to all the current database impls that allow
datasource configuration/pooling via JNDI
Did I miss anything?
--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
678.910.8017 (cell)
AIM: jmitchtx
MSN: jmitchell@apache.org
----- Original Message -----
From: <jm...@apache.org>
To: <ja...@apache.org>
Sent: Friday, February 06, 2004 8:26 AM
Subject: cvs commit: jakarta-commons-sandbox/resources/contrib/hibernate/sql
mysql.sql
> jmitchell 2004/02/06 05:26:09
>
> Added: resources/contrib/hibernate/src/test hibernate.cfg.xml
> hibernate.properties log4j.properties
> oscache.properties
>
resources/contrib/hibernate/src/java/org/apache/commons/resources/impl
> HibernateBasicMessage.hbm.xml
> HibernateBasicMessage.java HibernateResources.java
> HibernateResourcesFactory.java
>
resources/contrib/hibernate/src/test/org/apache/commons/resources/impl
> HibernateResourcesTestCase.java
> resources/contrib/hibernate/sql mysql.sql
> Log:
> Add new Database implementation that uses the
> Hibernate O/R mapping framework. This particular
> contribution was fully tested with the latest release
> (2.1.2).
>
> Revision Changes Path
> 1.1
jakarta-commons-sandbox/resources/contrib/hibernate/src/test/hibernate.cfg.x
ml
>
> Index: hibernate.cfg.xml
> ===================================================================
> <?xml version='1.0' encoding="UTF-8"?>
> <!DOCTYPE hibernate-configuration
> PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
> "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
>
> <hibernate-configuration>
>
> <session-factory>
>
> <!-- database connection -->
> <property
name="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect.java</propert
y>
> <property
name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
> <property
name="hibernate.connection.url">jdbc:mysql://localhost/resources</property>
> <property
name="hibernate.connection.username">resourcesTest</property>
> <property
name="hibernate.connection.password">resourcesTest</property>
> <property name="hibernate.connection.pool_size">4</property>
> <property name="hibernate.statement_cache.size">100</property>
> <property name="hibernate.show_sql">true</property>
> <property name="hibernate.jdbc.batch_size">0</property>
> <property
name="hibernate.cglib.use_reflection_optimizer">true</property>
>
> <mapping
resource="org/apache/commons/resources/impl/HibernateBasicMessage.hbm.xml"/>
>
> </session-factory>
>
> </hibernate-configuration>
>
>
>
> 1.1
jakarta-commons-sandbox/resources/contrib/hibernate/src/test/hibernate.prope
rties
>
> Index: hibernate.properties
> ===================================================================
> ######################
> ### Query Language ###
> ######################
>
> ## define query language constants / function names
>
> hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
>
>
>
> #################
> ### Platforms ###
> #################
>
> ## JNDI Datasource
>
> #hibernate.connection.datasource jdbc/test
> #hibernate.connection.username db2
> #hibernate.connection.password db2
>
>
> ## HypersonicSQL
>
> hibernate.dialect net.sf.hibernate.dialect.HSQLDialect
> hibernate.connection.driver_class org.hsqldb.jdbcDriver
> hibernate.connection.username sa
> hibernate.connection.password
> hibernate.connection.url jdbc:hsqldb:hsql://localhost
> hibernate.connection.url jdbc:hsqldb:test
> hibernate.connection.url jdbc:hsqldb:.
>
>
> ## PostgreSQL
>
> #hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect
> #hibernate.connection.driver_class org.postgresql.Driver
> #hibernate.connection.url jdbc:postgresql:template1
> #hibernate.connection.username pg
> #hibernate.connection.password
> #hibernate.query.substitutions yes 'Y', no 'N'
>
>
> ## DB2
>
> #hibernate.dialect net.sf.hibernate.dialect.DB2Dialect
> #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
> #hibernate.connection.url jdbc:db2:test
> #hibernate.connection.username db2
> #hibernate.connection.password db2
>
>
> ## DB2/400
>
> #hibernate.dialect net.sf.hibernate.dialect.DB2400Dialect
> #hibernate.connection.username user
> #hibernate.connection.password password
>
> ## Native driver
> #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
> #hibernate.connection.url jdbc:db2://systemname
>
> ## Toolbox driver
> #hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
> #hibernate.connection.url jdbc:as400://systemname
>
>
> ## MySQL
>
> #hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
> #hibernate.connection.driver_class org.gjt.mm.mysql.Driver
> #hibernate.connection.driver_class com.mysql.jdbc.Driver
> #hibernate.connection.url jdbc:mysql:///test
> #hibernate.connection.username root
> #hibernate.connection.password
>
>
> ## Oracle
>
> #hibernate.dialect net.sf.hibernate.dialect.Oracle9Dialect
> #hibernate.dialect net.sf.hibernate.dialect.OracleDialect
> #hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
> #hibernate.connection.username ora
> #hibernate.connection.password ora
> #hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
>
>
> ## Sybase
>
> #hibernate.dialect net.sf.hibernate.dialect.SybaseDialect
> #hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
> #hibernate.connection.username sa
> #hibernate.connection.password sasasa
> #hibernate.connection.rl jdbc:sybase:Tds:co3061835-a:5000/tempdb
>
>
> ## Mckoi SQL
>
> #hibernate.dialect net.sf.hibernate.dialect.MckoiDialect
> #hibernate.connection.driver_class com.mckoi.JDBCDriver
> #hibernate.connection.url jdbc:mckoi:///
> #hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
> #hibernate.connection.username admin
> #hibernate.connection.password nimda
>
>
> ## SAP DB
>
> #hibernate.dialect net.sf.hibernate.dialect.SAPDBDialect
> #hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB
> #hibernate.connection.url jdbc:sapdb://localhost/TST
> #hibernate.connection.username TEST
> #hibernate.connection.password TEST
> #hibernate.query.substitutions yes 'Y', no 'N'
>
>
> ## MS SQL Server
>
> #hibernate.dialect net.sf.hibernate.dialect.SQLServerDialect
> #hibernate.connection.username sa
> #hibernate.connection.password sa
>
> ## JSQL Driver
> #hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver
> #hibernate.connection.url jdbc:JSQLConnect://1E1/test
>
> ## JTURBO Driver
> #hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver
> #hibernate.connection.url jdbc:JTurbo://1E1:1433/test
>
> ## WebLogic Driver
> #hibernate.connection.driver_class weblogic.jdbc.mssqlserver4.Driver
> #hibernate.connection.url jdbc:weblogic:mssqlserver4:1E1:1433
>
> ## Microsoft Driver (not recommended!)
> #hibernate.connection.driver_class
com.microsoft.jdbc.sqlserver.SQLServerDriver
> #hibernate.connection.url
jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor
>
> ## jTDS (not supported!)
> #hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
> #hibernate.connection.url
jdbc:jtds:sqlserver://1E1/test;SelectMethod=cursor
> #hibernate.jdbc.use_scrollable_resultset false
>
> ## Interbase
>
> #hibernate.dialect net.sf.hibernate.dialect.InterbaseDialect
> #hibernate.connection.username sysdba
> #hibernate.connection.password masterkey
>
> ## DO NOT specify hibernate.connection.sqlDialect
>
> ## InterClient
>
> #hibernate.connection.driver_class interbase.interclient.Driver
> #hibernate.connection.url
jdbc:interbase://localhost:3060/C:/firebird/test.gdb
>
> ## Pure Java
>
> #hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
> #hibernate.connection.url
jdbc:firebirdsql:localhost/3050:/firebird/test.gdb
>
>
> ## Pointbase
>
> #hibernate.dialect net.sf.hibernate.dialect.PointbaseDialect
> #hibernate.connection.driver_class
com.pointbase.jdbc.jdbcUniversalDriver
> #hibernate.connection.url jdbc:pointbase:embedded:sample
> #hibernate.connection.username PBPUBLIC
> #hibernate.connection.password PBPUBLIC
>
>
>
> #################################
> ### Hibernate Connection Pool ###
> #################################
>
> hibernate.connection.pool_size 1
>
>
>
> ###########################
> ### C3P0 Connection Pool###
> ###########################
>
> #hibernate.c3p0.max_size 2
> #hibernate.c3p0.min_size 2
> #hibernate.c3p0.timeout 5000
> #hibernate.c3p0.max_statements 100
> #hibernate.c3p0.idle_test_period 3000
> #hibernate.c3p0.acquire_increment 2
> ##hibernate.c3p0.validate false
>
>
>
> ###################################
> ### Apache DBCP Connection Pool ###
> ###################################
>
> ## connection pool
>
> #hibernate.dbcp.maxActive 100
> #hibernate.dbcp.whenExhaustedAction 1
> #hibernate.dbcp.maxWait 120000
> #hibernate.dbcp.maxIdle 10
>
> ## prepared statement cache
>
> #hibernate.dbcp.ps.maxActive 100
> #hibernate.dbcp.ps.whenExhaustedAction 1
> #hibernate.dbcp.ps.maxWait 120000
> #hibernate.dbcp.ps.maxIdle 10
>
> ## optional query to validate pooled connections:
>
> #hibernate.dbcp.validationQuery select 1 from dual
> #hibernate.dbcp.testOnBorrow true
> #hibernate.dbcp.testOnReturn false
>
>
>
> ##############################
> ### Proxool Connection Pool###
> ##############################
>
> ## Properties for external configuration of Proxool
>
> hibernate.proxool.pool_alias pool1
>
> ## Only need one of the following
>
> #hibernate.proxool.existing_pool true
> #hibernate.proxool.xml proxool.xml
> #hibernate.proxool.properties proxool.properties
>
> ## Or, alternatively, all of these
> ## Standard configuration properties of Proxool
>
> #hibernate.proxool.house-keeping-sleep-time 30000
> #hibernate.proxool.house-keeping-test-sql
> #hibernate.proxool.maximum-connection-count 4
> #hibernate.proxool.maximum-connection-lifetime 4
> #hibernate.proxool.simultaneous-build-throttle 2
> #hibernate.proxool.maximum-active-time 500
> #hibernate.proxool.minimum-connection-count 2
> #hibernate.proxool.fatal-sql-exception
> #hibernate.proxool.prototype-count
> #hibernate.proxool.statistics
> #hibernate.proxool.recently-started-threshold
> #hibernate.proxool.overload-without-refusal-lifetime
>
>
>
> #################################
> ### Plugin ConnectionProvider ###
> #################################
>
> ## use a custom ConnectionProvider (if not set, Hibernate will choose a
built-in ConnectionProvider using hueristics)
>
> #hibernate.connection.provider_class
net.sf.hibernate.connection.DriverManagerConnectionProvider
> #hibernate.connection.provider_class
net.sf.hibernate.connection.DatasourceConnectionProvider
> #hibernate.connection.provider_class
net.sf.hibernate.connection.C3P0ConnectionProvider
> #hibernate.connection.provider_class
net.sf.hibernate.connection.DBCPConnectionProvider
> #hibernate.connection.provider_class
net.sf.hibernate.connection.ProxoolConnectionProvider
>
>
>
> #######################
> ### Transaction API ###
> #######################
>
> ## the Transaction API abstracts application code from the underlying
JTA or JDBC transactions
>
> #hibernate.transaction.factory_class
net.sf.hibernate.transaction.JTATransactionFactory
> #hibernate.transaction.factory_class
net.sf.hibernate.transaction.JDBCTransactionFactory
>
>
> ## to use JTATransactionFactory, Hibernate must be able to locate the
UserTransaction in JNDI
> ## default is java:comp/UserTransaction
> ## you do NOT need this setting if you specify
hibernate.transaction.manager_lookup_class
>
> #jta.UserTransaction jta/usertransaction
> #jta.UserTransaction javax.transaction.UserTransaction
> #jta.UserTransaction UserTransaction
>
>
> ## to use JCS caching with JTA, Hibernate must be able to obtain the JTA
TransactionManager
>
> #hibernate.transaction.manager_lookup_class
net.sf.hibernate.transaction.JBossTransactionManagerLookup
> #hibernate.transaction.manager_lookup_class
net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
> #hibernate.transaction.manager_lookup_class
net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
> #hibernate.transaction.manager_lookup_class
net.sf.hibernate.transaction.OrionTransactionManagerLookup
> #hibernate.transaction.manager_lookup_class
net.sf.hibernate.transaction.ResinTransactionManagerLookup
>
>
>
> ##############################
> ### Miscellaneous Settings ###
> ##############################
>
> ## print all generated SQL to the console
>
> #hibernate.show_sql true
>
>
> ## auto schema export
>
> #hibernate.hbm2ddl.auto create-drop
> #hibernate.hbm2ddl.auto create
> #hibernate.hbm2ddl.auto update
>
>
> ## specify a JDBC isolation level
>
> #hibernate.connection.isolation 4
>
>
> ## set the JDBC fetch size
>
> #hibernate.jdbc.fetch_size 25
>
>
> ## set the maximum JDBC 2 batch size (a nonzero value enables batching)
>
> hibernate.jdbc.batch_size 0
>
>
> ## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will
cause Hibernate to use a sensible default)
>
> #hibernate.jdbc.use_scrollable_resultset true
>
>
> ## use streams when writing binary types to / from JDBC
>
> hibernate.jdbc.use_streams_for_binary true
>
>
> ## use JDBC 3 PreparedStatement.getGeneratedKeys to get the identifier
of an inserted row
>
> #hibernate.jdbc.use_get_generated_keys true
>
>
> ## specify a default schema for unqualified tablenames
>
> #hibernate.default_schema test
>
>
> ## use a custom stylesheet for XML generation (if not specified,
hibernate-default.xslt will be used)
>
> #hibernate.xml.output_stylesheet
C:/Hibernate/net/sf/hibernate/hibernate-default.xslt
>
>
> ## enable outerjoin fetching (specifying a Dialect will cause Hibernate
to use sensible default)
>
> #hibernate.use_outer_join false
>
>
> ## set the maximum depth of the outer join fetch tree
>
> hibernate.max_fetch_depth 1
>
>
> ## enable CGLIB reflection optimizer (enabled by default)
>
> #hibernate.cglib.use_reflection_optimizer false
>
>
>
> ##########################
> ### Second-level Cache ###
> ##########################
>
> ## optimize chache for minimal "puts" instead of minimal "gets" (good
for clustered cache)
>
> #hibernate.cache.use_minimal_puts true
>
>
> ## enable the query cache
>
> hibernate.cache.use_query_cache true
>
>
> ## choose a cache implementation
>
> #hibernate.cache.provider_class net.sf.ehcache.hibernate.Provider
> #hibernate.cache.provider_class
net.sf.hibernate.cache.EmptyCacheProvider
> hibernate.cache.provider_class
net.sf.hibernate.cache.HashtableCacheProvider
> #hibernate.cache.provider_class net.sf.hibernate.cache.TreeCacheProvider
> #hibernate.cache.provider_class net.sf.hibernate.cache.OSCacheProvider
> #hibernate.cache.provider_class net.sf.hibernate.cache.JCSCacheProvider
> #hibernate.cache.provider_class
net.sf.hibernate.cache.SwarmCacheProvider
>
>
>
> ############
> ### JNDI ###
> ############
>
> ## specify a JNDI name for the SessionFactory
>
> #hibernate.session_factory_name hibernate/session_factory
>
>
> ## Hibernate uses JNDI to bind a name to a SessionFactory and to look up
the JTA UserTransaction;
> ## if hibernate.jndi.* are not specified, Hibernate will use the default
InitialContext() which
> ## is the best approach in an application server
>
> #file system
> #hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
> #hibernate.jndi.url file:/
>
> #WebSphere
> #hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
> #hibernate.jndi.url iiop://localhost:900/
>
>
>
>
> 1.1
jakarta-commons-sandbox/resources/contrib/hibernate/src/test/log4j.propertie
s
>
> Index: log4j.properties
> ===================================================================
> ### direct log messages to stdout ###
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.Target=System.out
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p
%c{1}:%L - %m%n
>
> ### direct messages to file hibernate.log ###
> #log4j.appender.file=org.apache.log4j.FileAppender
> #log4j.appender.file.File=hibernate.log
> #log4j.appender.file.layout=org.apache.log4j.PatternLayout
> #log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p
%c{1}:%L - %m%n
>
> ### set log levels - for more verbose logging change 'info' to 'debug'
###
>
> log4j.rootLogger=warn, stdout
>
> log4j.logger.net.sf.hibernate=info
>
> ### log just the SQL
> #log4j.logger.net.sf.hibernate.SQL=debug
>
> ### log JDBC bind parameters ###
> log4j.logger.net.sf.hibernate.type=info
>
> ### log schema export/update ###
> log4j.logger.net.sf.hibernate.tool.hbm2ddl=debug
>
> ### log cache activity ###
> #log4j.logger.net.sf.hibernate.cache=debug
>
> ### enable the following line if you want to track down connection ###
> ### leakages when using DriverManagerConnectionProvider ###
>
#log4j.logger.net.sf.hibernate.connection.DriverManagerConnectionProvider=tr
ace
>
>
>
> 1.1
jakarta-commons-sandbox/resources/contrib/hibernate/src/test/oscache.propert
ies
>
> Index: oscache.properties
> ===================================================================
> # CACHE IN MEMORY
> #
> # If you want to disable memory caching, just uncomment this line.
> #
> # cache.memory=false
>
>
> # CACHE KEY
> #
> # This is the key that will be used to store the cache in the
application
> # and session scope.
> #
> # If you want to set the cache key to anything other than the default
> # uncomment this line and change the cache.key
> #
> # cache.key=__oscache_cache
>
>
> # USE HOST DOMAIN NAME IN KEY
> #
> # Servers for multiple host domains may wish to add host name info to
> # the generation of the key. If this is true, then uncomment the
> # following line.
> #
> # cache.use.host.domain.in.key=true
>
>
> # CACHE LISTENERS
> #
> # These hook OSCache events and perform various actions such as logging
> # cache hits and misses, or broadcasting to other cache instances across
a cluster.
> # See the documentation for further information.
> #
> #
cache.event.listeners=com.opensymphony.oscache.plugins.clustersupport.JMSBro
adcastingListener, \
> #
com.opensymphony.oscache.extra.CacheEntryEventListenerImpl, \
> #
com.opensymphony.oscache.extra.CacheMapAccessEventListenerImpl, \
> #
com.opensymphony.oscache.extra.ScopeEventListenerImpl
>
>
> # CACHE PERSISTENCE CLASS
> #
> # Specify the class to use for persistence. If you use the supplied
DiskPersistenceListener,
> # don't forget to supply the cache.path property to specify the location
of the cache
> # directory.
> #
> # If a persistence class is not specified, OSCache will use memory
caching only.
> #
> #
cache.persistence.class=com.opensymphony.oscache.plugins.diskpersistence.Dis
kPersistenceListener
>
>
> # CACHE DIRECTORY
> #
> # This is the directory on disk where caches will be stored by the
DiskPersistenceListener.
> # it will be created if it doesn't already exist. Remember that OSCache
must have
> # write permission to this directory.
> #
> # Note: for Windows machines, this needs \ to be escaped
> # ie Windows:
> # cache.path=c:\\myapp\\cache
> # or *ix:
> # cache.path=/opt/myapp/cache
> #
> # cache.path=c:\\app\\cache
>
>
> # CACHE ALGORITHM
> #
> # Default cache algorithm to use. Note that in order to use an algorithm
> # the cache size must also be specified. If the cache size is not
specified,
> # the cache algorithm will be Unlimited cache.
> #
> # cache.algorithm=com.opensymphony.oscache.base.algorithm.LRUCache
> # cache.algorithm=com.opensymphony.oscache.base.algorithm.FIFOCache
> # cache.algorithm=com.opensymphony.oscache.base.algorithm.UnlimitedCache
>
>
> # CACHE SIZE
> #
> # Default cache size in number of items. If a size is specified but not
> # an algorithm, the cache algorithm used will be LRUCache.
> #
> cache.capacity=1000
>
>
> # CACHE UNLIMITED DISK
> # Use unlimited disk cache or not. The default value is false, which
means
> # the disk cache will be limited in size to the value specified by
cache.capacity.
> #
> # cache.unlimited.disk=false
>
>
> # JMS CLUSTER PROPERTIES
> #
> # Configuration properties for JMS clustering. See the clustering
documentation
> # for more information on these settings.
> #
>
#cache.cluster.jms.topic.factory=java:comp/env/jms/TopicConnectionFactory
> #cache.cluster.jms.topic.name=java:comp/env/jms/OSCacheTopic
> #cache.cluster.jms.node.name=node1
>
>
> # JAVAGROUPS CLUSTER PROPERTIES
> #
> # Configuration properites for the JavaGroups clustering. Only one of
these
> # should be specified. Default values (as shown below) will be used if
niether
> # property is set. See the clustering documentation and the JavaGroups
project
> # (www.javagroups.com) for more information on these settings.
> #
>
#cache.cluster.properties=UDP(mcast_addr=231.12.21.132;mcast_port=45566;ip_t
tl=32;mcast_send_buf_size=150000;mcast_recv_buf_size=80000):PING(timeout=200
0;num_initial_members=3):MERGE2(min_interval=5000;max_interval=10000):FD_SOC
K:VERIFY_SUSPECT(timeout=1500):pbcast.NAKACK(gc_lag=50;retransmit_timeout=30
0,600,1200,2400,4800):pbcast.STABLE(desired_avg_gossip=20000):UNICAST(timeou
t=5000):FRAG(frag_size=8096;down_thread=false;up_thread=false):pbcast.GMS(jo
in_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=true)
> #cache.cluster.multicast.ip=231.12.21.132
>
>
>
> 1.1
jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/apache/comm
ons/resources/impl/HibernateBasicMessage.hbm.xml
>
> Index: HibernateBasicMessage.hbm.xml
> ===================================================================
> <?xml version="1.0"?>
> <!DOCTYPE hibernate-mapping SYSTEM
> "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
>
>
> <hibernate-mapping>
>
> <class
name="org.apache.commons.resources.impl.HibernateBasicMessage"
table="resources">
>
> <composite-id>
> <key-property name="locale" type="java.lang.String" column="locale"/>
> <key-property name="key" type="java.lang.String" column="msgKey"/>
> </composite-id>
>
> <property name="value" type="java.lang.String" column="val"/>
> </class>
>
> <query name="QueryByLocale">
>
> from
> org.apache.commons.resources.impl.HibernateBasicMessage as msgRes
> where
> msgRes.locale = ?
>
> </query>
>
> </hibernate-mapping>
>
>
>
> 1.1
jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/apache/comm
ons/resources/impl/HibernateBasicMessage.java
>
> Index: HibernateBasicMessage.java
> ===================================================================
> /*
> * $Header:
/home/cvs/jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/a
pache/commons/resources/impl/HibernateBasicMessage.java,v 1.1 2004/02/06
13:26:09 jmitchell Exp $
> * $Revision: 1.1 $
> * $Date: 2004/02/06 13:26:09 $
> *
> * ====================================================================
> *
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution, if
> * any, must include the following acknowledgement:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgement may appear in the software
itself,
> * if and wherever such third-party acknowledgements normally appear.
> *
> * 4. The names, "Apache", "The Jakarta Project", "Commons", and "Apache
Software
> * Foundation" must not be used to endorse or promote products
derived
> * from this software without prior written permission. For written
> * permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache"
> * nor may "Apache" appear in their name, without prior written
> * permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> * ====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> */
>
> package org.apache.commons.resources.impl;
>
>
> /**
> * BasicMessage to allow standard Hibernate
> * configuration (no complex keys).
> *
> * @author James Mitchell
> *
> */
> public class HibernateBasicMessage extends BasicMessage {
>
> public HibernateBasicMessage() {
> super();
> }
> /**
> *
> * @param id The id (primary key) for this message.
> * @param locale The locale used to retrieve the value for the
specified key
> * @param key The key for this message.
> * @param value The value for this message.
> */
> public HibernateBasicMessage(Long id, String locale, String key,
Object[] values) {
> super(key, values);
> this.id = id;
> this.locale = locale;
>
> }
>
> private Long id = null;
> private String locale = null;
>
> /**
> * @return Returns the id.
> */
> public Long getId() {
> return id;
> }
>
> /**
> * @param id The id to set.
> */
> public void setId(Long id) {
> this.id = id;
> }
> /**
> * @return Returns the locale.
> */
> public String getLocale() {
> return locale;
> }
> /**
> * @param locale The locale to set.
> */
> public void setLocale(String locale) {
> this.locale = locale;
> }
>
> public void setKey(String key) {
> this.key = key;
> }
> public void setValue(String value) {
> this.values = new String[]{value};
> }
> public String getValue() {
> if (values == null || values.length < 1) {
> throw new IllegalStateException("The retrived value for msg
" +
> this.key + "was null");
> }
> if (values.length > 1) {
> throw new IllegalStateException("There were more than one
values " +
> "retrived value for msg " +
> this.key);
> }
> return (String)getValues()[0];
> }
>
> public boolean equals(Object obj) {
> return super.equals(obj);
> }
>
> public int hashCode() {
> return super.hashCode();
> }
> }
>
>
>
> 1.1
jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/apache/comm
ons/resources/impl/HibernateResources.java
>
> Index: HibernateResources.java
> ===================================================================
> /*
> * $Header:
/home/cvs/jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/a
pache/commons/resources/impl/HibernateResources.java,v 1.1 2004/02/06
13:26:09 jmitchell Exp $
> * $Revision: 1.1 $
> * $Date: 2004/02/06 13:26:09 $
> *
> * ====================================================================
> *
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution, if
> * any, must include the following acknowledgement:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgement may appear in the software
itself,
> * if and wherever such third-party acknowledgements normally appear.
> *
> * 4. The names, "Apache", "The Jakarta Project", "Commons", and "Apache
Software
> * Foundation" must not be used to endorse or promote products
derived
> * from this software without prior written permission. For written
> * permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache"
> * nor may "Apache" appear in their name, without prior written
> * permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> * ====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> */
>
> package org.apache.commons.resources.impl;
>
> import java.util.Iterator;
> import java.util.List;
> import java.util.Locale;
> import java.util.Map;
> import java.util.Properties;
>
> import net.sf.hibernate.HibernateException;
> import net.sf.hibernate.Query;
> import net.sf.hibernate.Session;
> import net.sf.hibernate.SessionFactory;
> import net.sf.hibernate.cfg.Configuration;
>
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import org.apache.commons.resources.ResourcesException;
>
> /**
> * <p>Concrete implementation of
> * {@link org.apache.commons.resources.Resources} that wraps a
> * Hibernate session and retrieves values for the given
> * <code>Locale</code> and have name suffixes reflecting the
> * <code>Locale</code> for which the document's messages apply.
> * For this specific implementation, resources are looked up in
> * a hierarchy of database values in a manner identical to that
> * performed by <code>java.util.ResourceBundle.getBundle().</code>.
> * </p>
> *
> * <p>The base URL passed to our constructor must contain the base name
> * of a the hibernate configuration file.</p>
> *
> * @author James Mitchell
> * @version $Revision: 1.1 $ $Date: 2004/02/06 13:26:09 $
> */
> public class HibernateResources extends CollectionResourcesBase {
>
> /**
> * <p>The <code>Log</code> instance for this class.</p>
> */
> private static final Log log =
LogFactory.getLog(HibernateResources.class);
>
> // -----------------------------------------------------------
Constructors
>
> /**
> * <p>Create a new
> * {@link org.apache.commons.resources.Resources} instance with the
specified
> * logical name and base resource URL.</p>
> *
> * @param name Logical name of the new instance
> * @param base Base URL of the Hibernate configuration file.
> */
> public HibernateResources(String name, String base) {
> super(name, base);
> }
>
>
> // ------------------------------------------------------ Protected
Methods
>
>
> /**
> * <p>Return a <code>Map</code> containing the name-value mappings
for
> * the specified base URL and requested <code>Locale</code>, if
there
> * are any. If there are no defined mappings for the specified
> * <code>Locale</code>, return an empty <code>Map</code>
instead.</p>
> *
> * <p>Concrete subclasses must override this method to perform the
> * appropriate lookup. A typical implementation will construct an
> * absolute URL based on the specified base URL and
<code>Locale</code>,
> * retrieve the specified resource file (if any), and parse it into
> * a <code>Map</code> structure.</p>
> *
> * <p>Caching of previously retrieved <code>Map</code>s (if any)
should
> * be performed by callers of this method. Therefore, this method
should
> * always attempt to retrieve the specified resource and load it
> * appropriately.</p>
> *
> * @param baseUrl Base URL of the resource files for this
> * {@link org.apache.commons.resources.Resources} instance
> * @param locale <code>Locale</code> for which name-value mappings
> * are requested
> */
> protected Map getLocaleMap(String baseUrl, Locale locale) {
>
> if (log.isDebugEnabled()) {
> log.debug("Loading database configuration'" + locale + "'
resources from base '" +
> baseUrl + "'");
> }
>
> Properties props = new Properties();
> Session session = null;
> try {
> // TODO - change this to load the specified hibernate config
file (baseUrl)
> SessionFactory sessionFactory =
> new Configuration().configure().buildSessionFactory();
> session = sessionFactory.openSession();
> Query q = session.getNamedQuery("QueryByLocale");
> q.setString(0, locale.toString());
> q.list();
> List msgs = q.list();
> for (Iterator iter = msgs.iterator(); iter.hasNext();) {
> HibernateBasicMessage msg = (HibernateBasicMessage)
iter.next();
> props.put(msg.getKey(), msg.getValue());
> }
> session.close();
>
> } catch (HibernateException e) {
> e.printStackTrace();
> }
>
> return props;
>
>
>
> }
>
>
> public void init() throws ResourcesException {
> super.init();
> }
> }
>
>
>
> 1.1
jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/apache/comm
ons/resources/impl/HibernateResourcesFactory.java
>
> Index: HibernateResourcesFactory.java
> ===================================================================
> /*
> * $Header:
/home/cvs/jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/a
pache/commons/resources/impl/HibernateResourcesFactory.java,v 1.1 2004/02/06
13:26:09 jmitchell Exp $
> * $Revision: 1.1 $
> * $Date: 2004/02/06 13:26:09 $
> *
> * ====================================================================
> *
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution, if
> * any, must include the following acknowledgement:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgement may appear in the software
itself,
> * if and wherever such third-party acknowledgements normally appear.
> *
> * 4. The names, "Apache", "The Jakarta Project", "Commons", and "Apache
Software
> * Foundation" must not be used to endorse or promote products
derived
> * from this software without prior written permission. For written
> * permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache"
> * nor may "Apache" appear in their name, without prior written
> * permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> * ====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> */
>
> package org.apache.commons.resources.impl;
>
> import org.apache.commons.resources.Resources;
> import org.apache.commons.resources.ResourcesException;
>
> /**
> * <p>Concrete implementation of
> * {@link org.apache.commons.resources.ResourcesFactory} that creates
> * {@link org.apache.commons.resources.Resources} instances that wraps
> * a Hibernate session and retrieves values for the given
> * <code>Locale</code> and have name suffixes reflecting the
> * <code>Locale</code> for which the document's messages apply.
> * For this specific implementation, resources are looked up in
> * a hierarchy of database values in a manner identical to that
> * performed by <code>java.util.ResourceBundle.getBundle().</code>.
> *
> * @author James Mitchell
> * @version $Revision: 1.1 $
> */
> public class HibernateResourcesFactory extends ResourcesFactoryBase {
>
>
> // ------------------------------------------------------ Protected
Methods
>
>
> /**
> * <p>Create and return a new {@link
org.apache.commons.resources.Resources}
> * instance with the specified logical name, after calling its
<code>init()</code>
> * method and delegating the relevant properties.</p>
> *
> * @param name Logical name of the {@link
org.apache.commons.resources.Resources}
> * instance to create
> *
> * @param config Configuration string for this resource (if any)
> *
> * @exception ResourcesException if a {@link
org.apache.commons.resources.Resources}
> * instance of the specified logical name cannot be created.
> */
> protected Resources createResources(String name, String config)
> throws ResourcesException {
>
> Resources res = new HibernateResources(name, config);
> res.setReturnNull(isReturnNull());
> res.init();
> return (res);
>
> }
>
>
> }
>
>
>
> 1.1
jakarta-commons-sandbox/resources/contrib/hibernate/src/test/org/apache/comm
ons/resources/impl/HibernateResourcesTestCase.java
>
> Index: HibernateResourcesTestCase.java
> ===================================================================
> /*
> * $Header:
/home/cvs/jakarta-commons-sandbox/resources/contrib/hibernate/src/test/org/a
pache/commons/resources/impl/HibernateResourcesTestCase.java,v 1.1
2004/02/06 13:26:09 jmitchell Exp $
> * $Revision: 1.1 $
> * $Date: 2004/02/06 13:26:09 $
> *
> * ====================================================================
> *
> * The Apache Software License, Version 1.1
> *
> * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution, if
> * any, must include the following acknowledgement:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgement may appear in the software
itself,
> * if and wherever such third-party acknowledgements normally appear.
> *
> * 4. The names, "Apache", "The Jakarta Project", "Commons", and "Apache
Software
> * Foundation" must not be used to endorse or promote products
derived
> * from this software without prior written permission. For written
> * permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache"
> * nor may "Apache" appear in their name, without prior written
> * permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> * ====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> */
> package org.apache.commons.resources.impl;
>
> import java.net.URL;
>
> import junit.framework.Test;
> import junit.framework.TestSuite;
>
> /**
> * <p>Unit tests for
> * <code>org.apache.commons.resources.impl.HibernateResources</code>.
> * </p>
> *
> * @author James Mitchell
> * @version $Revision: 1.1 $ $Date: 2004/02/06 13:26:09 $
> */
>
> public class HibernateResourcesTestCase
> extends CollectionResourcesBaseTestCase {
>
>
> // ----------------------------------------------------- Instance
Variables
>
>
> // -----------------------------------------------------------
Constructors
>
>
> public HibernateResourcesTestCase(String name) {
> super(name);
> }
>
>
> // --------------------------------------------------- Overall Test
Methods
>
>
> // Set up instance variables required by this test case
> public void setUp() throws Exception {
> factory = new HibernateResourcesFactory();
> resources = factory.getResources(
> NAME,
> "hibernate.cfg.xml");
> }
>
> // Return the tests included in this test suite
> public static Test suite() {
> return (new TestSuite(HibernateResourcesTestCase.class));
> }
>
> // Tear down the instance variables required by this test case
> public void tearDown() {
> resources = null;
> factory = null;
> }
>
>
> // ------------------------------------------------ Individual Test
Methods
>
>
> // ------------------------------------------------------ Protected
Methods
> protected String getBase() throws Exception
> {
> // default file name
> URL url =
> HibernateResourcesTestCase.class.getResource
> ("hibernate.cfg.xml");
>
> if (url == null) {
> fail("URL NOT FOUND");
> }
> String string = url.toExternalForm();
> String base = string.substring(0, string.length() - 11);
> return base;
> }
>
>
>
> }
>
>
>
> 1.1
jakarta-commons-sandbox/resources/contrib/hibernate/sql/mysql.sql
>
> Index: mysql.sql
> ===================================================================
> use the same script from the JDBC implementation.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [resources] new implementations [was: Re: cvs commit: jakart...]
Posted by "Craig R. McClanahan" <cr...@apache.org>.
Quoting James Mitchell <jm...@apache.org>:
>
> P.S.
>
> I'll be adding a few more items later tonight and/or this weekend:
> - a build script in resources/contrib that let's us produce
> a distribution of any single one of the implementations under
> contrib
> - a few docs
> - tutorial on how to setup and use these impls.
> - a plugin (location: jakarta-struts/contrib ????) that acts as
> a wrapper to the current (Struts 1.1) message resources api.
> This would let anyone use a current distribution of
> commons-resources with Struts 1.1 (going for the
> backwards-compatibility crowd)
>
>
> Future:
> - an iBatis implementation
> - a Torque implementation
> - a basic LDAP implementation
> - a [?? enter your choice ??] implementation
> - mods to all the current database impls that allow
> datasource configuration/pooling via JNDI
>
>
> Did I miss anything?
>
This list sounds awesome ... thanks James!
I agree that the Struts 1.1 wrapper should go in jakarta-struts/contrib ...
perhaps a new "resources-wrapper" subdirectory?
Craig
>
> --
> James Mitchell
> Software Engineer / Struts Evangelist
> http://www.struts-atlanta.org
> 678.910.8017 (cell)
> AIM: jmitchtx
> MSN: jmitchell@apache.org
>
>
>
> ----- Original Message -----
> From: <jm...@apache.org>
> To: <ja...@apache.org>
> Sent: Friday, February 06, 2004 8:26 AM
> Subject: cvs commit: jakarta-commons-sandbox/resources/contrib/hibernate/sql
> mysql.sql
>
>
> > jmitchell 2004/02/06 05:26:09
> >
> > Added: resources/contrib/hibernate/src/test hibernate.cfg.xml
> > hibernate.properties log4j.properties
> > oscache.properties
> >
> resources/contrib/hibernate/src/java/org/apache/commons/resources/impl
> > HibernateBasicMessage.hbm.xml
> > HibernateBasicMessage.java HibernateResources.java
> > HibernateResourcesFactory.java
> >
> resources/contrib/hibernate/src/test/org/apache/commons/resources/impl
> > HibernateResourcesTestCase.java
> > resources/contrib/hibernate/sql mysql.sql
> > Log:
> > Add new Database implementation that uses the
> > Hibernate O/R mapping framework. This particular
> > contribution was fully tested with the latest release
> > (2.1.2).
> >
> > Revision Changes Path
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/test/hibernate.cfg.x
> ml
> >
> > Index: hibernate.cfg.xml
> > ===================================================================
> > <?xml version='1.0' encoding="UTF-8"?>
> > <!DOCTYPE hibernate-configuration
> > PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
> > "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
> >
> > <hibernate-configuration>
> >
> > <session-factory>
> >
> > <!-- database connection -->
> > <property
> name="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect.java</propert
> y>
> > <property
> name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
> > <property
> name="hibernate.connection.url">jdbc:mysql://localhost/resources</property>
> > <property
> name="hibernate.connection.username">resourcesTest</property>
> > <property
> name="hibernate.connection.password">resourcesTest</property>
> > <property name="hibernate.connection.pool_size">4</property>
> > <property name="hibernate.statement_cache.size">100</property>
> > <property name="hibernate.show_sql">true</property>
> > <property name="hibernate.jdbc.batch_size">0</property>
> > <property
> name="hibernate.cglib.use_reflection_optimizer">true</property>
> >
> > <mapping
> resource="org/apache/commons/resources/impl/HibernateBasicMessage.hbm.xml"/>
> >
> > </session-factory>
> >
> > </hibernate-configuration>
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/test/hibernate.prope
> rties
> >
> > Index: hibernate.properties
> > ===================================================================
> > ######################
> > ### Query Language ###
> > ######################
> >
> > ## define query language constants / function names
> >
> > hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
> >
> >
> >
> > #################
> > ### Platforms ###
> > #################
> >
> > ## JNDI Datasource
> >
> > #hibernate.connection.datasource jdbc/test
> > #hibernate.connection.username db2
> > #hibernate.connection.password db2
> >
> >
> > ## HypersonicSQL
> >
> > hibernate.dialect net.sf.hibernate.dialect.HSQLDialect
> > hibernate.connection.driver_class org.hsqldb.jdbcDriver
> > hibernate.connection.username sa
> > hibernate.connection.password
> > hibernate.connection.url jdbc:hsqldb:hsql://localhost
> > hibernate.connection.url jdbc:hsqldb:test
> > hibernate.connection.url jdbc:hsqldb:.
> >
> >
> > ## PostgreSQL
> >
> > #hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect
> > #hibernate.connection.driver_class org.postgresql.Driver
> > #hibernate.connection.url jdbc:postgresql:template1
> > #hibernate.connection.username pg
> > #hibernate.connection.password
> > #hibernate.query.substitutions yes 'Y', no 'N'
> >
> >
> > ## DB2
> >
> > #hibernate.dialect net.sf.hibernate.dialect.DB2Dialect
> > #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
> > #hibernate.connection.url jdbc:db2:test
> > #hibernate.connection.username db2
> > #hibernate.connection.password db2
> >
> >
> > ## DB2/400
> >
> > #hibernate.dialect net.sf.hibernate.dialect.DB2400Dialect
> > #hibernate.connection.username user
> > #hibernate.connection.password password
> >
> > ## Native driver
> > #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
> > #hibernate.connection.url jdbc:db2://systemname
> >
> > ## Toolbox driver
> > #hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
> > #hibernate.connection.url jdbc:as400://systemname
> >
> >
> > ## MySQL
> >
> > #hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
> > #hibernate.connection.driver_class org.gjt.mm.mysql.Driver
> > #hibernate.connection.driver_class com.mysql.jdbc.Driver
> > #hibernate.connection.url jdbc:mysql:///test
> > #hibernate.connection.username root
> > #hibernate.connection.password
> >
> >
> > ## Oracle
> >
> > #hibernate.dialect net.sf.hibernate.dialect.Oracle9Dialect
> > #hibernate.dialect net.sf.hibernate.dialect.OracleDialect
> > #hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
> > #hibernate.connection.username ora
> > #hibernate.connection.password ora
> > #hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
> >
> >
> > ## Sybase
> >
> > #hibernate.dialect net.sf.hibernate.dialect.SybaseDialect
> > #hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
> > #hibernate.connection.username sa
> > #hibernate.connection.password sasasa
> > #hibernate.connection.rl jdbc:sybase:Tds:co3061835-a:5000/tempdb
> >
> >
> > ## Mckoi SQL
> >
> > #hibernate.dialect net.sf.hibernate.dialect.MckoiDialect
> > #hibernate.connection.driver_class com.mckoi.JDBCDriver
> > #hibernate.connection.url jdbc:mckoi:///
> > #hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
> > #hibernate.connection.username admin
> > #hibernate.connection.password nimda
> >
> >
> > ## SAP DB
> >
> > #hibernate.dialect net.sf.hibernate.dialect.SAPDBDialect
> > #hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB
> > #hibernate.connection.url jdbc:sapdb://localhost/TST
> > #hibernate.connection.username TEST
> > #hibernate.connection.password TEST
> > #hibernate.query.substitutions yes 'Y', no 'N'
> >
> >
> > ## MS SQL Server
> >
> > #hibernate.dialect net.sf.hibernate.dialect.SQLServerDialect
> > #hibernate.connection.username sa
> > #hibernate.connection.password sa
> >
> > ## JSQL Driver
> > #hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver
> > #hibernate.connection.url jdbc:JSQLConnect://1E1/test
> >
> > ## JTURBO Driver
> > #hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver
> > #hibernate.connection.url jdbc:JTurbo://1E1:1433/test
> >
> > ## WebLogic Driver
> > #hibernate.connection.driver_class weblogic.jdbc.mssqlserver4.Driver
> > #hibernate.connection.url jdbc:weblogic:mssqlserver4:1E1:1433
> >
> > ## Microsoft Driver (not recommended!)
> > #hibernate.connection.driver_class
> com.microsoft.jdbc.sqlserver.SQLServerDriver
> > #hibernate.connection.url
> jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor
> >
> > ## jTDS (not supported!)
> > #hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
> > #hibernate.connection.url
> jdbc:jtds:sqlserver://1E1/test;SelectMethod=cursor
> > #hibernate.jdbc.use_scrollable_resultset false
> >
> > ## Interbase
> >
> > #hibernate.dialect net.sf.hibernate.dialect.InterbaseDialect
> > #hibernate.connection.username sysdba
> > #hibernate.connection.password masterkey
> >
> > ## DO NOT specify hibernate.connection.sqlDialect
> >
> > ## InterClient
> >
> > #hibernate.connection.driver_class interbase.interclient.Driver
> > #hibernate.connection.url
> jdbc:interbase://localhost:3060/C:/firebird/test.gdb
> >
> > ## Pure Java
> >
> > #hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
> > #hibernate.connection.url
> jdbc:firebirdsql:localhost/3050:/firebird/test.gdb
> >
> >
> > ## Pointbase
> >
> > #hibernate.dialect net.sf.hibernate.dialect.PointbaseDialect
> > #hibernate.connection.driver_class
> com.pointbase.jdbc.jdbcUniversalDriver
> > #hibernate.connection.url jdbc:pointbase:embedded:sample
> > #hibernate.connection.username PBPUBLIC
> > #hibernate.connection.password PBPUBLIC
> >
> >
> >
> > #################################
> > ### Hibernate Connection Pool ###
> > #################################
> >
> > hibernate.connection.pool_size 1
> >
> >
> >
> > ###########################
> > ### C3P0 Connection Pool###
> > ###########################
> >
> > #hibernate.c3p0.max_size 2
> > #hibernate.c3p0.min_size 2
> > #hibernate.c3p0.timeout 5000
> > #hibernate.c3p0.max_statements 100
> > #hibernate.c3p0.idle_test_period 3000
> > #hibernate.c3p0.acquire_increment 2
> > ##hibernate.c3p0.validate false
> >
> >
> >
> > ###################################
> > ### Apache DBCP Connection Pool ###
> > ###################################
> >
> > ## connection pool
> >
> > #hibernate.dbcp.maxActive 100
> > #hibernate.dbcp.whenExhaustedAction 1
> > #hibernate.dbcp.maxWait 120000
> > #hibernate.dbcp.maxIdle 10
> >
> > ## prepared statement cache
> >
> > #hibernate.dbcp.ps.maxActive 100
> > #hibernate.dbcp.ps.whenExhaustedAction 1
> > #hibernate.dbcp.ps.maxWait 120000
> > #hibernate.dbcp.ps.maxIdle 10
> >
> > ## optional query to validate pooled connections:
> >
> > #hibernate.dbcp.validationQuery select 1 from dual
> > #hibernate.dbcp.testOnBorrow true
> > #hibernate.dbcp.testOnReturn false
> >
> >
> >
> > ##############################
> > ### Proxool Connection Pool###
> > ##############################
> >
> > ## Properties for external configuration of Proxool
> >
> > hibernate.proxool.pool_alias pool1
> >
> > ## Only need one of the following
> >
> > #hibernate.proxool.existing_pool true
> > #hibernate.proxool.xml proxool.xml
> > #hibernate.proxool.properties proxool.properties
> >
> > ## Or, alternatively, all of these
> > ## Standard configuration properties of Proxool
> >
> > #hibernate.proxool.house-keeping-sleep-time 30000
> > #hibernate.proxool.house-keeping-test-sql
> > #hibernate.proxool.maximum-connection-count 4
> > #hibernate.proxool.maximum-connection-lifetime 4
> > #hibernate.proxool.simultaneous-build-throttle 2
> > #hibernate.proxool.maximum-active-time 500
> > #hibernate.proxool.minimum-connection-count 2
> > #hibernate.proxool.fatal-sql-exception
> > #hibernate.proxool.prototype-count
> > #hibernate.proxool.statistics
> > #hibernate.proxool.recently-started-threshold
> > #hibernate.proxool.overload-without-refusal-lifetime
> >
> >
> >
> > #################################
> > ### Plugin ConnectionProvider ###
> > #################################
> >
> > ## use a custom ConnectionProvider (if not set, Hibernate will choose a
> built-in ConnectionProvider using hueristics)
> >
> > #hibernate.connection.provider_class
> net.sf.hibernate.connection.DriverManagerConnectionProvider
> > #hibernate.connection.provider_class
> net.sf.hibernate.connection.DatasourceConnectionProvider
> > #hibernate.connection.provider_class
> net.sf.hibernate.connection.C3P0ConnectionProvider
> > #hibernate.connection.provider_class
> net.sf.hibernate.connection.DBCPConnectionProvider
> > #hibernate.connection.provider_class
> net.sf.hibernate.connection.ProxoolConnectionProvider
> >
> >
> >
> > #######################
> > ### Transaction API ###
> > #######################
> >
> > ## the Transaction API abstracts application code from the underlying
> JTA or JDBC transactions
> >
> > #hibernate.transaction.factory_class
> net.sf.hibernate.transaction.JTATransactionFactory
> > #hibernate.transaction.factory_class
> net.sf.hibernate.transaction.JDBCTransactionFactory
> >
> >
> > ## to use JTATransactionFactory, Hibernate must be able to locate the
> UserTransaction in JNDI
> > ## default is java:comp/UserTransaction
> > ## you do NOT need this setting if you specify
> hibernate.transaction.manager_lookup_class
> >
> > #jta.UserTransaction jta/usertransaction
> > #jta.UserTransaction javax.transaction.UserTransaction
> > #jta.UserTransaction UserTransaction
> >
> >
> > ## to use JCS caching with JTA, Hibernate must be able to obtain the JTA
> TransactionManager
> >
> > #hibernate.transaction.manager_lookup_class
> net.sf.hibernate.transaction.JBossTransactionManagerLookup
> > #hibernate.transaction.manager_lookup_class
> net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
> > #hibernate.transaction.manager_lookup_class
> net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
> > #hibernate.transaction.manager_lookup_class
> net.sf.hibernate.transaction.OrionTransactionManagerLookup
> > #hibernate.transaction.manager_lookup_class
> net.sf.hibernate.transaction.ResinTransactionManagerLookup
> >
> >
> >
> > ##############################
> > ### Miscellaneous Settings ###
> > ##############################
> >
> > ## print all generated SQL to the console
> >
> > #hibernate.show_sql true
> >
> >
> > ## auto schema export
> >
> > #hibernate.hbm2ddl.auto create-drop
> > #hibernate.hbm2ddl.auto create
> > #hibernate.hbm2ddl.auto update
> >
> >
> > ## specify a JDBC isolation level
> >
> > #hibernate.connection.isolation 4
> >
> >
> > ## set the JDBC fetch size
> >
> > #hibernate.jdbc.fetch_size 25
> >
> >
> > ## set the maximum JDBC 2 batch size (a nonzero value enables batching)
> >
> > hibernate.jdbc.batch_size 0
> >
> >
> > ## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will
> cause Hibernate to use a sensible default)
> >
> > #hibernate.jdbc.use_scrollable_resultset true
> >
> >
> > ## use streams when writing binary types to / from JDBC
> >
> > hibernate.jdbc.use_streams_for_binary true
> >
> >
> > ## use JDBC 3 PreparedStatement.getGeneratedKeys to get the identifier
> of an inserted row
> >
> > #hibernate.jdbc.use_get_generated_keys true
> >
> >
> > ## specify a default schema for unqualified tablenames
> >
> > #hibernate.default_schema test
> >
> >
> > ## use a custom stylesheet for XML generation (if not specified,
> hibernate-default.xslt will be used)
> >
> > #hibernate.xml.output_stylesheet
> C:/Hibernate/net/sf/hibernate/hibernate-default.xslt
> >
> >
> > ## enable outerjoin fetching (specifying a Dialect will cause Hibernate
> to use sensible default)
> >
> > #hibernate.use_outer_join false
> >
> >
> > ## set the maximum depth of the outer join fetch tree
> >
> > hibernate.max_fetch_depth 1
> >
> >
> > ## enable CGLIB reflection optimizer (enabled by default)
> >
> > #hibernate.cglib.use_reflection_optimizer false
> >
> >
> >
> > ##########################
> > ### Second-level Cache ###
> > ##########################
> >
> > ## optimize chache for minimal "puts" instead of minimal "gets" (good
> for clustered cache)
> >
> > #hibernate.cache.use_minimal_puts true
> >
> >
> > ## enable the query cache
> >
> > hibernate.cache.use_query_cache true
> >
> >
> > ## choose a cache implementation
> >
> > #hibernate.cache.provider_class net.sf.ehcache.hibernate.Provider
> > #hibernate.cache.provider_class
> net.sf.hibernate.cache.EmptyCacheProvider
> > hibernate.cache.provider_class
> net.sf.hibernate.cache.HashtableCacheProvider
> > #hibernate.cache.provider_class net.sf.hibernate.cache.TreeCacheProvider
> > #hibernate.cache.provider_class net.sf.hibernate.cache.OSCacheProvider
> > #hibernate.cache.provider_class net.sf.hibernate.cache.JCSCacheProvider
> > #hibernate.cache.provider_class
> net.sf.hibernate.cache.SwarmCacheProvider
> >
> >
> >
> > ############
> > ### JNDI ###
> > ############
> >
> > ## specify a JNDI name for the SessionFactory
> >
> > #hibernate.session_factory_name hibernate/session_factory
> >
> >
> > ## Hibernate uses JNDI to bind a name to a SessionFactory and to look up
> the JTA UserTransaction;
> > ## if hibernate.jndi.* are not specified, Hibernate will use the default
> InitialContext() which
> > ## is the best approach in an application server
> >
> > #file system
> > #hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
> > #hibernate.jndi.url file:/
> >
> > #WebSphere
> > #hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
> > #hibernate.jndi.url iiop://localhost:900/
> >
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/test/log4j.propertie
> s
> >
> > Index: log4j.properties
> > ===================================================================
> > ### direct log messages to stdout ###
> > log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> > log4j.appender.stdout.Target=System.out
> > log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> > log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p
> %c{1}:%L - %m%n
> >
> > ### direct messages to file hibernate.log ###
> > #log4j.appender.file=org.apache.log4j.FileAppender
> > #log4j.appender.file.File=hibernate.log
> > #log4j.appender.file.layout=org.apache.log4j.PatternLayout
> > #log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p
> %c{1}:%L - %m%n
> >
> > ### set log levels - for more verbose logging change 'info' to 'debug'
> ###
> >
> > log4j.rootLogger=warn, stdout
> >
> > log4j.logger.net.sf.hibernate=info
> >
> > ### log just the SQL
> > #log4j.logger.net.sf.hibernate.SQL=debug
> >
> > ### log JDBC bind parameters ###
> > log4j.logger.net.sf.hibernate.type=info
> >
> > ### log schema export/update ###
> > log4j.logger.net.sf.hibernate.tool.hbm2ddl=debug
> >
> > ### log cache activity ###
> > #log4j.logger.net.sf.hibernate.cache=debug
> >
> > ### enable the following line if you want to track down connection ###
> > ### leakages when using DriverManagerConnectionProvider ###
> >
> #log4j.logger.net.sf.hibernate.connection.DriverManagerConnectionProvider=tr
> ace
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/test/oscache.propert
> ies
> >
> > Index: oscache.properties
> > ===================================================================
> > # CACHE IN MEMORY
> > #
> > # If you want to disable memory caching, just uncomment this line.
> > #
> > # cache.memory=false
> >
> >
> > # CACHE KEY
> > #
> > # This is the key that will be used to store the cache in the
> application
> > # and session scope.
> > #
> > # If you want to set the cache key to anything other than the default
> > # uncomment this line and change the cache.key
> > #
> > # cache.key=__oscache_cache
> >
> >
> > # USE HOST DOMAIN NAME IN KEY
> > #
> > # Servers for multiple host domains may wish to add host name info to
> > # the generation of the key. If this is true, then uncomment the
> > # following line.
> > #
> > # cache.use.host.domain.in.key=true
> >
> >
> > # CACHE LISTENERS
> > #
> > # These hook OSCache events and perform various actions such as logging
> > # cache hits and misses, or broadcasting to other cache instances across
> a cluster.
> > # See the documentation for further information.
> > #
> > #
> cache.event.listeners=com.opensymphony.oscache.plugins.clustersupport.JMSBro
> adcastingListener, \
> > #
> com.opensymphony.oscache.extra.CacheEntryEventListenerImpl, \
> > #
> com.opensymphony.oscache.extra.CacheMapAccessEventListenerImpl, \
> > #
> com.opensymphony.oscache.extra.ScopeEventListenerImpl
> >
> >
> > # CACHE PERSISTENCE CLASS
> > #
> > # Specify the class to use for persistence. If you use the supplied
> DiskPersistenceListener,
> > # don't forget to supply the cache.path property to specify the location
> of the cache
> > # directory.
> > #
> > # If a persistence class is not specified, OSCache will use memory
> caching only.
> > #
> > #
> cache.persistence.class=com.opensymphony.oscache.plugins.diskpersistence.Dis
> kPersistenceListener
> >
> >
> > # CACHE DIRECTORY
> > #
> > # This is the directory on disk where caches will be stored by the
> DiskPersistenceListener.
> > # it will be created if it doesn't already exist. Remember that OSCache
> must have
> > # write permission to this directory.
> > #
> > # Note: for Windows machines, this needs \ to be escaped
> > # ie Windows:
> > # cache.path=c:\\myapp\\cache
> > # or *ix:
> > # cache.path=/opt/myapp/cache
> > #
> > # cache.path=c:\\app\\cache
> >
> >
> > # CACHE ALGORITHM
> > #
> > # Default cache algorithm to use. Note that in order to use an algorithm
> > # the cache size must also be specified. If the cache size is not
> specified,
> > # the cache algorithm will be Unlimited cache.
> > #
> > # cache.algorithm=com.opensymphony.oscache.base.algorithm.LRUCache
> > # cache.algorithm=com.opensymphony.oscache.base.algorithm.FIFOCache
> > # cache.algorithm=com.opensymphony.oscache.base.algorithm.UnlimitedCache
> >
> >
> > # CACHE SIZE
> > #
> > # Default cache size in number of items. If a size is specified but not
> > # an algorithm, the cache algorithm used will be LRUCache.
> > #
> > cache.capacity=1000
> >
> >
> > # CACHE UNLIMITED DISK
> > # Use unlimited disk cache or not. The default value is false, which
> means
> > # the disk cache will be limited in size to the value specified by
> cache.capacity.
> > #
> > # cache.unlimited.disk=false
> >
> >
> > # JMS CLUSTER PROPERTIES
> > #
> > # Configuration properties for JMS clustering. See the clustering
> documentation
> > # for more information on these settings.
> > #
> >
> #cache.cluster.jms.topic.factory=java:comp/env/jms/TopicConnectionFactory
> > #cache.cluster.jms.topic.name=java:comp/env/jms/OSCacheTopic
> > #cache.cluster.jms.node.name=node1
> >
> >
> > # JAVAGROUPS CLUSTER PROPERTIES
> > #
> > # Configuration properites for the JavaGroups clustering. Only one of
> these
> > # should be specified. Default values (as shown below) will be used if
> niether
> > # property is set. See the clustering documentation and the JavaGroups
> project
> > # (www.javagroups.com) for more information on these settings.
> > #
> >
> #cache.cluster.properties=UDP(mcast_addr=231.12.21.132;mcast_port=45566;ip_t
> tl=32;mcast_send_buf_size=150000;mcast_recv_buf_size=80000):PING(timeout=200
> 0;num_initial_members=3):MERGE2(min_interval=5000;max_interval=10000):FD_SOC
> K:VERIFY_SUSPECT(timeout=1500):pbcast.NAKACK(gc_lag=50;retransmit_timeout=30
> 0,600,1200,2400,4800):pbcast.STABLE(desired_avg_gossip=20000):UNICAST(timeou
> t=5000):FRAG(frag_size=8096;down_thread=false;up_thread=false):pbcast.GMS(jo
> in_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=true)
> > #cache.cluster.multicast.ip=231.12.21.132
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/apache/comm
> ons/resources/impl/HibernateBasicMessage.hbm.xml
> >
> > Index: HibernateBasicMessage.hbm.xml
> > ===================================================================
> > <?xml version="1.0"?>
> > <!DOCTYPE hibernate-mapping SYSTEM
> > "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
> >
> >
> > <hibernate-mapping>
> >
> > <class
> name="org.apache.commons.resources.impl.HibernateBasicMessage"
> table="resources">
> >
> > <composite-id>
> > <key-property name="locale" type="java.lang.String" column="locale"/>
> > <key-property name="key" type="java.lang.String" column="msgKey"/>
> > </composite-id>
> >
> > <property name="value" type="java.lang.String" column="val"/>
> > </class>
> >
> > <query name="QueryByLocale">
> >
> > from
> > org.apache.commons.resources.impl.HibernateBasicMessage as msgRes
> > where
> > msgRes.locale = ?
> >
> > </query>
> >
> > </hibernate-mapping>
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/apache/comm
> ons/resources/impl/HibernateBasicMessage.java
> >
> > Index: HibernateBasicMessage.java
> > ===================================================================
> > /*
> > * $Header:
> /home/cvs/jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/a
> pache/commons/resources/impl/HibernateBasicMessage.java,v 1.1 2004/02/06
> 13:26:09 jmitchell Exp $
> > * $Revision: 1.1 $
> > * $Date: 2004/02/06 13:26:09 $
> > *
> > * ====================================================================
> > *
> > * The Apache Software License, Version 1.1
> > *
> > * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
> > * reserved.
> > *
> > * Redistribution and use in source and binary forms, with or without
> > * modification, are permitted provided that the following conditions
> > * are met:
> > *
> > * 1. Redistributions of source code must retain the above copyright
> > * notice, this list of conditions and the following disclaimer.
> > *
> > * 2. Redistributions in binary form must reproduce the above copyright
> > * notice, this list of conditions and the following disclaimer in
> > * the documentation and/or other materials provided with the
> > * distribution.
> > *
> > * 3. The end-user documentation included with the redistribution, if
> > * any, must include the following acknowledgement:
> > * "This product includes software developed by the
> > * Apache Software Foundation (http://www.apache.org/)."
> > * Alternately, this acknowledgement may appear in the software
> itself,
> > * if and wherever such third-party acknowledgements normally appear.
> > *
> > * 4. The names, "Apache", "The Jakarta Project", "Commons", and "Apache
> Software
> > * Foundation" must not be used to endorse or promote products
> derived
> > * from this software without prior written permission. For written
> > * permission, please contact apache@apache.org.
> > *
> > * 5. Products derived from this software may not be called "Apache"
> > * nor may "Apache" appear in their name, without prior written
> > * permission of the Apache Software Foundation.
> > *
> > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> > * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> > * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> > * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> > * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> > * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> > * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> > * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> > * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> > * SUCH DAMAGE.
> > * ====================================================================
> > *
> > * This software consists of voluntary contributions made by many
> > * individuals on behalf of the Apache Software Foundation. For more
> > * information on the Apache Software Foundation, please see
> > * <http://www.apache.org/>.
> > *
> > */
> >
> > package org.apache.commons.resources.impl;
> >
> >
> > /**
> > * BasicMessage to allow standard Hibernate
> > * configuration (no complex keys).
> > *
> > * @author James Mitchell
> > *
> > */
> > public class HibernateBasicMessage extends BasicMessage {
> >
> > public HibernateBasicMessage() {
> > super();
> > }
> > /**
> > *
> > * @param id The id (primary key) for this message.
> > * @param locale The locale used to retrieve the value for the
> specified key
> > * @param key The key for this message.
> > * @param value The value for this message.
> > */
> > public HibernateBasicMessage(Long id, String locale, String key,
> Object[] values) {
> > super(key, values);
> > this.id = id;
> > this.locale = locale;
> >
> > }
> >
> > private Long id = null;
> > private String locale = null;
> >
> > /**
> > * @return Returns the id.
> > */
> > public Long getId() {
> > return id;
> > }
> >
> > /**
> > * @param id The id to set.
> > */
> > public void setId(Long id) {
> > this.id = id;
> > }
> > /**
> > * @return Returns the locale.
> > */
> > public String getLocale() {
> > return locale;
> > }
> > /**
> > * @param locale The locale to set.
> > */
> > public void setLocale(String locale) {
> > this.locale = locale;
> > }
> >
> > public void setKey(String key) {
> > this.key = key;
> > }
> > public void setValue(String value) {
> > this.values = new String[]{value};
> > }
> > public String getValue() {
> > if (values == null || values.length < 1) {
> > throw new IllegalStateException("The retrived value for msg
> " +
> > this.key + "was null");
> > }
> > if (values.length > 1) {
> > throw new IllegalStateException("There were more than one
> values " +
> > "retrived value for msg " +
> > this.key);
> > }
> > return (String)getValues()[0];
> > }
> >
> > public boolean equals(Object obj) {
> > return super.equals(obj);
> > }
> >
> > public int hashCode() {
> > return super.hashCode();
> > }
> > }
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/apache/comm
> ons/resources/impl/HibernateResources.java
> >
> > Index: HibernateResources.java
> > ===================================================================
> > /*
> > * $Header:
> /home/cvs/jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/a
> pache/commons/resources/impl/HibernateResources.java,v 1.1 2004/02/06
> 13:26:09 jmitchell Exp $
> > * $Revision: 1.1 $
> > * $Date: 2004/02/06 13:26:09 $
> > *
> > * ====================================================================
> > *
> > * The Apache Software License, Version 1.1
> > *
> > * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
> > * reserved.
> > *
> > * Redistribution and use in source and binary forms, with or without
> > * modification, are permitted provided that the following conditions
> > * are met:
> > *
> > * 1. Redistributions of source code must retain the above copyright
> > * notice, this list of conditions and the following disclaimer.
> > *
> > * 2. Redistributions in binary form must reproduce the above copyright
> > * notice, this list of conditions and the following disclaimer in
> > * the documentation and/or other materials provided with the
> > * distribution.
> > *
> > * 3. The end-user documentation included with the redistribution, if
> > * any, must include the following acknowledgement:
> > * "This product includes software developed by the
> > * Apache Software Foundation (http://www.apache.org/)."
> > * Alternately, this acknowledgement may appear in the software
> itself,
> > * if and wherever such third-party acknowledgements normally appear.
> > *
> > * 4. The names, "Apache", "The Jakarta Project", "Commons", and "Apache
> Software
> > * Foundation" must not be used to endorse or promote products
> derived
> > * from this software without prior written permission. For written
> > * permission, please contact apache@apache.org.
> > *
> > * 5. Products derived from this software may not be called "Apache"
> > * nor may "Apache" appear in their name, without prior written
> > * permission of the Apache Software Foundation.
> > *
> > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> > * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> > * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> > * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> > * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> > * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> > * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> > * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> > * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> > * SUCH DAMAGE.
> > * ====================================================================
> > *
> > * This software consists of voluntary contributions made by many
> > * individuals on behalf of the Apache Software Foundation. For more
> > * information on the Apache Software Foundation, please see
> > * <http://www.apache.org/>.
> > *
> > */
> >
> > package org.apache.commons.resources.impl;
> >
> > import java.util.Iterator;
> > import java.util.List;
> > import java.util.Locale;
> > import java.util.Map;
> > import java.util.Properties;
> >
> > import net.sf.hibernate.HibernateException;
> > import net.sf.hibernate.Query;
> > import net.sf.hibernate.Session;
> > import net.sf.hibernate.SessionFactory;
> > import net.sf.hibernate.cfg.Configuration;
> >
> > import org.apache.commons.logging.Log;
> > import org.apache.commons.logging.LogFactory;
> > import org.apache.commons.resources.ResourcesException;
> >
> > /**
> > * <p>Concrete implementation of
> > * {@link org.apache.commons.resources.Resources} that wraps a
> > * Hibernate session and retrieves values for the given
> > * <code>Locale</code> and have name suffixes reflecting the
> > * <code>Locale</code> for which the document's messages apply.
> > * For this specific implementation, resources are looked up in
> > * a hierarchy of database values in a manner identical to that
> > * performed by <code>java.util.ResourceBundle.getBundle().</code>.
> > * </p>
> > *
> > * <p>The base URL passed to our constructor must contain the base name
> > * of a the hibernate configuration file.</p>
> > *
> > * @author James Mitchell
> > * @version $Revision: 1.1 $ $Date: 2004/02/06 13:26:09 $
> > */
> > public class HibernateResources extends CollectionResourcesBase {
> >
> > /**
> > * <p>The <code>Log</code> instance for this class.</p>
> > */
> > private static final Log log =
> LogFactory.getLog(HibernateResources.class);
> >
> > // -----------------------------------------------------------
> Constructors
> >
> > /**
> > * <p>Create a new
> > * {@link org.apache.commons.resources.Resources} instance with the
> specified
> > * logical name and base resource URL.</p>
> > *
> > * @param name Logical name of the new instance
> > * @param base Base URL of the Hibernate configuration file.
> > */
> > public HibernateResources(String name, String base) {
> > super(name, base);
> > }
> >
> >
> > // ------------------------------------------------------ Protected
> Methods
> >
> >
> > /**
> > * <p>Return a <code>Map</code> containing the name-value mappings
> for
> > * the specified base URL and requested <code>Locale</code>, if
> there
> > * are any. If there are no defined mappings for the specified
> > * <code>Locale</code>, return an empty <code>Map</code>
> instead.</p>
> > *
> > * <p>Concrete subclasses must override this method to perform the
> > * appropriate lookup. A typical implementation will construct an
> > * absolute URL based on the specified base URL and
> <code>Locale</code>,
> > * retrieve the specified resource file (if any), and parse it into
> > * a <code>Map</code> structure.</p>
> > *
> > * <p>Caching of previously retrieved <code>Map</code>s (if any)
> should
> > * be performed by callers of this method. Therefore, this method
> should
> > * always attempt to retrieve the specified resource and load it
> > * appropriately.</p>
> > *
> > * @param baseUrl Base URL of the resource files for this
> > * {@link org.apache.commons.resources.Resources} instance
> > * @param locale <code>Locale</code> for which name-value mappings
> > * are requested
> > */
> > protected Map getLocaleMap(String baseUrl, Locale locale) {
> >
> > if (log.isDebugEnabled()) {
> > log.debug("Loading database configuration'" + locale + "'
> resources from base '" +
> > baseUrl + "'");
> > }
> >
> > Properties props = new Properties();
> > Session session = null;
> > try {
> > // TODO - change this to load the specified hibernate config
> file (baseUrl)
> > SessionFactory sessionFactory =
> > new Configuration().configure().buildSessionFactory();
> > session = sessionFactory.openSession();
> > Query q = session.getNamedQuery("QueryByLocale");
> > q.setString(0, locale.toString());
> > q.list();
> > List msgs = q.list();
> > for (Iterator iter = msgs.iterator(); iter.hasNext();) {
> > HibernateBasicMessage msg = (HibernateBasicMessage)
> iter.next();
> > props.put(msg.getKey(), msg.getValue());
> > }
> > session.close();
> >
> > } catch (HibernateException e) {
> > e.printStackTrace();
> > }
> >
> > return props;
> >
> >
> >
> > }
> >
> >
> > public void init() throws ResourcesException {
> > super.init();
> > }
> > }
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/apache/comm
> ons/resources/impl/HibernateResourcesFactory.java
> >
> > Index: HibernateResourcesFactory.java
> > ===================================================================
> > /*
> > * $Header:
> /home/cvs/jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/a
> pache/commons/resources/impl/HibernateResourcesFactory.java,v 1.1 2004/02/06
> 13:26:09 jmitchell Exp $
> > * $Revision: 1.1 $
> > * $Date: 2004/02/06 13:26:09 $
> > *
> > * ====================================================================
> > *
> > * The Apache Software License, Version 1.1
> > *
> > * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
> > * reserved.
> > *
> > * Redistribution and use in source and binary forms, with or without
> > * modification, are permitted provided that the following conditions
> > * are met:
> > *
> > * 1. Redistributions of source code must retain the above copyright
> > * notice, this list of conditions and the following disclaimer.
> > *
> > * 2. Redistributions in binary form must reproduce the above copyright
> > * notice, this list of conditions and the following disclaimer in
> > * the documentation and/or other materials provided with the
> > * distribution.
> > *
> > * 3. The end-user documentation included with the redistribution, if
> > * any, must include the following acknowledgement:
> > * "This product includes software developed by the
> > * Apache Software Foundation (http://www.apache.org/)."
> > * Alternately, this acknowledgement may appear in the software
> itself,
> > * if and wherever such third-party acknowledgements normally appear.
> > *
> > * 4. The names, "Apache", "The Jakarta Project", "Commons", and "Apache
> Software
> > * Foundation" must not be used to endorse or promote products
> derived
> > * from this software without prior written permission. For written
> > * permission, please contact apache@apache.org.
> > *
> > * 5. Products derived from this software may not be called "Apache"
> > * nor may "Apache" appear in their name, without prior written
> > * permission of the Apache Software Foundation.
> > *
> > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> > * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> > * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> > * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> > * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> > * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> > * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> > * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> > * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> > * SUCH DAMAGE.
> > * ====================================================================
> > *
> > * This software consists of voluntary contributions made by many
> > * individuals on behalf of the Apache Software Foundation. For more
> > * information on the Apache Software Foundation, please see
> > * <http://www.apache.org/>.
> > *
> > */
> >
> > package org.apache.commons.resources.impl;
> >
> > import org.apache.commons.resources.Resources;
> > import org.apache.commons.resources.ResourcesException;
> >
> > /**
> > * <p>Concrete implementation of
> > * {@link org.apache.commons.resources.ResourcesFactory} that creates
> > * {@link org.apache.commons.resources.Resources} instances that wraps
> > * a Hibernate session and retrieves values for the given
> > * <code>Locale</code> and have name suffixes reflecting the
> > * <code>Locale</code> for which the document's messages apply.
> > * For this specific implementation, resources are looked up in
> > * a hierarchy of database values in a manner identical to that
> > * performed by <code>java.util.ResourceBundle.getBundle().</code>.
> > *
> > * @author James Mitchell
> > * @version $Revision: 1.1 $
> > */
> > public class HibernateResourcesFactory extends ResourcesFactoryBase {
> >
> >
> > // ------------------------------------------------------ Protected
> Methods
> >
> >
> > /**
> > * <p>Create and return a new {@link
> org.apache.commons.resources.Resources}
> > * instance with the specified logical name, after calling its
> <code>init()</code>
> > * method and delegating the relevant properties.</p>
> > *
> > * @param name Logical name of the {@link
> org.apache.commons.resources.Resources}
> > * instance to create
> > *
> > * @param config Configuration string for this resource (if any)
> > *
> > * @exception ResourcesException if a {@link
> org.apache.commons.resources.Resources}
> > * instance of the specified logical name cannot be created.
> > */
> > protected Resources createResources(String name, String config)
> > throws ResourcesException {
> >
> > Resources res = new HibernateResources(name, config);
> > res.setReturnNull(isReturnNull());
> > res.init();
> > return (res);
> >
> > }
> >
> >
> > }
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/test/org/apache/comm
> ons/resources/impl/HibernateResourcesTestCase.java
> >
> > Index: HibernateResourcesTestCase.java
> > ===================================================================
> > /*
> > * $Header:
> /home/cvs/jakarta-commons-sandbox/resources/contrib/hibernate/src/test/org/a
> pache/commons/resources/impl/HibernateResourcesTestCase.java,v 1.1
> 2004/02/06 13:26:09 jmitchell Exp $
> > * $Revision: 1.1 $
> > * $Date: 2004/02/06 13:26:09 $
> > *
> > * ====================================================================
> > *
> > * The Apache Software License, Version 1.1
> > *
> > * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
> > * reserved.
> > *
> > * Redistribution and use in source and binary forms, with or without
> > * modification, are permitted provided that the following conditions
> > * are met:
> > *
> > * 1. Redistributions of source code must retain the above copyright
> > * notice, this list of conditions and the following disclaimer.
> > *
> > * 2. Redistributions in binary form must reproduce the above copyright
> > * notice, this list of conditions and the following disclaimer in
> > * the documentation and/or other materials provided with the
> > * distribution.
> > *
> > * 3. The end-user documentation included with the redistribution, if
> > * any, must include the following acknowledgement:
> > * "This product includes software developed by the
> > * Apache Software Foundation (http://www.apache.org/)."
> > * Alternately, this acknowledgement may appear in the software
> itself,
> > * if and wherever such third-party acknowledgements normally appear.
> > *
> > * 4. The names, "Apache", "The Jakarta Project", "Commons", and "Apache
> Software
> > * Foundation" must not be used to endorse or promote products
> derived
> > * from this software without prior written permission. For written
> > * permission, please contact apache@apache.org.
> > *
> > * 5. Products derived from this software may not be called "Apache"
> > * nor may "Apache" appear in their name, without prior written
> > * permission of the Apache Software Foundation.
> > *
> > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> > * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> > * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> > * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> > * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> > * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> > * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> > * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> > * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> > * SUCH DAMAGE.
> > * ====================================================================
> > *
> > * This software consists of voluntary contributions made by many
> > * individuals on behalf of the Apache Software Foundation. For more
> > * information on the Apache Software Foundation, please see
> > * <http://www.apache.org/>.
> > *
> > */
> > package org.apache.commons.resources.impl;
> >
> > import java.net.URL;
> >
> > import junit.framework.Test;
> > import junit.framework.TestSuite;
> >
> > /**
> > * <p>Unit tests for
> > * <code>org.apache.commons.resources.impl.HibernateResources</code>.
> > * </p>
> > *
> > * @author James Mitchell
> > * @version $Revision: 1.1 $ $Date: 2004/02/06 13:26:09 $
> > */
> >
> > public class HibernateResourcesTestCase
> > extends CollectionResourcesBaseTestCase {
> >
> >
> > // ----------------------------------------------------- Instance
> Variables
> >
> >
> > // -----------------------------------------------------------
> Constructors
> >
> >
> > public HibernateResourcesTestCase(String name) {
> > super(name);
> > }
> >
> >
> > // --------------------------------------------------- Overall Test
> Methods
> >
> >
> > // Set up instance variables required by this test case
> > public void setUp() throws Exception {
> > factory = new HibernateResourcesFactory();
> > resources = factory.getResources(
> > NAME,
> > "hibernate.cfg.xml");
> > }
> >
> > // Return the tests included in this test suite
> > public static Test suite() {
> > return (new TestSuite(HibernateResourcesTestCase.class));
> > }
> >
> > // Tear down the instance variables required by this test case
> > public void tearDown() {
> > resources = null;
> > factory = null;
> > }
> >
> >
> > // ------------------------------------------------ Individual Test
> Methods
> >
> >
> > // ------------------------------------------------------ Protected
> Methods
> > protected String getBase() throws Exception
> > {
> > // default file name
> > URL url =
> > HibernateResourcesTestCase.class.getResource
> > ("hibernate.cfg.xml");
> >
> > if (url == null) {
> > fail("URL NOT FOUND");
> > }
> > String string = url.toExternalForm();
> > String base = string.substring(0, string.length() - 11);
> > return base;
> > }
> >
> >
> >
> > }
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/sql/mysql.sql
> >
> > Index: mysql.sql
> > ===================================================================
> > use the same script from the JDBC implementation.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [resources] new implementations [was: Re: cvs commit: jakart...]
Posted by "Craig R. McClanahan" <cr...@apache.org>.
Quoting James Mitchell <jm...@apache.org>:
>
> P.S.
>
> I'll be adding a few more items later tonight and/or this weekend:
> - a build script in resources/contrib that let's us produce
> a distribution of any single one of the implementations under
> contrib
> - a few docs
> - tutorial on how to setup and use these impls.
> - a plugin (location: jakarta-struts/contrib ????) that acts as
> a wrapper to the current (Struts 1.1) message resources api.
> This would let anyone use a current distribution of
> commons-resources with Struts 1.1 (going for the
> backwards-compatibility crowd)
>
>
> Future:
> - an iBatis implementation
> - a Torque implementation
> - a basic LDAP implementation
> - a [?? enter your choice ??] implementation
> - mods to all the current database impls that allow
> datasource configuration/pooling via JNDI
>
>
> Did I miss anything?
>
This list sounds awesome ... thanks James!
I agree that the Struts 1.1 wrapper should go in jakarta-struts/contrib ...
perhaps a new "resources-wrapper" subdirectory?
Craig
>
> --
> James Mitchell
> Software Engineer / Struts Evangelist
> http://www.struts-atlanta.org
> 678.910.8017 (cell)
> AIM: jmitchtx
> MSN: jmitchell@apache.org
>
>
>
> ----- Original Message -----
> From: <jm...@apache.org>
> To: <ja...@apache.org>
> Sent: Friday, February 06, 2004 8:26 AM
> Subject: cvs commit: jakarta-commons-sandbox/resources/contrib/hibernate/sql
> mysql.sql
>
>
> > jmitchell 2004/02/06 05:26:09
> >
> > Added: resources/contrib/hibernate/src/test hibernate.cfg.xml
> > hibernate.properties log4j.properties
> > oscache.properties
> >
> resources/contrib/hibernate/src/java/org/apache/commons/resources/impl
> > HibernateBasicMessage.hbm.xml
> > HibernateBasicMessage.java HibernateResources.java
> > HibernateResourcesFactory.java
> >
> resources/contrib/hibernate/src/test/org/apache/commons/resources/impl
> > HibernateResourcesTestCase.java
> > resources/contrib/hibernate/sql mysql.sql
> > Log:
> > Add new Database implementation that uses the
> > Hibernate O/R mapping framework. This particular
> > contribution was fully tested with the latest release
> > (2.1.2).
> >
> > Revision Changes Path
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/test/hibernate.cfg.x
> ml
> >
> > Index: hibernate.cfg.xml
> > ===================================================================
> > <?xml version='1.0' encoding="UTF-8"?>
> > <!DOCTYPE hibernate-configuration
> > PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
> > "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
> >
> > <hibernate-configuration>
> >
> > <session-factory>
> >
> > <!-- database connection -->
> > <property
> name="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect.java</propert
> y>
> > <property
> name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
> > <property
> name="hibernate.connection.url">jdbc:mysql://localhost/resources</property>
> > <property
> name="hibernate.connection.username">resourcesTest</property>
> > <property
> name="hibernate.connection.password">resourcesTest</property>
> > <property name="hibernate.connection.pool_size">4</property>
> > <property name="hibernate.statement_cache.size">100</property>
> > <property name="hibernate.show_sql">true</property>
> > <property name="hibernate.jdbc.batch_size">0</property>
> > <property
> name="hibernate.cglib.use_reflection_optimizer">true</property>
> >
> > <mapping
> resource="org/apache/commons/resources/impl/HibernateBasicMessage.hbm.xml"/>
> >
> > </session-factory>
> >
> > </hibernate-configuration>
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/test/hibernate.prope
> rties
> >
> > Index: hibernate.properties
> > ===================================================================
> > ######################
> > ### Query Language ###
> > ######################
> >
> > ## define query language constants / function names
> >
> > hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
> >
> >
> >
> > #################
> > ### Platforms ###
> > #################
> >
> > ## JNDI Datasource
> >
> > #hibernate.connection.datasource jdbc/test
> > #hibernate.connection.username db2
> > #hibernate.connection.password db2
> >
> >
> > ## HypersonicSQL
> >
> > hibernate.dialect net.sf.hibernate.dialect.HSQLDialect
> > hibernate.connection.driver_class org.hsqldb.jdbcDriver
> > hibernate.connection.username sa
> > hibernate.connection.password
> > hibernate.connection.url jdbc:hsqldb:hsql://localhost
> > hibernate.connection.url jdbc:hsqldb:test
> > hibernate.connection.url jdbc:hsqldb:.
> >
> >
> > ## PostgreSQL
> >
> > #hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect
> > #hibernate.connection.driver_class org.postgresql.Driver
> > #hibernate.connection.url jdbc:postgresql:template1
> > #hibernate.connection.username pg
> > #hibernate.connection.password
> > #hibernate.query.substitutions yes 'Y', no 'N'
> >
> >
> > ## DB2
> >
> > #hibernate.dialect net.sf.hibernate.dialect.DB2Dialect
> > #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
> > #hibernate.connection.url jdbc:db2:test
> > #hibernate.connection.username db2
> > #hibernate.connection.password db2
> >
> >
> > ## DB2/400
> >
> > #hibernate.dialect net.sf.hibernate.dialect.DB2400Dialect
> > #hibernate.connection.username user
> > #hibernate.connection.password password
> >
> > ## Native driver
> > #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
> > #hibernate.connection.url jdbc:db2://systemname
> >
> > ## Toolbox driver
> > #hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
> > #hibernate.connection.url jdbc:as400://systemname
> >
> >
> > ## MySQL
> >
> > #hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
> > #hibernate.connection.driver_class org.gjt.mm.mysql.Driver
> > #hibernate.connection.driver_class com.mysql.jdbc.Driver
> > #hibernate.connection.url jdbc:mysql:///test
> > #hibernate.connection.username root
> > #hibernate.connection.password
> >
> >
> > ## Oracle
> >
> > #hibernate.dialect net.sf.hibernate.dialect.Oracle9Dialect
> > #hibernate.dialect net.sf.hibernate.dialect.OracleDialect
> > #hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
> > #hibernate.connection.username ora
> > #hibernate.connection.password ora
> > #hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
> >
> >
> > ## Sybase
> >
> > #hibernate.dialect net.sf.hibernate.dialect.SybaseDialect
> > #hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
> > #hibernate.connection.username sa
> > #hibernate.connection.password sasasa
> > #hibernate.connection.rl jdbc:sybase:Tds:co3061835-a:5000/tempdb
> >
> >
> > ## Mckoi SQL
> >
> > #hibernate.dialect net.sf.hibernate.dialect.MckoiDialect
> > #hibernate.connection.driver_class com.mckoi.JDBCDriver
> > #hibernate.connection.url jdbc:mckoi:///
> > #hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
> > #hibernate.connection.username admin
> > #hibernate.connection.password nimda
> >
> >
> > ## SAP DB
> >
> > #hibernate.dialect net.sf.hibernate.dialect.SAPDBDialect
> > #hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB
> > #hibernate.connection.url jdbc:sapdb://localhost/TST
> > #hibernate.connection.username TEST
> > #hibernate.connection.password TEST
> > #hibernate.query.substitutions yes 'Y', no 'N'
> >
> >
> > ## MS SQL Server
> >
> > #hibernate.dialect net.sf.hibernate.dialect.SQLServerDialect
> > #hibernate.connection.username sa
> > #hibernate.connection.password sa
> >
> > ## JSQL Driver
> > #hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver
> > #hibernate.connection.url jdbc:JSQLConnect://1E1/test
> >
> > ## JTURBO Driver
> > #hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver
> > #hibernate.connection.url jdbc:JTurbo://1E1:1433/test
> >
> > ## WebLogic Driver
> > #hibernate.connection.driver_class weblogic.jdbc.mssqlserver4.Driver
> > #hibernate.connection.url jdbc:weblogic:mssqlserver4:1E1:1433
> >
> > ## Microsoft Driver (not recommended!)
> > #hibernate.connection.driver_class
> com.microsoft.jdbc.sqlserver.SQLServerDriver
> > #hibernate.connection.url
> jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor
> >
> > ## jTDS (not supported!)
> > #hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
> > #hibernate.connection.url
> jdbc:jtds:sqlserver://1E1/test;SelectMethod=cursor
> > #hibernate.jdbc.use_scrollable_resultset false
> >
> > ## Interbase
> >
> > #hibernate.dialect net.sf.hibernate.dialect.InterbaseDialect
> > #hibernate.connection.username sysdba
> > #hibernate.connection.password masterkey
> >
> > ## DO NOT specify hibernate.connection.sqlDialect
> >
> > ## InterClient
> >
> > #hibernate.connection.driver_class interbase.interclient.Driver
> > #hibernate.connection.url
> jdbc:interbase://localhost:3060/C:/firebird/test.gdb
> >
> > ## Pure Java
> >
> > #hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
> > #hibernate.connection.url
> jdbc:firebirdsql:localhost/3050:/firebird/test.gdb
> >
> >
> > ## Pointbase
> >
> > #hibernate.dialect net.sf.hibernate.dialect.PointbaseDialect
> > #hibernate.connection.driver_class
> com.pointbase.jdbc.jdbcUniversalDriver
> > #hibernate.connection.url jdbc:pointbase:embedded:sample
> > #hibernate.connection.username PBPUBLIC
> > #hibernate.connection.password PBPUBLIC
> >
> >
> >
> > #################################
> > ### Hibernate Connection Pool ###
> > #################################
> >
> > hibernate.connection.pool_size 1
> >
> >
> >
> > ###########################
> > ### C3P0 Connection Pool###
> > ###########################
> >
> > #hibernate.c3p0.max_size 2
> > #hibernate.c3p0.min_size 2
> > #hibernate.c3p0.timeout 5000
> > #hibernate.c3p0.max_statements 100
> > #hibernate.c3p0.idle_test_period 3000
> > #hibernate.c3p0.acquire_increment 2
> > ##hibernate.c3p0.validate false
> >
> >
> >
> > ###################################
> > ### Apache DBCP Connection Pool ###
> > ###################################
> >
> > ## connection pool
> >
> > #hibernate.dbcp.maxActive 100
> > #hibernate.dbcp.whenExhaustedAction 1
> > #hibernate.dbcp.maxWait 120000
> > #hibernate.dbcp.maxIdle 10
> >
> > ## prepared statement cache
> >
> > #hibernate.dbcp.ps.maxActive 100
> > #hibernate.dbcp.ps.whenExhaustedAction 1
> > #hibernate.dbcp.ps.maxWait 120000
> > #hibernate.dbcp.ps.maxIdle 10
> >
> > ## optional query to validate pooled connections:
> >
> > #hibernate.dbcp.validationQuery select 1 from dual
> > #hibernate.dbcp.testOnBorrow true
> > #hibernate.dbcp.testOnReturn false
> >
> >
> >
> > ##############################
> > ### Proxool Connection Pool###
> > ##############################
> >
> > ## Properties for external configuration of Proxool
> >
> > hibernate.proxool.pool_alias pool1
> >
> > ## Only need one of the following
> >
> > #hibernate.proxool.existing_pool true
> > #hibernate.proxool.xml proxool.xml
> > #hibernate.proxool.properties proxool.properties
> >
> > ## Or, alternatively, all of these
> > ## Standard configuration properties of Proxool
> >
> > #hibernate.proxool.house-keeping-sleep-time 30000
> > #hibernate.proxool.house-keeping-test-sql
> > #hibernate.proxool.maximum-connection-count 4
> > #hibernate.proxool.maximum-connection-lifetime 4
> > #hibernate.proxool.simultaneous-build-throttle 2
> > #hibernate.proxool.maximum-active-time 500
> > #hibernate.proxool.minimum-connection-count 2
> > #hibernate.proxool.fatal-sql-exception
> > #hibernate.proxool.prototype-count
> > #hibernate.proxool.statistics
> > #hibernate.proxool.recently-started-threshold
> > #hibernate.proxool.overload-without-refusal-lifetime
> >
> >
> >
> > #################################
> > ### Plugin ConnectionProvider ###
> > #################################
> >
> > ## use a custom ConnectionProvider (if not set, Hibernate will choose a
> built-in ConnectionProvider using hueristics)
> >
> > #hibernate.connection.provider_class
> net.sf.hibernate.connection.DriverManagerConnectionProvider
> > #hibernate.connection.provider_class
> net.sf.hibernate.connection.DatasourceConnectionProvider
> > #hibernate.connection.provider_class
> net.sf.hibernate.connection.C3P0ConnectionProvider
> > #hibernate.connection.provider_class
> net.sf.hibernate.connection.DBCPConnectionProvider
> > #hibernate.connection.provider_class
> net.sf.hibernate.connection.ProxoolConnectionProvider
> >
> >
> >
> > #######################
> > ### Transaction API ###
> > #######################
> >
> > ## the Transaction API abstracts application code from the underlying
> JTA or JDBC transactions
> >
> > #hibernate.transaction.factory_class
> net.sf.hibernate.transaction.JTATransactionFactory
> > #hibernate.transaction.factory_class
> net.sf.hibernate.transaction.JDBCTransactionFactory
> >
> >
> > ## to use JTATransactionFactory, Hibernate must be able to locate the
> UserTransaction in JNDI
> > ## default is java:comp/UserTransaction
> > ## you do NOT need this setting if you specify
> hibernate.transaction.manager_lookup_class
> >
> > #jta.UserTransaction jta/usertransaction
> > #jta.UserTransaction javax.transaction.UserTransaction
> > #jta.UserTransaction UserTransaction
> >
> >
> > ## to use JCS caching with JTA, Hibernate must be able to obtain the JTA
> TransactionManager
> >
> > #hibernate.transaction.manager_lookup_class
> net.sf.hibernate.transaction.JBossTransactionManagerLookup
> > #hibernate.transaction.manager_lookup_class
> net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
> > #hibernate.transaction.manager_lookup_class
> net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
> > #hibernate.transaction.manager_lookup_class
> net.sf.hibernate.transaction.OrionTransactionManagerLookup
> > #hibernate.transaction.manager_lookup_class
> net.sf.hibernate.transaction.ResinTransactionManagerLookup
> >
> >
> >
> > ##############################
> > ### Miscellaneous Settings ###
> > ##############################
> >
> > ## print all generated SQL to the console
> >
> > #hibernate.show_sql true
> >
> >
> > ## auto schema export
> >
> > #hibernate.hbm2ddl.auto create-drop
> > #hibernate.hbm2ddl.auto create
> > #hibernate.hbm2ddl.auto update
> >
> >
> > ## specify a JDBC isolation level
> >
> > #hibernate.connection.isolation 4
> >
> >
> > ## set the JDBC fetch size
> >
> > #hibernate.jdbc.fetch_size 25
> >
> >
> > ## set the maximum JDBC 2 batch size (a nonzero value enables batching)
> >
> > hibernate.jdbc.batch_size 0
> >
> >
> > ## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will
> cause Hibernate to use a sensible default)
> >
> > #hibernate.jdbc.use_scrollable_resultset true
> >
> >
> > ## use streams when writing binary types to / from JDBC
> >
> > hibernate.jdbc.use_streams_for_binary true
> >
> >
> > ## use JDBC 3 PreparedStatement.getGeneratedKeys to get the identifier
> of an inserted row
> >
> > #hibernate.jdbc.use_get_generated_keys true
> >
> >
> > ## specify a default schema for unqualified tablenames
> >
> > #hibernate.default_schema test
> >
> >
> > ## use a custom stylesheet for XML generation (if not specified,
> hibernate-default.xslt will be used)
> >
> > #hibernate.xml.output_stylesheet
> C:/Hibernate/net/sf/hibernate/hibernate-default.xslt
> >
> >
> > ## enable outerjoin fetching (specifying a Dialect will cause Hibernate
> to use sensible default)
> >
> > #hibernate.use_outer_join false
> >
> >
> > ## set the maximum depth of the outer join fetch tree
> >
> > hibernate.max_fetch_depth 1
> >
> >
> > ## enable CGLIB reflection optimizer (enabled by default)
> >
> > #hibernate.cglib.use_reflection_optimizer false
> >
> >
> >
> > ##########################
> > ### Second-level Cache ###
> > ##########################
> >
> > ## optimize chache for minimal "puts" instead of minimal "gets" (good
> for clustered cache)
> >
> > #hibernate.cache.use_minimal_puts true
> >
> >
> > ## enable the query cache
> >
> > hibernate.cache.use_query_cache true
> >
> >
> > ## choose a cache implementation
> >
> > #hibernate.cache.provider_class net.sf.ehcache.hibernate.Provider
> > #hibernate.cache.provider_class
> net.sf.hibernate.cache.EmptyCacheProvider
> > hibernate.cache.provider_class
> net.sf.hibernate.cache.HashtableCacheProvider
> > #hibernate.cache.provider_class net.sf.hibernate.cache.TreeCacheProvider
> > #hibernate.cache.provider_class net.sf.hibernate.cache.OSCacheProvider
> > #hibernate.cache.provider_class net.sf.hibernate.cache.JCSCacheProvider
> > #hibernate.cache.provider_class
> net.sf.hibernate.cache.SwarmCacheProvider
> >
> >
> >
> > ############
> > ### JNDI ###
> > ############
> >
> > ## specify a JNDI name for the SessionFactory
> >
> > #hibernate.session_factory_name hibernate/session_factory
> >
> >
> > ## Hibernate uses JNDI to bind a name to a SessionFactory and to look up
> the JTA UserTransaction;
> > ## if hibernate.jndi.* are not specified, Hibernate will use the default
> InitialContext() which
> > ## is the best approach in an application server
> >
> > #file system
> > #hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
> > #hibernate.jndi.url file:/
> >
> > #WebSphere
> > #hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
> > #hibernate.jndi.url iiop://localhost:900/
> >
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/test/log4j.propertie
> s
> >
> > Index: log4j.properties
> > ===================================================================
> > ### direct log messages to stdout ###
> > log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> > log4j.appender.stdout.Target=System.out
> > log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> > log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p
> %c{1}:%L - %m%n
> >
> > ### direct messages to file hibernate.log ###
> > #log4j.appender.file=org.apache.log4j.FileAppender
> > #log4j.appender.file.File=hibernate.log
> > #log4j.appender.file.layout=org.apache.log4j.PatternLayout
> > #log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p
> %c{1}:%L - %m%n
> >
> > ### set log levels - for more verbose logging change 'info' to 'debug'
> ###
> >
> > log4j.rootLogger=warn, stdout
> >
> > log4j.logger.net.sf.hibernate=info
> >
> > ### log just the SQL
> > #log4j.logger.net.sf.hibernate.SQL=debug
> >
> > ### log JDBC bind parameters ###
> > log4j.logger.net.sf.hibernate.type=info
> >
> > ### log schema export/update ###
> > log4j.logger.net.sf.hibernate.tool.hbm2ddl=debug
> >
> > ### log cache activity ###
> > #log4j.logger.net.sf.hibernate.cache=debug
> >
> > ### enable the following line if you want to track down connection ###
> > ### leakages when using DriverManagerConnectionProvider ###
> >
> #log4j.logger.net.sf.hibernate.connection.DriverManagerConnectionProvider=tr
> ace
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/test/oscache.propert
> ies
> >
> > Index: oscache.properties
> > ===================================================================
> > # CACHE IN MEMORY
> > #
> > # If you want to disable memory caching, just uncomment this line.
> > #
> > # cache.memory=false
> >
> >
> > # CACHE KEY
> > #
> > # This is the key that will be used to store the cache in the
> application
> > # and session scope.
> > #
> > # If you want to set the cache key to anything other than the default
> > # uncomment this line and change the cache.key
> > #
> > # cache.key=__oscache_cache
> >
> >
> > # USE HOST DOMAIN NAME IN KEY
> > #
> > # Servers for multiple host domains may wish to add host name info to
> > # the generation of the key. If this is true, then uncomment the
> > # following line.
> > #
> > # cache.use.host.domain.in.key=true
> >
> >
> > # CACHE LISTENERS
> > #
> > # These hook OSCache events and perform various actions such as logging
> > # cache hits and misses, or broadcasting to other cache instances across
> a cluster.
> > # See the documentation for further information.
> > #
> > #
> cache.event.listeners=com.opensymphony.oscache.plugins.clustersupport.JMSBro
> adcastingListener, \
> > #
> com.opensymphony.oscache.extra.CacheEntryEventListenerImpl, \
> > #
> com.opensymphony.oscache.extra.CacheMapAccessEventListenerImpl, \
> > #
> com.opensymphony.oscache.extra.ScopeEventListenerImpl
> >
> >
> > # CACHE PERSISTENCE CLASS
> > #
> > # Specify the class to use for persistence. If you use the supplied
> DiskPersistenceListener,
> > # don't forget to supply the cache.path property to specify the location
> of the cache
> > # directory.
> > #
> > # If a persistence class is not specified, OSCache will use memory
> caching only.
> > #
> > #
> cache.persistence.class=com.opensymphony.oscache.plugins.diskpersistence.Dis
> kPersistenceListener
> >
> >
> > # CACHE DIRECTORY
> > #
> > # This is the directory on disk where caches will be stored by the
> DiskPersistenceListener.
> > # it will be created if it doesn't already exist. Remember that OSCache
> must have
> > # write permission to this directory.
> > #
> > # Note: for Windows machines, this needs \ to be escaped
> > # ie Windows:
> > # cache.path=c:\\myapp\\cache
> > # or *ix:
> > # cache.path=/opt/myapp/cache
> > #
> > # cache.path=c:\\app\\cache
> >
> >
> > # CACHE ALGORITHM
> > #
> > # Default cache algorithm to use. Note that in order to use an algorithm
> > # the cache size must also be specified. If the cache size is not
> specified,
> > # the cache algorithm will be Unlimited cache.
> > #
> > # cache.algorithm=com.opensymphony.oscache.base.algorithm.LRUCache
> > # cache.algorithm=com.opensymphony.oscache.base.algorithm.FIFOCache
> > # cache.algorithm=com.opensymphony.oscache.base.algorithm.UnlimitedCache
> >
> >
> > # CACHE SIZE
> > #
> > # Default cache size in number of items. If a size is specified but not
> > # an algorithm, the cache algorithm used will be LRUCache.
> > #
> > cache.capacity=1000
> >
> >
> > # CACHE UNLIMITED DISK
> > # Use unlimited disk cache or not. The default value is false, which
> means
> > # the disk cache will be limited in size to the value specified by
> cache.capacity.
> > #
> > # cache.unlimited.disk=false
> >
> >
> > # JMS CLUSTER PROPERTIES
> > #
> > # Configuration properties for JMS clustering. See the clustering
> documentation
> > # for more information on these settings.
> > #
> >
> #cache.cluster.jms.topic.factory=java:comp/env/jms/TopicConnectionFactory
> > #cache.cluster.jms.topic.name=java:comp/env/jms/OSCacheTopic
> > #cache.cluster.jms.node.name=node1
> >
> >
> > # JAVAGROUPS CLUSTER PROPERTIES
> > #
> > # Configuration properites for the JavaGroups clustering. Only one of
> these
> > # should be specified. Default values (as shown below) will be used if
> niether
> > # property is set. See the clustering documentation and the JavaGroups
> project
> > # (www.javagroups.com) for more information on these settings.
> > #
> >
> #cache.cluster.properties=UDP(mcast_addr=231.12.21.132;mcast_port=45566;ip_t
> tl=32;mcast_send_buf_size=150000;mcast_recv_buf_size=80000):PING(timeout=200
> 0;num_initial_members=3):MERGE2(min_interval=5000;max_interval=10000):FD_SOC
> K:VERIFY_SUSPECT(timeout=1500):pbcast.NAKACK(gc_lag=50;retransmit_timeout=30
> 0,600,1200,2400,4800):pbcast.STABLE(desired_avg_gossip=20000):UNICAST(timeou
> t=5000):FRAG(frag_size=8096;down_thread=false;up_thread=false):pbcast.GMS(jo
> in_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=true)
> > #cache.cluster.multicast.ip=231.12.21.132
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/apache/comm
> ons/resources/impl/HibernateBasicMessage.hbm.xml
> >
> > Index: HibernateBasicMessage.hbm.xml
> > ===================================================================
> > <?xml version="1.0"?>
> > <!DOCTYPE hibernate-mapping SYSTEM
> > "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
> >
> >
> > <hibernate-mapping>
> >
> > <class
> name="org.apache.commons.resources.impl.HibernateBasicMessage"
> table="resources">
> >
> > <composite-id>
> > <key-property name="locale" type="java.lang.String" column="locale"/>
> > <key-property name="key" type="java.lang.String" column="msgKey"/>
> > </composite-id>
> >
> > <property name="value" type="java.lang.String" column="val"/>
> > </class>
> >
> > <query name="QueryByLocale">
> >
> > from
> > org.apache.commons.resources.impl.HibernateBasicMessage as msgRes
> > where
> > msgRes.locale = ?
> >
> > </query>
> >
> > </hibernate-mapping>
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/apache/comm
> ons/resources/impl/HibernateBasicMessage.java
> >
> > Index: HibernateBasicMessage.java
> > ===================================================================
> > /*
> > * $Header:
> /home/cvs/jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/a
> pache/commons/resources/impl/HibernateBasicMessage.java,v 1.1 2004/02/06
> 13:26:09 jmitchell Exp $
> > * $Revision: 1.1 $
> > * $Date: 2004/02/06 13:26:09 $
> > *
> > * ====================================================================
> > *
> > * The Apache Software License, Version 1.1
> > *
> > * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
> > * reserved.
> > *
> > * Redistribution and use in source and binary forms, with or without
> > * modification, are permitted provided that the following conditions
> > * are met:
> > *
> > * 1. Redistributions of source code must retain the above copyright
> > * notice, this list of conditions and the following disclaimer.
> > *
> > * 2. Redistributions in binary form must reproduce the above copyright
> > * notice, this list of conditions and the following disclaimer in
> > * the documentation and/or other materials provided with the
> > * distribution.
> > *
> > * 3. The end-user documentation included with the redistribution, if
> > * any, must include the following acknowledgement:
> > * "This product includes software developed by the
> > * Apache Software Foundation (http://www.apache.org/)."
> > * Alternately, this acknowledgement may appear in the software
> itself,
> > * if and wherever such third-party acknowledgements normally appear.
> > *
> > * 4. The names, "Apache", "The Jakarta Project", "Commons", and "Apache
> Software
> > * Foundation" must not be used to endorse or promote products
> derived
> > * from this software without prior written permission. For written
> > * permission, please contact apache@apache.org.
> > *
> > * 5. Products derived from this software may not be called "Apache"
> > * nor may "Apache" appear in their name, without prior written
> > * permission of the Apache Software Foundation.
> > *
> > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> > * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> > * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> > * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> > * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> > * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> > * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> > * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> > * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> > * SUCH DAMAGE.
> > * ====================================================================
> > *
> > * This software consists of voluntary contributions made by many
> > * individuals on behalf of the Apache Software Foundation. For more
> > * information on the Apache Software Foundation, please see
> > * <http://www.apache.org/>.
> > *
> > */
> >
> > package org.apache.commons.resources.impl;
> >
> >
> > /**
> > * BasicMessage to allow standard Hibernate
> > * configuration (no complex keys).
> > *
> > * @author James Mitchell
> > *
> > */
> > public class HibernateBasicMessage extends BasicMessage {
> >
> > public HibernateBasicMessage() {
> > super();
> > }
> > /**
> > *
> > * @param id The id (primary key) for this message.
> > * @param locale The locale used to retrieve the value for the
> specified key
> > * @param key The key for this message.
> > * @param value The value for this message.
> > */
> > public HibernateBasicMessage(Long id, String locale, String key,
> Object[] values) {
> > super(key, values);
> > this.id = id;
> > this.locale = locale;
> >
> > }
> >
> > private Long id = null;
> > private String locale = null;
> >
> > /**
> > * @return Returns the id.
> > */
> > public Long getId() {
> > return id;
> > }
> >
> > /**
> > * @param id The id to set.
> > */
> > public void setId(Long id) {
> > this.id = id;
> > }
> > /**
> > * @return Returns the locale.
> > */
> > public String getLocale() {
> > return locale;
> > }
> > /**
> > * @param locale The locale to set.
> > */
> > public void setLocale(String locale) {
> > this.locale = locale;
> > }
> >
> > public void setKey(String key) {
> > this.key = key;
> > }
> > public void setValue(String value) {
> > this.values = new String[]{value};
> > }
> > public String getValue() {
> > if (values == null || values.length < 1) {
> > throw new IllegalStateException("The retrived value for msg
> " +
> > this.key + "was null");
> > }
> > if (values.length > 1) {
> > throw new IllegalStateException("There were more than one
> values " +
> > "retrived value for msg " +
> > this.key);
> > }
> > return (String)getValues()[0];
> > }
> >
> > public boolean equals(Object obj) {
> > return super.equals(obj);
> > }
> >
> > public int hashCode() {
> > return super.hashCode();
> > }
> > }
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/apache/comm
> ons/resources/impl/HibernateResources.java
> >
> > Index: HibernateResources.java
> > ===================================================================
> > /*
> > * $Header:
> /home/cvs/jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/a
> pache/commons/resources/impl/HibernateResources.java,v 1.1 2004/02/06
> 13:26:09 jmitchell Exp $
> > * $Revision: 1.1 $
> > * $Date: 2004/02/06 13:26:09 $
> > *
> > * ====================================================================
> > *
> > * The Apache Software License, Version 1.1
> > *
> > * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
> > * reserved.
> > *
> > * Redistribution and use in source and binary forms, with or without
> > * modification, are permitted provided that the following conditions
> > * are met:
> > *
> > * 1. Redistributions of source code must retain the above copyright
> > * notice, this list of conditions and the following disclaimer.
> > *
> > * 2. Redistributions in binary form must reproduce the above copyright
> > * notice, this list of conditions and the following disclaimer in
> > * the documentation and/or other materials provided with the
> > * distribution.
> > *
> > * 3. The end-user documentation included with the redistribution, if
> > * any, must include the following acknowledgement:
> > * "This product includes software developed by the
> > * Apache Software Foundation (http://www.apache.org/)."
> > * Alternately, this acknowledgement may appear in the software
> itself,
> > * if and wherever such third-party acknowledgements normally appear.
> > *
> > * 4. The names, "Apache", "The Jakarta Project", "Commons", and "Apache
> Software
> > * Foundation" must not be used to endorse or promote products
> derived
> > * from this software without prior written permission. For written
> > * permission, please contact apache@apache.org.
> > *
> > * 5. Products derived from this software may not be called "Apache"
> > * nor may "Apache" appear in their name, without prior written
> > * permission of the Apache Software Foundation.
> > *
> > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> > * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> > * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> > * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> > * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> > * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> > * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> > * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> > * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> > * SUCH DAMAGE.
> > * ====================================================================
> > *
> > * This software consists of voluntary contributions made by many
> > * individuals on behalf of the Apache Software Foundation. For more
> > * information on the Apache Software Foundation, please see
> > * <http://www.apache.org/>.
> > *
> > */
> >
> > package org.apache.commons.resources.impl;
> >
> > import java.util.Iterator;
> > import java.util.List;
> > import java.util.Locale;
> > import java.util.Map;
> > import java.util.Properties;
> >
> > import net.sf.hibernate.HibernateException;
> > import net.sf.hibernate.Query;
> > import net.sf.hibernate.Session;
> > import net.sf.hibernate.SessionFactory;
> > import net.sf.hibernate.cfg.Configuration;
> >
> > import org.apache.commons.logging.Log;
> > import org.apache.commons.logging.LogFactory;
> > import org.apache.commons.resources.ResourcesException;
> >
> > /**
> > * <p>Concrete implementation of
> > * {@link org.apache.commons.resources.Resources} that wraps a
> > * Hibernate session and retrieves values for the given
> > * <code>Locale</code> and have name suffixes reflecting the
> > * <code>Locale</code> for which the document's messages apply.
> > * For this specific implementation, resources are looked up in
> > * a hierarchy of database values in a manner identical to that
> > * performed by <code>java.util.ResourceBundle.getBundle().</code>.
> > * </p>
> > *
> > * <p>The base URL passed to our constructor must contain the base name
> > * of a the hibernate configuration file.</p>
> > *
> > * @author James Mitchell
> > * @version $Revision: 1.1 $ $Date: 2004/02/06 13:26:09 $
> > */
> > public class HibernateResources extends CollectionResourcesBase {
> >
> > /**
> > * <p>The <code>Log</code> instance for this class.</p>
> > */
> > private static final Log log =
> LogFactory.getLog(HibernateResources.class);
> >
> > // -----------------------------------------------------------
> Constructors
> >
> > /**
> > * <p>Create a new
> > * {@link org.apache.commons.resources.Resources} instance with the
> specified
> > * logical name and base resource URL.</p>
> > *
> > * @param name Logical name of the new instance
> > * @param base Base URL of the Hibernate configuration file.
> > */
> > public HibernateResources(String name, String base) {
> > super(name, base);
> > }
> >
> >
> > // ------------------------------------------------------ Protected
> Methods
> >
> >
> > /**
> > * <p>Return a <code>Map</code> containing the name-value mappings
> for
> > * the specified base URL and requested <code>Locale</code>, if
> there
> > * are any. If there are no defined mappings for the specified
> > * <code>Locale</code>, return an empty <code>Map</code>
> instead.</p>
> > *
> > * <p>Concrete subclasses must override this method to perform the
> > * appropriate lookup. A typical implementation will construct an
> > * absolute URL based on the specified base URL and
> <code>Locale</code>,
> > * retrieve the specified resource file (if any), and parse it into
> > * a <code>Map</code> structure.</p>
> > *
> > * <p>Caching of previously retrieved <code>Map</code>s (if any)
> should
> > * be performed by callers of this method. Therefore, this method
> should
> > * always attempt to retrieve the specified resource and load it
> > * appropriately.</p>
> > *
> > * @param baseUrl Base URL of the resource files for this
> > * {@link org.apache.commons.resources.Resources} instance
> > * @param locale <code>Locale</code> for which name-value mappings
> > * are requested
> > */
> > protected Map getLocaleMap(String baseUrl, Locale locale) {
> >
> > if (log.isDebugEnabled()) {
> > log.debug("Loading database configuration'" + locale + "'
> resources from base '" +
> > baseUrl + "'");
> > }
> >
> > Properties props = new Properties();
> > Session session = null;
> > try {
> > // TODO - change this to load the specified hibernate config
> file (baseUrl)
> > SessionFactory sessionFactory =
> > new Configuration().configure().buildSessionFactory();
> > session = sessionFactory.openSession();
> > Query q = session.getNamedQuery("QueryByLocale");
> > q.setString(0, locale.toString());
> > q.list();
> > List msgs = q.list();
> > for (Iterator iter = msgs.iterator(); iter.hasNext();) {
> > HibernateBasicMessage msg = (HibernateBasicMessage)
> iter.next();
> > props.put(msg.getKey(), msg.getValue());
> > }
> > session.close();
> >
> > } catch (HibernateException e) {
> > e.printStackTrace();
> > }
> >
> > return props;
> >
> >
> >
> > }
> >
> >
> > public void init() throws ResourcesException {
> > super.init();
> > }
> > }
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/apache/comm
> ons/resources/impl/HibernateResourcesFactory.java
> >
> > Index: HibernateResourcesFactory.java
> > ===================================================================
> > /*
> > * $Header:
> /home/cvs/jakarta-commons-sandbox/resources/contrib/hibernate/src/java/org/a
> pache/commons/resources/impl/HibernateResourcesFactory.java,v 1.1 2004/02/06
> 13:26:09 jmitchell Exp $
> > * $Revision: 1.1 $
> > * $Date: 2004/02/06 13:26:09 $
> > *
> > * ====================================================================
> > *
> > * The Apache Software License, Version 1.1
> > *
> > * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
> > * reserved.
> > *
> > * Redistribution and use in source and binary forms, with or without
> > * modification, are permitted provided that the following conditions
> > * are met:
> > *
> > * 1. Redistributions of source code must retain the above copyright
> > * notice, this list of conditions and the following disclaimer.
> > *
> > * 2. Redistributions in binary form must reproduce the above copyright
> > * notice, this list of conditions and the following disclaimer in
> > * the documentation and/or other materials provided with the
> > * distribution.
> > *
> > * 3. The end-user documentation included with the redistribution, if
> > * any, must include the following acknowledgement:
> > * "This product includes software developed by the
> > * Apache Software Foundation (http://www.apache.org/)."
> > * Alternately, this acknowledgement may appear in the software
> itself,
> > * if and wherever such third-party acknowledgements normally appear.
> > *
> > * 4. The names, "Apache", "The Jakarta Project", "Commons", and "Apache
> Software
> > * Foundation" must not be used to endorse or promote products
> derived
> > * from this software without prior written permission. For written
> > * permission, please contact apache@apache.org.
> > *
> > * 5. Products derived from this software may not be called "Apache"
> > * nor may "Apache" appear in their name, without prior written
> > * permission of the Apache Software Foundation.
> > *
> > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> > * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> > * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> > * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> > * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> > * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> > * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> > * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> > * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> > * SUCH DAMAGE.
> > * ====================================================================
> > *
> > * This software consists of voluntary contributions made by many
> > * individuals on behalf of the Apache Software Foundation. For more
> > * information on the Apache Software Foundation, please see
> > * <http://www.apache.org/>.
> > *
> > */
> >
> > package org.apache.commons.resources.impl;
> >
> > import org.apache.commons.resources.Resources;
> > import org.apache.commons.resources.ResourcesException;
> >
> > /**
> > * <p>Concrete implementation of
> > * {@link org.apache.commons.resources.ResourcesFactory} that creates
> > * {@link org.apache.commons.resources.Resources} instances that wraps
> > * a Hibernate session and retrieves values for the given
> > * <code>Locale</code> and have name suffixes reflecting the
> > * <code>Locale</code> for which the document's messages apply.
> > * For this specific implementation, resources are looked up in
> > * a hierarchy of database values in a manner identical to that
> > * performed by <code>java.util.ResourceBundle.getBundle().</code>.
> > *
> > * @author James Mitchell
> > * @version $Revision: 1.1 $
> > */
> > public class HibernateResourcesFactory extends ResourcesFactoryBase {
> >
> >
> > // ------------------------------------------------------ Protected
> Methods
> >
> >
> > /**
> > * <p>Create and return a new {@link
> org.apache.commons.resources.Resources}
> > * instance with the specified logical name, after calling its
> <code>init()</code>
> > * method and delegating the relevant properties.</p>
> > *
> > * @param name Logical name of the {@link
> org.apache.commons.resources.Resources}
> > * instance to create
> > *
> > * @param config Configuration string for this resource (if any)
> > *
> > * @exception ResourcesException if a {@link
> org.apache.commons.resources.Resources}
> > * instance of the specified logical name cannot be created.
> > */
> > protected Resources createResources(String name, String config)
> > throws ResourcesException {
> >
> > Resources res = new HibernateResources(name, config);
> > res.setReturnNull(isReturnNull());
> > res.init();
> > return (res);
> >
> > }
> >
> >
> > }
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/src/test/org/apache/comm
> ons/resources/impl/HibernateResourcesTestCase.java
> >
> > Index: HibernateResourcesTestCase.java
> > ===================================================================
> > /*
> > * $Header:
> /home/cvs/jakarta-commons-sandbox/resources/contrib/hibernate/src/test/org/a
> pache/commons/resources/impl/HibernateResourcesTestCase.java,v 1.1
> 2004/02/06 13:26:09 jmitchell Exp $
> > * $Revision: 1.1 $
> > * $Date: 2004/02/06 13:26:09 $
> > *
> > * ====================================================================
> > *
> > * The Apache Software License, Version 1.1
> > *
> > * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
> > * reserved.
> > *
> > * Redistribution and use in source and binary forms, with or without
> > * modification, are permitted provided that the following conditions
> > * are met:
> > *
> > * 1. Redistributions of source code must retain the above copyright
> > * notice, this list of conditions and the following disclaimer.
> > *
> > * 2. Redistributions in binary form must reproduce the above copyright
> > * notice, this list of conditions and the following disclaimer in
> > * the documentation and/or other materials provided with the
> > * distribution.
> > *
> > * 3. The end-user documentation included with the redistribution, if
> > * any, must include the following acknowledgement:
> > * "This product includes software developed by the
> > * Apache Software Foundation (http://www.apache.org/)."
> > * Alternately, this acknowledgement may appear in the software
> itself,
> > * if and wherever such third-party acknowledgements normally appear.
> > *
> > * 4. The names, "Apache", "The Jakarta Project", "Commons", and "Apache
> Software
> > * Foundation" must not be used to endorse or promote products
> derived
> > * from this software without prior written permission. For written
> > * permission, please contact apache@apache.org.
> > *
> > * 5. Products derived from this software may not be called "Apache"
> > * nor may "Apache" appear in their name, without prior written
> > * permission of the Apache Software Foundation.
> > *
> > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> > * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> > * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> > * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> > * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> > * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> > * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> > * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> > * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> > * SUCH DAMAGE.
> > * ====================================================================
> > *
> > * This software consists of voluntary contributions made by many
> > * individuals on behalf of the Apache Software Foundation. For more
> > * information on the Apache Software Foundation, please see
> > * <http://www.apache.org/>.
> > *
> > */
> > package org.apache.commons.resources.impl;
> >
> > import java.net.URL;
> >
> > import junit.framework.Test;
> > import junit.framework.TestSuite;
> >
> > /**
> > * <p>Unit tests for
> > * <code>org.apache.commons.resources.impl.HibernateResources</code>.
> > * </p>
> > *
> > * @author James Mitchell
> > * @version $Revision: 1.1 $ $Date: 2004/02/06 13:26:09 $
> > */
> >
> > public class HibernateResourcesTestCase
> > extends CollectionResourcesBaseTestCase {
> >
> >
> > // ----------------------------------------------------- Instance
> Variables
> >
> >
> > // -----------------------------------------------------------
> Constructors
> >
> >
> > public HibernateResourcesTestCase(String name) {
> > super(name);
> > }
> >
> >
> > // --------------------------------------------------- Overall Test
> Methods
> >
> >
> > // Set up instance variables required by this test case
> > public void setUp() throws Exception {
> > factory = new HibernateResourcesFactory();
> > resources = factory.getResources(
> > NAME,
> > "hibernate.cfg.xml");
> > }
> >
> > // Return the tests included in this test suite
> > public static Test suite() {
> > return (new TestSuite(HibernateResourcesTestCase.class));
> > }
> >
> > // Tear down the instance variables required by this test case
> > public void tearDown() {
> > resources = null;
> > factory = null;
> > }
> >
> >
> > // ------------------------------------------------ Individual Test
> Methods
> >
> >
> > // ------------------------------------------------------ Protected
> Methods
> > protected String getBase() throws Exception
> > {
> > // default file name
> > URL url =
> > HibernateResourcesTestCase.class.getResource
> > ("hibernate.cfg.xml");
> >
> > if (url == null) {
> > fail("URL NOT FOUND");
> > }
> > String string = url.toExternalForm();
> > String base = string.substring(0, string.length() - 11);
> > return base;
> > }
> >
> >
> >
> > }
> >
> >
> >
> > 1.1
> jakarta-commons-sandbox/resources/contrib/hibernate/sql/mysql.sql
> >
> > Index: mysql.sql
> > ===================================================================
> > use the same script from the JDBC implementation.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org
Re: [resources] new implementations [was: Re: cvs commit: jakart...]
Posted by Ted Husted <hu...@apache.org>.
Looking forward to it, James :)
I am finding that a lot of teams in the field do want this functionality.
If the plugin was not coupled to the contrib implementations, then I suppose you could try putting it under /plugins instead of contrib.
-Ted.
On Fri, 06 Feb 2004 08:40:09 -0500, James Mitchell wrote:
>
> P.S.
>
>
> I'll be adding a few more items later tonight and/or this weekend: -
> a build script in resources/contrib that let's us produce a
> distribution of any single one of the implementations under contrib
> - a few docs - tutorial on how to setup and use these impls.
> - a plugin (location: jakarta-struts/contrib ????) that acts as a
> wrapper to the current (Struts 1.1) message resources api. This
> would let anyone use a current distribution of commons-resources
> with Struts 1.1 (going for the backwards-compatibility crowd)
>
>
> Future:
> - an iBatis implementation
> - a Torque implementation
> - a basic LDAP implementation
> - a [?? enter your choice ??] implementation
> - mods to all the current database impls that allow
> datasource configuration/pooling via JNDI
>
>
> Did I miss anything?
>
>
> --
> James Mitchell
> Software Engineer / Struts Evangelist
> http://www.struts-atlanta.org
> 678.910.8017 (cell)
> AIM: jmitchtx
> MSN: jmitchell@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org
Re: [resources] new implementations [was: Re: cvs commit: jakart...]
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On 6 Feb 2004, at 13:56, Ted Husted wrote:
> Looking forward to it, James :)
>
> I am finding that a lot of teams in the field do want this
> functionality.
>
> If the plugin was not coupled to the contrib implementations, then I
> suppose you could try putting it under /plugins instead of contrib.
FWIW
i think that (for jakarta-commons anyway) plugins would be better than
contrib. my reason is that we try to create compact, focussed
components here. i'd actually probably prefer (in the medium term) a
separate resource-plugins component.
- robert
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [resources] new implementations [was: Re: cvs commit: jakart...]
Posted by Ted Husted <hu...@apache.org>.
Looking forward to it, James :)
I am finding that a lot of teams in the field do want this functionality.
If the plugin was not coupled to the contrib implementations, then I suppose you could try putting it under /plugins instead of contrib.
-Ted.
On Fri, 06 Feb 2004 08:40:09 -0500, James Mitchell wrote:
>
> P.S.
>
>
> I'll be adding a few more items later tonight and/or this weekend: -
> a build script in resources/contrib that let's us produce a
> distribution of any single one of the implementations under contrib
> - a few docs - tutorial on how to setup and use these impls.
> - a plugin (location: jakarta-struts/contrib ????) that acts as a
> wrapper to the current (Struts 1.1) message resources api. This
> would let anyone use a current distribution of commons-resources
> with Struts 1.1 (going for the backwards-compatibility crowd)
>
>
> Future:
> - an iBatis implementation
> - a Torque implementation
> - a basic LDAP implementation
> - a [?? enter your choice ??] implementation
> - mods to all the current database impls that allow
> datasource configuration/pooling via JNDI
>
>
> Did I miss anything?
>
>
> --
> James Mitchell
> Software Engineer / Struts Evangelist
> http://www.struts-atlanta.org
> 678.910.8017 (cell)
> AIM: jmitchtx
> MSN: jmitchell@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org