org.glite.data.common.db
Class SchemaLoader
java.lang.Object
org.glite.data.common.db.SchemaLoader
- public class SchemaLoader
- extends java.lang.Object
Utility class to conditionally load schema into a database.
Method Summary |
static void |
loadSchema(java.sql.Connection conn,
java.lang.String schemaName,
java.lang.String createStatement)
Look for the specified schema, and create it if it does not exist. |
static void |
loadSchemaFromResource(java.sql.Connection conn,
java.lang.String schemaName,
java.lang.String classpathResource)
Look for specified schema, and load it into the database if it does not exist. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SchemaLoader
public SchemaLoader()
loadSchema
public static void loadSchema(java.sql.Connection conn,
java.lang.String schemaName,
java.lang.String createStatement)
throws java.sql.SQLException
- Look for the specified schema, and create it if it does not exist.
- Parameters:
conn
- the database connection to load intoschemaName
- the create statement to create the schema
- Throws:
java.sql.SQLException
- if there are problems loading the schema into the DB
loadSchemaFromResource
public static void loadSchemaFromResource(java.sql.Connection conn,
java.lang.String schemaName,
java.lang.String classpathResource)
throws java.io.IOException,
java.sql.SQLException
- Look for specified schema, and load it into the database if it does not exist.
The schema is taken from the specified classpath resource file.
- Parameters:
conn
- the DB connection to useschemaName
- the name of the schema to checkclasspathResource
- the name of the file that contains the schema definition
- Throws:
java.io.IOException
- if the classpath resource could not be found or read
java.sql.SQLException
- if there are problems loading the schema into the DB