View Javadoc

1   package com.atlassian.config.db;
2   
3   import com.atlassian.config.lifecycle.LifecycleItem;
4   import com.atlassian.config.lifecycle.LifecycleContext;
5   import com.atlassian.config.lifecycle.LifecycleManager;
6   import com.atlassian.config.bootstrap.AtlassianBootstrapManager;
7   import com.atlassian.config.bootstrap.BootstrapException;
8   
9   import java.util.Properties;
10  
11  import org.apache.log4j.Logger;
12  
13  public class DatabaseLowerPropertyCheck implements LifecycleItem
14  {
15      private static final Logger log = Logger.getLogger(LifecycleManager.class);
16  
17      private AtlassianBootstrapManager bootstrapManager;
18  
19      public void setBootstrapManager(AtlassianBootstrapManager bootstrapManager)
20      {
21          this.bootstrapManager = bootstrapManager;
22      }
23  
24      public void startup(LifecycleContext context) throws Exception
25      {
26          Properties databaseProperties = bootstrapManager.getHibernateProperties();
27          DatabaseHelper databaseHelper = new DatabaseHelper();
28          try
29          {
30              databaseHelper.setDatabaseLowerProperty(databaseProperties, bootstrapManager.getApplicationConfig());
31          }
32          catch (BootstrapException e)
33          {
34              log.error("Exception while checking for lowercasing support of database for non ascii characters: " + e, e);
35          }
36      }
37  
38      public void shutdown(LifecycleContext context) throws Exception
39      {
40          // t'aint nothin' need doin'
41      }
42  }