1 package org
.argeo
.slc
.client
.oxm
;
3 import org
.argeo
.slc
.SlcException
;
4 import org
.springframework
.oxm
.Marshaller
;
5 import org
.springframework
.oxm
.Unmarshaller
;
6 import org
.springframework
.xml
.transform
.StringResult
;
7 import org
.springframework
.xml
.transform
.StringSource
;
9 public class OxmBean
implements OxmInterface
{
11 private Marshaller marshaller
;
12 private Unmarshaller unmarshaller
;
17 public Object
unmarshal(String result
) {
20 throw new SlcException("Cannot unmarshall empty string ");
22 res
= unmarshaller
.unmarshal(new StringSource(result
));
23 } catch (Exception e
) {
24 throw new SlcException("Could not unmarshall " + result
, e
);
29 public String
marshal(Object graph
) {
30 StringResult result
= new StringResult();
32 marshaller
.marshal(graph
, result
);
33 } catch (Exception e
) {
34 throw new SlcException("Cannot Marshal object " + graph
.toString()
37 return result
.toString();
41 public void setMarshaller(Marshaller marshaller
) {
42 this.marshaller
= marshaller
;
45 public void setUnmarshaller(Unmarshaller unmarshaller
) {
46 this.unmarshaller
= unmarshaller
;