Example usage for javax.xml.bind JAXBException getMessage

List of usage examples for javax.xml.bind JAXBException getMessage

Introduction

In this page you can find the example usage for javax.xml.bind JAXBException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.plasma.provisioning.cli.XSDTool.java

private static Schema unmarshalSchema(InputStream stream) {
    try {//  w  ww .  ja  va2s  .c o m
        SchemaDataBinding binding = new SchemaDataBinding(new DefaultValidationEventHandler());
        return (Schema) binding.unmarshal(stream);

    } catch (JAXBException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    } catch (SAXException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    }
}

From source file:org.plasma.sdo.DeepFindTest.java

public void testTaxonomyQuery() throws Exception {
    log.info("testTaxonomyQuery()");

    int num = 1;//ww w . j a  v  a2s.  c  o  m
    long before = System.currentTimeMillis();

    Query query = TaxonomyQuery.createQuery("FEA Technical Reference Model (TRM)");
    try {
        PlasmaQueryDataBinding binding = new PlasmaQueryDataBinding(new DefaultValidationEventHandler());
        String xml = binding.marshal(query);
        log.info("query: " + xml);

        query = (Query) binding.validate(xml);

    } catch (JAXBException e) {
        log.error(e.getMessage(), e);
        throw e;
    } catch (SAXException e) {
        log.error(e.getMessage(), e);
        throw e;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw e;
    }

    try {
        DataGraph[] results = service.find(query);
        for (int i = 0; i < results.length; i++) {
            PlasmaDataObject dataObject = (PlasmaDataObject) results[i].getRootObject();
            log.info(dataObject.dump());
        }
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw e;
    }

    long after = System.currentTimeMillis();
    float totalSeconds = (after - before) / 1000;
    float averageSecondsPerGraph = ((float) (after - before) / num) / 1000;
    log.info("total seconds: " + totalSeconds + " average seconds per graph: " + averageSecondsPerGraph);
}

From source file:org.plasma.sdo.helper.PlasmaQueryHelper.java

private void writeStagingModel(Model stagingModel, String location, String fileName) {
    try {//from   www .j av  a  2s.  c o  m
        BindingValidationEventHandler debugHandler = new BindingValidationEventHandler() {
            public int getErrorCount() {
                return 0;
            }

            public boolean handleEvent(ValidationEvent ve) {
                ValidationEventLocator vel = ve.getLocator();

                String message = "Line:Col:Offset[" + vel.getLineNumber() + ":" + vel.getColumnNumber() + ":"
                        + String.valueOf(vel.getOffset()) + "] - " + ve.getMessage();

                switch (ve.getSeverity()) {
                default:
                    log.debug(message);
                }
                return true;
            }
        };
        ProvisioningModelDataBinding binding = new ProvisioningModelDataBinding(debugHandler);
        String xml = binding.marshal(stagingModel);
        binding.validate(xml);

        File provDebugFile = null;
        if (location != null)
            provDebugFile = new File(location, fileName);
        else
            provDebugFile = File.createTempFile(fileName, "");
        FileOutputStream provDebugos = new FileOutputStream(provDebugFile);
        log.debug("Writing provisioning model to: " + provDebugFile.getAbsolutePath());
        binding.marshal(stagingModel, provDebugos);
    } catch (JAXBException e) {
        log.debug(e.getMessage(), e);
    } catch (SAXException e) {
        log.debug(e.getMessage(), e);
    } catch (IOException e) {
        log.debug(e.getMessage(), e);
    }

}

From source file:org.plasma.sdo.helper.PlasmaQueryHelper.java

private void marshalQuery(Query schema, OutputStream stream) {
    try {//from  ww  w.ja v  a2 s  .co  m
        PlasmaQueryDataBinding binding = new PlasmaQueryDataBinding(new DefaultValidationEventHandler());

        binding.marshal(schema, stream);
    } catch (JAXBException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    } catch (SAXException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    }
}

From source file:org.plasma.sdo.helper.PlasmaQueryHelper.java

private Query unmarshalQuery(InputStream stream) {
    try {/*  w  w w  .j av a2s  . c om*/
        PlasmaQueryDataBinding binding = new PlasmaQueryDataBinding(new DefaultValidationEventHandler());
        return (Query) binding.unmarshal(stream);

    } catch (JAXBException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    } catch (SAXException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    }
}

From source file:org.plasma.sdo.helper.PlasmaQueryHelper.java

private Query unmarshalQuery(String xml) {
    try {//  w w w.  j  a  v a 2s. com
        PlasmaQueryDataBinding binding = new PlasmaQueryDataBinding(new DefaultValidationEventHandler());
        return (Query) binding.unmarshal(xml);

    } catch (JAXBException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    } catch (SAXException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    }
}

From source file:org.plasma.sdo.helper.PlasmaQueryHelper.java

private Query unmarshalQuery(Reader reader) {
    try {/*  www.  j  a va2 s.  co  m*/
        PlasmaQueryDataBinding binding = new PlasmaQueryDataBinding(new DefaultValidationEventHandler());
        return (Query) binding.unmarshal(reader);

    } catch (JAXBException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    } catch (SAXException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    }
}

From source file:org.plasma.sdo.helper.PlasmaQueryHelper.java

private Query unmarshalQuery(Source source) {
    try {//from  w  w  w .  ja  va  2  s. c o  m
        PlasmaQueryDataBinding binding = new PlasmaQueryDataBinding(new DefaultValidationEventHandler());
        return (Query) binding.unmarshal(source);

    } catch (JAXBException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    } catch (SAXException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    }
}

From source file:org.plasma.sdo.helper.PlasmaXSDHelper.java

private void marshalSchema(Schema schema, OutputStream stream) {
    try {// w w  w  .ja v a  2  s.com
        SchemaDataBinding binding = new SchemaDataBinding(new DefaultValidationEventHandler());

        binding.marshal(schema, stream);
    } catch (JAXBException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    } catch (SAXException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    }
}

From source file:org.plasma.sdo.helper.PlasmaXSDHelper.java

private Schema unmarshalSchema(InputStream stream) {
    try {/* w  ww .ja v a  2 s.  co m*/
        SchemaDataBinding binding = new SchemaDataBinding(new DefaultValidationEventHandler());
        return (Schema) binding.unmarshal(stream);

    } catch (JAXBException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    } catch (SAXException e) {
        log.error(e.getMessage(), e);
        throw new PlasmaRuntimeException(e);
    }
}