站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.6 API 英文版文档

SessionFactoryBinder - JBOSS Portal 2.6 API 英文版文档


org.jboss.portal.jems.hibernate
Class SessionFactoryBinder

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.portal.jems.as.system.AbstractJBossService
              extended byorg.jboss.portal.jems.hibernate.SessionFactoryBinder
All Implemented Interfaces:
HibernateProvider, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class SessionFactoryBinder
extends AbstractJBossService
implements HibernateProvider

Configures and binds the hibernate session factory.

Version:
$Revision: 5448 $
Author:
Julien Viet, Boleslaw Dawidowicz

Field Summary
private  org.hibernate.cfg.Configuration config
          The hibernate configuration object.
private  java.lang.String configLocation
          .
private  java.net.URL configURL
          Where we configure hibernate.
private  java.lang.String dialectName
           
private  boolean doChecking
          If true checks the schema existence on start and create it if necessary.
protected  java.lang.String jndiName
           
private static int RESULT_CREATE
          doCheck result - schema not exist
private static int RESULT_NONE
          doCheck result - schema ok
private static int RESULT_UPDATE
          doCheck result - schema need updates
private  org.hibernate.SessionFactory sessionFactory
          The session factory.
private  java.lang.String setupLocation
          .
private  LoaderResource setupResource
          .
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
SessionFactoryBinder()
           
 
Method Summary
 void createContent()
           
 void createSchema()
           
protected  void createService()
          During this step the hibernate configuration is created.
protected  void createSessionFactory()
          Create the session factory.
 void destroySchema()
           
protected  void destroyService()
          During this step the hibernate config is unreferenced.
protected  void destroySessionFactory()
          Close the session factory if it is not null.
 int doCheck()
           
 org.hibernate.cfg.Configuration getConfig()
           
 java.lang.String getConfigLocation()
           
 java.net.URL getConfigURL()
           
private  int getDatabaseMajorVersion(java.sql.DatabaseMetaData meta)
           
 java.lang.String getDialectName()
           
 boolean getDoChecking()
           
 java.lang.String getJNDIName()
           
 org.hibernate.SessionFactory getSessionFactory()
           
 java.lang.String getSetupLocation()
           
 LoaderResource getSetupResource()
           
 void setConfigLocation(java.lang.String configLocation)
           
 void setDoChecking(boolean doChecking)
           
 void setJNDIName(java.lang.String jndiName)
           
private  void setPropertyIfAbsent(java.lang.String name, java.lang.String value)
           
 void setSetupLocation(java.lang.String setupLocation)
           
protected  void startService()
          During this step the session factory is created and the content creation is triggered.
protected  void stopService()
          During this step the session factory is destroyed.
 void updateSchema()
           
 
Methods inherited from class org.jboss.portal.jems.as.system.AbstractJBossService
create, destroy, getState, getStateString, start, stop
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESULT_NONE

private static final int RESULT_NONE
doCheck result - schema ok

See Also:
Constant Field Values

RESULT_UPDATE

private static final int RESULT_UPDATE
doCheck result - schema need updates

See Also:
Constant Field Values

RESULT_CREATE

private static final int RESULT_CREATE
doCheck result - schema not exist

See Also:
Constant Field Values

configLocation

private java.lang.String configLocation
.


setupLocation

private java.lang.String setupLocation
.


doChecking

private boolean doChecking
If true checks the schema existence on start and create it if necessary.


sessionFactory

private org.hibernate.SessionFactory sessionFactory
The session factory.


configURL

private java.net.URL configURL
Where we configure hibernate.


setupResource

private LoaderResource setupResource
.


config

private org.hibernate.cfg.Configuration config
The hibernate configuration object.


dialectName

private java.lang.String dialectName

jndiName

protected java.lang.String jndiName
Constructor Detail

SessionFactoryBinder

public SessionFactoryBinder()
Method Detail

getDoChecking

public boolean getDoChecking()

setDoChecking

public void setDoChecking(boolean doChecking)

getConfigLocation

public java.lang.String getConfigLocation()

setConfigLocation

public void setConfigLocation(java.lang.String configLocation)

getSetupLocation

public java.lang.String getSetupLocation()

setSetupLocation

public void setSetupLocation(java.lang.String setupLocation)

getConfigURL

public java.net.URL getConfigURL()

getSetupResource

public LoaderResource getSetupResource()

getConfig

public org.hibernate.cfg.Configuration getConfig()
Specified by:
getConfig in interface HibernateProvider

getSessionFactory

public org.hibernate.SessionFactory getSessionFactory()
Specified by:
getSessionFactory in interface HibernateProvider

getDialectName

public java.lang.String getDialectName()

getJNDIName

public java.lang.String getJNDIName()

setJNDIName

public void setJNDIName(java.lang.String jndiName)

createService

protected void createService()
                      throws java.lang.Exception
During this step the hibernate configuration is created.

Throws:
java.lang.Exception

setPropertyIfAbsent

private void setPropertyIfAbsent(java.lang.String name,
                                 java.lang.String value)

startService

protected void startService()
                     throws java.lang.Exception
During this step the session factory is created and the content creation is triggered.

Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
During this step the session factory is destroyed.

Throws:
java.lang.Exception

destroyService

protected void destroyService()
                       throws java.lang.Exception
During this step the hibernate config is unreferenced.

Throws:
java.lang.Exception

doCheck

public int doCheck()

createSchema

public void createSchema()

destroySchema

public void destroySchema()

createContent

public void createContent()

updateSchema

public void updateSchema()

createSessionFactory

protected void createSessionFactory()
                             throws java.lang.Exception
Create the session factory.

Throws:
java.lang.Exception

destroySessionFactory

protected void destroySessionFactory()
Close the session factory if it is not null.


getDatabaseMajorVersion

private int getDatabaseMajorVersion(java.sql.DatabaseMetaData meta)