Package org.wso2.carbon.utils.dbcreator
Class DatabaseCreator
- java.lang.Object
-
- org.wso2.carbon.utils.dbcreator.DatabaseCreator
-
public class DatabaseCreator extends Object
-
-
Constructor Summary
Constructors Constructor Description DatabaseCreator(DataSource dataSource)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleancheckStringBufferEndsWith(StringBuffer buffer, String suffix)Checks that a string buffer ends up with a given string.voidcreateRegistryDatabase()Creates registry databasestatic StringgetDatabaseType(String dbUrl)Overloaded method with String inputstatic StringgetDatabaseType(Connection conn)computes relatational database type using database nameprotected StringgetDbScriptLocation(String databaseType)booleanisDatabaseStructureCreated(String checkSQL)Checks whether database tables are created.
-
-
-
Constructor Detail
-
DatabaseCreator
public DatabaseCreator(DataSource dataSource)
-
-
Method Detail
-
createRegistryDatabase
public void createRegistryDatabase() throws ExceptionCreates 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, elsefalse.
-
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
-
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 onsuffix- the suffix- Returns:
trueif the character sequence represented by the argument is a suffix of the character sequence represented by the StringBuffer object;falseotherwise. Note that the result will betrueif the argument is the empty string.
-
-