Package org.voltdb.compiler.projectfile

Examples of org.voltdb.compiler.projectfile.DatabaseType


            m_catalog.getClusters().get("cluster").
                setSecurityenabled(security.isEnabled());

        }

        DatabaseType database = project.getDatabase();
        if (database != null) {
            compileDatabaseNode(database);
        }
    }
View Full Code Here


        // Make the new compiler use the original jarfile's classloader so it can
        // pull in the class files for procedures and imports
        autoGenCompiler.m_classLoader = origJarFile.getLoader();
        List<VoltCompilerReader> autogenReaderList = new ArrayList<VoltCompilerReader>(1);
        autogenReaderList.add(new VoltCompilerJarFileReader(origJarFile, AUTOGEN_DDL_FILE_NAME));
        DatabaseType autoGenDatabase = getProjectDatabase(null);
        InMemoryJarfile autoGenJarOutput = new InMemoryJarfile();
        autoGenCompiler.m_currentFilename = AUTOGEN_DDL_FILE_NAME;
        Catalog autoGenCatalog = autoGenCompiler.compileCatalogInternal(autoGenDatabase,
                autogenReaderList, autoGenJarOutput);
        FilteredCatalogDiffEngine diffEng = new FilteredCatalogDiffEngine(origCatalog, autoGenCatalog);
View Full Code Here

        m_warnings.clear();
        m_infos.clear();
        m_errors.clear();

        // do all the work to get the catalog
        DatabaseType database = getProjectDatabase(projectReader);
        if (database == null) {
            return null;
        }
        final Catalog catalog = compileCatalogInternal(database, ddlReaderList, jarOutput);
        if (catalog == null) {
View Full Code Here

     * @throws VoltCompilerException
     */
    public Catalog compileCatalogFromDDL(final String... ddlFilePaths)
            throws VoltCompilerException
    {
        DatabaseType database = getProjectDatabase(null);
        InMemoryJarfile jarOutput = new InMemoryJarfile();
        return compileCatalogInternal(database, DDLPathsToReaderList(ddlFilePaths), jarOutput);
    }
View Full Code Here

        catch (IOException e) {
            throw new VoltCompilerException(String.format(
                    "Unable to create project reader for \"%s\": %s",
                    projectFileURL, e.getMessage()));
        }
        DatabaseType database = getProjectDatabase(projectReader);
        InMemoryJarfile jarOutput = new InMemoryJarfile();
        // Provide an empty DDL reader list.
        return compileCatalogInternal(database, DDLPathsToReaderList(), jarOutput);
    }
View Full Code Here

     * @param projectFileURL  project file URL/path
     * @return  database for project or null
     */
    private DatabaseType getProjectDatabase(final VoltCompilerReader projectReader)
    {
        DatabaseType database = null;
        m_currentFilename = (projectReader != null ? projectReader.getName() : "null");
        if (projectReader != null) {
            try {
                JAXBContext jc = JAXBContext.newInstance("org.voltdb.compiler.projectfile");
                // This schema shot the sheriff.
                SchemaFactory sf = SchemaFactory.newInstance(
                  javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
                Schema schema = sf.newSchema(this.getClass().getResource("ProjectFileSchema.xsd"));
                Unmarshaller unmarshaller = jc.createUnmarshaller();
                // But did not shoot unmarshaller!
                unmarshaller.setSchema(schema);
                @SuppressWarnings("unchecked")
                JAXBElement<ProjectType> result = (JAXBElement<ProjectType>) unmarshaller.unmarshal(projectReader);
                ProjectType project = result.getValue();
                database = project.getDatabase();
            }
            catch (JAXBException e) {
                // Convert some linked exceptions to more friendly errors.
                if (e.getLinkedException() instanceof java.io.FileNotFoundException) {
                    addErr(e.getLinkedException().getMessage());
                    compilerLog.error(e.getLinkedException().getMessage());
                }
                else {
                    DeprecatedProjectElement deprecated = DeprecatedProjectElement.valueOf(e);
                    if( deprecated != null) {
                        addErr("Found deprecated XML element \"" + deprecated.name() + "\" in project.xml file, "
                                + deprecated.getSuggestion());
                        addErr("Error schema validating project.xml file. " + e.getLinkedException().getMessage());
                        compilerLog.error("Found deprecated XML element \"" + deprecated.name() + "\" in project.xml file");
                        compilerLog.error(e.getMessage());
                        compilerLog.error(projectReader.getPath());
                    }
                    else if (e.getLinkedException() instanceof org.xml.sax.SAXParseException) {
                        addErr("Error schema validating project.xml file. " + e.getLinkedException().getMessage());
                        compilerLog.error("Error schema validating project.xml file: " + e.getLinkedException().getMessage());
                        compilerLog.error(e.getMessage());
                        compilerLog.error(projectReader.getPath());
                    }
                    else {
                        throw new RuntimeException(e);
                    }
                }
            }
            catch (SAXException e) {
                addErr("Error schema validating project.xml file. " + e.getMessage());
                compilerLog.error("Error schema validating project.xml file. " + e.getMessage());
            }
        }
        else {
            // No project.xml - create a stub object.
            database = new DatabaseType();
        }

        return database;
    }
View Full Code Here

TOP

Related Classes of org.voltdb.compiler.projectfile.DatabaseType

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.