org.ow2.jonas.db.base
Class AbsDBServiceImpl

java.lang.Object
  extended by org.ow2.jonas.lib.management.javaee.ManagedObject
      extended by org.ow2.jonas.lib.service.AbsServiceImpl
          extended by org.ow2.jonas.db.base.AbsDBServiceImpl
All Implemented Interfaces:
Service

public abstract class AbsDBServiceImpl
extends AbsServiceImpl

Abstract database service to be implemented by implementation of Java databases.

Author:
Florent Benoit

Field Summary
protected  JmxService jmxService
          TheJmxService
protected  ObjectName objectName
          The ObjectName associate to the database MBean
protected  String portNumber
          port number used.
 
Constructor Summary
AbsDBServiceImpl()
          Constructor initialization.
 
Method Summary
 void bindJmxService(JmxService jmxService)
           
protected  void doStart()
          Start the service.
protected  void doStop()
          Stop the service.
 String getDbName()
           
 String getDbUsers()
           
static org.objectweb.util.monolog.api.Logger getLogger()
           
 String getPortNumber()
          
protected abstract  void initServer(List<User> users, String databaseName, String portNumber)
          Create a database with the specified arguments.
protected  void registerMBean()
          Register DB MBean
 void setDbname(String db)
           
 void setPort(String port)
           
 void setUsers(String users)
          Transform the pair user:pass into User instances.
 void unbindJmxService(JmxService jmxService)
           
 
Methods inherited from class org.ow2.jonas.lib.service.AbsServiceImpl
convertToList, doInit, getDomainName, getJonasServerName, getName, getSequenceNumber, getServerProperties, init, isStarted, setName, setServerProperties, start, stop, throwRequirementException, toString
 
Methods inherited from class org.ow2.jonas.lib.management.javaee.ManagedObject
getModelMBean, sendNotification, sendReconfigNotification, sendSaveNotification, setModelMBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jmxService

protected JmxService jmxService
TheJmxService


objectName

protected ObjectName objectName
The ObjectName associate to the database MBean


portNumber

protected String portNumber
port number used.

Constructor Detail

AbsDBServiceImpl

public AbsDBServiceImpl()
Constructor initialization.

Method Detail

setUsers

public void setUsers(String users)
Transform the pair user:pass into User instances.

Parameters:
users - String of user/password (separated by a ":")

setPort

public void setPort(String port)
Parameters:
port - Database port

setDbname

public void setDbname(String db)
Parameters:
db - Database name

initServer

protected abstract void initServer(List<User> users,
                                   String databaseName,
                                   String portNumber)
                            throws ServiceException
Create a database with the specified arguments. Need to be implemented by classes extending this one.

Parameters:
users - user/password (separated by a ":")
databaseName - name of the database
portNumber - port number of the database
Throws:
ServiceException

doStart

protected void doStart()
                throws ServiceException
Start the service.

Specified by:
doStart in class AbsServiceImpl
Throws:
ServiceException - if the startup failed.

doStop

protected void doStop()
               throws ServiceException
Stop the service.

Specified by:
doStop in class AbsServiceImpl
Throws:
ServiceException - if the stop failed.

getLogger

public static org.objectweb.util.monolog.api.Logger getLogger()
Returns:
the logger.

bindJmxService

public void bindJmxService(JmxService jmxService)
Parameters:
jmxService - The JmxService to bind

unbindJmxService

public void unbindJmxService(JmxService jmxService)
Parameters:
jmxService - The JmxService to unbind

registerMBean

protected void registerMBean()
Register DB MBean


getPortNumber

public String getPortNumber()


getDbName

public String getDbName()
Returns:
the name of the db

getDbUsers

public String getDbUsers()
Returns:
the list of pair of


Copyright © 2012 OW2 Consortium. All Rights Reserved.