站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 varia API Documentation 英文版文档

DataSourceDelegator (Various API) - JBoss 3.2.7 varia API Documentation 英文版文档


org.jboss.varia.dsdelegator
Class DataSourceDelegator

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.varia.dsdelegator.DataSourceDelegator
All Implemented Interfaces:
DataSource, DataSourceDelegatorMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class DataSourceDelegator
extends org.jboss.system.ServiceMBeanSupport
implements DataSource, DataSourceDelegatorMBean

DataSource delegator service. The goal is to dynamically change the datasource, for example, for entity beans at runtime. The service implements javax.sql.DataSource interface and is bound in the JNDI. The target datasource can be changed with setTargetName(String jndiName) passing in the JNDI name of the target datasource.

Author:
Alexey Loubyansky

Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.varia.dsdelegator.DataSourceDelegatorMBean
OBJECT_NAME
 
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
DataSourceDelegator()
           
 
Method Summary
 String getBindName()
           
 Connection getConnection()
           
 Connection getConnection(String user, String password)
           
 int getLoginTimeout()
           
 PrintWriter getLogWriter()
           
 String getTargetName()
           
 void setBindName(String bindName)
           
 void setLoginTimeout(int seconds)
           
 void setLogWriter(PrintWriter printWriter)
           
 void setTargetName(String targetName)
           
 void startService()
           
 void stopService()
           
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Constructor Detail

DataSourceDelegator

public DataSourceDelegator()
Method Detail

setBindName

public void setBindName(String bindName)
                 throws NamingException
Specified by:
setBindName in interface DataSourceDelegatorMBean
Parameters:
bindName - the name under which the service will be bound in JNDI.
Throws:
NamingException

getBindName

public String getBindName()
Specified by:
getBindName in interface DataSourceDelegatorMBean
Returns:
the name under which the service is bound in JNDI.

getTargetName

public String getTargetName()
Specified by:
getTargetName in interface DataSourceDelegatorMBean
Returns:
JNDI name of the target datasource.

setTargetName

public void setTargetName(String targetName)
                   throws NamingException
Specified by:
setTargetName in interface DataSourceDelegatorMBean
Parameters:
targetName - the JNDI name of target DataSource.
Throws:
NamingException

startService

public void startService()
                  throws Exception
Throws:
Exception

stopService

public void stopService()
                 throws Exception
Throws:
Exception

getConnection

public Connection getConnection()
                         throws SQLException
Specified by:
getConnection in interface DataSource
Throws:
SQLException

getConnection

public Connection getConnection(String user,
                                String password)
                         throws SQLException
Specified by:
getConnection in interface DataSource
Throws:
SQLException

getLogWriter

public PrintWriter getLogWriter()
                         throws SQLException
Specified by:
getLogWriter in interface DataSource
Throws:
SQLException

getLoginTimeout

public int getLoginTimeout()
                    throws SQLException
Specified by:
getLoginTimeout in interface DataSource
Throws:
SQLException

setLogWriter

public void setLogWriter(PrintWriter printWriter)
                  throws SQLException
Specified by:
setLogWriter in interface DataSource
Throws:
SQLException

setLoginTimeout

public void setLoginTimeout(int seconds)
                     throws SQLException
Specified by:
setLoginTimeout in interface DataSource
Throws:
SQLException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.