From:
<xua...@ba...> - 2007-04-20 13:07:02
|
Peri wrote: > hi, Hi Peri, > > Topic: > Copy of contents xtm files to my-sql DBMS. > The process goes smooth till it finds scope object in either > <basename(s)> or <occurrence(s)> > > > If observed, in the method copyScopedObject of > TopicMapFactoryBase.TopicMapFactoryBase, the Topic object is sent as > is to the implementation classes, which works fine if the copy is > performed at the same level (file-system to file-system). > > Have tried fixing this problem and did a bit of testing too, to copy > the topics from various XTM, provided in the example section. thank you for your patch. I applied your patch to both the "MAIN" and the "TM4J_1_x" branch of TM4J. > > If there is a process I would have to follow in order to test the > validity of my logic, please let me know. I wish TM4J had a comprehensive test suite that could be applied before checking in a patch, but (apart from "ant ozone-test", which is not really a test suite), I'm not aware of any test suite for TM4J. Using the mailing-list is okay (for me), but maybe raising a bug at https://sourceforge.net/tracker/?group_id=27895&atid=391879 would make the discussion more standardized. :-) > > Thank you. Thank you, too, for digging into the problem and contributing a patch. :-) > > > > > On 4/12/07, *Peri* <per...@gm... <mailto:per...@gm...>> > wrote: > > Hi, > I am trying to perform a copy from a TopicMap generated from in > memory provider and populate my topicmap stored in the database. > While copying the scope bounded basenames, the copy operations > errors out with a class cast exception... > > > TopicMap: > topicmaps/kings_and_queens.xtm # Sample provided in the examples > > Code Snippet: > TopicMapProvider provider_m = > tmpf_m.newTopicMapProvider(providerProps); > Locator baseLocator_m = > provider_m.getLocatorFactory().createLocator("URI", getInputURI()); > > TopicMapSource src_m = new > SerializedTopicMapSource(getInputStream(), baseLocator_m); > > // Parse the topic map > TopicMap tm_m = provider_m.addTopicMap(src_m); > > TopicMapProvider provider_h = > tmpf_h.newTopicMapProvider(providerProps); > Locator baseLocator_h = > provider_h.getLocatorFactory().createLocator("URI", getInputURI()); > > TopicMap tm_h = provider_h.getTopicMap(baseLocator_h); > provider_h.removeTopicMap(tm_h); > tm_h = provider_h.createTopicMap(baseLocator_h); > > // Perform a copy > tm_h.getFactory().copy(tm_m); > > > Stack trace: > Exception in thread "main" > org.tm4j.topicmap.TopicMapRuntimeException: > Cause: java.lang.ClassCastException: > org.tm4j.topicmap.memory.TopicImpl cannot be cast to > org.tm4j.topicmap.hibernate.TopicImpl > Cause:org.tm4j.topicmap.memory.TopicImpl cannot be cast to > org.tm4j.topicmap.hibernate.TopicImpl > at > org.tm4j.topicmap.hibernate.ScopedObjectImpl.setScope(Unknown Source) > at > org.tm4j.topicmap.TopicMapFactoryBase.copyScopedObject(TopicMapFactoryBase.java:741) > at > org.tm4j.topicmap.TopicMapFactoryBase.copy(TopicMapFactoryBase.java:507) > at org.tm4j.topicmap.TopicMapFactoryBase.copy > (TopicMapFactoryBase.java:259) > at > org.tm4j.topicmap.TopicMapFactoryBase.copy(TopicMapFactoryBase.java:212) > at > org.tm4j.topicmap.TopicMapFactoryBase.copy(TopicMapFactoryBase.java:203) > at org.tm4j.topicmap.TopicMapFactoryBase.copy > (TopicMapFactoryBase.java:96) > at > com.krl.examples.HibernateProviderTest.setUp(HibernateProviderTest.java:97) > at > com.krl.examples.HibernateProviderTest.main(HibernateProviderTest.java:108) > Caused by: java.lang.ClassCastException : > org.tm4j.topicmap.memory.TopicImpl cannot be cast to > org.tm4j.topicmap.hibernate.TopicImpl > at > org.tm4j.topicmap.hibernate.ScopedObjectImpl.setScope(Unknown Source) > ... 9 more > > Am I missing anything here... > > > Any help would me much appreciated!!! > -- > warm regards > Peri > > The best way out of difficulty is through it. :) > > > > > -- > warm regards > Peri > > The best way out of difficulty is through it. :) > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > ------------------------------------------------------------------------ > > _______________________________________________ > Tm4j-developers mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-developers |