eu.etaxonomy.cdm.api.service
Class DatabaseServiceHibernateImpl

java.lang.Object
  extended by eu.etaxonomy.cdm.api.service.DatabaseServiceHibernateImpl
All Implemented Interfaces:
IDatabaseService, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@Service
@Transactional(readOnly=true)
public class DatabaseServiceHibernateImpl
extends Object
implements IDatabaseService, org.springframework.context.ApplicationContextAware

Author:
a.mueller

Field Summary
protected  org.springframework.context.ApplicationContext appContext
           
 
Constructor Summary
DatabaseServiceHibernateImpl()
           
 
Method Summary
 boolean connectToDatabase(DatabaseTypeEnum databaseTypeEnum, String server, String database, String username, String password)
          Connect to the database with the given parameters.
 boolean connectToDatabase(DatabaseTypeEnum databaseTypeEnum, String server, String database, String username, String password, int port, String filePath, H2Mode mode, NomenclaturalCode code)
          Connect to the database with the given parameters
 boolean connectToDatasource(CdmPersistentDataSource dataSource)
          Connect to the database with the given parameters.
 String getUrl()
          Returns the database URL
 String getUsername()
          Returns the username.
 CdmPersistentDataSource saveDataSource(String strDataSourceName, ICdmDataSource dataSource)
          Saves a new ICdmDatasource into the datasource config file.
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setApplicationController(CdmApplicationController cdmApplicationController)
           
 CdmPersistentDataSource updateDataSource(String strDataSourceName, CdmPersistentDataSource dataSource)
          Update an already saved datasource in datasource config file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

appContext

@Autowired
protected org.springframework.context.ApplicationContext appContext
Constructor Detail

DatabaseServiceHibernateImpl

public DatabaseServiceHibernateImpl()
Method Detail

setApplicationController

public void setApplicationController(CdmApplicationController cdmApplicationController)
Specified by:
setApplicationController in interface IDatabaseService

connectToDatasource

public boolean connectToDatasource(CdmPersistentDataSource dataSource)
                            throws TermNotFoundException
Description copied from interface: IDatabaseService
Connect to the database with the given parameters. Uses default port.

Specified by:
connectToDatasource in interface IDatabaseService
Returns:
returns true if successful
Throws:
TermNotFoundException

connectToDatabase

public boolean connectToDatabase(DatabaseTypeEnum databaseTypeEnum,
                                 String server,
                                 String database,
                                 String username,
                                 String password,
                                 int port,
                                 String filePath,
                                 H2Mode mode,
                                 NomenclaturalCode code)
                          throws TermNotFoundException
Description copied from interface: IDatabaseService
Connect to the database with the given parameters

Specified by:
connectToDatabase in interface IDatabaseService
Returns:
returns true if successful
Throws:
TermNotFoundException

connectToDatabase

public boolean connectToDatabase(DatabaseTypeEnum databaseTypeEnum,
                                 String server,
                                 String database,
                                 String username,
                                 String password)
                          throws TermNotFoundException
Description copied from interface: IDatabaseService
Connect to the database with the given parameters. Uses default port.

Specified by:
connectToDatabase in interface IDatabaseService
Returns:
returns true if successful
Throws:
TermNotFoundException

saveDataSource

public CdmPersistentDataSource saveDataSource(String strDataSourceName,
                                              ICdmDataSource dataSource)
Description copied from interface: IDatabaseService
Saves a new ICdmDatasource into the datasource config file.

Specified by:
saveDataSource in interface IDatabaseService
Returns:

updateDataSource

public CdmPersistentDataSource updateDataSource(String strDataSourceName,
                                                CdmPersistentDataSource dataSource)
                                         throws DataSourceNotFoundException
Description copied from interface: IDatabaseService
Update an already saved datasource in datasource config file

Specified by:
updateDataSource in interface IDatabaseService
Parameters:
strDataSourceName - the beanId under which the dataSource should be saved
dataSource - the dataSource to be saved
Returns:
the CdmDataSource, null if not successful
Throws:
DataSourceNotFoundException

getUrl

public String getUrl()
Description copied from interface: IDatabaseService
Returns the database URL

Specified by:
getUrl in interface IDatabaseService
Returns:

getUsername

public String getUsername()
Description copied from interface: IDatabaseService
Returns the username.

Specified by:
getUsername in interface IDatabaseService
Returns:

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException


Copyright © 2007-2013 EDIT. All Rights Reserved.