org.zeroexchange.dao.importing
Class DatabaseInitializer

java.lang.Object
  extended by org.zeroexchange.dao.importing.DatabaseInitializer
All Implemented Interfaces:
EventListener, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>

public class DatabaseInitializer
extends Object
implements org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>

Service initializes database at startup if it needed.

Author:
black

Constructor Summary
DatabaseInitializer()
           
 
Method Summary
 void afterPropertiesSet()
           Is called on spring context startup.
protected  boolean isDatabaseInitialized()
          Returns true if the database is initialized.
 void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
           
 void setScriptsDir(File scriptsDir)
           
 void setUploadExampleData(boolean uploadExampleData)
           
 void setXmlScript2RepresentationClass(Map<String,Class> xmlScript2RepresentationClass)
          Sets the xml script.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseInitializer

public DatabaseInitializer()
Method Detail

setXmlScript2RepresentationClass

public void setXmlScript2RepresentationClass(Map<String,Class> xmlScript2RepresentationClass)
Sets the xml script.


setUploadExampleData

public void setUploadExampleData(boolean uploadExampleData)
Parameters:
uploadExampleData - the uploadExampleData to set

setScriptsDir

public void setScriptsDir(File scriptsDir)
Parameters:
baseScript - the baseScript to set

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Is called on spring context startup. Initialized database if it needed.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

isDatabaseInitialized

protected boolean isDatabaseInitialized()
Returns true if the database is initialized.


onApplicationEvent

public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event)
Specified by:
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>


Copyright © 2013. All Rights Reserved.