From: Xuan B. <med...@us...> - 2008-01-23 19:49:24
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1 In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv16009/src/org/tm4j/topicmap/tmdm/tm4j1 Modified Files: TopicImpl.java Log Message: Allow Occurences to be created in the TM4J1 compatibility layer. Index: TopicImpl.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1/TopicImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TopicImpl.java 22 Jan 2008 21:49:10 -0000 1.6 --- TopicImpl.java 23 Jan 2008 19:49:28 -0000 1.7 *************** *** 10,17 **** --- 10,19 ---- import java.beans.PropertyVetoException; + import org.tm4j.net.LocatorFactoryException; import org.tm4j.net.LocatorFactory; import org.tm4j.net.Locator; import org.tm4j.topicmap.*; + import org.tm4j.topicmap.tmdm.PSI; import org.tm4j.topicmap.tmdm.ReadableTopic; import org.tm4j.topicmap.tmdm.ReadableTopicName; *************** *** 453,473 **** * this TopicMap. */ ! public Occurrence createOccurrence(String id) ! throws DuplicateObjectIDException, PropertyVetoException { ! throw new UnsupportedOperationException(); } ! public Occurrence createOccurrence(String id, Locator resourceLocator, ! Topic type, Locator ref, Topic[] themes) ! throws DuplicateObjectIDException, DuplicateResourceLocatorException, ! PropertyVetoException { ! throw new UnsupportedOperationException(); } ! public Occurrence createOccurrence(String id, Locator resourceLocator, ! Topic type, String data, Topic[] themes) ! throws DuplicateObjectIDException, DuplicateResourceLocatorException, ! PropertyVetoException { ! throw new UnsupportedOperationException(); } --- 455,488 ---- * this TopicMap. */ ! public Occurrence createOccurrence(String id) throws DuplicateObjectIDException, PropertyVetoException { ! assert id==null; // not supported ! ! try { ! return getContainer().unmergedToExternal(getRepresentedObject().createOccurrence(getContainer().getInternalUnspecifiedTopic(),OccurrenceImpl.createLocator(PSI.XMLSchema.String,this),"",null)); // dummy, not allowed in TMDM ! } catch (LocatorFactoryException e) { ! throw new RuntimeException("This should never happen.",e); ! } } ! public Occurrence createOccurrence(String id, Locator resourceLocator,Topic type,Locator ref, Topic[] themes) throws DuplicateObjectIDException,DuplicateResourceLocatorException,PropertyVetoException { ! assert id==null; // not supported ! assert resourceLocator==null; // not supported ! ! try { ! return getContainer().unmergedToExternal(getRepresentedObject().createOccurrence(getContainer().externalToUnmerged(type),OccurrenceImpl.createLocator(PSI.XMLSchema.IRI,this),TM4J1Utils.locatorToIRI(ref),getContainer().convertToInternalScope(themes))); ! } catch (LocatorFactoryException e) { ! throw new RuntimeException("This should never happen.",e); ! } } ! public Occurrence createOccurrence(String id, Locator resourceLocator,Topic type,String data, Topic[] themes) throws DuplicateObjectIDException,DuplicateResourceLocatorException,PropertyVetoException { ! assert id==null; // not supported ! assert resourceLocator==null; // not supported ! ! try { ! return getContainer().unmergedToExternal(getRepresentedObject().createOccurrence(getContainer().externalToUnmerged(type),OccurrenceImpl.createLocator(PSI.XMLSchema.String,this),data,getContainer().convertToInternalScope(themes))); ! } catch (LocatorFactoryException e) { ! throw new RuntimeException("This should never happen.",e); ! } } |