[jboss-cvs] JBossAS SVN: r72148 - in trunk: hibernate-int and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Apr 13 21:45:45 EDT 2008
Author: ALRubinger
Date: 2008-04-13 21:45:44 -0400 (Sun, 13 Apr 2008)
New Revision: 72148
Added:
trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMappingVisitor.java
trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-service.xml
trunk/testsuite/src/resources/hibernate/har-deployment/jboss-service.xml
Removed:
trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/
trunk/hibernate-int/src/resources/
trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-hibernate.xml
trunk/testsuite/src/resources/hibernate/har-deployment/jboss-hibernate.xml
Modified:
trunk/build/build-distr.xml
trunk/hibernate-int/build.xml
trunk/hibernate-int/src/main/org/jboss/hibernate/ListenerInjector.java
trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java
trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMBean.java
trunk/hibernate-int/src/main/org/jboss/hibernate/session/HibernateContext.java
trunk/testsuite/imports/sections/hibernate.xml
trunk/testsuite/src/main/org/jboss/test/hibernate/test/TimersUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/hibernate/timers/TimersFactory.java
Log:
Broken build, reverted Revision 72143
Modified: trunk/build/build-distr.xml
===================================================================
--- trunk/build/build-distr.xml 2008-04-14 00:52:58 UTC (rev 72147)
+++ trunk/build/build-distr.xml 2008-04-14 01:45:44 UTC (rev 72148)
@@ -1606,12 +1606,6 @@
<fileset dir="${hibernate.lib}" includes="*.jar"/>
</copy>
- <copy todir="${install.server}/all/deployers" filtering="no">
- <fileset dir="${_module.output}/resources">
- <include name="hibernate-deployer-beans.xml"/>
- </fileset>
- </copy>
-
<!-- ASM jars (cglib dependency)
<copy todir="${install.all.lib}" filtering="no">
<fileset dir="${asm.asm.lib}" includes="*.jar" />
Modified: trunk/hibernate-int/build.xml
===================================================================
--- trunk/hibernate-int/build.xml 2008-04-14 00:52:58 UTC (rev 72147)
+++ trunk/hibernate-int/build.xml 2008-04-14 01:45:44 UTC (rev 72148)
@@ -76,14 +76,10 @@
<path refid="hibernate3.classpath"/>
<path refid="odmg.classpath"/>
<path refid="cglib.classpath"/>
- <path refid="javax.xml.bind.classpath"/>
- <path refid="jboss.jboss.deployers.classpath"/>
+ <path refid="jboss.jboss.deployers.classpath"/>
<path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.integration.classpath"/>
<path refid="jboss.jboss.vfs.classpath"/>
- <path refid="jboss.jboss.mdr.classpath"/>
- <path refid="jboss.jboss.man.classpath"/>
- <path refid="jboss.jbossxb.classpath"/>
</path>
<!-- ======= -->
Modified: trunk/hibernate-int/src/main/org/jboss/hibernate/ListenerInjector.java
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/ListenerInjector.java 2008-04-14 00:52:58 UTC (rev 72147)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/ListenerInjector.java 2008-04-14 01:45:44 UTC (rev 72148)
@@ -9,6 +9,8 @@
import org.hibernate.cfg.Configuration;
import org.jboss.deployment.DeploymentException;
+import javax.management.ObjectName;
+
/**
* Implementors are responsible for injecting any custom Hibernate3 event listeners into the {@link
* org.hibernate.cfg.Configuration} which will then later be used to build the {@link org.hibernate.SessionFactory}.
@@ -34,11 +36,11 @@
* useful for the listeners, themselves, being able to read custom settings later from the {@link
* org.hibernate.SessionFactory}.
*
- * @param objectName The bean name.
* @param configuration The configuration into which the customer listeners should be injected.
+ * @param objectName The MBean object name.
*
* @throws DeploymentException If any problems occur which should lead to a deployment failure (i.e. do not build the
* {@link org.hibernate.SessionFactory}).
*/
- public void injectListeners(Object objectName, Configuration configuration) throws DeploymentException;
+ public void injectListeners(ObjectName objectName, Configuration configuration) throws DeploymentException;
}
Modified: trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java 2008-04-14 00:52:58 UTC (rev 72147)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java 2008-04-14 01:45:44 UTC (rev 72148)
@@ -8,10 +8,13 @@
import java.io.IOException;
import java.net.URL;
+import java.net.URLClassLoader;
import java.util.Date;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
+import javax.management.Notification;
import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -22,18 +25,18 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.jmx.StatisticsService;
-import org.hibernate.jmx.StatisticsServiceMBean;
import org.hibernate.transaction.JBossTransactionManagerLookup;
import org.hibernate.transaction.JTATransactionFactory;
-import org.jboss.beans.metadata.api.annotations.Inject;
-import org.jboss.beans.metadata.api.model.FromContext;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployment.DeploymentException;
import org.jboss.hibernate.ListenerInjector;
import org.jboss.hibernate.cache.DeployedTreeCacheProvider;
-import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
-import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.logging.Logger;
+import org.jboss.mx.loading.RepositoryClassLoader;
+import org.jboss.system.ServiceMBeanSupport;
import org.jboss.util.naming.Util;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileVisitor;
/**
* The {@link HibernateMBean} implementation.
@@ -45,7 +48,7 @@
* @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
* @version <tt>$Revision$</tt>
*/
-public class Hibernate implements HibernateMBean
+public class Hibernate extends ServiceMBeanSupport implements HibernateMBean
{
private static final Logger log = Logger.getLogger( Hibernate.class );
@@ -86,41 +89,18 @@
private String listenerInjector;
private URL harUrl;
private boolean scanForMappingsEnabled = false;
- private Set mappings;
+ private Set classpathUrls = new HashSet();
// Internal state
private boolean dirty = false;
private Date runningSince;
private SessionFactory sessionFactory;
- private String hibernateStatisticsServiceName;
+ private ObjectName hibernateStatisticsServiceName;
- public Hibernate(Set mappings)
- {
- if (mappings == null)
- throw new IllegalArgumentException("Null mappings");
- this.mappings = mappings;
- }
-
- // Injected from underlying MC
- private Object beanName;
- private KernelController controller;
-
- @Inject(fromContext = FromContext.NAME)
- public void setBeanName(Object beanName)
- {
- this.beanName = beanName;
- }
-
- @Inject(bean = KernelConstants.KERNEL_CONTROLLER_NAME)
- public void setController(KernelController controller)
- {
- this.controller = controller;
- }
-
/**
* Configure Hibernate and bind the <tt>SessionFactory</tt> to JNDI.
*/
- public void start() throws Throwable
+ public void startService() throws Exception
{
log.debug( "Hibernate MBean starting; " + this );
@@ -130,15 +110,19 @@
destroySessionFactory();
}
+ log.trace( "start scanning for mappings" );
+ scanForMappings();
+
buildSessionFactory();
}
/**
* Close the <tt>SessionFactory</tt>.
*/
- public void stop() throws Exception
+ public void stopService() throws Exception
{
destroySessionFactory();
+ classpathUrls.clear();
}
/**
@@ -146,7 +130,7 @@
*
* @throws Exception
*/
- private void buildSessionFactory() throws Throwable
+ private void buildSessionFactory() throws Exception
{
log.debug( "Building SessionFactory; " + this );
@@ -157,7 +141,7 @@
ListenerInjector listenerInjector = generateListenerInjectorInstance();
if ( listenerInjector != null )
{
- listenerInjector.injectListeners( beanName, cfg );
+ listenerInjector.injectListeners( getServiceName(), cfg );
}
// Handle config settings....
@@ -181,7 +165,7 @@
// Handle stat-mbean creation/registration....
if ( sessionFactory.getStatistics() != null && sessionFactory.getStatistics().isStatisticsEnabled() )
{
- String serviceName = beanName.toString();
+ String serviceName = getServiceName().toString();
if( serviceName.indexOf("type=service") != -1 )
{
serviceName = serviceName.replaceAll("type=service","type=stats");
@@ -190,17 +174,10 @@
{
serviceName = serviceName + ",type=stats";
}
- hibernateStatisticsServiceName = serviceName;
+ hibernateStatisticsServiceName = new ObjectName( serviceName );
StatisticsService hibernateStatisticsService = new StatisticsService();
hibernateStatisticsService.setSessionFactory( sessionFactory );
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(hibernateStatisticsServiceName, StatisticsService.class.getName());
- StringBuffer buffer = new StringBuffer();
- buffer.append("@org.jboss.aop.microcontainer.aspects.jmx.JMX(name=\"").append(hibernateStatisticsServiceName).append("JMX\"");
- buffer.append(", exposedInterface=").append(StatisticsServiceMBean.class.getName()).append(".class, registerDirectly=true)");
- String jmxAnnotation = buffer.toString();
- // todo - add the @JMX into annotations
- //builder.addAnnotation(jmxAnnotation);
- controller.install(builder.getBeanMetaData(), hibernateStatisticsService);
+ getServer().registerMBean( hibernateStatisticsService, hibernateStatisticsServiceName );
}
// Handle JNDI binding....
@@ -214,6 +191,10 @@
dirty = false;
+ sendNotification(
+ new Notification( SESSION_FACTORY_CREATE, getServiceName(), getNextNotificationSequenceNumber() )
+ );
+
runningSince = new Date();
log.info( "SessionFactory successfully built and bound into JNDI [" + sessionFactoryName + "]" );
@@ -240,7 +221,7 @@
{
try
{
- controller.uninstall( hibernateStatisticsServiceName );
+ getServer().unregisterMBean( hibernateStatisticsServiceName );
}
catch ( Throwable t )
{
@@ -248,12 +229,16 @@
log.warn( "unable to cleanup statistics mbean", t );
}
}
+
+ sendNotification(
+ new Notification( SESSION_FACTORY_DESTROY, getServiceName(), getNextNotificationSequenceNumber() )
+ );
}
}
private void handleMappings(Configuration cfg) throws IOException
{
- Iterator itr = mappings.iterator();
+ Iterator itr = classpathUrls.iterator();
while ( itr.hasNext() )
{
final URL url = (URL)itr.next();
@@ -263,6 +248,66 @@
}
/**
+ * Scan the current context's classloader to locate any potential sources of Hibernate mapping files.
+ *
+ * @throws DeploymentException
+ */
+ private void scanForMappings() throws DeploymentException
+ {
+ // Won't this cause problems if start() is called from say the console?
+ // a way around is to locate our DeploymentInfo and grab its ucl attribute
+ // for use here.
+ URL[] urls;
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if ( cl instanceof RepositoryClassLoader )
+ {
+ urls = ( ( RepositoryClassLoader ) cl ).getClasspath();
+ }
+ else if ( cl instanceof URLClassLoader )
+ {
+ urls = ( ( URLClassLoader ) cl ).getURLs();
+ }
+ else
+ {
+ throw new DeploymentException( "Unable to determine urls from classloader [" + cl + "]" );
+ }
+
+ // Search the urls for each of the classpath entries for any containing
+ // hibernate mapping files
+ VirtualFileVisitor visitor = new HibernateMappingVisitor(classpathUrls);
+ // visit har url if set
+ if (harUrl != null)
+ visitURL(harUrl, visitor);
+ // visit CL urls
+ for ( int i = 0; i < urls.length; i++ )
+ {
+ final URL entry = urls[i];
+ visitURL(entry, visitor);
+ }
+ log.trace("Found mappings: " + classpathUrls);
+ }
+
+ /**
+ * Visit url for possible mapping files.
+ *
+ * @param entry the url to visit
+ * @param visitor the visitor
+ */
+ protected void visitURL(URL entry, VirtualFileVisitor visitor)
+ {
+ log.trace( "checking classpath entry [" + entry + "]" );
+ try
+ {
+ VirtualFile vf = VFS.getRoot(entry);
+ vf.visit(visitor);
+ }
+ catch (IOException e)
+ {
+ log.debug("Ignoring URL entry: " + entry + ", exception: " + e);
+ }
+ }
+
+ /**
* Transfer the state represented by our current attribute values into the given Properties instance, translating our
* attributes into the appropriate Hibernate settings.
*
@@ -472,13 +517,13 @@
public String toString()
{
- return super.toString() + " [BeanName=" + beanName + ", JNDI=" + sessionFactoryName + "]";
+ return super.toString() + " [ServiceName=" + serviceName + ", JNDI=" + sessionFactoryName + "]";
}
// Managed operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- public void rebuildSessionFactory() throws Throwable
+ public void rebuildSessionFactory() throws Exception
{
destroySessionFactory();
buildSessionFactory();
@@ -507,7 +552,7 @@
return sessionFactory;
}
- public Object getStatisticsServiceName()
+ public ObjectName getStatisticsServiceName()
{
return hibernateStatisticsServiceName;
}
Modified: trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMBean.java
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMBean.java 2008-04-14 00:52:58 UTC (rev 72147)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMBean.java 2008-04-14 01:45:44 UTC (rev 72148)
@@ -8,9 +8,11 @@
import java.net.URL;
import java.util.Date;
+import javax.management.MBeanRegistration;
import javax.management.ObjectName;
import org.hibernate.SessionFactory;
+import org.jboss.system.ServiceMBean;
/**
* Describes a Hibernate service MBean. Configures a
@@ -19,6 +21,8 @@
* <li>auto-discovery : where the classpath of the top-level deployment
* containing this MBean is searched for jars and directories to add to the
* config
+ * <li>har-deployment : where the deployment containing this MBean description
+ * conforms to the har layout definition.
* </ul>
*
* @version <tt>$Revision$</tt>
@@ -26,10 +30,10 @@
* @author <a href="mailto:gavin at hibernate.org">Gavin King</a>
* @author <a href="mailto:steve at hibernate.org">Steve Ebersole</a>
* @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
*/
-public interface HibernateMBean
+public interface HibernateMBean extends ServiceMBean, MBeanRegistration
{
+
/**
* The url to the har deployment, if MBean is operating in har deployment mode.
*
@@ -98,7 +102,7 @@
*
* @return The service name of the stats mbean, or null if stats not enabled.
*/
- public Object getStatisticsServiceName();
+ public ObjectName getStatisticsServiceName();
/**
* The name of the dialect class to use for communicating with the database.
@@ -570,5 +574,6 @@
*
* @throws Exception
*/
- public void rebuildSessionFactory() throws Throwable;
+ public void rebuildSessionFactory() throws Exception;
+
}
Copied: trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMappingVisitor.java (from rev 72142, trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMappingVisitor.java)
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMappingVisitor.java (rev 0)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMappingVisitor.java 2008-04-14 01:45:44 UTC (rev 72148)
@@ -0,0 +1,89 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.hibernate.jmx;
+
+import java.net.URL;
+import java.util.Set;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileVisitor;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * Mapping visitor, matching .hbm.xml files.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class HibernateMappingVisitor implements VirtualFileVisitor
+{
+ private Set<URL> urls;
+
+ public HibernateMappingVisitor(Set<URL> urls)
+ {
+ if (urls == null)
+ throw new IllegalArgumentException("Null urls");
+ this.urls = urls;
+ }
+
+ private static class MappingVisitorAttributes extends VisitorAttributes
+ {
+ public MappingVisitorAttributes()
+ {
+ setIgnoreErrors(true);
+ setIncludeHidden(false);
+ setIncludeRoot(false);
+ setLeavesOnly(false);
+ setRecurseFilter(RECURSE_ALL);
+ }
+ }
+
+ private static final VisitorAttributes MAPPING_ATTRIBUTES = new MappingVisitorAttributes();
+
+ public VisitorAttributes getAttributes()
+ {
+ return MAPPING_ATTRIBUTES;
+ }
+
+ public void visit(VirtualFile vf)
+ {
+ try
+ {
+ if (isMapping(vf))
+ urls.add(vf.toURL());
+ }
+ catch (Exception e)
+ {
+ new RuntimeException("Visit failed: " + e);
+ }
+ }
+
+ /**
+ * Is virtual file a mapping file.
+ *
+ * @param vf the virtual file
+ * @return true if virtual file is mapping
+ */
+ protected boolean isMapping(VirtualFile vf)
+ {
+ return vf.getName().indexOf(".hbm.xml") > 0;
+ }
+}
Modified: trunk/hibernate-int/src/main/org/jboss/hibernate/session/HibernateContext.java
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/session/HibernateContext.java 2008-04-14 00:52:58 UTC (rev 72147)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/session/HibernateContext.java 2008-04-14 01:45:44 UTC (rev 72148)
@@ -87,7 +87,8 @@
try
{
context = new InitialContext();
- return ( SessionFactory ) context.lookup(name);
+ final SessionFactory factory = ( SessionFactory ) context.lookup(name);
+ return factory;
}
catch( NamingException e )
{
Modified: trunk/testsuite/imports/sections/hibernate.xml
===================================================================
--- trunk/testsuite/imports/sections/hibernate.xml 2008-04-14 00:52:58 UTC (rev 72147)
+++ trunk/testsuite/imports/sections/hibernate.xml 2008-04-14 01:45:44 UTC (rev 72148)
@@ -33,7 +33,7 @@
<jar basedir="${build.classes}" destfile="${build.lib}/hib-timers.har">
<metainf dir="${build.resources}/hibernate/ejbtimers">
- <include name="jboss-hibernate.xml"/>
+ <include name="jboss-service.xml"/>
<include name="Timers.hbm.xml"/>
</metainf>
<include name="org/jboss/test/hibernate/SimpleInterceptor.class"/>
Modified: trunk/testsuite/src/main/org/jboss/test/hibernate/test/TimersUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/hibernate/test/TimersUnitTestCase.java 2008-04-14 00:52:58 UTC (rev 72147)
+++ trunk/testsuite/src/main/org/jboss/test/hibernate/test/TimersUnitTestCase.java 2008-04-14 01:45:44 UTC (rev 72148)
@@ -70,7 +70,6 @@
ITimersHome home = (ITimersHome) ctx.lookup("hib-timers/ITimersHome");
ITimers bean = null;
- log.info("Starting test: " + getClass().getName());
try
{
bean = home.create();
Modified: trunk/testsuite/src/main/org/jboss/test/hibernate/timers/TimersFactory.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/hibernate/timers/TimersFactory.java 2008-04-14 00:52:58 UTC (rev 72147)
+++ trunk/testsuite/src/main/org/jboss/test/hibernate/timers/TimersFactory.java 2008-04-14 01:45:44 UTC (rev 72148)
@@ -23,7 +23,6 @@
import java.util.List;
import javax.naming.InitialContext;
-import javax.naming.NamingException;
import org.jboss.logging.Logger;
import org.hibernate.SessionFactory;
@@ -38,31 +37,22 @@
{
private static final Logger log = Logger.getLogger(Timers.class);
- private SessionFactory sessionFactory;
+ private final SessionFactory sessionFactory = getSessionFactory();
protected SessionFactory getSessionFactory()
{
- if (sessionFactory == null)
+ try
{
- try
- {
- InitialContext ctx = new InitialContext();
- try
- {
- sessionFactory = (SessionFactory) ctx.lookup("java:/hib-timers/SessionFactory");
- }
- finally
- {
- ctx.close();
- }
- }
- catch (Exception e)
- {
- log.error("Could not locate SessionFactory in JNDI", e);
- throw new IllegalStateException("Could not locate SessionFactory in JNDI");
- }
+ InitialContext ctx = new InitialContext();
+ SessionFactory factory = (SessionFactory) ctx.lookup("java:/hib-timers/SessionFactory");
+ ctx.close();
+ return factory;
}
- return sessionFactory;
+ catch (Exception e)
+ {
+ log.error("Could not locate SessionFactory in JNDI", e);
+ throw new IllegalStateException("Could not locate SessionFactory in JNDI");
+ }
}
public void persist(Timers transientInstance)
@@ -70,7 +60,7 @@
log.debug("persisting Timers instance");
try
{
- getSessionFactory().getCurrentSession().persist(transientInstance);
+ sessionFactory.getCurrentSession().persist(transientInstance);
log.debug("persist successful");
}
catch (RuntimeException re)
@@ -85,7 +75,7 @@
log.debug("attaching dirty Timers instance");
try
{
- getSessionFactory().getCurrentSession().saveOrUpdate(instance);
+ sessionFactory.getCurrentSession().saveOrUpdate(instance);
log.debug("attach successful");
}
catch (RuntimeException re)
@@ -100,7 +90,7 @@
log.debug("attaching clean Timers instance");
try
{
- getSessionFactory().getCurrentSession().lock(instance, LockMode.NONE);
+ sessionFactory.getCurrentSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
}
catch (RuntimeException re)
@@ -115,7 +105,7 @@
log.debug("deleting Timers instance");
try
{
- getSessionFactory().getCurrentSession().delete(persistentInstance);
+ sessionFactory.getCurrentSession().delete(persistentInstance);
log.debug("delete successful");
}
catch (RuntimeException re)
@@ -130,7 +120,7 @@
log.debug("merging Timers instance");
try
{
- Timers result = (Timers) getSessionFactory().getCurrentSession()
+ Timers result = (Timers) sessionFactory.getCurrentSession()
.merge(detachedInstance);
log.debug("merge successful");
return result;
@@ -144,7 +134,7 @@
public List listUsers() throws HibernateException
{
- return getSessionFactory().getCurrentSession()
+ return sessionFactory.getCurrentSession()
.createQuery("from Timers")
.list();
}
@@ -154,7 +144,7 @@
log.debug("getting Timers instance with id: " + id);
try
{
- Timers instance = (Timers) getSessionFactory().getCurrentSession()
+ Timers instance = (Timers) sessionFactory.getCurrentSession()
.get("org.jboss.ejb.txtimer.data.Timers", id);
if (instance == null)
{
Deleted: trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-hibernate.xml
===================================================================
--- trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-hibernate.xml 2008-04-14 00:52:58 UTC (rev 72147)
+++ trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-hibernate.xml 2008-04-14 01:45:44 UTC (rev 72148)
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<hibernate-configuration xmlns="urn:jboss:hibernate-deployer:1.0">
-
- <session-factory name="java:/hib-timers/SessionFactory" bean="jboss.test.har:service=Hibernate,testcase=TimersUnitTestCase">
- <property name="datasourceName">java:/DefaultDS</property>
- <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
- <property name="sessionFactoryInterceptor">org.jboss.test.hibernate.SimpleInterceptor</property>
- <property name="hbm2ddlAuto">create</property>
- <depends>jboss:service=Naming</depends>
- <depends>jboss:service=TransactionManager</depends>
- </session-factory>
-
-</hibernate-configuration>
Copied: trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-service.xml (from rev 72142, trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-service.xml)
===================================================================
--- trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-service.xml (rev 0)
+++ trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-service.xml 2008-04-14 01:45:44 UTC (rev 72148)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+
+ <mbean code="org.jboss.hibernate.jmx.Hibernate"
+ name="jboss.test.har:service=Hibernate,testcase=TimersUnitTestCase">
+ <attribute name="DatasourceName">java:/DefaultDS</attribute>
+ <attribute name="SessionFactoryName">
+ java:/hib-timers/SessionFactory</attribute>
+ <attribute name="Dialect">org.hibernate.dialect.HSQLDialect</attribute>
+ <attribute name="SessionFactoryInterceptor">
+ org.jboss.test.hibernate.SimpleInterceptor</attribute>
+ <attribute name="Hbm2ddlAuto">create</attribute>
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+ </mbean>
+
+</server>
Deleted: trunk/testsuite/src/resources/hibernate/har-deployment/jboss-hibernate.xml
===================================================================
--- trunk/testsuite/src/resources/hibernate/har-deployment/jboss-hibernate.xml 2008-04-14 00:52:58 UTC (rev 72147)
+++ trunk/testsuite/src/resources/hibernate/har-deployment/jboss-hibernate.xml 2008-04-14 01:45:44 UTC (rev 72148)
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<hibernate-configuration xmlns="urn:jboss:hibernate-deployer:1.0">
-
- <session-factory name="java:/hibernate/SessionFactory" bean="jboss.har:service=Hibernate">
- <property name="datasourceName">java:/DefaultDS</property>
- <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
- <property name="cacheProviderClass">org.hibernate.cache.HashtableCacheProvider</property>
- <property name="hbm2ddlAuto">create</property>
- <depends>jboss:service=Naming</depends>
- <depends>jboss:service=TransactionManager</depends>
- </session-factory>
-
-</hibernate-configuration>
Copied: trunk/testsuite/src/resources/hibernate/har-deployment/jboss-service.xml (from rev 72142, trunk/testsuite/src/resources/hibernate/har-deployment/jboss-service.xml)
===================================================================
--- trunk/testsuite/src/resources/hibernate/har-deployment/jboss-service.xml (rev 0)
+++ trunk/testsuite/src/resources/hibernate/har-deployment/jboss-service.xml 2008-04-14 01:45:44 UTC (rev 72148)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE server>
+
+<server>
+<!--
+ <mbean code="org.jboss.cache.jmx.CacheLegacyJmxWrapper" name="jboss.har:service=HarSecondLevelCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+ <attribute name="CacheMode">LOCAL</attribute>
+ <attribute name="ClusterName">HAR-Cluster</attribute>
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP mcast_addr="230.1.2.3" mcast_port="35666"
+ ip_ttl="64" ip_mcast="true"
+ mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
+ ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
+ loopback="false"/>
+ <PING timeout="2000" num_initial_members="3"
+ up_thread="false" down_thread="false"/>
+ <MERGE2 min_interval="10000" max_interval="20000"/>
+ <FD_SOCK/>
+ <VERIFY_SUSPECT timeout="1500"
+ up_thread="false" down_thread="false"/>
+ <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
+ max_xmit_size="8192" up_thread="false" down_thread="false"/>
+ <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
+ down_thread="false"/>
+ <pbcast.STABLE desired_avg_gossip="20000"
+ up_thread="false" down_thread="false"/>
+ <FRAG frag_size="8192"
+ down_thread="false" up_thread="false"/>
+ <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
+ shun="true" print_local_addr="true"/>
+ <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
+ </config>
+ </attribute>
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ </mbean>
+
+-->
+ <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=Hibernate">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+<!--
+ <depends optional-attribute-name="DeployedTreeCacheObjectName">jboss.har:service=HarSecondLevelCache</depends>
+-->
+ <attribute name="DatasourceName">java:/DefaultDS</attribute>
+ <attribute name="SessionFactoryName">java:/hibernate/SessionFactory</attribute>
+ <attribute name="Dialect">org.hibernate.dialect.HSQLDialect</attribute>
+<!--
+ <attribute name="CacheProviderClass">org.jboss.hibernate.cache.DeployedTreeCacheProvider</attribute>
+-->
+ <attribute name="CacheProviderClass">org.hibernate.cache.HashtableCacheProvider</attribute>
+ <attribute name="Hbm2ddlAuto">create-drop</attribute>
+
+ </mbean>
+
+</server>
+
More information about the jboss-cvs-commits
mailing list