Hello, I have created patch JIRA_1317_June25_Amita.txt attached to ASF-JIRA. Below is the brief design and changes done to each class. Please give your comments/recommendetions I will be sending separate mail for XMLResource.OPTION_RECORD_UNKNOWN_FEATURE. ML - www.mail-archive.com/[EMAIL PROTECTED]/msg01000.html Where shall I create patch for it? (1-2 more days)(i.e. shall I append patch for this to JIRA-1317 or create a new JIRA, to keep the work separate?)
***Questions:*** XMLStreamHelperTestCase-testSave, testSaveObject, XMLDocumentTestCase-testNoNameSpaceSchemaLocation, testSchemaLocation are the two which showed Malformed URL Exception , but were not counted as failure/error by mvn. I am checking the cause , please let me know if anybody has any pointer, a typical stack trace is below:- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ java.net.MalformedURLException at java.net.URL.<init>(URL.java:601) at java.net.URL.<init>(URL.java:464) at java.net.URL.<init>(URL.java:413) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity( XMLEntityManager.java:968) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion (XMLVersionDetector.java:184) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:798) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse( XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse( DOMParser.java:250) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse( DocumentBuilderImpl.java:292) at org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java :335) at org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java :372) at org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:680) at org.eclipse.xsd.util.XSDResourceImpl.load(XSDResourceImpl.java:617) at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java :247) at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java :237) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$1.generate( SDOXMLResourceImpl.java:527) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processSchemaLocations( XMLHandler.java:1459) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleTopLocations (SDOXMLResourceImpl.java:264) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType( XMLHandler.java:1139) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject( XMLHandler.java:1244) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java :880) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java :863) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java :627) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement (SDOXMLResourceImpl.java:364) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement( AbstractSAXParser.java:533) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement (XMLNSDocumentScannerImpl.java:330) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook (XMLNSDocumentScannerImpl.java:779) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch (XMLDocumentFragmentScannerImpl.java:1794) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument (XMLDocumentFragmentScannerImpl.java:368) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:834) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse( XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse( AbstractSAXParser.java:1242) at javax.xml.parsers.SAXParser.parse(SAXParser.java:375) at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:265) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad( XMLResourceImpl.java:666) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad( SDOXMLResourceImpl.java:541) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java :634) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java :259) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java :232) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:128) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:101) at org.apache.tuscany.sdo.test.XMLDocumentTestCase.testSchemaLocation( XMLDocumentTestCase.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run( JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run( TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run( RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196) java.net.MalformedURLException at java.net.URL.<init>(URL.java:601) at java.net.URL.<init>(URL.java:464) at java.net.URL.<init>(URL.java:413) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity( XMLEntityManager.java:968) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion (XMLVersionDetector.java:184) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:798) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse( XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse( DOMParser.java:250) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse( DocumentBuilderImpl.java:292) at org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java :335) at org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java :372) at org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:680) at org.eclipse.xsd.util.XSDResourceImpl.load(XSDResourceImpl.java:617) at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java :247) at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java :237) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$1.generate( SDOXMLResourceImpl.java:527) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processSchemaLocations( XMLHandler.java:1459) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleTopLocations (SDOXMLResourceImpl.java:264) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType( XMLHandler.java:1139) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject( XMLHandler.java:1244) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java :880) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java :863) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java :627) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement (SDOXMLResourceImpl.java:364) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement( AbstractSAXParser.java:533) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement (XMLNSDocumentScannerImpl.java:330) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook (XMLNSDocumentScannerImpl.java:779) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch (XMLDocumentFragmentScannerImpl.java:1794) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument (XMLDocumentFragmentScannerImpl.java:368) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:834) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse( XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse( AbstractSAXParser.java:1242) at javax.xml.parsers.SAXParser.parse(SAXParser.java:375) at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:265) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad( XMLResourceImpl.java:666) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad( SDOXMLResourceImpl.java:541) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java :634) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java :259) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java :232) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:128) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:101) at org.apache.tuscany.sdo.test.XMLDocumentTestCase.testSchemaLocation( XMLDocumentTestCase.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run( JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run( TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run( RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( RemoteTestRunner.java:196) java.net.MalformedURLException at java.net.URL.<init>(URL.java:601) at java.net.URL.<init>(URL.java:464) at java.net.URL.<init>(URL.java:413) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity( XMLEntityManager.java:968) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion (XMLVersionDetector.java:184) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:798) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse( XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse( DOMParser.java:250) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse( DocumentBuilderImpl.java:292) at org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java :335) at org.eclipse.xsd.util.XSDResourceImpl.getDocument(XSDResourceImpl.java :372) at org.eclipse.xsd.util.XSDResourceImpl.doLoad(XSDResourceImpl.java:680) at org.eclipse.xsd.util.XSDResourceImpl.load(XSDResourceImpl.java:617) at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java :247) at org.apache.tuscany.sdo.helper.XSDHelperImpl.define(XSDHelperImpl.java :237) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$1.generate( SDOXMLResourceImpl.java:527) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processSchemaLocations( XMLHandler.java:1459) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.handleTopLocations (SDOXMLResourceImpl.java:264) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType( XMLHandler.java:1139) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject( XMLHandler.java:1244) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java :880) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java :863) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java :627) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl$SDOXMLLoadImpl$XmlHandler.startElement (SDOXMLResourceImpl.java:364) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement( AbstractSAXParser.java:533) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement (XMLNSDocumentScannerImpl.java:330) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook (XMLNSDocumentScannerImpl.java:779) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch (XMLDocumentFragmentScannerImpl.java:1794) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument (XMLDocumentFragmentScannerImpl.java:368) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:834) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse( XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse( XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse( AbstractSAXParser.java:1242) at javax.xml.parsers.SAXParser.parse(SAXParser.java:375) at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:265) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad( XMLResourceImpl.java:666) at org.apache.tuscany.sdo.util.resource.SDOXMLResourceImpl.doLoad( SDOXMLResourceImpl.java:541) at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.load(XMLResourceImpl.java :634) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java :259) at org.apache.tuscany.sdo.helper.XMLDocumentImpl.load(XMLDocumentImpl.java :232) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:128) at org.apache.tuscany.sdo.helper.XMLHelperImpl.load(XMLHelperImpl.java:101) at org.apache.tuscany.sdo.test.XMLDocumentTestCase.testSchemaLocation( XMLDocumentTestCase.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run( JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run( TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run( RemoteTestRunner.java:386) $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ASSUMPTION: ---------- No new load options are covered in this JIRA. XMLResource.OPTION_RECORD_UNKNOWN_FEATURE will be treated using another JIRA so as not to mix different issues into one. This JIRA caters for only load options to be provided by default and does not consider save options. Existing: --------- Existing load options XML_LOAD_SCHEMA - already implemented in SDOXMLResourceImpl (Default behavior - FALSE) -When TRUE, loads an xml document consisting of a xsi:schemaLocation and xsi:noNamespaceSchemaLocation defined. It will then use the XMLDocument API to get and set the schemaLocation property. XML_LOAD_LAX_FORM - already implemented in SDOXMLResourceImpl (Default bahavior - ON == 1) -When 0, elements/attributes not adhering to xsd, cause exception during load -When 1, document loads without exceptions Existing Behavior - There was no/partial way to pass options to, during xmlhelper.load() or xmlStreamHelper.loadObject(), default values are assumed. The above options are required to be passed by user if different behavior is expected. There is no way at present in tuscany-sdo-lib where user can set options at HelperContext level, which can then be used by all load() calls to XMLHelper. New: ---- New Behavior - This JIRA provides methods so that user can set the behavior once per HelperContext and use it for all later use of XMLHelper, XMLStreamHelper. In this case, user does not need to pass options to load(). If user still passes options to load(), these will override what is set in the HelperContext for that particular invocation of load(). Also, there is a mail discussion http://www.mail-archive.com/[email protected]/msg17479.html which says need to have XML_LOAD_SCHEMA TRUE by default, it is done using this JIRA. CHANGES: in code marked with //JIRA-1317 ---------- tuscany-sdo-impl 1*XMLHelperImpl 2*HelperContextImpl 3*HelperProviderImpl 4*AllTests 5*XLMOptionsTestCase 6*SDOHelperImpl 7*XMLStreamHelperImpl 8*SDOXMLResourceImpl tuscany-sdo-lib 9*SDOUtil 10*HelperProviderBase 11*SDOHelper 12*XMLStreamHelper QUESTION: ---------- Is there a need to modify CTS for this? or just tuscany-sdo-impl/tests? What is the standard convention we follow for DAS? PATHS: These are the different flows used during setting options. ---------- 1)HelperProviderBase->HelperProviderImpl->HelperContextImpl->XMLHelperImpl->XMLDocumentImpl 2)SDOUtil->SDOHelper->SDOHelperImpl->HelperContextImpl->XMLHelperImpl->XMLDocumentImpl 3)SDOUtil->SDOHelper->SDOHelperImpl->XMLStreamHelperImpl->XMLDocumentImpl 4)SDOUtil->SDOHelper->SDOHelperImpl->HelperContextImpl->XMLStreamHelperImpl->XMLDocumentImpl TEST: New test case - XMLOptionsTestCase. Ran complete mvn and cts. General design thought: ----------------------- HelperContextImpl has new member defaultOptions. These can be set by The same are referenced by XMLHelper and XMStreamHelper if there are no explicit options passed to their load(), loadObject() methods. So far, XMLStreamHelper was not bunched with other helpers like XMLHelper, XSDHelper under HelperContextImpl. This JIRA has made that change, so that the path 4) is possible. But this needs spec support , i.e. commonj....HelperContext should provide getXMLStreamHelper(). Due to this change, internal to Tuscany-SDO it is possible to have only one member defaultOption at context level, instead of duplicating it at XMLHelper and XMLStreamHelper level. Done changes to HelperContextImpl->XMLStreamHelperImpl for this. Also, HelperContext should be reachable from helpers, so that the context level information can be shared.At present made this to only XMLHelper and XMLStreamHelper, but if this sounds the appropriate change, it should be made to other helpers as well like XSDHelper.., to keep design consistent. Probably this was not needed before as so far HelperContextImpl held only these helpers and a static builtInModelRegistry. But as helpers are instance members, options have to be instance member of HelperContextImpl and also reachable from Helpers bunched under the same context. So introduced member Map defaultOptions in HelperContextImpl, and pass helperContextImpl ref. to Helpers (at present only XMLHelper and XMStreamHelper) Regards, Amita On 6/22/07, Frank Budinsky <[EMAIL PROTECTED]> wrote:
Since the word "feature" is an EMF term (in SDO it's called "property") I would recommend changing the name of the new option in Tuscany. Something like XMLOptions.XML_LOAD_UNKNOWN_PROPERTIES would be a good name. Frank. "Amita Vadhavkar" <[EMAIL PROTECTED]> wrote on 06/22/2007 09:33:22 AM: > Hello, > I am trying to summarize the discussion so far below and about to finish the > patch > based on that. I will attach it when tested completely in a day or so. > Please see > the ASSUMPTIONS and PATHS in particular to see if there is some wrong > understanding > there. > > ASSUMPTION: > ---------- > No new load options except XMLResource.OPTION_RECORD_UNKNOWN_FEATURE are > required. This JIRA caters for only load options to be provided by default > and does not consider save options. > > Existing load options > XML_LOAD_SCHEMA - already implemented in SDOXMLResourceImpl > XML_LOAD_LAX_FORM - already implemented in SDOXMLResourceImpl > > Behavior - the above options are required to be passed using xmlhelper.load() > by user. > There is no way at present in tuscany-sdo-lib where user can assume default > options. > This JIRA is to provide this default behavior where XML_LOAD_SCHEMA and > XML_LOAD_LAX_FORM will assume default "true". User will need to pass FALSE > option if this is not desired (For XML_LOAD_SCHEMA - Boolean.FALSE, for > XML_LOAD_LAX_FORM Integer(0)) > > As the mail [Tuscany SDO] JIRA-1317 - questions/doubts says - ResolvableImpl > - is not in working condition, no code changes done to it. > > Also, there is a mail discussion > http://www.mail-archive.com/[email protected]/msg17479.html > which says need to have XML_LOAD_SCHEMA ON by default, it is done using this > JIRA. > > CHANGES: marked with //JIRA-1317 > ---------- > impl > > *XMLHelperImpl > *HelperContextImpl > *HelperProviderImpl > *AllTests > *XLMOptionsTestCase > *SDOHelperImpl > *XMLStreamHelperImpl > > lib > > *SDOUtil > *HelperProviderBase > *SDOHelper > *XMLStreamHelper > > QUESTION: > ---------- > Is there a need to modify CTS for this? or just tuscany-sdo-impl/tests? What > is the standard > convention we follow for Unit Testing JIRA in SDO? > > NOTE: > ---------- > This JIRA does not include anything for > XMLResource.OPTION_RECORD_UNKNOWN_FEATURE. Checking more details for that. > PATHS: > ---------- > HelperProviderBase->HelperProviderImpl->HelperContextImpl->XMLHelperImpl->XMLDocumentImpl > > SDOUtil->SDOHelper->SDOHelperImpl->HelperContextImpl->XMLHelperImpl->XMLDocumentImpl > > SDOUtil->SDOHelperImpl->XMLStreamHelperImpl->XMLDocumentImpl > > Regards, > Amita > > > On 6/22/07, Frank Budinsky <[EMAIL PROTECTED]> wrote: > > > > Amita, > > > > This part of your mapping is wrong: > > > > XML_SAVE_LINE_BREAK OPTION_FORMATTED > > XML_SAVE_INDENT OPTION_FORMATTED > > XML_SAVE_MARGIN OPTION_FORMATTED > > > > These options don't map to anything in EMF. They are Tuscany defined > > options which are processed in SDOXMLResourceImpl. > > > > Frank. > > > > Fuhwei Lwo <[EMAIL PROTECTED]> wrote on 06/21/2007 02:44:55 PM: > > > > > Hi Amita, > > > > > > Currently Tuscany SDO is not exposing all the EMF options for load > > > and save. Also it's not 1:1 mapping from SDO to EMF options. That's > > > why all the supported SDO options are described in the org.apache. > > > tuscany.sdo.api.SDOHelper$XMLOptions. In order to add more options > > > to SDO, you need to modify SDOHelper$XMLOptions then implement the > > > new SDO option by either mapping to EMF's option or implementing > > > your own. Also, I believe load and save options are mutually > > > exclusive which means passing save options to load method will be a > > no-op. > > > > > > In your test case for JIRA 1317, you cannot do something like this: > > > > > > options.put(XMLResource.OPTION_SAVE_DOCTYPE, Boolean.FALSE); > > > > > > because it's using EMF API not SDO's. From a SDO user point > > > of view > > > > > > because it's using EMF API not SDO's. From a SDO user point of view, > > > he/she should not need to import any EMF packages in his/her SDO > > program. > > > > > > Fuhwei > > > > > > Amita Vadhavkar <[EMAIL PROTECTED]> wrote: Hi, > > > I got the below mapping between Tuscany's XMLOptions and emf XMLResource > > > Options > > > Is this what is intended to be passed to in load method, i.e. is it > > expected > > > to > > > have this mapping and pass appropriate options set to the doLoad()? > > Also, we > > > have > > > multiple options for line formatting whereas there is only > > OPTION_FORMATTED > > > in emf XMLResource, so what needs to be done here? > > > Mapping:- > > > > > > XML_SAVE_LINE_BREAK OPTION_FORMATTED > > > XML_SAVE_LINE_BREAK OPTION_FORMATTED > > > XML_SAVE_INDENT OPTION_FORMATTED > > > XML_SAVE_MARGIN OPTION_FORMATTED > > > XML_SAVE_LINE_WIDTH OPTION_LINE_WIDTH > > > XML_SAVE_DOCTYPE OPTION_SAVE_DOCTYPE > > > XML_LOAD_SCHEMA OPTION_SCHEMA_LOCATION > > > XML_LOAD_LAX_FORM OPTION_EXTENDED_META_DATA - already implemented > > > > > > When we talk about moving away from emf, what will happen to these > > options? > > > > > > I am yet to follow all the answers to the questions I had, but after > > passing > > > a couple of > > > options (say OPTION_FORMATTED, OPTION_SAVE_DOCTYPE) and calling load(), > > I > > > see that in > > > SDOXMLResourceImpl.doLoad() that options are getting passed, but I do > > not > > > see any > > > difference in the deserialized DO(see the testcase - dumping do to > > console > > > using xmlhelper) > > > with the option ON/OFF? So what super.doLoad() is > > > doing? > > > > > > I am attaching a patch file JIRA_1317_June21.txt, just to show what code > > > changes I have done so far, this is > > > far away from the solution though. I will collect all answers from this > > > thread and > > > refine the patch, but kind of getting lost with doLoad(). > > > > > > Regards, > > > Amita > > > > > > > > > On 6/21/07, Frank Budinsky wrote: > > > > > > > > The GENERATED_LOADER was used in conjuction with the -generateLoader > > > > option in JavaGenerator. The JavaDoc says this: > > > > > > > > * -generateLoader > > > > * Generate a fast XML parser/loader for instances of the > > model. > > > > The details of this option are > > > > * subject to change, but currently it generates two additional > > > > classes in a "util" package: > > > > * > > > ResourceImpl and > > > ResourceFactoryImpl. To use > > > > the generated loader at runtime, > > > > * you need to pass an option to the XMLHelper.load() method > > like > > > > this: > > > > * Map options = new HashMap(); > > > > * options.put("GENERATED_LOADER", > > > > > > > ResourceFactoryImpl.class); > > > > * XMLDocument doc = XMLHelper.INSTANCE.load(new > > > > FileInputStream("somefile.xml"), null, options); > > > > * Note: this option currently only works for simple schemas > > > > without substitution groups or wildcards. > > > > > > > > Note, however, that this was always an unsupported option (prototype) > > and > > > > it is now completely broken, since we swiched to the -noEMF code > > generator > > > > patterns. > > > > > > > > Frank. > > > > > > > > > > > > "kelvin goodson" wrote on 06/21/2007 05:47:37 > > > > AM: > > > > > > > > > > > > > > > > 3)What is meaning of below code in XMLDocumentImpl? > > > > > > if (options instanceof Map) > > > > > > { > > > > > > Class resourceFactoryClass = > > > > > > (Class)((Map)options).get("GENERATED_LOADER"); > > > > > > if (resourceFactoryClass != null) > > > > > > { > > > > > > try > > > > > > { > > > > > > Object resourceFactory = > > resourceFactoryClass.newInstance(); > > > > > > resourceSet.getResourceFactoryRegistry(). > > > > > getExtensionToFactoryMap().put("*", > > > > > > resourceFactory); > > > > > > } > > > > > > catch (Exception e) > > > > > > { > > > > > > e.printStackTrace(); > > > > > > } > > > > > > } > > > > > > } > > > > > > > > > > I looked back at the svn history, and this code has been there > > since > > > > > the original contribution of code to Apache. > > > > > > > > > > My guess from the name of the option and other brushes with topics > > of > > > > > a similar nature is that this allows optimised loads of XML > > documents > > > > > of a specific nature by employing a generated Factory which loads > > only > > > > > documents conforming to s specific XML schema. > > > > > > > > > > It would be good to get a test in place to exercise this code if it > > is > > > > > still relevant. I know for sure that neither the unit tests nor the > > > > > CTS exercises it. > > > > > > > > > > This is standard EMF stuff, but I'm not sure whether we ever put it > > > > > to good use in SDO, so all I can do is translate the meaning of the > > > > > code to the best of my understanding, which you may already > > > > > understand anyway. > > > > > > > > > > In an EMF resource set, there can be a set of Factories that know > > how > > > > > to create java objects from resources. The resource set holds a > > > > > mapping from file extensions for the resources to factories. If a > > > > > request is made to load a resource file with a given extension then > > > > > the map is used to look up the factory that will be used to load the > > > > > resource. There is scope for using wildcards in the file extensions > > in > > > > > the mapping. If you want to override existing behaviour or add new > > > > > file extensions you can add another factory to the mapping. So here > > > > > the one option that seems to be permitted for this operation is the > > > > > "GENERATED_LOADER" option, for which the value must be a class > > which > > > > > is a Factory that knows how to load all resources that the resource > > > > > set is going to encounter. A new instance of this factory is > > created > > > > > and lodged in the resource set's map against the "*" wildcard. So > > > > > whenever the resource set needs to load a resource, the Factory it > > > > > uses to attempt to do the load will always be an instance of the > > class > > > > > that was provided in the option. If the option is not provided or > > > > > the construction of the specified instance fails then the resource > > set > > > > > relies on whatever factories if already knew about to create > > > > > resources. > > > > > > > > > > Regards, Kelvin. > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
