Package com.oltpbenchmark.api.dialects

Examples of com.oltpbenchmark.api.dialects.DialectsType


            LOG.warn(String.format("SKIP - The SQL dialect file '%s' does not exist", this.xmlFile));
            return (false);
        }
       
        // COPIED FROM VoltDB's VoltCompiler.java
        DialectsType dialects = null;
        try {
            JAXBContext jc = JAXBContext.newInstance(this.xmlContext);
            // This schema shot the sheriff.
            SchemaFactory sf = SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
            Schema schema = sf.newSchema(this.xmlSchemaURL);
            Unmarshaller unmarshaller = jc.createUnmarshaller();
            // But did not shoot unmarshaller!
            unmarshaller.setSchema(schema);
            @SuppressWarnings("unchecked")
            JAXBElement<DialectsType> result = (JAXBElement<DialectsType>) unmarshaller.unmarshal(this.xmlFile);
            dialects = result.getValue();
        }
        catch (JAXBException ex) {
            // Convert some linked exceptions to more friendly errors.
            if (ex.getLinkedException() instanceof org.xml.sax.SAXParseException) {
                throw new RuntimeException(String.format("Error schema validating %s - %s", xmlFile, ex.getLinkedException().getMessage()), ex);
            }
            throw new RuntimeException(ex);
        }
        catch (SAXException ex) {
            throw new RuntimeException(String.format("Error schema validating %s - %s", xmlFile, ex.getMessage()), ex);
        }
       
        if (LOG.isDebugEnabled())
            LOG.debug(String.format("Loading the SQL dialect file '%s' for %s",
                                    this.xmlFile.getName(), this.dbType));

        for (DialectType dialect : dialects.getDialect()) {
            assert(this.dbType != null);
            assert(dialect != null);
            if (dialect.getType().equalsIgnoreCase(this.dbType.name()) == false)
                continue;
View Full Code Here


                sType.setValue(e.getValue().getOriginalSQL());
                pType.getStatement().add(sType);
            } // FOR (stmt)
            dType.getProcedure().add(pType);
        } // FOR
        DialectsType dialects = factory.createDialectsType();
        dialects.getDialect().add(dType);
       
        StringWriter st = new StringWriter();
        try {
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
            marshaller.marshal(factory.createDialects(dialects), st);
View Full Code Here

TOP

Related Classes of com.oltpbenchmark.api.dialects.DialectsType

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.