[jboss-cvs] JBossAS SVN: r72143 - in trunk: hibernate-int and 12 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Apr 13 13:40:12 EDT 2008


Author: alesj
Date: 2008-04-13 13:40:10 -0400 (Sun, 13 Apr 2008)
New Revision: 72143

Added:
   trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/
   trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/HibernateDeployer.java
   trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/HibernateMappingVisitor.java
   trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/
   trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/BaseElement.java
   trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/BaseNamedElement.java
   trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/HibernateMetaData.java
   trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/SessionFactoryMetaData.java
   trunk/hibernate-int/src/resources/
   trunk/hibernate-int/src/resources/hibernate-deployer-beans.xml
   trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-hibernate.xml
   trunk/testsuite/src/resources/hibernate/har-deployment/jboss-hibernate.xml
Removed:
   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
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:
[JBAS-5232]; changing Hibernate bean to work with new classloader and VFS.

Modified: trunk/build/build-distr.xml
===================================================================
--- trunk/build/build-distr.xml	2008-04-13 17:35:26 UTC (rev 72142)
+++ trunk/build/build-distr.xml	2008-04-13 17:40:10 UTC (rev 72143)
@@ -1606,6 +1606,12 @@
       <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-13 17:35:26 UTC (rev 72142)
+++ trunk/hibernate-int/build.xml	2008-04-13 17:40:10 UTC (rev 72143)
@@ -76,10 +76,14 @@
       <path refid="hibernate3.classpath"/>
       <path refid="odmg.classpath"/>
       <path refid="cglib.classpath"/>
-      <path refid="jboss.jboss.deployers.classpath"/>      
+      <path refid="javax.xml.bind.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-13 17:35:26 UTC (rev 72142)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/ListenerInjector.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -9,8 +9,6 @@
 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}.
@@ -36,11 +34,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(ObjectName objectName, Configuration configuration) throws DeploymentException;
+	public void injectListeners(Object objectName, Configuration configuration) throws DeploymentException;
 }

Added: trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/HibernateDeployer.java
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/HibernateDeployer.java	                        (rev 0)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/HibernateDeployer.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -0,0 +1,117 @@
+/*
+* 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.deployers;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.hibernate.deployers.metadata.BaseElement;
+import org.jboss.hibernate.deployers.metadata.BaseNamedElement;
+import org.jboss.hibernate.deployers.metadata.HibernateMetaData;
+import org.jboss.hibernate.deployers.metadata.SessionFactoryMetaData;
+import org.jboss.hibernate.jmx.Hibernate;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileVisitor;
+
+/**
+ * Hibernate deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class HibernateDeployer extends AbstractSimpleRealDeployer<HibernateMetaData>
+{
+   private boolean scanFromTop;
+
+   public HibernateDeployer()
+   {
+      super(HibernateMetaData.class);
+      setOutput(BeanMetaData.class);
+   }
+
+   public void deploy(DeploymentUnit unit, HibernateMetaData metaData) throws DeploymentException
+   {
+      if (unit instanceof VFSDeploymentUnit == false)
+         return;
+
+      SessionFactoryMetaData sessionFactoryMetaData = metaData.getSessionFactory();
+      if (sessionFactoryMetaData == null)
+         return;
+
+      VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
+      if (scanFromTop)
+         vfsUnit = vfsUnit.getTopLevel();
+
+      Set<URL> mappings = new HashSet<URL>();
+      VirtualFile root = vfsUnit.getRoot();
+      VirtualFileVisitor visitor = new HibernateMappingVisitor(mappings);
+      try
+      {
+         root.visit(visitor);
+      }
+      catch (IOException e)
+      {
+         throw DeploymentException.rethrowAsDeploymentException("Cannot scan for mappings.", e);
+      }
+      // build the hibernate bean
+      String beanName = sessionFactoryMetaData.getBean();
+      if (beanName == null)
+         beanName = unit.getSimpleName() + "$Hibernate";
+
+      BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(beanName, Hibernate.class.getName());
+      builder.addConstructorParameter(Set.class.getName(), mappings);
+      builder.addPropertyMetaData("sessionFactoryName", sessionFactoryMetaData.getName());
+      Set<BaseNamedElement> propertys = sessionFactoryMetaData.getProperties();
+      if (propertys != null && propertys.isEmpty() == false)
+      {
+         for (BaseNamedElement bne : propertys)
+            builder.addPropertyMetaData(bne.getName(), bne.getValue());
+      }
+      Set<BaseElement> depends = sessionFactoryMetaData.getDepends();
+      if (depends != null && depends.isEmpty() == false)
+      {
+         for (BaseElement bne : depends)
+            builder.addDependency(bne.getValue());
+      }
+      BeanMetaData beanMetaData = builder.getBeanMetaData();
+      vfsUnit.addAttachment(BeanMetaData.class + "$Hibernate", beanMetaData);
+      log.info("Created Hibernate bean: " + beanMetaData);
+   }
+
+   /**
+    * Do we scan for mapping from the top,
+    * or from this deployment unit.
+    *
+    * @param scanFromTop true if we're scanning from the top
+    */
+   public void setScanFromTop(boolean scanFromTop)
+   {
+      this.scanFromTop = scanFromTop;
+   }
+}

Copied: trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/HibernateMappingVisitor.java (from rev 72106, trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMappingVisitor.java)
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/HibernateMappingVisitor.java	                        (rev 0)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/HibernateMappingVisitor.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -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.deployers;
+
+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)
+      {
+         throw 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;
+   }
+}

Added: trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/BaseElement.java
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/BaseElement.java	                        (rev 0)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/BaseElement.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -0,0 +1,50 @@
+/*
+* 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.deployers.metadata;
+
+import java.io.Serializable;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+/**
+ * Simple name element.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at XmlType(name = "baseType")
+public class BaseElement implements Serializable
+{
+   private static final long serialVersionUID = 1;
+
+   private Object value;
+
+   public Object getValue()
+   {
+      return value;
+   }
+
+   @XmlValue
+   public void setValue(Object value)
+   {
+      this.value = value;
+   }
+}
\ No newline at end of file

Added: trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/BaseNamedElement.java
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/BaseNamedElement.java	                        (rev 0)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/BaseNamedElement.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -0,0 +1,49 @@
+/*
+* 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.deployers.metadata;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * Simple name element.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at XmlType(name = "namedType")
+public class BaseNamedElement extends BaseElement
+{
+   private static final long serialVersionUID = 1;
+
+   private String name;
+
+   public String getName()
+   {
+      return name;
+   }
+
+   @XmlAttribute
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+}

Added: trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/HibernateMetaData.java
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/HibernateMetaData.java	                        (rev 0)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/HibernateMetaData.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -0,0 +1,56 @@
+/*
+* 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.deployers.metadata;
+
+import java.io.Serializable;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * Hibernate metadata.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at JBossXmlSchema(namespace="urn:jboss:hibernate-deployer:1.0", elementFormDefault=XmlNsForm.QUALIFIED, replacePropertyRefs=false)
+ at XmlRootElement(name="hibernate-configuration")
+ at XmlType(name="hibernateConfigurationType", propOrder={"sessionFactory"})
+public class HibernateMetaData implements Serializable
+{
+   private static final long serialVersionUID = 1;
+
+   private SessionFactoryMetaData sessionFactory;
+
+   public SessionFactoryMetaData getSessionFactory()
+   {
+      return sessionFactory;
+   }
+
+   @XmlElement(name = "session-factory")
+   public void setSessionFactory(SessionFactoryMetaData sessionFactory)
+   {
+      this.sessionFactory = sessionFactory;
+   }
+}

Added: trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/SessionFactoryMetaData.java
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/SessionFactoryMetaData.java	                        (rev 0)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/deployers/metadata/SessionFactoryMetaData.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -0,0 +1,90 @@
+/*
+* 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.deployers.metadata;
+
+import java.io.Serializable;
+import java.util.Set;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * Hibernate session factory metadata.
+ * 
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at XmlRootElement(name="session-factory")
+ at XmlType(name="sessionFactoryType", propOrder={"properties", "depends"})
+public class SessionFactoryMetaData implements Serializable
+{
+   private static final long serialVersionUID = 1;
+
+   private String name;
+   private String bean;
+   private Set<BaseNamedElement> properties;
+   private Set<BaseElement> depends;
+
+   public String getName()
+   {
+      return name;
+   }
+
+   @XmlAttribute(required = true)
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   public String getBean()
+   {
+      return bean;
+   }
+
+   @XmlAttribute
+   public void setBean(String bean)
+   {
+      this.bean = bean;
+   }
+
+   public Set<BaseNamedElement> getProperties()
+   {
+      return properties;
+   }
+
+   @XmlElement(name="property")
+   public void setProperties(Set<BaseNamedElement> properties)
+   {
+      this.properties = properties;
+   }
+
+   public Set<BaseElement> getDepends()
+   {
+      return depends;
+   }
+
+   @XmlElement(name="depends")
+   public void setDepends(Set<BaseElement> depends)
+   {
+      this.depends = depends;
+   }
+}
\ No newline at end of file

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-13 17:35:26 UTC (rev 72142)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -8,13 +8,10 @@
 
 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;
@@ -25,18 +22,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.deployment.DeploymentException;
+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.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.
@@ -48,7 +45,7 @@
  * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
  * @version <tt>$Revision$</tt>
  */
-public class Hibernate extends ServiceMBeanSupport implements HibernateMBean
+public class Hibernate implements HibernateMBean
 {
    private static final Logger log = Logger.getLogger( Hibernate.class );
 
@@ -89,18 +86,41 @@
    private String listenerInjector;
    private URL harUrl;
    private boolean scanForMappingsEnabled = false;
-   private Set classpathUrls = new HashSet();
+   private Set mappings;
 
    // Internal state
    private boolean dirty = false;
    private Date runningSince;
    private SessionFactory sessionFactory;
-   private ObjectName hibernateStatisticsServiceName;
+   private String 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 startService() throws Exception
+   public void start() throws Throwable
    {
       log.debug( "Hibernate MBean starting; " + this );
 
@@ -110,19 +130,15 @@
          destroySessionFactory();
       }
 
-      log.trace( "start scanning for mappings" );
-      scanForMappings();
-
       buildSessionFactory();
    }
 
    /**
     * Close the <tt>SessionFactory</tt>.
     */
-   public void stopService() throws Exception
+   public void stop() throws Exception
    {
       destroySessionFactory();
-      classpathUrls.clear();
    }
 
    /**
@@ -130,7 +146,7 @@
     *
     * @throws Exception
     */
-   private void buildSessionFactory() throws Exception
+   private void buildSessionFactory() throws Throwable
    {
       log.debug( "Building SessionFactory; " + this );
 
@@ -141,7 +157,7 @@
       ListenerInjector listenerInjector = generateListenerInjectorInstance();
       if ( listenerInjector != null )
       {
-         listenerInjector.injectListeners( getServiceName(), cfg );
+         listenerInjector.injectListeners( beanName, cfg );
       }
 
       // Handle config settings....
@@ -165,7 +181,7 @@
          // Handle stat-mbean creation/registration....
          if ( sessionFactory.getStatistics() != null && sessionFactory.getStatistics().isStatisticsEnabled() )
          {
-            String serviceName = getServiceName().toString();
+            String serviceName = beanName.toString();
             if( serviceName.indexOf("type=service") != -1 )
             {
                serviceName = serviceName.replaceAll("type=service","type=stats");
@@ -174,10 +190,17 @@
             {
                serviceName = serviceName + ",type=stats";
             }
-            hibernateStatisticsServiceName = new ObjectName(  serviceName );
+            hibernateStatisticsServiceName = serviceName;
             StatisticsService hibernateStatisticsService = new StatisticsService();
             hibernateStatisticsService.setSessionFactory( sessionFactory );
-            getServer().registerMBean( hibernateStatisticsService, hibernateStatisticsServiceName );
+            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);
          }
 
          // Handle JNDI binding....
@@ -191,10 +214,6 @@
 
       dirty = false;
 
-      sendNotification(
-            new Notification( SESSION_FACTORY_CREATE, getServiceName(), getNextNotificationSequenceNumber() )
-      );
-
       runningSince = new Date();
 
       log.info( "SessionFactory successfully built and bound into JNDI [" + sessionFactoryName + "]" );
@@ -221,7 +240,7 @@
          {
             try
             {
-               getServer().unregisterMBean( hibernateStatisticsServiceName );
+               controller.uninstall( hibernateStatisticsServiceName );
             }
             catch ( Throwable t )
             {
@@ -229,16 +248,12 @@
                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 = classpathUrls.iterator();
+      Iterator itr = mappings.iterator();
       while ( itr.hasNext() )
       {
          final URL url = (URL)itr.next();
@@ -248,66 +263,6 @@
    }
 
    /**
-    * 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.
     *
@@ -517,13 +472,13 @@
 
    public String toString()
    {
-      return super.toString() + " [ServiceName=" + serviceName + ", JNDI=" + sessionFactoryName + "]";
+      return super.toString() + " [BeanName=" + beanName + ", JNDI=" + sessionFactoryName + "]";
    }
 
 
    // Managed operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-   public void rebuildSessionFactory() throws Exception
+   public void rebuildSessionFactory() throws Throwable
    {
       destroySessionFactory();
       buildSessionFactory();
@@ -552,7 +507,7 @@
       return sessionFactory;
    }
 
-   public ObjectName getStatisticsServiceName()
+   public Object 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-13 17:35:26 UTC (rev 72142)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMBean.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -8,11 +8,9 @@
 
 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
@@ -21,8 +19,6 @@
  * <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>
@@ -30,10 +26,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 extends ServiceMBean, MBeanRegistration
+public interface HibernateMBean
 {
-
 	/**
     * The url to the har deployment, if MBean is operating in har deployment mode.
 	 *
@@ -102,7 +98,7 @@
 	 *
 	 * @return The service name of the stats mbean, or null if stats not enabled.
 	 */
-	public ObjectName getStatisticsServiceName();
+	public Object getStatisticsServiceName();
 
 	/**
 	 * The name of the dialect class to use for communicating with the database.
@@ -574,6 +570,5 @@
 	 *
 	 * @throws Exception
 	 */
-	public void rebuildSessionFactory() throws Exception;
-
+	public void rebuildSessionFactory() throws Throwable;
 }

Deleted: trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMappingVisitor.java
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMappingVisitor.java	2008-04-13 17:35:26 UTC (rev 72142)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMappingVisitor.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -1,89 +0,0 @@
-/*
-* 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-13 17:35:26 UTC (rev 72142)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/session/HibernateContext.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -87,8 +87,7 @@
       try
       {
          context = new InitialContext();
-         final SessionFactory factory = ( SessionFactory ) context.lookup(name);
-         return factory;
+         return ( SessionFactory ) context.lookup(name);
       }
       catch( NamingException e )
       {

Added: trunk/hibernate-int/src/resources/hibernate-deployer-beans.xml
===================================================================
--- trunk/hibernate-int/src/resources/hibernate-deployer-beans.xml	                        (rev 0)
+++ trunk/hibernate-int/src/resources/hibernate-deployer-beans.xml	2008-04-13 17:40:10 UTC (rev 72143)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+   Hibernate deployer beans.
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+<!--
+  <jbossxb-parser xmlns="urn:jboss:deployers:2.0"
+                            name="HibernateParser"
+                            class="org.jboss.hibernate.deployers.metadata.HibernateMetaData"
+                            registerWithJBossXB="true"
+                            suffix="-hibernate.xml"/>
+-->
+
+  <bean name="HibernateParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+      <constructor>
+         <parameter>org.jboss.hibernate.deployers.metadata.HibernateMetaData</parameter>
+      </constructor>
+      <property name="suffix">-hibernate.xml</property>
+      <property name="registerWithJBossXB">true</property>
+   </bean>
+
+  <bean name="HibernateDeployer" class="org.jboss.hibernate.deployers.HibernateDeployer"/>
+
+</deployment>

Modified: trunk/testsuite/imports/sections/hibernate.xml
===================================================================
--- trunk/testsuite/imports/sections/hibernate.xml	2008-04-13 17:35:26 UTC (rev 72142)
+++ trunk/testsuite/imports/sections/hibernate.xml	2008-04-13 17:40:10 UTC (rev 72143)
@@ -33,7 +33,7 @@
       
       <jar basedir="${build.classes}" destfile="${build.lib}/hib-timers.har">
          <metainf dir="${build.resources}/hibernate/ejbtimers">
-            <include name="jboss-service.xml"/>
+            <include name="jboss-hibernate.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-13 17:35:26 UTC (rev 72142)
+++ trunk/testsuite/src/main/org/jboss/test/hibernate/test/TimersUnitTestCase.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -70,6 +70,7 @@
       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-13 17:35:26 UTC (rev 72142)
+++ trunk/testsuite/src/main/org/jboss/test/hibernate/timers/TimersFactory.java	2008-04-13 17:40:10 UTC (rev 72143)
@@ -23,6 +23,7 @@
 
 import java.util.List;
 import javax.naming.InitialContext;
+import javax.naming.NamingException;
 
 import org.jboss.logging.Logger;
 import org.hibernate.SessionFactory;
@@ -37,22 +38,31 @@
 {
    private static final Logger log = Logger.getLogger(Timers.class);
 
-   private final SessionFactory sessionFactory = getSessionFactory();
+   private SessionFactory sessionFactory;
 
    protected SessionFactory getSessionFactory()
    {
-      try
+      if (sessionFactory == null)
       {
-         InitialContext ctx = new InitialContext();
-         SessionFactory factory = (SessionFactory) ctx.lookup("java:/hib-timers/SessionFactory");
-         ctx.close();
-         return factory;
+         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");
+         }
       }
-      catch (Exception e)
-      {
-         log.error("Could not locate SessionFactory in JNDI", e);
-         throw new IllegalStateException("Could not locate SessionFactory in JNDI");
-      }
+      return sessionFactory;
    }
 
    public void persist(Timers transientInstance)
@@ -60,7 +70,7 @@
       log.debug("persisting Timers instance");
       try
       {
-         sessionFactory.getCurrentSession().persist(transientInstance);
+         getSessionFactory().getCurrentSession().persist(transientInstance);
          log.debug("persist successful");
       }
       catch (RuntimeException re)
@@ -75,7 +85,7 @@
       log.debug("attaching dirty Timers instance");
       try
       {
-         sessionFactory.getCurrentSession().saveOrUpdate(instance);
+         getSessionFactory().getCurrentSession().saveOrUpdate(instance);
          log.debug("attach successful");
       }
       catch (RuntimeException re)
@@ -90,7 +100,7 @@
       log.debug("attaching clean Timers instance");
       try
       {
-         sessionFactory.getCurrentSession().lock(instance, LockMode.NONE);
+         getSessionFactory().getCurrentSession().lock(instance, LockMode.NONE);
          log.debug("attach successful");
       }
       catch (RuntimeException re)
@@ -105,7 +115,7 @@
       log.debug("deleting Timers instance");
       try
       {
-         sessionFactory.getCurrentSession().delete(persistentInstance);
+         getSessionFactory().getCurrentSession().delete(persistentInstance);
          log.debug("delete successful");
       }
       catch (RuntimeException re)
@@ -120,7 +130,7 @@
       log.debug("merging Timers instance");
       try
       {
-         Timers result = (Timers) sessionFactory.getCurrentSession()
+         Timers result = (Timers) getSessionFactory().getCurrentSession()
             .merge(detachedInstance);
          log.debug("merge successful");
          return result;
@@ -134,7 +144,7 @@
 
    public List listUsers() throws HibernateException
    {
-      return sessionFactory.getCurrentSession()
+      return getSessionFactory().getCurrentSession()
             .createQuery("from Timers")
             .list();
    }
@@ -144,7 +154,7 @@
       log.debug("getting Timers instance with id: " + id);
       try
       {
-         Timers instance = (Timers) sessionFactory.getCurrentSession()
+         Timers instance = (Timers) getSessionFactory().getCurrentSession()
             .get("org.jboss.ejb.txtimer.data.Timers", id);
          if (instance == null)
          {

Added: trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-hibernate.xml
===================================================================
--- trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-hibernate.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-hibernate.xml	2008-04-13 17:40:10 UTC (rev 72143)
@@ -0,0 +1,14 @@
+<?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>

Deleted: trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-service.xml
===================================================================
--- trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-service.xml	2008-04-13 17:35:26 UTC (rev 72142)
+++ trunk/testsuite/src/resources/hibernate/ejbtimers/jboss-service.xml	2008-04-13 17:40:10 UTC (rev 72143)
@@ -1,19 +0,0 @@
-<?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>

Added: trunk/testsuite/src/resources/hibernate/har-deployment/jboss-hibernate.xml
===================================================================
--- trunk/testsuite/src/resources/hibernate/har-deployment/jboss-hibernate.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/hibernate/har-deployment/jboss-hibernate.xml	2008-04-13 17:40:10 UTC (rev 72143)
@@ -0,0 +1,14 @@
+<?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>

Deleted: trunk/testsuite/src/resources/hibernate/har-deployment/jboss-service.xml
===================================================================
--- trunk/testsuite/src/resources/hibernate/har-deployment/jboss-service.xml	2008-04-13 17:35:26 UTC (rev 72142)
+++ trunk/testsuite/src/resources/hibernate/har-deployment/jboss-service.xml	2008-04-13 17:40:10 UTC (rev 72143)
@@ -1,65 +0,0 @@
-<?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