org.figure8.join.core.setup
Class BootstrapManager

java.lang.Object
  extended by org.figure8.join.core.setup.BootstrapManager

public class BootstrapManager
extends java.lang.Object

Manager object responsible of Join application bootstrapping.

Version:
$Revision: 1.3 $
Author:
Laurent Broudoux

Field Summary
protected static org.apache.commons.logging.Log log
          Get a commons logger.
 
Constructor Summary
BootstrapManager()
          Creates a new instance of BootstrapManager
 
Method Summary
 void bootstrap()
          Bootstrap the Join application !
 void bootstrapDatabase(DatabaseDetails details, boolean embedded)
          Bootstrap the database access system.
 void bootstrapDatasource(java.lang.String datasourceName, java.lang.String dialect)
          Bootstrap the database access system through JNDI datasource.
 void bootstrapMessaging(java.lang.String brokerUrl, boolean embedded)
          Bootstrap the messaging system.
 java.lang.String getJoinHome()
          Retrieve Join home location onto filesystem.
 java.lang.String getOtherSideUrl()
          Convenient method for knowing the Url of application other side.
 java.lang.String getPathProperty(java.lang.String key)
          Convenient method for getting a path property that may contain the ${join.home} string.
 java.lang.String getProperty(java.lang.String property)
          Convenient method for retrieving application configuration property.
 boolean isAsynchronousSide()
           
 boolean isBootstrapped()
          Tell if bootstrap phase has ran ok.
 boolean isCustomSetup()
          Convenient method for knowing if application setup is a custom setup.
 boolean isDissociatedSetup()
           
 boolean isHibernateSetup()
          Convenient method for knowing if hibernate setup is complete.
 boolean isMessagingSetup()
          Convenient method for knowing it activeMQ setup is complete.
 boolean isSetupComplete()
          Convenient method for knowing if application setup is complete.
 boolean isStandardSetup()
          Convenient method for knowing if application setup is a standard setup.
 boolean isSynchronousSide()
           
protected  void launchConnectionKeeper()
          Launch the ConnectionKeeper daemon.
 void setApplicationConfig(ApplicationConfig config)
           
 void setHibernateConfigurator(HibernateConfigurator configurator)
           
 void setHomeLocator(JoinHomeLocator locator)
           
 void setMessagingConfigurator(ActiveMQConfigurator configurator)
           
 void setProperty(java.lang.String key, java.lang.Object value)
          Convenient method for setting an application config property.
protected  void testBrokerConnection(java.net.URI brokerUri)
          Test the connection to broker denoted by brokerUri.
protected  void testDatabaseConnection(DatabaseDetails details)
          Test the connection to configured database.
protected  void testDatasourceAccess(java.lang.String datasourceName)
          Test the access to configured datasource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Get a commons logger.

Constructor Detail

BootstrapManager

public BootstrapManager()
Creates a new instance of BootstrapManager

Method Detail

setHomeLocator

public void setHomeLocator(JoinHomeLocator locator)
Parameters:
locator - JoinHomeLocator instance

setApplicationConfig

public void setApplicationConfig(ApplicationConfig config)
Parameters:
config - ApplicationConfig instance

setMessagingConfigurator

public void setMessagingConfigurator(ActiveMQConfigurator configurator)
Parameters:
configurator - ActiveMQConfigurator instance

setHibernateConfigurator

public void setHibernateConfigurator(HibernateConfigurator configurator)
Parameters:
configurator - HibernateConfigurator instance

bootstrap

public void bootstrap()
               throws BootstrapException
Bootstrap the Join application ! First step is to try locating Join home path. Then load application configuration.

Throws:
BootstrapException - if Join home cannot be located or if parsing the application configuration file failed.

isBootstrapped

public boolean isBootstrapped()
Tell if bootstrap phase has ran ok.

Returns:
boostrapped flag.

isSetupComplete

public boolean isSetupComplete()
Convenient method for knowing if application setup is complete.

Returns:
The corresponding flag on ApplicationConfig

isCustomSetup

public boolean isCustomSetup()
Convenient method for knowing if application setup is a custom setup.

Returns:
The corresponding flag on ApplicationConfig

isStandardSetup

public boolean isStandardSetup()
Convenient method for knowing if application setup is a standard setup.

Returns:
The corresponding flag on ApplicationConfig

isMessagingSetup

public boolean isMessagingSetup()
Convenient method for knowing it activeMQ setup is complete.

Returns:
true if the setup is complete, false otherwise

isHibernateSetup

public boolean isHibernateSetup()
Convenient method for knowing if hibernate setup is complete.

Returns:
true if the setup is complete, false otherwise

isSynchronousSide

public boolean isSynchronousSide()
Returns:
true if this side of application is synchronous

isAsynchronousSide

public boolean isAsynchronousSide()
Returns:
true if this side of application is asynchronous

isDissociatedSetup

public boolean isDissociatedSetup()
Returns:
true if this setup is custom with dissociation of synch/asynch services

getOtherSideUrl

public java.lang.String getOtherSideUrl()
Convenient method for knowing the Url of application other side. This url only exists if application has a dissociated setup type.

Returns:
The url of the other side of application, or null if it has no sense...

getJoinHome

public java.lang.String getJoinHome()
Retrieve Join home location onto filesystem.

Returns:
String representing Join home location (or null if not defined)

getProperty

public java.lang.String getProperty(java.lang.String property)
Convenient method for retrieving application configuration property.

Parameters:
property - The name of the property of retrieve
Returns:
The value of the corresponding application property.

setProperty

public void setProperty(java.lang.String key,
                        java.lang.Object value)
Convenient method for setting an application config property.

Parameters:
key - Unique id of the application property
value - Value associated to key
See Also:
ApplicationConfig.setProperty(String, Object)

getPathProperty

public java.lang.String getPathProperty(java.lang.String key)
Convenient method for getting a path property that may contain the ${join.home} string. This latter will be replaced by its value.

Parameters:
key - Unique id of the application property
Returns:
The value of the corresponding application path property.

bootstrapDatabase

public void bootstrapDatabase(DatabaseDetails details,
                              boolean embedded)
                       throws BootstrapException
Bootstrap the database access system. This method first test the access to database and them launch its configuration process within Hibernate.

Parameters:
details - Database security details wrapper
embedded - Tells if the db is the default embedded one
Throws:
BootstrapException - if database cannot be reached or configured

bootstrapDatasource

public void bootstrapDatasource(java.lang.String datasourceName,
                                java.lang.String dialect)
                         throws BootstrapException
Bootstrap the database access system through JNDI datasource. This method first test the access to datasource and them launch its configuration process within Hibernate.

Parameters:
datasourceName - JNDI name of datasource to use for accessing database
dialect - Dialect of database to access (as Hibernate dialect)
Throws:
BootstrapException - if database cannot be reached or configured

bootstrapMessaging

public void bootstrapMessaging(java.lang.String brokerUrl,
                               boolean embedded)
                        throws BootstrapException
Bootstrap the messaging system. This method launches the configuration process within AcitveMQ.

Parameters:
brokerUrl - Messaging broker url
embedded - Tells if the messaging broker is on this side of application
Throws:
BootstrapException - if connection to messaging system cannot be configured

testDatabaseConnection

protected void testDatabaseConnection(DatabaseDetails details)
                               throws java.lang.Exception
Test the connection to configured database.

Parameters:
details - Database details wrapper for connection params
Throws:
java.lang.Exception

testDatasourceAccess

protected void testDatasourceAccess(java.lang.String datasourceName)
                             throws java.lang.Exception
Test the access to configured datasource

Parameters:
datasourceName - JNDI name of datasource to access
Throws:
java.lang.Exception

testBrokerConnection

protected void testBrokerConnection(java.net.URI brokerUri)
                             throws java.lang.Exception
Test the connection to broker denoted by brokerUri. If URI denotes localhost, we have to test broker from server side point of view (ie. using a ServerSocket).

Parameters:
brokerUri - The URI of broker to test connection to
Throws:
java.lang.Exception

launchConnectionKeeper

protected void launchConnectionKeeper()
Launch the ConnectionKeeper daemon.



Copyright © 2005-2008 Join. All Rights Reserved.