Class DatabaseCreator

java.lang.Object
org.wso2.carbon.utils.dbcreator.DatabaseCreator

public class DatabaseCreator extends Object
  • Constructor Details

    • DatabaseCreator

      public DatabaseCreator(DataSource dataSource)
  • Method Details

    • createRegistryDatabase

      public void createRegistryDatabase() throws Exception
      Creates registry database
      Throws:
      Exception
    • isDatabaseStructureCreated

      public boolean isDatabaseStructureCreated(String checkSQL)
      Checks whether database tables are created.
      Parameters:
      checkSQL - SQL execute during check.
      Returns:
      true if checkSQL is success, else false.
    • getDatabaseType

      public static String getDatabaseType(Connection conn) throws Exception
      computes relatational database type using database name
      Returns:
      String
      Throws:
      Exception
    • getDatabaseType

      public static String getDatabaseType(String dbUrl) throws Exception
      Overloaded method with String input
      Returns:
      String
      Throws:
      Exception
    • getDbScriptLocation

      protected String getDbScriptLocation(String databaseType)
    • checkStringBufferEndsWith

      public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix)
      Checks that a string buffer ends up with a given string. It may sound trivial with the existing JDK API but the various implementation among JDKs can make those methods extremely resource intensive and perform poorly due to massive memory allocation and copying. See
      Parameters:
      buffer - the buffer to perform the check on
      suffix - the suffix
      Returns:
      true if the character sequence represented by the argument is a suffix of the character sequence represented by the StringBuffer object; false otherwise. Note that the result will be true if the argument is the empty string.