From: Peri <per...@gm...> - 2007-04-17 11:17:03
|
hi, 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. If there is a process I would have to follow in order to test the validity of my logic, please let me know. Thank you. On 4/12/07, Peri <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.TopicImplcannot 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. :) |