Package org.apache.ddlutils.io

Examples of org.apache.ddlutils.io.DatabaseIO


    /**
     * {@inheritDoc}
     */
    protected Database readModel()
    {
        DatabaseIO reader = new DatabaseIO();
        Database   model  = null;

        reader.setUseInternalDtd(_useInternalDtd);
        if ((_singleSchemaFile != null) && !_fileSets.isEmpty())
        {
            throw new BuildException("Please use either the schemafile attribute or the sub fileset element, but not both");
        }
        if (_singleSchemaFile != null)
View Full Code Here


     */
    public void createDatabase( String user, String passwd, String seedDataResource ) {
       
        // Get the database schema XML file
        InputStream schemaIS = getClass().getClassLoader().getResourceAsStream( "photovault_schema.xml" );
        DatabaseIO dbio = new DatabaseIO();
        dbio.setValidateXml( false );
        Database dbModel = dbio.read( new InputStreamReader( schemaIS ) );
       
        // Create the datasource for accessing this database
       
        String driverName = "com.mysql.jdbc.Driver";
        String dbUrl = "jdbc:mysql://" + getHost() + "/" + getDbName();
View Full Code Here

        }
        platform.getPlatformInfo().setDelimiterToken( "" );
       
        // Get the database schema XML file
        InputStream schemaIS = getClass().getClassLoader().getResourceAsStream( "photovault_schema.xml" );
        DatabaseIO dbio = new DatabaseIO();
        dbio.setValidateXml( false );
        Database dbModel = dbio.read( new InputStreamReader( schemaIS ) );
       
        // Alter tables to match corrent schema
        PersistenceBroker broker = PersistenceBrokerFactory.createPersistenceBroker( connKey );
        broker.beginTransaction();
        try {
View Full Code Here

        return schemaFiles;
    }

    protected Database readModel(File[] files) throws MojoExecutionException
    {
        DatabaseIO reader = new DatabaseIO();
        Database   model  = null;

        reader.setValidateXml(validateXml);
        reader.setUseInternalDtd(useInternalDtd);
       
        for (int idx = 0; (files != null) && (idx < files.length); idx++)
        {
            Database curModel = null;
            if (!files[idx].isFile())
            {
                throw new MojoExecutionException("Path " + files[idx].getAbsolutePath() + " does not denote a file");
            }
            else if (!files[idx].canRead())
            {
                throw new MojoExecutionException("Could not read schema file " + files[idx].getAbsolutePath());
            }
            else
            {
                try
                {
                    curModel = reader.read(files[idx]);
                    getLog().info("Read schema file " + files[idx].getAbsolutePath());
                }
                catch (Exception ex)
                {
                    throw new MojoExecutionException("Could not read schema file "+files[idx].getAbsolutePath()+": "+ex.getLocalizedMessage(), ex);
View Full Code Here

   *
   * @param fileName
   */
  public void writeDatabaseSchematoFile(String fileName)
  {
    new DatabaseIO().write(model, fileName);
  }
View Full Code Here

   *            The database XML definition
   * @return The database model
   */
  protected Database createDatabaseSchemaFromXML(String fileName)
  {
    DatabaseIO io = new DatabaseIO();
    io.setValidateXml(false);
    return io.read(fileName);
  }
View Full Code Here

   *            The database XML definition
   * @return The database model
   */
  protected Database createDatabaseSchemaFromString(String dbDef)
  {
    DatabaseIO dbIO = new DatabaseIO();

    dbIO.setUseInternalDtd(true);
    dbIO.setValidateXml(false);
    return dbIO.read(new StringReader(dbDef));
  }
View Full Code Here

TOP

Related Classes of org.apache.ddlutils.io.DatabaseIO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.