Package eu.europa.esig.dss.jaxb
Class AbstractJaxbFacade<T>
java.lang.Object
eu.europa.esig.dss.jaxb.AbstractJaxbFacade<T>
- Type Parameters:
- T- A JAXB Object
- Direct Known Subclasses:
- DetailedReportFacade,- DiagnosticDataFacade,- SimpleCertificateReportFacade,- SimpleReportFacade,- TrustedListFacade,- ValidationPolicyFacade,- ValidationReportFacade
public abstract class AbstractJaxbFacade<T> extends Object
Generic JAXB Facade which contains basic marshalling/unmarshalling
 operations.
- 
Constructor SummaryConstructors Constructor Description AbstractJaxbFacade()
- 
Method SummaryModifier and Type Method Description protected abstract JAXBContextgetJAXBContext()This method returns the instance ofJAXBContextwhich can handle the JAXB ObjectMarshallergetMarshaller(boolean validate)protected abstract SchemagetSchema()This method returns an instance ofSchemawith the loaded XML Schema(s).UnmarshallergetUnmarshaller(boolean validate)Stringmarshall(T jaxbObject)This method returns the String representation of the jaxbObject.Stringmarshall(T jaxbObject, boolean validate)This method returns the String representation of the jaxbObject with an optional validation.voidmarshall(T jaxbObject, OutputStream os)This method marshalls the jaxbObject into theOutputStream.voidmarshall(T jaxbObject, OutputStream os, boolean validate)This method marshalls the jaxbObject into theOutputStreamwith an optional validation.Tunmarshall(File file)This method unmarshalls theFileand returns an instance of the JAXB Object.Tunmarshall(File file, boolean validate)This method unmarshalls theFileand returns an instance of the JAXB Object with an optional validation.Tunmarshall(InputStream is)This method unmarshalls theInputStreamand returns an instance of the JAXB Object.Tunmarshall(InputStream is, boolean validate)This method unmarshalls theInputStreamand returns an instance of the JAXB Object with an optional validation.Tunmarshall(String xmlObject)This method unmarshalls theStringand returns an instance of the JAXB Object.Tunmarshall(String xmlObject, boolean validate)This method unmarshalls theStringand returns an instance of the JAXB Object with an optional validation.protected abstract JAXBElement<T>wrap(T jaxbObject)This method wraps/envelops the JAXB object with a "root" element
- 
Constructor Details- 
AbstractJaxbFacadepublic AbstractJaxbFacade()
 
- 
- 
Method Details- 
getJAXBContextThis method returns the instance ofJAXBContextwhich can handle the JAXB Object- Returns:
- an instance of JAXBContext
- Throws:
- JAXBException- if an error occurred in the initialization process
 
- 
getSchemaThis method returns an instance ofSchemawith the loaded XML Schema(s). The XSD(s) allows to validate the JAXB Object.- Returns:
- an instance of Schema
- Throws:
- IOException- if an I/O error occurred in the initialization process
- SAXException- if a SAX error occurred in the initialization process
 
- 
wrapThis method wraps/envelops the JAXB object with a "root" element- Parameters:
- jaxbObject- the JAXB object to be enveloped to marshall
- Returns:
- the enveloped JAXB object, ready to be marshalled
 
- 
marshallThis method returns the String representation of the jaxbObject. The validation of the jaxbObject against its related XSD is enabled.- Parameters:
- jaxbObject- the jaxb object to be marshalled
- Returns:
- the result of the marshalling for the given jaxbObject
- Throws:
- JAXBException- if an exception occurred with the- JAXBContext
- IOException- if an exception occurred with the I/O.
- SAXException- if an exception occurred with the- Schema
 
- 
marshallpublic String marshall(T jaxbObject, boolean validate) throws JAXBException, IOException, SAXExceptionThis method returns the String representation of the jaxbObject with an optional validation.- Parameters:
- jaxbObject- the jaxb object to be marshalled
- validate- enable/disable the validation against the related XSD
- Returns:
- the result of the marshalling for the given jaxbObject
- Throws:
- JAXBException- if an exception occurred with the- JAXBContext
- IOException- if an exception occurred with the I/O.
- SAXException- if an exception occurred with the- Schema
 
- 
marshallpublic void marshall(T jaxbObject, OutputStream os) throws JAXBException, SAXException, IOExceptionThis method marshalls the jaxbObject into theOutputStream. The validation of the jaxbObject against its related XSD is enabled.- Parameters:
- jaxbObject- the jaxb object to be marshalled
- os- the- OutputStreamwhere the object will be marshalled.
- Throws:
- JAXBException- if an exception occurred with the- JAXBContext
- IOException- if an exception occurred with the I/O.
- SAXException- if an exception occurred with the- Schema
 
- 
marshallpublic void marshall(T jaxbObject, OutputStream os, boolean validate) throws JAXBException, SAXException, IOExceptionThis method marshalls the jaxbObject into theOutputStreamwith an optional validation.- Parameters:
- jaxbObject- the jaxb object to be marshalled
- os- the- OutputStreamwhere the object will be marshalled
- validate- enable/disable the validation against the related XSD
- Throws:
- JAXBException- if an exception occurred with the- JAXBContext
- IOException- if an exception occurred with the I/O.
- SAXException- if an exception occurred with the- Schema
 
- 
unmarshallpublic T unmarshall(InputStream is) throws JAXBException, XMLStreamException, IOException, SAXExceptionThis method unmarshalls theInputStreamand returns an instance of the JAXB Object. The validation of theInputStreamagainst its related XSD is enabled.- Parameters:
- is- the- InputStreamwhich contains a XML representation of JAXB Object.
- Returns:
- an instance of the JAXB Object
- Throws:
- JAXBException- if an exception occurred with the- JAXBContext
- XMLStreamException- if an exception occurred with the source
- IOException- if an exception occurred with the I/O.
- SAXException- if an exception occurred with the- Schema
 
- 
unmarshallpublic T unmarshall(InputStream is, boolean validate) throws JAXBException, XMLStreamException, IOException, SAXExceptionThis method unmarshalls theInputStreamand returns an instance of the JAXB Object with an optional validation.- Parameters:
- is- the- InputStreamwhich contains a XML representation of JAXB Object.
- validate- enable/disable the validation against the related XSD
- Returns:
- an instance of JAXB Object
- Throws:
- JAXBException- if an exception occurred with the- JAXBContext
- XMLStreamException- if an exception occurred with the source
- IOException- if an exception occurred with the I/O.
- SAXException- if an exception occurred with the- Schema
 
- 
unmarshallThis method unmarshalls theFileand returns an instance of the JAXB Object. The validation of theFileagainst its related XSD is enabled.- Parameters:
- file- the- Filewhich contains a XML representation of JAXB Object.
- Returns:
- an instance of JAXB Object
- Throws:
- JAXBException- if an exception occurred with the- JAXBContext
- XMLStreamException- if an exception occurred with the source
- IOException- if an exception occurred with the I/O.
- SAXException- if an exception occurred with the- Schema
 
- 
unmarshallpublic T unmarshall(File file, boolean validate) throws JAXBException, XMLStreamException, IOException, SAXExceptionThis method unmarshalls theFileand returns an instance of the JAXB Object with an optional validation.- Parameters:
- file- the- Filewhich contains a XML representation of JAXB Object.
- validate- enable/disable the validation against the related XSD
- Returns:
- an instance of JAXB Object
- Throws:
- JAXBException- if an exception occurred with the- JAXBContext
- XMLStreamException- if an exception occurred with the source
- IOException- if an exception occurred with the I/O.
- SAXException- if an exception occurred with the- Schema
 
- 
unmarshallpublic T unmarshall(String xmlObject) throws JAXBException, XMLStreamException, IOException, SAXExceptionThis method unmarshalls theStringand returns an instance of the JAXB Object. The validation of theStringagainst its related XSD is enabled.- Parameters:
- xmlObject- the- Stringwhich contains a XML representation of JAXB Object.
- Returns:
- an instance of JAXB Object
- Throws:
- JAXBException- if an exception occurred with the- JAXBContext
- XMLStreamException- if an exception occurred with the source
- IOException- if an exception occurred with the I/O.
- SAXException- if an exception occurred with the- Schema
 
- 
unmarshallpublic T unmarshall(String xmlObject, boolean validate) throws JAXBException, XMLStreamException, IOException, SAXExceptionThis method unmarshalls theStringand returns an instance of the JAXB Object with an optional validation.- Parameters:
- xmlObject- the- Stringwhich contains a XML representation of JAXB Object.
- validate- enable/disable the validation against the related XSD
- Returns:
- an instance of JAXB Object
- Throws:
- JAXBException- if an exception occurred with the- JAXBContext
- XMLStreamException- if an exception occurred with the source
- IOException- if an exception occurred with the I/O.
- SAXException- if an exception occurred with the- Schema
 
- 
getMarshaller- Throws:
- JAXBException
- SAXException
- IOException
 
- 
getUnmarshallerpublic Unmarshaller getUnmarshaller(boolean validate) throws JAXBException, IOException, SAXException- Throws:
- JAXBException
- IOException
- SAXException
 
 
-