1 package org.exoplatform.services.xml.querying.impl.xtas.helper;2 3 import java.io.InputStream ;4 import org.xml.sax.InputSource ;5 import org.exoplatform.services.xml.querying.UniFormTransformationException;6 import org.exoplatform.services.xml.querying.XMLData;7 import org.exoplatform.services.xml.querying.XMLFragmentData;8 import org.exoplatform.services.xml.querying.XMLWellFormedData;9 import org.exoplatform.services.xml.querying.helper.XMLDataManager;10 import org.exoplatform.services.xml.querying.impl.xtas.UniFormConverter;11 import org.exoplatform.services.xml.querying.impl.xtas.UniFormTree;12 import org.exoplatform.services.xml.querying.impl.xtas.UniFormTreeFragment;13 import org.exoplatform.services.xml.querying.impl.xtas.WellFormedUniFormTree;14 import org.exoplatform.services.xml.querying.object.MarshallerCreateException;15 import org.exoplatform.services.xml.querying.object.ObjectMappingException;16 import org.exoplatform.services.xml.querying.object.ObjectMarshalException;17 import org.w3c.dom.Node ;18 19 20 21 public class XMLDataManagerFacade implements XMLDataManager {22 23 public XMLFragmentData create(InputStream stream) throws UniFormTransformationException {24 UniFormTreeFragment tree = new UniFormTreeFragment();25 tree.init(stream);26 return tree;27 }28 29 public XMLWellFormedData create(InputSource src) throws UniFormTransformationException {30 WellFormedUniFormTree tree = new WellFormedUniFormTree();31 tree.init(src);32 return tree;33 }34 35 public XMLWellFormedData create(Node node) throws UniFormTransformationException {36 WellFormedUniFormTree tree = new WellFormedUniFormTree();37 tree.init(node);38 return tree;39 }40 41 public XMLWellFormedData create(Object obj) throws UniFormTransformationException, ObjectMarshalException,42 MarshallerCreateException, ObjectMappingException {43 WellFormedUniFormTree tree = new WellFormedUniFormTree();44 tree.init(obj);45 return tree;46 }47 48 public XMLWellFormedData create(Object mapping, Object obj) throws UniFormTransformationException, ObjectMarshalException,49 MarshallerCreateException, ObjectMappingException {50 WellFormedUniFormTree tree = new WellFormedUniFormTree();51 tree.init(mapping, obj);52 return tree;53 }54 55 public XMLFragmentData toFragment(XMLData tree) throws UniFormTransformationException {56 return UniFormConverter.toFragment((UniFormTree) tree);57 }58 59 public XMLWellFormedData toWellFormed(XMLData tree) throws UniFormTransformationException {60 return UniFormConverter.toWellForm((UniFormTree) tree);61 }62 63 }64