[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: AW: [sdo] 2nd try: SDOSource, SDOResult and ContentHandler
Hello Stefan & Michael, I have been re-thinking the decision to make SDOSource and SDOResult abstract classes. In JAXB, JAXBSource and JAXBResult are concrete classes that extend their SAX counterparts. JAXB benefits from not needing a factory, but suffers from exposing meaningless public API, the best they can do is add Java doc comments stating that the users should not consider using the inherited API. If we go the factory route then we can offer the benefit of a clean API, and also the potential for implementors to offer Source/Result implementations better tuned for their implementation (on DOM, SAX, or StAX). All we really need are the attached interfaces and some new creation methods on XMLHelper (the following are based on current XML Helper API):
If there are expectations that a SDOSource from one vendor can act as input to another vendors SDO implementation load operation we can enhance the SDOSource interface further:
public XMLDocument load(Source inputSource, String locationURI, Object options) { if(inputSource instanceof SDOSource) { SDOSource sdoSource = (SDOSource) inputSource; SDOContentHandler sdoContentHandler = this.createContentHandler(options); sdoSource.getXMLHelper().save(sdoSource.getDocument(), new SAXResult(sdoContentHandler), sdoSource.getOptions()); return sdoContentHandler.getDocument(); } } If there are expectations that an SDOResult from one vendor can serve as the output to another vendors SDO implementation save operation we can enhance the SDOResult interface further:
if(outputResult instanceof SDOResult) { SDOResult sdoResult = (SDOResult) outputResult; SDOContentHandler sdoContentHandler = sdoResult.getContentHandler(); save(xmlDocument, new SAXResult(sdoContentHandler), options); } } -Blaise Michael Glavassevich wrote: OF90D3FE93.D191612D-ON85257581.00653383-85257581.0066D232@ca.ibm.com" type="cite"> |
package commonj.sdo.helper.util; import javax.xml.transform.Source; public interface SDOSource extends Source { }
package commonj.sdo.helper.util; import javax.xml.transform.Result; import commonj.sdo.helper.XMLDocument; public interface SDOResult extends Result { XMLDocument getDocument(); }
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]