@Service(value="dhxMarshallerService") public class DhxMarshallerServiceImpl extends java.lang.Object implements DhxMarshallerService
In order for big data logic to work, object parameter which might be BIG must be annotated with
BigDataXmlElement
annotation and be of type File
. XMLSerializer
is used
during marshalling/unmarshalling process and does all the job except for the parameters annotated
with BigDataXmlElement
.
Constructor and Description |
---|
DhxMarshallerServiceImpl() |
Modifier and Type | Method and Description |
---|---|
javax.xml.bind.JAXBContext |
getJaxbContext()
Returns the jaxbContext.
|
javax.xml.bind.Marshaller |
getMarshaller()
Method returns marshaller.
|
javax.xml.bind.Unmarshaller |
getUnmarshaller()
Method returns unmarshaller.
|
void |
init()
Postconstruct init method.
|
java.io.File |
marshall(java.lang.Object container)
Marshalls object to file.
|
void |
marshall(java.lang.Object container,
java.io.File file)
Marshalls object to given file.
|
void |
marshallToOutputStream(java.lang.Object container,
java.io.OutputStream stream)
Marshalls object to outputStream.
|
void |
marshallToOutputStreamNoNamespacePrefixes(java.lang.Object container,
java.io.OutputStream stream,
java.lang.Boolean includeXmlns)
Marshalls object to outputStream, removes all namespace prefixes from XML.
|
void |
marshallToResult(java.lang.Object obj,
javax.xml.transform.Result result)
Marshalls object to result.
|
java.io.StringWriter |
marshallToWriter(java.lang.Object container)
Marshalls object to writer.
|
java.io.StringWriter |
marshallToWriterAndValidate(java.lang.Object container,
java.io.InputStream schemaStream)
Marshalls object to writer and validates object if schemaStream is present.
|
<T> T |
unmarshall(java.io.File capsuleFile)
Parses(unmarshalls) object from file.
|
<T> T |
unmarshall(java.io.File capsuleFile,
java.lang.Class<? extends java.lang.Object> bigDataClass)
Parses(unmarshalls) object from file.
|
<T> T |
unmarshall(java.io.InputStream capsuleStream)
Parses(unmarshalls) object from file.
|
<T> T |
unmarshall(java.io.InputStream capsuleStream,
java.lang.Class<? extends java.lang.Object> bigDataClass)
Parses(unmarshalls) object from file.
|
<T> T |
unmarshall(org.w3c.dom.Node node)
Parses(unmarshalls) object from Node.
|
<T> T |
unmarshall(javax.xml.transform.Source source)
Method parses(unmarshalls) object.
|
<T> T |
unmarshallAndValidate(java.io.File capsuleFile,
java.io.InputStream schemaStream)
Parses(unmarshalls) object from file.
|
<T> T |
unmarshallAndValidate(java.io.InputStream capsuleStream,
java.io.InputStream schemaStream)
Parses(unmarshalls) object from file.
|
<T> T |
unmarshallAndValidate(java.io.InputStream capsuleStream,
java.io.InputStream schemaStream,
java.lang.Class<? extends java.lang.Object> bigDataClass)
Parses(unmarshalls) object from file.
|
void |
validate(java.io.File file,
java.io.InputStream schemaStream)
Method validates file against XSD schema.
|
void |
validate(java.io.InputStream fileStream,
java.io.InputStream schemaStream)
Function validates file against XSD schema.
|
public javax.xml.bind.Unmarshaller getUnmarshaller() throws ee.ria.dhx.exception.DhxException
DhxMarshallerService
getUnmarshaller
in interface DhxMarshallerService
ee.ria.dhx.exception.DhxException
- - thrown if error occuredpublic javax.xml.bind.Marshaller getMarshaller() throws ee.ria.dhx.exception.DhxException
DhxMarshallerService
getMarshaller
in interface DhxMarshallerService
ee.ria.dhx.exception.DhxException
- - thrown if error occured@PostConstruct public void init() throws javax.xml.bind.JAXBException
javax.xml.bind.JAXBException
- - thrown when error occured@Loggable public <T> T unmarshall(javax.xml.transform.Source source) throws ee.ria.dhx.exception.DhxException
unmarshall
in interface DhxMarshallerService
T
- - type of the capsule being unmarshalledsource
- - source of the marshalled objectee.ria.dhx.exception.DhxException
- - thrown if error occurs while unmrashalling object@Loggable public <T> T unmarshall(java.io.File capsuleFile) throws ee.ria.dhx.exception.DhxException
unmarshall
in interface DhxMarshallerService
T
- - type of the capsule being unmarshalledcapsuleFile
- - file to parseee.ria.dhx.exception.DhxException
- - thrown if error occurs while parsing file@Loggable public <T> T unmarshall(java.io.InputStream capsuleStream) throws ee.ria.dhx.exception.DhxException
unmarshall
in interface DhxMarshallerService
T
- - type of the capsule being unmarshalledcapsuleStream
- - stream to parseee.ria.dhx.exception.DhxException
- - thrown if error occurs while parsing file@Loggable public <T> T unmarshall(java.io.File capsuleFile, java.lang.Class<? extends java.lang.Object> bigDataClass) throws ee.ria.dhx.exception.DhxException
T
- - type of the capsule being unmarshalledcapsuleFile
- file to parsebigDataClass
- class having big data that is being unmarshalled or null if no big datat is
expectedee.ria.dhx.exception.DhxException
- - thrown if error occurs while parsing filepublic <T> T unmarshall(org.w3c.dom.Node node) throws ee.ria.dhx.exception.DhxException
unmarshall
in interface DhxMarshallerService
T
- - type of the capsule being unmarshallednode
- - node to unmarshallee.ria.dhx.exception.DhxException
- - thrown if error occurs while parsing file@Loggable public <T> T unmarshallAndValidate(java.io.InputStream capsuleStream, java.io.InputStream schemaStream) throws ee.ria.dhx.exception.DhxException
unmarshallAndValidate
in interface DhxMarshallerService
T
- - type of the capsule being unmarshalledcapsuleStream
- - stream of to parseschemaStream
- - stream on XSD schema against which to validate. No validation is done if
stream is NULLee.ria.dhx.exception.DhxException
- - thrown if error occurs while parsing file@Loggable public <T> T unmarshallAndValidate(java.io.File capsuleFile, java.io.InputStream schemaStream) throws ee.ria.dhx.exception.DhxException
unmarshallAndValidate
in interface DhxMarshallerService
T
- - type of the capsule being unmarshalledcapsuleFile
- - file to parseschemaStream
- - stream on XSD schema against which to validate. No validation is done if
stream is NULLee.ria.dhx.exception.DhxException
- - thrown if error occurs while parsing file@Loggable public <T> T unmarshallAndValidate(java.io.InputStream capsuleStream, java.io.InputStream schemaStream, java.lang.Class<? extends java.lang.Object> bigDataClass) throws ee.ria.dhx.exception.DhxException
T
- - type of the capsule being unmarshalledcapsuleStream
- - stream of to parseschemaStream
- - stream on XSD schema against which to validate. No validation is done if
stream is NULLbigDataClass
- class having big data that is being unmarshalled or null if no big datat is
expectedee.ria.dhx.exception.DhxException
- - thrown if error occurs while parsing file@Loggable public <T> T unmarshall(java.io.InputStream capsuleStream, java.lang.Class<? extends java.lang.Object> bigDataClass) throws ee.ria.dhx.exception.DhxException
T
- - type of the capsule being unmarshalledcapsuleStream
- - stream to parsebigDataClass
- class having big data that is being unmarshalled or null if no big datat is
expectedee.ria.dhx.exception.DhxException
- - thrown if error occurs while parsing file@Loggable public java.io.File marshall(java.lang.Object container) throws ee.ria.dhx.exception.DhxException
marshall
in interface DhxMarshallerService
container
- - object to marshallee.ria.dhx.exception.DhxException
- - thrown if error occurs while marshalling object@Loggable public void marshall(java.lang.Object container, java.io.File file) throws ee.ria.dhx.exception.DhxException
marshall
in interface DhxMarshallerService
container
- object to marshallfile
- file to marshall toee.ria.dhx.exception.DhxException
- thrown if error occurs while marshalling object@Loggable public void marshallToOutputStream(java.lang.Object container, java.io.OutputStream stream) throws ee.ria.dhx.exception.DhxException
marshallToOutputStream
in interface DhxMarshallerService
container
- - object to marshallstream
- - containing marshalled objectee.ria.dhx.exception.DhxException
- - thrown if error occurs while marshalling object@Loggable public void marshallToOutputStreamNoNamespacePrefixes(java.lang.Object container, java.io.OutputStream stream, java.lang.Boolean includeXmlns) throws ee.ria.dhx.exception.DhxException
marshallToOutputStreamNoNamespacePrefixes
in interface DhxMarshallerService
container
- - object to marshallstream
- - containing marshalled objectincludeXmlns
- if true, then xmlns will be addedee.ria.dhx.exception.DhxException
- - thrown if error occurs while marshalling object@Loggable public void marshallToResult(java.lang.Object obj, javax.xml.transform.Result result) throws ee.ria.dhx.exception.DhxException
marshallToResult
in interface DhxMarshallerService
obj
- - object to marshallresult
- - result into which object will be marshalledee.ria.dhx.exception.DhxException
- - thrown if error occurs while marshalling object@Loggable public java.io.StringWriter marshallToWriter(java.lang.Object container) throws ee.ria.dhx.exception.DhxException
marshallToWriter
in interface DhxMarshallerService
container
- - object to marshallee.ria.dhx.exception.DhxException
- - thrown if error occurs while marshalling objectpublic java.io.StringWriter marshallToWriterAndValidate(java.lang.Object container, java.io.InputStream schemaStream) throws ee.ria.dhx.exception.DhxException
marshallToWriterAndValidate
in interface DhxMarshallerService
container
- object to marshallschemaStream
- InputStream
of the XSD schema to validate againstee.ria.dhx.exception.DhxException
- thrown if error occurs while marshalling object@Loggable public void validate(java.io.File file, java.io.InputStream schemaStream) throws ee.ria.dhx.exception.DhxException
validate
in interface DhxMarshallerService
file
- - file to validateschemaStream
- - stream caontaining XSD schemaee.ria.dhx.exception.DhxException
- - thrown if error occurs@Loggable public void validate(java.io.InputStream fileStream, java.io.InputStream schemaStream) throws ee.ria.dhx.exception.DhxException
validate
in interface DhxMarshallerService
fileStream
- - stream to validateschemaStream
- - stream containing schema against which to validateee.ria.dhx.exception.DhxException
- - thrown if file is not validated against XSD schema.public javax.xml.bind.JAXBContext getJaxbContext()