You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
(30) |
Jul
(74) |
Aug
(2) |
Sep
(91) |
Oct
(27) |
Nov
(77) |
Dec
(33) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(175) |
Feb
(133) |
Mar
(94) |
Apr
(65) |
May
(108) |
Jun
(100) |
Jul
(46) |
Aug
(19) |
Sep
(145) |
Oct
(289) |
Nov
(134) |
Dec
(211) |
2003 |
Jan
(106) |
Feb
(269) |
Mar
(106) |
Apr
(202) |
May
(300) |
Jun
(83) |
Jul
(70) |
Aug
(217) |
Sep
(183) |
Oct
(292) |
Nov
(324) |
Dec
(117) |
2004 |
Jan
(318) |
Feb
(151) |
Mar
(64) |
Apr
(195) |
May
(279) |
Jun
(263) |
Jul
(280) |
Aug
(167) |
Sep
(91) |
Oct
(175) |
Nov
(34) |
Dec
(38) |
2005 |
Jan
|
Feb
|
Mar
(4) |
Apr
|
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(5) |
2006 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(6) |
2007 |
Jan
(2) |
Feb
(11) |
Mar
(1) |
Apr
(33) |
May
(13) |
Jun
(1) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2008 |
Jan
(191) |
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
(33) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(14) |
2009 |
Jan
(39) |
Feb
(6) |
Mar
(22) |
Apr
(31) |
May
(78) |
Jun
(74) |
Jul
(39) |
Aug
(22) |
Sep
(16) |
Oct
(32) |
Nov
(4) |
Dec
(5) |
2010 |
Jan
(1) |
Feb
|
Mar
(33) |
Apr
(45) |
May
(66) |
Jun
(63) |
Jul
(32) |
Aug
(56) |
Sep
(19) |
Oct
(1) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(1) |
2016 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
From: Xuan B. <med...@us...> - 2008-01-21 19:11:17
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv7960/src/org/tm4j/topicmap/tmdm Modified Files: AssociationRole.java ReadableAssociationRole.java Log Message: Bugfix: AssocationRole is actually not Scopeable, only Reifiable (bug found thanks to a code-review by Benjamin Bock <bb-...@bo...>) Index: AssociationRole.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/AssociationRole.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AssociationRole.java 21 Jan 2008 11:13:44 -0000 1.1 --- AssociationRole.java 21 Jan 2008 19:11:20 -0000 1.2 *************** *** 9,13 **** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ ! public interface AssociationRole extends ReadableAssociationRole,Scopeable { @TMDM --- 9,13 ---- @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ ! public interface AssociationRole extends ReadableAssociationRole,Reifiable { @TMDM Index: ReadableAssociationRole.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/ReadableAssociationRole.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ReadableAssociationRole.java 21 Jan 2008 11:13:44 -0000 1.1 --- ReadableAssociationRole.java 21 Jan 2008 19:11:20 -0000 1.2 *************** *** 9,13 **** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ ! public interface ReadableAssociationRole extends ReadableScopeable { @TMDM --- 9,13 ---- @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ ! public interface ReadableAssociationRole extends ReadableReifiable { @TMDM |
From: Xuan B. <med...@us...> - 2008-01-21 19:11:16
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/merged In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv7960/src/org/tm4j/topicmap/tmdm/merged Modified Files: MergedAssociationRole.java Log Message: Bugfix: AssocationRole is actually not Scopeable, only Reifiable (bug found thanks to a code-review by Benjamin Bock <bb-...@bo...>) Index: MergedAssociationRole.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/merged/MergedAssociationRole.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MergedAssociationRole.java 21 Jan 2008 11:13:45 -0000 1.1 --- MergedAssociationRole.java 21 Jan 2008 19:11:20 -0000 1.2 *************** *** 16,20 **** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ ! public class MergedAssociationRole extends MergedScopeable<ReadableAssociationRole,MergedAssociationRoleKey> implements ReadableAssociationRole { protected MergedAssociationRole(MergedTopicMapView container,MergedAssociationRoleKey key,ReadableAssociationRole firstComponent) { --- 16,20 ---- @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ ! public class MergedAssociationRole extends MergedReifiable<ReadableAssociationRole,MergedAssociationRoleKey> implements ReadableAssociationRole { protected MergedAssociationRole(MergedTopicMapView container,MergedAssociationRoleKey key,ReadableAssociationRole firstComponent) { |
From: Xuan B. <med...@us...> - 2008-01-21 19:11:16
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/basic In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv7960/src/org/tm4j/topicmap/tmdm/basic Modified Files: BasicAssociationRole.java Log Message: Bugfix: AssocationRole is actually not Scopeable, only Reifiable (bug found thanks to a code-review by Benjamin Bock <bb-...@bo...>) Index: BasicAssociationRole.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/basic/BasicAssociationRole.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicAssociationRole.java 21 Jan 2008 11:13:44 -0000 1.1 --- BasicAssociationRole.java 21 Jan 2008 19:11:20 -0000 1.2 *************** *** 12,16 **** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ ! public class BasicAssociationRole extends BasicScopeable implements AssociationRole { BasicAssociation parent; BasicTopic type; --- 12,16 ---- @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ ! public class BasicAssociationRole extends BasicReifiable implements AssociationRole { BasicAssociation parent; BasicTopic type; |
From: Xuan B. <med...@us...> - 2008-01-21 19:04:42
|
Update of /cvsroot/tm4j/tm4j In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv4940 Modified Files: README.txt Log Message: Update documentation regarding requirements.. Index: README.txt =================================================================== RCS file: /cvsroot/tm4j/tm4j/README.txt,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** README.txt 15 Dec 2004 10:23:42 -0000 1.20 --- README.txt 21 Jan 2008 19:04:36 -0000 1.21 *************** *** 72,79 **** http://java.sun.com/j2se/1.4.2/index.html ! TM4J is targetted for JDK 1.3.1 and later. If you have trouble ! compiling TM4J on JDK 1.3.1 or later 1.3 versions, please report ! a bug to the development team. However, please note that some ! (minor) features of TM4J are not supported under JDK 1.3.x. Please refer to the "Known Problems" section of the RELEASE.txt file. --- 72,78 ---- http://java.sun.com/j2se/1.4.2/index.html ! TM4J is targetted for JDK 1.5 and later. If you have trouble ! compiling TM4J on JDK 1.5 or later versions, please report ! a bug to the development team. Please refer to the "Known Problems" section of the RELEASE.txt file. |
From: Xuan B. <med...@us...> - 2008-01-21 11:13:44
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1 In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27256/src/org/tm4j/topicmap/tmdm/tm4j1 Added Files: AssociationImpl.java BaseNameImpl.java MemberImpl.java ScopedObjectImpl.java TopicImpl.java TopicMapFactoryImpl.java TopicMapImpl.java TopicMapObjectImpl.java TopicMapProviderFactoryImpl.java TopicMapProviderImpl.java TopicMapUtilsImpl.java package.jdo Log Message: This change introduces the new TMDM (re-)implementation towards TM4J 2.0. It consists of about 430KB, 9900 lines of code. It is written by Xuan Baldauf and depends on the package baldauf-common. --- NEW FILE: TopicMapProviderFactoryImpl.java --- package org.tm4j.topicmap.tmdm.tm4j1; import java.util.Properties; import org.tm4j.topicmap.TopicMapProvider; import org.tm4j.topicmap.TopicMapProviderException; import org.tm4j.topicmap.TopicMapProviderFactory; import com.mn.util.data.CollectionsFactory; import com.mn.util.data.JavaUtilCollectionsFactory; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class TopicMapProviderFactoryImpl extends TopicMapProviderFactory { public TopicMapProviderImpl newTopicMapProvider(Properties props) throws TopicMapProviderException { return new TopicMapProviderImpl(this,props,JavaUtilCollectionsFactory.getDefault()); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: TopicImpl.java --- package org.tm4j.topicmap.tmdm.tm4j1; import java.util.Set; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.beans.PropertyVetoException; import org.tm4j.net.LocatorFactory; import org.tm4j.net.Locator; import org.tm4j.topicmap.*; import org.tm4j.topicmap.tmdm.ReadableTopic; import org.tm4j.topicmap.tmdm.ReadableTopicName; import org.tm4j.topicmap.tmdm.ReadableTopicMap; import org.tm4j.topicmap.tmdm.ReadableTopicMapConstruct; import org.tm4j.topicmap.tmdm.merged.MergedTopic; import org.tm4j.topicmap.tmdm.merged.MergedTopicName; import org.tm4j.topicmap.tmdm.merged.MergedTopicMapView; import org.tm4j.topicmap.tmdm.merged.MergedAssociationRole; import com.mn.util.data.*; import com.mn.util.diag.syslog.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class TopicImpl extends TopicMapObjectImpl<org.tm4j.topicmap.tmdm.Topic,org.tm4j.topicmap.tmdm.ReadableTopic> implements org.tm4j.topicmap.Topic { protected TopicImpl(org.tm4j.topicmap.tmdm.Topic representedObject,TopicMapImpl container) { super(representedObject,container); } protected MergedTopic getMergedObject() { assert isSane() : toDiagnosticsString()+".getRepresentedObject() is not correctly loaded?"; return getContainer().getMergedTopicMapView().getMergedTopic(getRepresentedObject()); } protected boolean isSane() { boolean result = getRepresentedObject().getParent()!=null; return result; } /** * Retrieves the reference to the resource which is the subject of this topic. * * @return The resource reference as a {@link Locator}, or <code>null</code> if no resource * represents the subject which this topic reifies. */ public Locator getSubject() { // throw new UnsupportedOperationException(); Collection<Locator> subjectLocatorsCollection = getMergedObject().getSubjectLocatorsCollection(); if (subjectLocatorsCollection.isEmpty()) { return null; } else { // we return only one of possible many subject locators // Syslog.log(this,Syslog.DEBUG4,"getSubject(): subjectLocatorsCollection="+subjectLocatorsCollection+"."); return subjectLocatorsCollection.iterator().next(); } } /** * Retrieves the reference to the resource which is the subject of this topic. * @param includeMergedTopics if true, then the subject defined by any one of the topics merged with this topic will be returned, * otherwise a value will only be returned if it was specified on this Topic instance. * @return the resource reference as a Locator or <code>null</code> if there is no subject * locator. */ public Locator getSubject(boolean includeMergedTopics) { throw new UnsupportedOperationException(); } /** * Sets the reference to the subject of this topic. * * @param subject The locator of the resource that is the subject which this topic reifies. */ public void setSubject(Locator subject) throws PropertyVetoException { // throw new UnsupportedOperationException(); // Syslog.log(this,Syslog.DEBUG4,"setSubject("+subject+")."); getRepresentedObject().addSubjectLocator(subject); } // Get/Set subject indicators /** * Returns the subject indicators for this topic and all merged topics. * This method is a shorthand for <code>getSubjectIndicators(true)</code>. * * @return An unmodifiable collection of {@link Locator}s representing * the subject indicators for this topic. * If no subject indicators are currently defined on this * topic (or merged topics), the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection getSubjectIndicators() { // throw new UnsupportedOperationException(); return getMergedObject().getSubjectIdentifiers(); } /** * Returns the subject indicators for this topic and, optionally, for all merged topics. * * @param includeMergedTopics if <code>true</code>, then the subject indicators of all * merged topics are included in the returned collection, * otherwise only the subject indicators of this topic are returned. * @return An unmodifiable collection of {@link Locator}s representing * the subject indicators for this topic. * If no subject indicators are currently defined on this * topic (or merged topics), the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection getSubjectIndicators(boolean includeMergedTopics) { throw new UnsupportedOperationException(); } /** * Adds a subject indicator to this topic. * * @param subjectIndicator the subject indicator reference to be added. */ public void addSubjectIndicator(Locator subjectIndicator) throws PropertyVetoException { getRepresentedObject().addSubjectIdentifier(subjectIndicator); } /** * Sets the collection of subject indicators for this topic. * * @param indicators the subject indicator references, * as an array of {@link Locator}s. */ public void setSubjectIndicators(Locator[] indicators) throws PropertyVetoException { throw new UnsupportedOperationException(); } // Get/Set/Add type: /** * Returns the Topics defining the type of this topic and all merged topics. * This method is shorthand for <code>getTypes(true)</code>. * * @return An unmodifiable Collection of the {@link Topic}s defining the type * of this topic and all merged topics. * If no types are currently defined on this * topic (or merged topics), the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection getTypes() { // throw new UnsupportedOperationException(); return Collections.emptyList(); } /** * Returns the Topics defining the type of this topic and, * optionally, of all merged topics. * * @param includeMergedTopics If <code>true</code> then the types of all merged * topics are included in the returned collection, * otherwise, only the typing topics * defined on this topic are returned. * @return An unmodifiable Collection of the {@link Topic}s defining the type * of this topic and, if <code>includeMergedTopics</code> is set * to <code>true</code>, of all merged topics. * If no subject indicators are currently defined on this * topic (or merged topics), the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection getTypes(boolean includeMergedTopics) { throw new UnsupportedOperationException(); } /** * Defines the type of this topic. * * @param types the new set of topics to define the type of * this topic. If this is <code>null</code>, * all the existing typing topics of this topic * are removed. */ public void setTypes(Topic[] types) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Adds a new topic into the set of those defining the type of this topic. * * @param type The typing topic to be added. */ public void addType(Topic type) throws PropertyVetoException { addType(((TopicImpl) type).getRepresentedObject()); } protected void addType(org.tm4j.topicmap.tmdm.Topic type) throws PropertyVetoException { org.tm4j.topicmap.tmdm.Association association = getContainer().getRepresentedObject().createAssociation(getContainer().getInternalTypeInstanceTopic()); association.createRole(getContainer().getInternalTypeTopic(),type); association.createRole(getContainer().getInternalInstanceTopic(),getRepresentedObject()); } /** * Determines whether the specified topic is one of the types of this topic. * * @param type the topic to be compared to this topic's typing topics. * @return <code>true</code> if <code>type</code> is among the topics * defining this topic's type, <code>false</code> otherwise. */ public boolean isOfType(Topic type) { throw new UnsupportedOperationException(); } /** * Determines whether this topic is typed by a topic whose subject * is or whose subject is indicated by <code>subjectOrIndicator</code>. * <p>This method will return true if one of the following conditions hold:</p> * <ul> * <li>A subject indicator of a typing topic of this topic, or</li> * <li>the actual subject of a typing topic of this topic.</li> * </ul> * * @return <code>true</code> if <code>subjectOrIndicator</code> * meets the above conditions, <code>false</code> otherwise. */ public boolean isOfType(Locator subjectOrIndicator) { throw new UnsupportedOperationException(); } // Get/Set/Add Names /** * Retrieves a collection of the base names of this topic * and any merged topics. This function is shorthand for * <code>getNames(true)</code>. * * @return An unmodifiable collection of {@link BaseName}s defined * on this topic and any merged topics. * If no base names are currently defined on this * topic (or merged topics), the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection<? extends BaseName> getNames() { // throw new UnsupportedOperationException(); /* return new MappedSet<MergedTopicName,BaseName>((Set<MergedTopicName>) (Set<? extends ReadableTopicName>) (getMergedObject().getTopicNames())) { protected BaseName map(MergedTopicName key) { return getContainer().mergedToExternal(key); } }; */ return getContainer().mergedToExternalTopicNames(getMergedObject().getTopicNames()); } /** * Retrieves the collection of the base names of this topic * and, if so specified, of any merged topics. * * @param includeMergedTopics If <code>true</code>, the names of * all merged topics are included in the returned collection. * Otherwise, the collection contains only the names defined * specifically on this topic. * @return An unmodifiable collection of {@link BaseName}s defined * on this topic and, optionally, any merged topics. * If no base names are currently defined on this * topic (or merged topics), the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection getNames(boolean includeMergedTopics) { throw new UnsupportedOperationException(); } /** * Sets the names of this Topic. * * @param names the new set of names to be assigned to * this topic. If this is <code>null</code>, * all the existing names of this topic * are removed. */ public void setNames(BaseName[] names) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Adds another name to the set of names of this Topic. * @param name the name to be added. */ public void addName(BaseName name) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Creates a new BaseName as a child of this Topic. * @param id the unique object id to be assigned to the new BaseName object. If * this parameter is null, the back-end will assign an ID to the * newly created object. * @throws DuplicateObjectIDException if <code>id</code> specifies and identifier * value already used in the containing TopicMap. * @throws PropertyVetoException if to create a new name for this Topic would * violate a constraint imposed by a VetoableChangeListener assigned to * this TopicMap. */ public BaseName createName(String id) throws DuplicateObjectIDException, PropertyVetoException { throw new UnsupportedOperationException(); } /** * Creates a new BaseName as a child of this Topic * @param id the unique object id to be assigned to the new BaseName object. If * this parameter is null, the back-end will assign an ID to the newly created * object. * @param nameString the string to be assigned to the new BaseName as content. * @throws DuplicateObjectIDException if <code>id</code> specifies and identifier * value already used in the containing TopicMap. * @throws PropertyVetoException if to create a new name for this Topic would * violate a constraint imposed by a VetoableChangeListener assigned to * this TopicMap. * @return a new BaseName object. */ public BaseName createName(String id, String nameString) throws DuplicateObjectIDException, PropertyVetoException { throw new UnsupportedOperationException(); } /** * Creates a new BaseName as a child of this Topic * @param id the unique object id to be assigned to the new BaseName object. If * this parameter is null, the back-end will assign an ID to the newly created * object. * @param nameString the string to be assigned to the new BaseName as content. * @param scope the topics to be assigned to the scope of the new BaseName. * @throws DuplicateObjectIDException if <code>id</code> specifies and identifier * value already used in the containing TopicMap. * @throws PropertyVetoException if to create a new name for this Topic would * violate a constraint imposed by a VetoableChangeListener assigned to * this TopicMap. * @return a new BaseName object. */ public BaseName createName(String id, String nameString, Topic[] scope) throws DuplicateObjectIDException, PropertyVetoException { return createName(id,nameString,(TopicImpl[]) scope); } protected BaseName createName(String id, String nameString, TopicImpl[] scope) throws DuplicateObjectIDException, PropertyVetoException { return getContainer().unmergedToExternal(getRepresentedObject().createTopicName(nameString,getContainer().convertToInternalScope(scope))); } // Get/Set/Add Occurence /** * Returns the occurrences for this topic and any merged topics. * This function is shorthand for <code>getOccurrences(true)</code>. * * @return A collection of the {@link Occurrence}s for this * topic and for any merged topics. * The returned collection is a copy of the internal set * of occurrences of the topic &mdash { throw new UnsupportedOperationException(); } modifying the * collection has no effect on the occurrence set of the Topic. * If no occurrences are currently defined on this * topic (or merged topics), the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection getOccurrences() { // throw new UnsupportedOperationException(); // FIXME return Collections.emptyList(); } /** * Returns the occurrences for this topic and, if so specified, of any merged topics. * * @param includeMergedTopics if <code>true</code>, then the occurrences of all * merged topics are included in the returned collection. * Otherwise, the collection contains only the occurrences defined * specifically for this topic. * @return A collection of the {@link Occurrence}s for this * topic and for any merged topics. * The returned collection is a copy of the internal set * of occurrences of the topic &mdash { throw new UnsupportedOperationException(); } modifying the * collection has no effect on the occurrence set of the Topic. * If no occurrences are currently defined on this * topic (or merged topics), the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection getOccurrences(boolean includeMergedTopics) { throw new UnsupportedOperationException(); } /** * Sets the list of occurrences for this Topic. * * @param occurs the new set of occurrences to be associated with * this topic. If this is <code>null</code>, * all the existing occurrences of this topic * are removed. * @deprecated Do not use this method (anymore). If you want to remove an occurence from its parent topic, use {Occurence#destroy} instead. Adding an occurence to a topic which is not its former parent is not properly supported and is to be removed. See <a href="https://sourceforge.net/tracker/?func=detail&atid=391879&aid=1704268&group_id=27895">Bug 1704268</a>. */ @Deprecated public void setOccurrences(Occurrence[] occurs) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Adds an occurrence to this Topic. * * @param occurs The Occurrence to be added. * @deprecated Do not use this method (anymore). Adding an occurence to a topic which is not its former parent is not properly supported and is to be removed. See <a href="https://sourceforge.net/tracker/?func=detail&atid=391879&aid=1704268&group_id=27895">Bug 1704268</a>. */ @Deprecated public void addOccurrence(Occurrence occurs) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Creates a new Occurrence as a child of this Topic. * @param id the unique object id to be assigned to the new Occurrence object. If * this parameter is null, the back-end will assign an ID to the * newly created object. * @throws DuplicateObjectIDException if <code>id</code> specifies and identifier * value already used in the containing TopicMap. * @throws PropertyVetoException if to create a new Occurrence for this Topic would * violate a constraint imposed by a VetoableChangeListener assigned to * 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(); } // Get/Set/Add Association /** * Gets the Member objects which define roles played by this topic in associations. The roles * played by all merged topics are also included. This function is shorthand for getRolesPlayed(true). * * @return A Collection of the {@link Member} objects representing roles played by this Topic in Associations. */ public Collection<? extends Member> getRolesPlayed() { Collection<? extends MergedAssociationRole> rolesPlayed = getMergedObject().getRolesPlayed(); assert rolesPlayed!=null; return getContainer().mergedToExternalAssociationRoles(rolesPlayed); } /** * Gets the Member objects which define roles played by this topic in associations. * @param includeMergedTopics If <code>true</code> then the roles played by all merged topics are included in the returned collection. */ public Collection getRolesPlayed(boolean includeMergedTopics) { throw new UnsupportedOperationException(); } // Get/Add Merged Topics /** * Adds the specified topic to the set of merged topics. * @param t the topic to be added to the merge set. */ public void addMergedTopic(Topic t) throws MergedTopicSubjectClashException { throw new UnsupportedOperationException(); } /* protected void removeMergedTopic(Topic mergedTopic) { throw new UnsupportedOperationException() { throw new UnsupportedOperationException(); } } */ /** * Returns a collection of all of the other topics which were merged with this topic * due to identity matches or topic map naming constraints. * * @return An unmodifiable collection of original {@link Topic}s * that were topic merged with this topic. * If no topics were merged with this * topic, the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection getMergedTopics() { throw new UnsupportedOperationException(); } /** * Gets the topic with which this topic is merged if any. * * @return The topic that this topic is merged with, or <code>null</code> * if the topic has not merged with any other. */ public Topic getBaseTopic() { // throw new UnsupportedOperationException(); return this; } /** * Generates a list of all names of the topic, qualified by the * scope of the names and of the topic itself. * Each qualified name is generated as follows:<br /> * <pre> < { throw new UnsupportedOperationException(); }sorted-scope-list> { throw new UnsupportedOperationException(); }.< { throw new UnsupportedOperationException(); }name-string> { throw new UnsupportedOperationException(); }</pre> * Where < { throw new UnsupportedOperationException(); }sorted-scope-list> { throw new UnsupportedOperationException(); } is a list of all themes SGML * identifiers sorted in ascending alphabetical order, with a * period separator between each identifier. * @param includeMergedTopics If <code>true</code>, the scoped names of all * topics merged with this topic are returned. Otherwise, * only the scoped names of this topic are returned. * @return A collection of strings containing the scoped names, * as described above. * If no names are currently defined on this * topic (or merged topics), the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection getScopedNames(boolean includeMergedTopics) { throw new UnsupportedOperationException(); } /** * Generates a list of all names of the topic and all merged topics, * qualified by the scope of the names and of the topic itself. This * is equivalent to <code>getScopedNames(true)</code>. * Each qualified name is generated as follows:<br /> * <pre> < { throw new UnsupportedOperationException(); }sorted-scope-list> { throw new UnsupportedOperationException(); }.< { throw new UnsupportedOperationException(); }name-string> { throw new UnsupportedOperationException(); }</pre> * Where < { throw new UnsupportedOperationException(); }sorted-scope-list> { throw new UnsupportedOperationException(); } is a list of all themes SGML * identifiers sorted in ascending alphabetical order, with a * period separator between each identifier. * * @return A collection of strings containing the scoped names, * as described above. * If no names are currently defined on this * topic (or merged topics), the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection getScopedNames() { throw new UnsupportedOperationException(); } /** * Returns the TopicMap object which contains this Topic object. * * @return The topic map that this topic is contained in. */ public TopicMap getParent() { return getContainer(); } public String toDiagnosticsString() { return "TopicMap@"+Integer.toString(System.identityHashCode(this),16); } public String toString() { // return "TopicMap[getMergedObject()="+getMergedObject()+"]"; return "TopicMap[names="+getNames()+",subjectIndicators="+getSubjectIndicators()+",sourceLocators="+getSourceLocators()+"]@"+Integer.toString(System.identityHashCode(this),16); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: ScopedObjectImpl.java --- package org.tm4j.topicmap.tmdm.tm4j1; import java.util.Set; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.beans.PropertyVetoException; import org.tm4j.net.LocatorFactory; import org.tm4j.net.Locator; import org.tm4j.topicmap.*; import org.tm4j.topicmap.tmdm.ReadableTopicName; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public abstract class ScopedObjectImpl<I extends org.tm4j.topicmap.tmdm.Scopeable,V extends org.tm4j.topicmap.tmdm.ReadableScopeable> extends TopicMapObjectImpl<I,V> implements org.tm4j.topicmap.ScopedObject { protected ScopedObjectImpl(I representedObject,TopicMapImpl container) { super(representedObject,container); } /** * This method should be invoked when the object is no longer needed. * Its implementation should ensure that any contained objects are disposed * and that any external references are cleared out. */ public void dispose() { throw new UnsupportedOperationException(); } /** * Gets the collection of topics which define the scope of validity for this object. * @return a Set of Topic objects. */ public Set getScope() { // throw new UnsupportedOperationException(); // FIXME return Collections.emptySet(); } /** * Sets the collection of topics which define the scope of validity for this object. * The input array will be processed to a set, removing any duplicate Topics. * For the purposes of defining scope, merging will not be considered. So * if topic A and B are two different topics and are in the array scopingTopics * getScope() will return a two element collection, regardless of whether * A and B are merged at the time of addition or merging of the topics happens after * their addition to the collection. * * @param scopingTopics the new set of scoping topics for this object * @throws PropertyVetoException if the update of the scope is vetoed by a listener */ public void setScope(Topic[] scopingTopics) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Adds a topic to the collection which define the scope of validity for this object. * @param theme the scoping topic to be added * @throws PropertyVetoException if the update of the scope is vetoed by a listener */ public void addTheme(Topic theme) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Removes a topic from the collection which defines the scope of validity for this object. * This method has no effect if <code>theme</code> is not a part of the set of * scoping topics for this object. * @param theme the topic to be removed. * @throws PropertyVetoException if the update of the scope is vetoed by a listener */ public void removeTheme(Topic theme) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Determines whether the specified theme is in the scope of this object. * * @return <code>true</code> if the specified theme is in the scope * of this object, <code>false</code> otherwise. */ public boolean inScope(Topic theme) { throw new UnsupportedOperationException(); } /** * Determines whether one or more of the specified themes are in the scope of this object. * * @return <code>true</code> if the one or more of the specified * themes are in the scope of this object, <code>false</code> otherwise. */ public boolean inScope(Topic[] themes) { throw new UnsupportedOperationException(); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: TopicMapFactoryImpl.java --- package org.tm4j.topicmap.tmdm.tm4j1; import java.util.Set; import java.util.Collection; import java.util.Iterator; import java.beans.PropertyVetoException; import org.tm4j.net.LocatorFactory; import org.tm4j.net.LocatorFactoryException; import org.tm4j.topicmap.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class TopicMapFactoryImpl implements org.tm4j.topicmap.TopicMapFactory { protected TopicMapFactoryImpl(TopicMapImpl topicMap) { } /** * Returns a deep copy of <code>src</code> * @see #copy(TopicMap, boolean) */ public TopicMap copy(TopicMap src) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } public Topic copy(Topic src) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } public Association copy(Association src) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } public Member copy(Member src, Association destAssoc) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } public BaseName copy(BaseName src, Topic destTopic) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } public Variant copy(Variant src, VariantContainer destContainer) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } public VariantName copy(VariantName src, Variant destVariant) throws TopicMapProcessingException { throw new UnsupportedOperationException(); } public Occurrence copy(Occurrence src, Topic destTopic) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } /** * Creates a copy of <code>src</code>. * A deep copy of <code>src</code> returns a copy in which * all contained Topics and Associations are also deep copied. * A shallow copy of <code>src</code> returns a TopicMap in * which all contained Topics and Associations are shallow copied. * @see #copy(Topic, boolean) * @see #copy(Association, boolean) */ public TopicMap copy(TopicMap src, boolean deep) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } /** * Creates a copy of <code>src</code>. * A deep copy of <code>src</code> returns a Topic in which * the types and all the child Occurrences and BaseNames * are also deep copied. * A shallow copy of <code>src</code> returns a Topic * which will merge with <code>src</code>. This is * achieved by copying the subject of src, or one * of its subject indicators or one of its BaseNames * If <code>src</code> has none of these characteristics, * a TopicMapProcessingException will be thrown. */ public Topic copy(Topic src, boolean deep) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } /** * Creates a copy of <code>src</code> * A deep copy of <code>src</code> returns an Association in * which the type and all child Members are deep copied. * A shallow copy of <code>src</code> returns an Association * in which the type and child Members are shallow copied. * @see #copy(Topic, boolean) * @see #copy(Member, Association, boolean) */ public Association copy(Association src, boolean deep) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } /** * Creates a copy of <code>src</code> as a new child of <code>destAssoc</code> * A deep copy of <code>src</code> returns a Member in which * the roleSpec and players are all deep copied. * A shallow copy of <code>src</code> returns a Member in which * the roleSpec and the players are shallow copied. * @see #copy(Topic, boolean) */ public Member copy(Member src, Association destAssoc, boolean deep) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } /** * Creates a copy of <code>src</code> as a new child of <code>destTopic</code> * A deep copy of <code>src</code> returns a BaseName in which * the name string is a duplicate of the name string of src * and the child Variants are deep copied. * A shallow copy of <code>src</code> returns a BaseName in which * the name string is a reference to the name string of src * and the child Variants are shallow copied. */ public BaseName copy(BaseName src, Topic destTopic, boolean deep) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } /** * Creates a copy of <code>src</code> * A deep copy of <code>src</code> returns a Variant in which * the child VariantName and Variant objects are deep copied. * A shallow copy of <code>src</code> returns a Variant in which * the child VariantName and Variant objects are shallow copied. */ public Variant copy(Variant src, VariantContainer destContainer, boolean deep) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } /** * Creates a copy of <code>src</code> as a new child of <code>destVariant</code> * A deep copy of <code>src</code> returns a VariantName in which * the child resourceRef or resourceData is a duplicate of the * value in the source object. * A shallow copy of <code>src</code> returns a VariantName in * which the child resourceRef or resourceData is a reference to the * value in the source object. */ public VariantName copy(VariantName src, Variant destVariant, boolean deep) throws TopicMapProcessingException { throw new UnsupportedOperationException(); } /** * Creates a copy of <code>src</code> as a new child of <code>destTopic</code> * A deep copy of <code>src</code> returns an Occurrence in which * the type topic is deep copied and the child resourceRef or * resourceData is a duplicate of the value * in the source object. * A shallow copy of <code>src</code> returns an Occurrence in * which the type topic is shallow copied and * the child resourceRef or resourceData is a reference to the * value in the source object. * @see #copy(Topic, boolean) */ public Occurrence copy(Occurrence src, Topic destTopic, boolean deep) throws TopicMapProcessingException, LocatorFactoryException { throw new UnsupportedOperationException(); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MemberImpl.java --- package org.tm4j.topicmap.tmdm.tm4j1; import java.util.Set; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.beans.PropertyVetoException; import org.tm4j.net.LocatorFactory; import org.tm4j.net.Locator; import org.tm4j.topicmap.*; import org.tm4j.topicmap.tmdm.ReadableTopic; import org.tm4j.topicmap.tmdm.ReadableAssociationRole; import org.tm4j.topicmap.tmdm.ReadableTopicMap; import org.tm4j.topicmap.tmdm.ReadableTopicMapConstruct; import org.tm4j.topicmap.tmdm.merged.MergedTopicMapView; import com.mn.util.diag.syslog.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MemberImpl extends ScopedObjectImpl<org.tm4j.topicmap.tmdm.AssociationRole,org.tm4j.topicmap.tmdm.ReadableAssociationRole> implements org.tm4j.topicmap.Member { protected MemberImpl(org.tm4j.topicmap.tmdm.AssociationRole representedObject,TopicMapImpl container) { super(representedObject,container); } protected ReadableAssociationRole getMergedObject() { return getContainer().getMergedTopicMapView().getMergedAssociationRole(getRepresentedObject()); } /** * Returns the association to which the Member belongs. * * @return The member's parent association, or <code>null</code> * if the member is currently not part of any association. */ public Association getParent() { throw new UnsupportedOperationException(); } /* * Sets the association to which the Member belongs. * If the Member is already part of another Association, * then invoking this method will implicitly remove * the Member from its existing Association parent.<br/> * Applications should not use this method directly. * It is invoked by {@link Association#addMember(Member)} * and {@link Association#setMembers(Member[])}. * * @param parent the association to be used as the new * parent of this member. * @deprecated from 0.8.0 this method is no longer supported. Call {@link Association#addMember(Member)} * or {@link Association#setMembers(Member[])} to assign a Member to an Association. * public void setParent(Association parent) throws PropertyVetoException { throw new UnsupportedOperationException(); } */ /** * Returns the topic which defines the type of this * Member. * * @return The role-defining topic of this member. */ public Topic getRoleSpec() { assert getRepresentedObject().getType()!=null; // Syslog.log(this,Syslog.DEBUG4,"getRoleSpec()=="+getContainer().unmergedToExternal(getRepresentedObject().getType())+"."); return getContainer().unmergedToExternal(getRepresentedObject().getType()); } /** * Sets the topic which defines the type of this Member. * If the Member already has a type defined, then the * existing type is replaced by the new one. * * @param roleSpec the new role-defining topic of this member. */ public void setRoleSpec(Topic roleSpec) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Adds a topic as a player, meaning one of the topics * that define this member. * A topic may be a player in multiple Members of * multiple Associations. * * @param player the topic to be added to the set of topics * that define this member. */ public void addPlayer(Topic player) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Removes the specified topic from the * list of players of this Member object. * If the specified Topic is not in the list of * players for this Member object, then this method has * no effect. * * @param player the topic to be removed from the set of topics * that define this member. */ public void removePlayer(Topic player) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Returns an unmodifiable collection of the Topics * which are players of this Member. * * @return The collection of {@link Topic}s that define * this member. * If no players are currently defined for this * member, the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection<? extends Topic> getPlayers() { return Collections.singleton(getContainer().unmergedToExternal(getRepresentedObject().getPlayer())); } /** * Sets the collection of Topics which are players of * this Member. The specified array replaces all the * existing players of this Member. * * @param players the new set of topics to define * this member. If this is <code>null</code>, * all the existing players of this member * are removed. */ public void setPlayers(Topic[] players) throws PropertyVetoException { throw new UnsupportedOperationException(); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: package.jdo --- <?xml version="1.0"?> <!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd"> <jdo> <package name="org.tm4j.topicmap.tmdm.tm4j1"> <class name="AssociationImpl" /> <class name="BaseNameImpl" /> <class name="MemberImpl" /> <class name="ScopedObjectImpl" /> <class name="TopicImpl" /> <class name="TopicMapFactoryImpl" /> <class name="TopicMapImpl"> <field persistence-modifier="persistent" name="topicMapUtils" /> <field persistence-modifier="persistent" name="type" /> <field persistence-modifier="persistent" name="instance" /> <field persistence-modifier="persistent" field-type="org.tm4j.topicmap.tmdm.tm4j1.TopicImpl" name="type_instance" /> <field persistence-modifier="persistent" name="nullAssociationType" /> <field persistence-modifier="persistent" name="topicMapProvider" /> <!-- <field persistence-modifier="persistent" name="topicMapFactory" /> --> <field persistence-modifier="persistent" name="mergedTopicMapView" /> </class> <class name="TopicMapObjectImpl"> <field persistence-modifier="persistent" name="representedObject" /> <field persistence-modifier="persistent" name="container" /> </class> <class name="TopicMapProviderFactoryImpl" /> <class name="TopicMapProviderImpl"> <field name="storedTopicMaps" field-type="com.mn.util.data.persistent.jdo.java.util.HashMap" persistence-modifier="persistent" > <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field persistence-modifier="persistent" name="collectionsFactory" field-type="com.mn.util.data.persistent.jdo.java.util.JDOJavaUtilCollectionsFactory" /> <!-- <field persistence-modifier="persistent" name="locatorFactory" field-type="org.tm4j.topicmap.tmdm.jdo.JDOLocatorFactoryImpl" /> --> <!-- Warning, this will make stock JPOX not persist anything..? --> <field persistence-modifier="persistent" name="locatorFactory" field-type="javax.jdo.spi.PersistenceCapable" /> <field persistence-modifier="persistent" name="properties" /> <!-- <field name="storedTopicMaps" field-type="com.mn.util.data.persistent.jdo.java.util.HashMap" persistence-modifier="persistent" default-fetch-group="true"> <map key-type="org.tm4j.net.Locator" value-type="org.tm4j.topicmap.tmdm.tm4j1.TopicMapImpl" embedded-key="false" embedded-value="false" /> </field> --> </class> <class name="TopicMapUtilsImpl"> <field persistence-modifier="persistent" name="idGenerator" field-type="org.tm4j.topicmap.utils.IDGeneratorImpl" /> </class> </package> </jdo> --- NEW FILE: BaseNameImpl.java --- package org.tm4j.topicmap.tmdm.tm4j1; import java.util.Set; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.beans.PropertyVetoException; import org.tm4j.net.LocatorFactory; import org.tm4j.net.Locator; import org.tm4j.topicmap.*; import org.tm4j.topicmap.tmdm.ReadableTopicName; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class BaseNameImpl extends ScopedObjectImpl<org.tm4j.topicmap.tmdm.TopicName,org.tm4j.topicmap.tmdm.ReadableTopicName> implements org.tm4j.topicmap.BaseName { protected BaseNameImpl(org.tm4j.topicmap.tmdm.TopicName representedObject,TopicMapImpl container) { super(representedObject,container); } protected ReadableTopicName getMergedObject() { return getContainer().getMergedTopicMapView().getMergedTopicName(getRepresentedObject()); } /** * Returns the data string for this name. * * @return The data string. */ public String getData() { return getRepresentedObject().getValue(); } /** * Sets the data string for this name. * * @param data the new data string. * @throws PropertyVetoException If a listener vetos the update */ public void setData(String data) throws PropertyVetoException { getRepresentedObject().setValue(data); } /** * Returns the Topic object which contains this BaseName. * * @return This BaseName's parent object. Since XTM * allows BaseNames only to be contained * within Topics, this must always be an * object of a class which implements {@link Topic}. */ public Topic getParent() { return getContainer().unmergedToExternal(getRepresentedObject().getParent()); } /** * Returns the child Variants as an unmodifiable * collection of {@link Variant} objects. Note that this method will not * descend any nesting of variants inside variants, * but will instead only return the immediate child variants * of this <code>VariantContainer</code>. * * @return The collection of direct child {@link Variant}s. * If no child variants are currently defined on this * object, the returned collection is empty { throw new UnsupportedOperationException(); } * it is never <code>null</code>. */ public Collection getVariants() { // throw new UnsupportedOperationException(); // FIXME return Collections.emptyList(); } /** * Sets the child variants of this object. All existing * child variants are previously removed. * * @param variants the new set of child variants this object * contains. If this is <code>null</code>, * all the existing variants contained * in this object are removed. */ public void setVariants(Variant[] variants) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Adds a new child variant to this object. * * @param variant the new child {@link Variant}. */ public void addVariant(Variant variant) throws PropertyVetoException { throw new UnsupportedOperationException(); } /** * Creates a new child variant of this object. * @param id the unique identifier to be assigned to the newly created * Variant. If null is passed in, then the backend will * generate a unique identifier for the new Variant. * @throws DuplicateObjectIDException if <code>id</code> specifies and identifier * value already used in the containing TopicMap. * @throws PropertyVetoException if to create a new Variant for this object would * violate a constraint imposed by a VetoableChangeListener assigned to * the containing TopicMap. * @return the newly created Variant. The new Variant has no data or dataLocator * set and no parameters specified. */ public Variant createVariant(String id) throws DuplicateObjectIDException, PropertyVetoException { throw new UnsupportedOperationException(); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: TopicMapProviderImpl.java --- package org.tm4j.topicmap.tmdm.tm4j1; import java.util.Properties; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.HashMap; import java.util.Set; import java.util.HashSet; import java.util.Arrays; import java.util.Iterator; import java.io.InputStream; import org.tm4j.net.LocatorFactory; import org.tm4j.net.Locator; import org.tm4j.topicmap.*; import org.tm4j.topicmap.TopicMapProvider; import org.tm4j.topicmap.TopicMapProviderException; import org.tm4j.topicmap.TopicMapProviderBase; import org.tm4j.topicmap.ProviderTransaction; import org.tm4j.topicmap.tmdm.NestedTransactionManaging; import org.tm4j.topicmap.utils.TopicMapBuilder; import org.tm4j.topicmap.utils.LTMBuilder; import org.tm4j.topicmap.utils.XTMBuilder; import org.tm4j.topicmap.source.TopicMapSourceSupport; import org.tm4j.topicmap.utils.BuilderPropertyInvalidException; import org.tm4j.topicmap.utils.BuilderPropertyNotRecognizedException; import org.tm4j.net.memory.LocatorFactoryImpl; import org.tm4j.topicmap.tmdm.jdo.*; import com.mn.util.diag.syslog.*; import com.mn.util.data.CollectionsFactory; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class TopicMapProviderImpl /* extends TopicMapProviderBase */ extends TopicMapSourceSupport implements TopicMapProvider,NestedTransactionManaging { protected transient TopicMapProviderFactoryImpl factory; protected CollectionsFactory collectionsFactory; protected LocatorFactory locatorFactory; protected Map<Locator,TopicMapImpl> storedTopicMaps; int count; protected static boolean verbose = false; protected Properties properties; protected TopicMapProviderImpl() throws TopicMapProviderException { } protected TopicMapProviderImpl(TopicMapProviderFactoryImpl factory,Properties props,CollectionsFactory collectionsFactory) throws TopicMapProviderException { this.factory = factory; this.collectionsFactory = collectionsFactory; init(props); this.storedTopicMaps = collectionsFactory.createHashMap(); } protected TopicMapProviderFactoryImpl getFactory() { return factory; } public org.tm4j.topicmap.TopicMap getTopicMap(Locator baseLocator) { // throw new UnsupportedOperationException(); // FIXME return null; } public org.tm4j.topicmap.TopicMap createTopicMap(Locator baseLocator) { // Syslog.log(this,Syslog.DEBUG4,"createTopicMap("+baseLocator+")."); nestedTransactionBegin(); // Syslog.log(this,Syslog.DEBUG4,"createTopicMap("+baseLocator+"): this="+JDOUtil.toStringPart(this)); // Syslog.log(this,Syslog.DEBUG4,"createTopicMap("+baseLocator+"): this="+JDOUtil.toStringPart(this)+", result="+result+"."); try { TopicMapImpl topicMap = new TopicMapImpl(this,baseLocator,collectionsFactory); // add this TopicMapImpl to database? assert storedTopicMaps!=null; // makePersistent(baseLocator); TopicMapImpl oldTopicMap = storedTopicMaps.put(baseLocator,topicMap); storedTopicMaps = storedTopicMaps; count++; /* TopicMapProviderImpl result = (TopicMapProviderImpl) (((JDOTransactionManager) (((JDOTopicMapProviderImpl) this).getTransactionManager())).getPersistenceManager().makePersistent(this)); ((JDOTransactionManager) (((JDOTopicMapProviderImpl) this).getTransactionManager())).getPersistenceManager().makePersistent(topicMap); // should not be necessary */ count++; assert oldTopicMap==null; nestedTransactionSuccess(); return topicMap; } finally { nestedTransactionEnd(); } } public LocatorFactory getLocatorFactory() { if (locatorFactory==null) { locatorFactory = new LocatorFactoryImpl(); } return locatorFactory; } public Collection<org.tm4j.net.Locator> getTopicMapBaseLocators() { // FIXME: return Collections.emptyList(); // throw new UnsupportedOperationException(); } public void removeTopicMap(org.tm4j.topicmap.TopicMap topicMap) { throw new UnsupportedOperationException(); } public void close() { } /** Called when a transaction may begin, if it has not already begun. The idea is: nestedTransactionBegin(); try { // do work nestedTransactionSuccess(); } finally { nestedTransactionEnd(); } */ public void nestedTransactionBegin() { // no operation in this implementation } /** Called when the transaction-part at this nesting level was successful. */ public void nestedTransactionSuccess() { // no operation in this implementation } /** Called in every case when leaving a transaction-nesting level. If called after nestTransactionSuccess(), the current sub-transaction is considered to be successful. If called after nestTransactionBegin() or after nestTransactionEnd(), the current sub-transaction is considered to be not successful. */ public void nestedTransactionEnd() { // no operation in this implementation } public void makePersistent(Object o) { // no operation in this implementation } //@Override public boolean isTransactional() { return false; } //@Override public ProviderTransaction openTransaction() { throw new UnsupportedOperationException(); } //@Override public boolean isTransactionOpen() { return false; } //@Override public ProviderTransaction getOpenTransaction() { return null; } public void init(Properties props) throws TopicMapProviderException { this.properties = properties; // ignore... } /** * A convenience method returning the added TopicMap. See * {@link #addTopicMap(InputStream,Locator,TopicMap,Topic[],TopicMapBuilder) }. */ public TopicMap addTopicMap(InputStream srcStream, Locator baseLocator) throws TopicMapProviderException { return addTopicMap(srcStream, baseLocator, null, null, null); } /** * A convenience method returning the added TopicMap. See * {@link #addTopicMap(InputStream,Locator,TopicMap,Topic[],TopicMapBuilder) }. * @deprecated from 0.9.0 use {@link #addTopicMap(TopicMapSource)} */ public TopicMap addTopicMap(InputStream srcStream, Locator baseLocator, TopicMap existingTopicMap) throws TopicMapProviderException { return addTopicMap(srcStream, baseLocator, existingTopicMap, null, null); } /** * A convenience method returning the added TopicMap. See * {@link #addTopicMap(InputStream,Locator,TopicMap,Topic[],TopicMapBuilder) }. * @deprecated from 0.9.0 use {@link #addTopicMap(TopicMapSource, TopicMap)} */ public TopicMap addTopicMap(InputStream srcStre... [truncated message content] |
From: Xuan B. <med...@us...> - 2008-01-21 11:13:44
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/net/memory In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27256/src/org/tm4j/net/memory Added Files: package.jdo Log Message: This change introduces the new TMDM (re-)implementation towards TM4J 2.0. It consists of about 430KB, 9900 lines of code. It is written by Xuan Baldauf and depends on the package baldauf-common. --- NEW FILE: package.jdo --- <?xml version="1.0"?> <!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd"> <jdo> <package name="org.tm4j.net.memory"> <class name="LocatorFactoryImpl" /> <class name="URILocatorImpl" /> </package> </jdo> |
From: Xuan B. <med...@us...> - 2008-01-21 11:13:44
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/jdo In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27256/src/org/tm4j/topicmap/tmdm/jdo Added Files: JDOLocatorFactoryImpl.java JDOTopicMapProviderFactoryImpl.java JDOTopicMapProviderImpl.java JDOTransactionManager.java JDOUtil.java package.jdo Log Message: This change introduces the new TMDM (re-)implementation towards TM4J 2.0. It consists of about 430KB, 9900 lines of code. It is written by Xuan Baldauf and depends on the package baldauf-common. --- NEW FILE: JDOTransactionManager.java --- package org.tm4j.topicmap.tmdm.jdo; import java.util.Properties; import javax.jdo.*; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapProviderImpl; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapProviderFactoryImpl; import org.tm4j.topicmap.TopicMapProvider; import org.tm4j.topicmap.TopicMapProviderException; import org.tm4j.topicmap.TopicMapProviderFactory; import org.tm4j.topicmap.ProviderTransaction; import org.tm4j.topicmap.ProviderTransactionException; import org.tm4j.topicmap.tmdm.NestedTransactionManaging; import org.tm4j.topicmap.tmdm.NestedTransactionManager; import com.db4o.ObjectContainer; import com.mn.util.data.persistent.db4o.util.ObjectContainerCatcher; import com.mn.util.diag.syslog.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class JDOTransactionManager implements NestedTransactionManaging,NestedTransactionManager { protected transient PersistenceManagerFactory persistenceManagerFactory; protected transient PersistenceManager persistenceManager; protected transient Transaction currentTransaction; protected transient boolean closed; protected transient int nestLevel = 0; protected transient boolean lastNestedTransactionCallWasANestedTransactionSuccessCall = false; protected transient boolean failureDuringNestedTransaction; /** Only for debug. Should be false by default. */ protected final static boolean commitAnyways = false; protected JDOTransactionManager() { Syslog.log(this,Syslog.DEBUG4,"<init>(): persistenceManagerFactory="+persistenceManagerFactory+", persistenceManager="+persistenceManager+".", new Exception()); } protected JDOTransactionManager(Properties props) { persistenceManagerFactory = JDOHelper.getPersistenceManagerFactory(props); persistenceManager = persistenceManagerFactory.getPersistenceManager(); Syslog.log(this,Syslog.DEBUG4,"<init>(,): persistenceManagerFactory="+persistenceManagerFactory+", persistenceManager="+persistenceManager+"."); /* nestedTransactionBegin(); try { // do work persistenceManager.makePersistent(storedTopicMaps); nestedTransactionSuccess(); } finally { nestedTransactionEnd(); } */ } /** only for debug (now not only) */ public PersistenceManager getPersistenceManager() { return persistenceManager; } public void beginTransaction() { assert currentTransaction==null; // persistenceManager = persistenceManagerFactory.getPersistenceManager(); currentTransaction = persistenceManager.currentTransaction(); currentTransaction.setOptimistic(false); // FIXME: for testing only currentTransaction.begin(); Syslog.log(this,Syslog.DEBUG4,"beginTransaction()."); } public void commitTransaction() { assert currentTransaction!=null; assert currentTransaction.isActive(); Syslog.log(this,Syslog.DEBUG4,"commitTransaction()."); try { currentTransaction.commit(); } finally { currentTransaction = null; } assert nestLevel==0; // persistenceManager.close(); } public void rollbackTransaction() { assert currentTransaction!=null; try { if (currentTransaction.isActive()) { if (!commitAnyways) { Syslog.log(this,Syslog.DEBUG4,"rollbackTransaction().",new Exception()); currentTransaction.rollback(); } else { commitTransaction(); } } } finally { currentTransaction = null; } assert nestLevel==0; } public void close() { if (!closed) { closed = true; Syslog.log(this,Syslog.DEBUG4,"close().",new Exception()); persistenceManager.close(); } } public boolean isTransactionOpen() { if (true) { assert !((currentTransaction==null)^(nestLevel==0)) : "currentTransaction=="+currentTransaction+" while nestLevel=="+nestLevel+"."; return currentTransaction!=null; } else { return (currentTransaction!=null)&&(nestLevel!=0); } } //@Override public void nestedTransactionBegin() { lastNestedTransactionCallWasANestedTransactionSuccessCall = false; if (nestLevel==0) { failureDuringNestedTransaction = false; beginTransaction(); } nestLevel++; } public void nestedTransactionSuccessAndEnd() { nestedTransactionSuccess(); nestedTransactionEnd(); } public void nestedTransactionNoSuccessAndEnd() { nestedTransactionEnd(); } //@Override public void nestedTransactionSuccess() { lastNestedTransactionCallWasANestedTransactionSuccessCall = true; } //@Override public void nestedTransactionEnd() { if (!lastNestedTransactionCallWasANestedTransactionSuccessCall) { failureDuringNestedTransaction = true; } lastNestedTransactionCallWasANestedTransactionSuccessCall = false; nestLevel--; assert nestLevel>=0; if (nestLevel==0) { if (!failureDuringNestedTransaction) { commitTransaction(); } else { rollbackTransaction(); } assert currentTransaction==null; } // no operation in this implementation } public Object makePersistent(Object o) { return persistenceManager.makePersistent(o); } protected void finalize() { if (!closed) { close(); } } protected ObjectContainer getDB4OObjectContainer() { ObjectContainerCatcher catcher = new ObjectContainerCatcher(); nestedTransactionBegin(); ObjectContainer objectContainer; try { persistenceManager.makePersistent(catcher.getDummy()); // assert catcher.getObjectContainer()!=null; nestedTransactionSuccess(); } finally { nestedTransactionEnd(); } objectContainer = catcher.getObjectContainer(); // assert objectContainer!=null; nestedTransactionBegin(); try { persistenceManager.deletePersistent(catcher.getDummy()); nestedTransactionSuccess(); } finally { nestedTransactionEnd(); } return objectContainer; } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: package.jdo --- <?xml version="1.0"?> <!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd"> <jdo> <package name="org.tm4j.topicmap.tmdm.jdo"> <class name="JDOTopicMapProviderImpl"> </class> <class name="JDOLocatorFactoryImpl"> </class> </package> </jdo> --- NEW FILE: JDOUtil.java --- package org.tm4j.topicmap.tmdm.jdo; import java.util.Properties; import javax.jdo.*; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapImpl; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapProviderImpl; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapProviderFactoryImpl; import org.tm4j.topicmap.tmdm.NestedTransactionManager; import org.tm4j.topicmap.TopicMapProvider; import org.tm4j.topicmap.TopicMapProviderException; import org.tm4j.topicmap.TopicMapProviderFactory; import org.tm4j.topicmap.ProviderTransaction; import org.tm4j.topicmap.ProviderTransactionException; import com.mn.util.diag.syslog.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class JDOUtil { public static String toStringPart(Object jdoObject) { return "isDirty="+JDOHelper.isDirty(jdoObject)+",isNew="+JDOHelper.isNew(jdoObject)+",isDetached="+JDOHelper.isDetached(jdoObject)+",isPersistent="+JDOHelper.isPersistent(jdoObject)+",isTransactional="+JDOHelper.isTransactional(jdoObject)+",isDeleted="+JDOHelper.isDeleted(jdoObject)+",objectID="+JDOHelper.getObjectId(jdoObject)+", persistenceManager="+JDOHelper.getPersistenceManager(jdoObject); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: JDOLocatorFactoryImpl.java --- package org.tm4j.topicmap.tmdm.jdo; import java.util.Properties; import javax.jdo.*; import org.tm4j.net.Locator; import org.tm4j.net.LocatorFactoryException; import org.tm4j.net.memory.LocatorFactoryImpl; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapImpl; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapProviderImpl; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapProviderFactoryImpl; import org.tm4j.topicmap.tmdm.NestedTransactionManager; import org.tm4j.topicmap.TopicMapProvider; import org.tm4j.topicmap.TopicMapProviderException; import org.tm4j.topicmap.TopicMapProviderFactory; import org.tm4j.topicmap.ProviderTransaction; import org.tm4j.topicmap.ProviderTransactionException; import com.mn.util.diag.syslog.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class JDOLocatorFactoryImpl extends LocatorFactoryImpl { protected JDOTopicMapProviderImpl topicMapProvider; protected JDOLocatorFactoryImpl(JDOTopicMapProviderImpl topicMapProvider) { this.topicMapProvider = topicMapProvider; } protected JDOTopicMapProviderImpl getTopicMapProvider() { return topicMapProvider; } public Locator createLocator(String notation, String address) throws LocatorFactoryException { if (true) { return super.createLocator(notation,address); } else { getTopicMapProvider().nestedTransactionBegin(); try { Locator result = super.createLocator(notation,address); assert result!=null; getTopicMapProvider().makePersistent(result); getTopicMapProvider().nestedTransactionSuccess(); return result; } finally { getTopicMapProvider().nestedTransactionEnd(); } } } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: JDOTopicMapProviderFactoryImpl.java --- package org.tm4j.topicmap.tmdm.jdo; import java.util.Properties; import javax.jdo.*; import org.tm4j.net.LocatorFactoryException; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapProviderImpl; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapProviderFactoryImpl; import org.tm4j.topicmap.TopicMapProvider; import org.tm4j.topicmap.TopicMapProviderException; import org.tm4j.topicmap.TopicMapProviderFactory; import org.tm4j.topicmap.ProviderTransaction; import com.db4o.ObjectContainer; import com.mn.util.diag.syslog.*; import com.mn.util.data.CollectionsFactory; import com.mn.util.data.persistent.jdo.customized.java.util.JDOJavaUtilCollectionsFactory; import com.mn.util.data.persistent.db4o.util.JDODB4OJavaUtilCollectionsFactory; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class JDOTopicMapProviderFactoryImpl extends TopicMapProviderFactoryImpl { public JDOTopicMapProviderFactoryImpl() { } public JDOTopicMapProviderImpl newTopicMapProvider(Properties props) throws TopicMapProviderException { JDOTransactionManager transactionManager = new JDOTransactionManager(props); // ObjectContainer objectContainer = transactionManager.getDB4OObjectContainer(); transactionManager.nestedTransactionBegin(); JDOTopicMapProviderImpl result0; try { result0 = new JDOTopicMapProviderImpl(this,props,JDODB4OJavaUtilCollectionsFactory.createFactory(transactionManager.getPersistenceManager()),transactionManager); // result0 = new JDOTopicMapProviderImpl(this,props,JDOJavaUtilCollectionsFactory.getDefault(),transactionManager); JDOTopicMapProviderImpl result1 = null; Object identity = null; Syslog.log(this,Syslog.DEBUG4,"newTopicMapProvider(): result0="+JDOUtil.toStringPart(result0)); // result.transactionManager = transactionManager; Syslog.log(this,Syslog.DEBUG4,"newTopicMapProvider(): result0="+JDOUtil.toStringPart(result0)); Syslog.log(this,Syslog.DEBUG4,"newTopicMapProvider(): result1="+JDOUtil.toStringPart(result1)); result1 = (JDOTopicMapProviderImpl) transactionManager.makePersistent(result0); identity = transactionManager.getPersistenceManager().getObjectId(result0); Syslog.log(this,Syslog.DEBUG4,"newTopicMapProvider(): (result0==result1)="+(result0==result1)+"."); Syslog.log(this,Syslog.DEBUG4,"newTopicMapProvider(): result0="+JDOUtil.toStringPart(result0)); Syslog.log(this,Syslog.DEBUG4,"newTopicMapProvider(): result1="+JDOUtil.toStringPart(result1)); /* try { result0.createTopicMap(result0.getLocatorFactory().createLocator("URI","http://test.test/test1/")); } catch (LocatorFactoryException e) { Syslog.caught(this,e); } */ transactionManager.nestedTransactionSuccess(); return result1; } finally { // transactionManager.persistenceManager.makePersistent(result0); transactionManager.nestedTransactionEnd(); /* try { result0 = (JDOTopicMapProviderImpl) transactionManager.getPersistenceManager().getObjectById(identity); Syslog.log(this,Syslog.DEBUG4,"newTopicMapProvider(): (result0==result1)="+(result0==result1)+"."); result0.createTopicMap(result0.getLocatorFactory().createLocator("URI","http://test.test/test2/")); } catch (LocatorFactoryException e) { Syslog.caught(this,e); } */ } } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: JDOTopicMapProviderImpl.java --- package org.tm4j.topicmap.tmdm.jdo; import java.util.Properties; import javax.jdo.*; import org.tm4j.net.Locator; import org.tm4j.net.LocatorFactory; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapImpl; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapProviderImpl; import org.tm4j.topicmap.tmdm.tm4j1.TopicMapProviderFactoryImpl; import org.tm4j.topicmap.tmdm.NestedTransactionManager; import org.tm4j.topicmap.TopicMapProvider; import org.tm4j.topicmap.TopicMapProviderException; import org.tm4j.topicmap.TopicMapProviderFactory; import org.tm4j.topicmap.ProviderTransaction; import org.tm4j.topicmap.ProviderTransactionException; import com.mn.util.diag.syslog.*; import com.mn.util.data.CollectionsFactory; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class JDOTopicMapProviderImpl extends TopicMapProviderImpl implements ProviderTransaction { protected transient NestedTransactionManager transactionManager; protected transient boolean closed; protected final static boolean commitAnyways = true; protected JDOTopicMapProviderImpl() throws TopicMapProviderException { Syslog.log(this,Syslog.DEBUG4,"<init>()."); } protected JDOTopicMapProviderImpl(JDOTopicMapProviderFactoryImpl factory,Properties props,CollectionsFactory collectionsFactory,NestedTransactionManager transactionManager) throws TopicMapProviderException { super(factory,props,collectionsFactory); this.transactionManager = transactionManager; } /** Only for debug */ public NestedTransactionManager getTransactionManager() { return transactionManager; } public LocatorFactory getLocatorFactory() { if (locatorFactory==null) { locatorFactory = new JDOLocatorFactoryImpl(this); } return locatorFactory; } public org.tm4j.topicmap.TopicMap createTopicMap(Locator baseLocator) { // Syslog.log(this,Syslog.DEBUG4,"createTopicMap("+baseLocator+"): this="+JDOUtil.toStringPart(this)); return super.createTopicMap(baseLocator); } /* public org.tm4j.topicmap.TopicMap createTopicMap(Locator baseLocator) { Syslog.log(this,Syslog.DEBUG4,"createTopicMap("+baseLocator+")."); nestedTransactionBegin(); try { TopicMapImpl topicMap = new TopicMapImpl(this,baseLocator); // add this TopicMapImpl to database? TopicMapImpl oldTopicMap = storedTopicMaps.put(baseLocator,topicMap); assert oldTopicMap==null; topicMap = (TopicMapImpl) ((JDOTransactionManager) transactionManager).persistenceManager.makePersistent(topicMap); lastStoredMap = topicMap; nestedTransactionSuccess(); return topicMap; } finally { nestedTransactionEnd(); } } */ public void close() { if (!closed) { closed = true; Syslog.log(this,Syslog.DEBUG4,"close().",new Exception()); transactionManager.close(); } super.close(); } @Override public void nestedTransactionBegin() { transactionManager.nestedTransactionBegin(); } public void nestedTransactionSuccessAndEnd() { transactionManager.nestedTransactionSuccessAndEnd(); } public void nestedTransactionNoSuccessAndEnd() { if (!commitAnyways) { transactionManager.nestedTransactionNoSuccessAndEnd(); } else { transactionManager.nestedTransactionSuccessAndEnd(); } } public void nestedTransactionSuccess() { transactionManager.nestedTransactionSuccess(); } @Override public void nestedTransactionEnd() { transactionManager.nestedTransactionEnd(); } public void makePersistent(Object o) { transactionManager.makePersistent(o); // no operation in this implementation } @Override public boolean isTransactional() { return true; } @Override public ProviderTransaction openTransaction() { nestedTransactionBegin(); return this; } @Override public boolean isTransactionOpen() { return transactionManager.isTransactionOpen(); } @Override public ProviderTransaction getOpenTransaction() { return this; } /** * Determine if this transaction is currently open * @return true if the transaction is open, false otherwise * @throws ProviderTransactionException */ //@Override public boolean isOpen() throws ProviderTransactionException { return isTransactionOpen(); } /** * Rollback the transaction, discarding any changes made while it was open. * @throws ProviderTransactionException */ //@Override public void rollback() throws ProviderTransactionException { nestedTransactionNoSuccessAndEnd(); } /** * Commit the transaction and any changes made while it was open. * @throws ProviderTransactionException */ //@Override public void commit() throws ProviderTransactionException { nestedTransactionSuccessAndEnd(); } //@Override public void abort() throws ProviderTransactionException { // What is the meaning of this call compared to rollback()? // Should we call rollbackTransaction();? // throw new UnsupportedOperationException(); rollback(); } /* protected void finalize() { if (!closed) { close(); } } */ } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: |
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/merged In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27256/src/org/tm4j/topicmap/tmdm/merged Added Files: MergedAssociation.java MergedAssociationKey.java MergedAssociationRole.java MergedAssociationRoleKey.java MergedOccurence.java MergedOccurenceKey.java MergedReifiable.java MergedScope.java MergedScopeKey.java MergedScopeable.java MergedScopeableKey.java MergedTopic.java MergedTopicMap.java MergedTopicMapConstruct.java MergedTopicMapView.java MergedTopicName.java MergedTopicNameKey.java MergedVariant.java notes.txt package.jdo Log Message: This change introduces the new TMDM (re-)implementation towards TM4J 2.0. It consists of about 430KB, 9900 lines of code. It is written by Xuan Baldauf and depends on the package baldauf-common. --- NEW FILE: MergedTopic.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.Collections; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; import com.mn.util.data.*; import com.mn.util.diag.syslog.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedTopic extends MergedTopicMapConstruct<ReadableTopic> implements ReadableTopic { protected MergedTopicMap parent; protected Set<MergedAssociation> usedAsAssociationType; protected Set<MergedAssociationRole> usedAsAssociationRoleType; protected Set<MergedAssociationRole> usedAsAssociationRolePlayer; protected Set<MergedTopicName> usedAsTopicNameParent; /** @param components the components collection to be used here. It may be prefilled. It is used directly, not copied. This may be good for efficiently, but it must made sure that nobody else is using this collection. */ protected MergedTopic(MergedTopicMap parent,Collection<ReadableTopic> components) { super(parent.getContainer(),components); this.parent = parent; // Syslog.log(this,Syslog.DEBUG5,"<init>().",new Exception()); } protected MergedTopic(MergedTopicMap parent,ReadableTopic firstComponent) { super(parent.getContainer(),firstComponent); this.parent = parent; // Syslog.log(this,Syslog.DEBUG5,"<init>().",new Exception()); } /** so far only used for assertions. */ protected boolean containsSubjectIdentifierOrItemIdentifier(Locator subjectIdentifierOrItemIdentifier) { return containsSubjectIdentifier(subjectIdentifierOrItemIdentifier)||containsItemIdentifier(subjectIdentifierOrItemIdentifier); } protected void addUsedAsAssociationType(MergedAssociation user) { if (usedAsAssociationType==null) { usedAsAssociationType = getContainer().createIdentitySet(); } boolean success = usedAsAssociationType.add(user); assert success; } protected void removeUsedAsAssociationType(MergedAssociation user) { assert usedAsAssociationType!=null; boolean success = usedAsAssociationType.remove(user); assert success; } protected Set<MergedAssociation> getUsedAsAssociationType() { return usedAsAssociationType; } protected void addUsedAsAssociationRoleType(MergedAssociationRole user) { if (usedAsAssociationRoleType==null) { usedAsAssociationRoleType = getContainer().createIdentitySet(); } boolean success = usedAsAssociationRoleType.add(user); assert success; } protected void removeUsedAsAssociationRoleType(MergedAssociationRole user) { assert usedAsAssociationRoleType!=null; boolean success = usedAsAssociationRoleType.remove(user); assert success; } protected Set<MergedAssociationRole> getUsedAsAssociationRoleType() { return usedAsAssociationRoleType; } protected void addUsedAsAssociationRolePlayer(MergedAssociationRole user) { if (usedAsAssociationRolePlayer==null) { usedAsAssociationRolePlayer = getContainer().createIdentitySet(); } boolean success = usedAsAssociationRolePlayer.add(user); assert success; } protected void removeUsedAsAssociationRolePlayer(MergedAssociationRole user) { assert usedAsAssociationRolePlayer!=null; boolean success = usedAsAssociationRolePlayer.remove(user); assert success; } protected Set<MergedAssociationRole> getUsedAsAssociationRolePlayer() { return usedAsAssociationRolePlayer; } protected void addUsedAsTopicNameParent(MergedTopicName user) { if (usedAsTopicNameParent==null) { usedAsTopicNameParent = getContainer().createIdentitySet(); } boolean success = usedAsTopicNameParent.add(user); assert success : "Could not add "+user+" to "+this+".usedAsTopicNameParent, usedAsTopicNameParent already contains this user."; } protected void removeUsedAsTopicNameParent(MergedTopicName user) { assert usedAsTopicNameParent!=null; boolean success = usedAsTopicNameParent.remove(user); assert success; } protected Set<MergedTopicName> getUsedAsTopicNameParent() { return usedAsTopicNameParent; } @TMDM public Set<MergedTopicName> getTopicNames() { if (usedAsTopicNameParent==null) { return Collections.emptySet(); } else { /* return new MappedSet<MergedTopicNameKey,MergedTopicName>(getUsedAsTopicNameParent()) { public MergedTopicName map(MergedTopicNameKey key) { return getContainer().getMergedTopicNameByKey(key); } }; */ return usedAsTopicNameParent; } } @TMDM public Set<? extends MergedAssociationRole> getRolesPlayed() { if (usedAsAssociationRolePlayer!=null) { return usedAsAssociationRolePlayer; } else { return Collections.emptySet(); } } /* This method is called often by {@link MergedTopicMapView}. Thus, either it should be very fast or the calls by MergedTopicMapView should be replaced by internal accesses to {@link MergedTopicMapView#getMergedTopicMap()}. */ @TMDM public MergedTopicMap getParent() { return parent; } @TMAPI public ReadableTopicMap getTopicMap() { return getParent(); } public Collection<Locator> getItemIdentifiersTogetherWithSubjectIdentifiersCollection() { @SuppressWarnings("unchecked") List<Collection<Set<Locator>>> subjectIdentifiersOrItemIdentifiersSetCollection = Arrays.asList(getSubjectIdentifiersSetCollection(),getItemIdentifiersSetCollection()); return new MergedCollection<Locator>(new MergedCollection<Set<Locator>>(subjectIdentifiersOrItemIdentifiersSetCollection)); } @TMDM @TMAPI public Set<Locator> getSubjectIdentifiers() { return getSubjectIdentifiersSet(); } protected Collection<Set<Locator>> getSubjectIdentifiersSetCollection() { MappedCollection<ReadableTopic,Set<Locator>> subjectIdentifiersCollection = new MappedCollection<ReadableTopic,Set<Locator>>(components) { protected Set<Locator> map(ReadableTopic key) { return key.getSubjectIdentifiers(); } }; return subjectIdentifiersCollection; } public Set<Locator> getSubjectIdentifiersSet() { return new MergedSet<Locator>(getSubjectIdentifiersSetCollection()); } public Collection<Locator> getSubjectIdentifiersCollection() { return new MergedCollection<Locator>(getSubjectIdentifiersSetCollection()); } /** so far only used for assertions. */ protected boolean containsSubjectIdentifier(Locator subjectIdentifier) { return getSubjectIdentifiersCollection().contains(subjectIdentifier); } @TMDM @TMAPI public Set<Locator> getSubjectLocators() { return getSubjectLocatorsSet(); } protected Collection<Set<Locator>> getSubjectLocatorsSetCollection() { MappedCollection<ReadableTopic,Set<Locator>> subjectLocatorsCollection = new MappedCollection<ReadableTopic,Set<Locator>>(components) { protected Set<Locator> map(ReadableTopic key) { return key.getSubjectLocators(); } }; return subjectLocatorsCollection; } public Set<Locator> getSubjectLocatorsSet() { return new MergedSet<Locator>(getSubjectLocatorsSetCollection()); } /** Returns a collection of all SubjectLocators of this Topic. It is allowed to have SubjectLocators be more than once in the collection. Thus, this method does not need to handle duplicate removal. Thus, it may be implemented faster. */ public Collection<Locator> getSubjectLocatorsCollection() { return new MergedCollection<Locator>(getSubjectLocatorsSetCollection()); } /** so far only used for assertions. */ protected boolean containsSubjectLocator(Locator subjectLocator) { return getSubjectLocatorsCollection().contains(subjectLocator); } /* This conflicts with TMAPI 1.0 */ @TMDM public Reifiable getReified() { throw new UnsupportedOperationException(); // FIXME } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedTopicMap.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedTopicMap extends MergedReifiable<ReadableTopicMap,Object> implements ReadableTopicMap { protected MergedTopicMap(MergedTopicMapView container) { super(container,null); // we do not define any specific key for MergedTopicMaps, was TopicMaps themselves are not merged impliedly, there are only merged intendedly. assert container!=null; } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedTopicMapView.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Map; import java.util.Set; import java.util.Iterator; import java.util.Collection; import java.util.List; import java.util.HashSet; import org.tm4j.net.Locator; import org.tm4j.net.LocatorFactory; import org.tm4j.topicmap.tmdm.*; import org.tm4j.topicmap.tmdm.basic.BasicTopicMap; import org.tmapi.core.DuplicateSourceLocatorException; [...1236 lines suppressed...] return false; } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedVariant.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedVariant extends MergedTopicMapConstruct<ReadableVariant> /*implements ReadableVariant*/ { protected MergedTopicName parent; protected MergedVariant(MergedTopicName parent,Variant firstComponent) { super(parent.getContainer(),firstComponent); this.parent = parent; } public MergedTopicName getParent() { return parent; } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedTopicName.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedTopicName extends MergedScopeable<ReadableTopicName,MergedTopicNameKey> implements ReadableTopicName { //protected MergedTopic parent; protected MergedTopicName(MergedTopicMapView container,MergedTopicNameKey key,ReadableTopicName firstComponent) { super(container,key,firstComponent); // this.parent = parent; } public MergedTopic getParent() { // throw new UnsupportedOperationException(); // return parent; return getContainer().getMergedTopic(getRandomComponent().getParent()); } @TMDM @TMAPI public ReadableTopic getType() { return getContainer().getMergedTopic(getRandomComponent().getType()); } @TMDM @TMAPI public String getValue() { return getRandomComponent().getValue(); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedAssociationRoleKey.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** An AssociationRole in context of one MergedAssociation. @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedAssociationRoleKey extends MergedScopeableKey { protected MergedTopic type; protected MergedTopic player; protected MergedAssociationRoleKey(MergedTopic type,MergedTopic player,MergedScopeKey scope) { super(scope); this.type = type; this.player = player; } protected MergedAssociationRoleKey changeType(MergedTopic newType) { return new MergedAssociationRoleKey(newType,player,scope); } protected MergedAssociationRoleKey changePlayer(MergedTopic newPlayer) { return new MergedAssociationRoleKey(type,newPlayer,scope); } protected MergedAssociationRoleKey changeScope(MergedScopeKey newScope) { return new MergedAssociationRoleKey(type,player,newScope); } protected MergedTopic getType() { return type; } protected MergedTopic getPlayer() { return player; } public boolean equals(Object o) { return equals((MergedAssociationRoleKey) o); } public boolean equals(MergedAssociationRoleKey o) { return type.equals(o.type)&&player.equals(o.player)&&super.equals(o); } public int hashCode() { return type.hashCode()^player.hashCode()^super.hashCode(); } public String toString() { return "MergedAssociationRoleKey[type="+type+",player="+player+",scope="+getScope()+"]"; } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: package.jdo --- <?xml version="1.0"?> <!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd"> <jdo> <package name="org.tm4j.topicmap.tmdm.merged"> <class name="MergedAssociation"> <field name="associationRoleToMergedAssociationRole"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="mergedAssociationRoleByKey"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> </class> <class name="MergedAssociationKey"> <field name="roles"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> </class> <class name="MergedAssociationRole" /> <class name="MergedAssociationRoleKey" /> <class name="MergedOccurence" /> <class name="MergedReifiable"> <field persistence-modifier="persistent" name="key" /> </class> <class name="MergedScopeable" /> <class name="MergedScopeableKey" /> <class name="MergedScope" /> <class name="MergedScopeKey"> <field name="scopingTopics"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> </class> <class name="MergedTopic"> <!-- These fields use IdentityHashSets, which may not be embeddable be JPOX. --> <field name="usedAsAssociationType"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="usedAsAssociationRoleType"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="usedAsAssociationRolePlayer"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="usedAsTopicNameParent"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> </class> <class name="MergedTopicMapConstruct"> <field name="components" field-type="com.mn.util.data.persistent.jdo.java.util.ArrayList" > <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> </class> <class name="MergedTopicMap"> </class> <class name="MergedTopicMapView"> <field name="itemIdentifierOrSubjectIdentifierToMergedTopicMapConstruct"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="subjectLocatorToMergedTopic"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="mergedTopics"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="topicToMergedTopic"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="associationToMergedAssociation"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="topicNameToMergedTopicName"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="variantToMergedVariant"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="occurenceToMergedOccurence"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="mergedAssociationByKey"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="mergedAssociationRoleByKey"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="mergedTopicNameByKey"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field persistence-modifier="persistent" name="collectionsFactory" /> <!-- maybe, maybe not? <field persistence-modifier="persistent" name="eventListener" /> --> </class> <class name="MergedTopicName" /> <class name="MergedTopicNameKey" /> <class name="MergedVariant" /> </package> </jdo> --- NEW FILE: MergedScope.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedScope implements ReadableScope { protected MergedScopeKey key; protected MergedScope(MergedTopicMapView container,MergedScopeKey key,ReadableScope firstComponent) { this.key = key; // super(container,key,firstComponent); } protected MergedScopeKey getKey() { return key; } /** May return null, which represents the empty scope. */ public Set<? extends ReadableTopic> getScopingTopics() { return getKey().getScopingTopics(); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedTopicNameKey.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** An TopicName (* in context of one MergedTopic *). @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedTopicNameKey extends MergedScopeableKey { protected MergedTopic parent; protected MergedTopic type; protected String value; // FIXME: variants missing // FIXME: scope missing protected MergedTopicNameKey(MergedTopic parent,MergedTopic type,String value,MergedScopeKey scope) { super(scope); this.parent = parent; this.type = type; this.value = value; // FIXME: register at MergedTopics // parent.addUsedAsTopicNameParent(this); } protected MergedAssociationRoleKey changeScope(MergedScopeKey newScope) { return new MergedAssociationRoleKey(parent,type,newScope); } protected MergedTopic getParent() { return parent; } public boolean equals(Object o) { return equals((MergedTopicNameKey) o); } public boolean equals(MergedTopicNameKey o) { return parent.equals(o.parent)&&type.equals(o.type)&&value.equals(o.value); } public int hashCode() { return parent.hashCode()^type.hashCode()^value.hashCode(); } protected void destroy() { assert parent!=null; if (parent!=null) { // parent.removeUsedAsTopicNameParent(this); parent = null; } // FIXME: type.. } public String toString() { return "MergedTopicNameKey("+parent+","+type+",\""+value+"\")"; } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedAssociationRole.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedAssociationRole extends MergedScopeable<ReadableAssociationRole,MergedAssociationRoleKey> implements ReadableAssociationRole { protected MergedAssociationRole(MergedTopicMapView container,MergedAssociationRoleKey key,ReadableAssociationRole firstComponent) { super(container,key,firstComponent); } @TMDM @TMAPI //@Override public MergedTopic getType() { return getContainer().getMergedTopic(getRandomComponent().getType()); } @TMDM @TMAPI //@Override public MergedTopic getPlayer() { return getContainer().getMergedTopic(getRandomComponent().getPlayer()); } @TMDM //@Override public MergedAssociation getParent() { return getContainer().getMergedAssociation(getRandomComponent().getParent()); } @TMAPI //@Override public MergedAssociation getAssociation() { return getParent(); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedScopeable.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public abstract class MergedScopeable<I extends ReadableScopeable,K> extends MergedReifiable<I,K> implements ReadableScopeable { protected MergedScopeable(MergedTopicMapView container,K key) { super(container,key); } protected MergedScopeable(MergedTopicMapView container,K key,I firstComponent) { super(container,key,firstComponent); } public MergedScope getScope() { throw new UnsupportedOperationException(); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedOccurence.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedOccurence extends MergedReifiable<ReadableOccurence,MergedOccurenceKey> /*implements ReadableOccurence*/ { protected MergedTopic parent; protected MergedOccurence(MergedTopic parent,MergedOccurenceKey key,Occurence firstComponent) { super(parent.getContainer(),key,firstComponent); this.parent = parent; } public MergedTopic getParent() { return parent; } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: notes.txt --- This is "EarlyMerged" (i.e. as soon as possible) as opposed to "LateMerged" (i.e. only on demand at query time) --- NEW FILE: MergedTopicMapConstruct.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.Iterator; import java.util.Collection; import java.util.List; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; import com.mn.util.data.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public abstract class MergedTopicMapConstruct<I extends ReadableTopicMapConstruct> extends TMDMObject implements ReadableTopicMapConstruct { /** invariant: if components!=null, then components.size()>0. */ protected List<I> components; protected MergedTopicMapView container; protected MergedTopicMapConstruct(MergedTopicMapView container) { this.components = container.createArrayList(1); this.container = container; } protected MergedTopicMapConstruct(MergedTopicMapView container,I firstComponent) { this(container); addComponent(firstComponent); } /** Use with care. @param components the components collection to be used here. It may be prefilled. It is used directly, not copied. This may be good for efficiently, but it must made sure that nobody else is using this collection. */ @SuppressWarnings("unchecked") protected MergedTopicMapConstruct(MergedTopicMapView container,Collection<I> components) { this.container = container; this.components = (List<I>) components; } protected MergedTopicMapView getContainer() { return container; } /** Used for assertions */ public boolean containsComponent(I component) { return components.contains(component); } protected void addComponent(I component) { boolean success = components.add(component); assert success; } protected void removeComponent(I component) { boolean success = components.remove(component); assert success; } protected Collection<I> getComponents() { return components; } /** Makes this TopicMapConstruct invalid. No further actions may be done on this TopicMapConstruct @return the former components of this MergedTopicMapConstruct */ protected Collection<I> invalidate() { Collection<I> formerComponents = this.components; this.components = null; return formerComponents; } /** Undos the the {@link #invalidate} in case it is decided that this topic should survive (in merging). */ protected void revalidate(Collection<I> newComponents) { this.components = (List<I>) newComponents; } protected boolean isValid() { return components!=null; } /** Notifies this MergedTopicMapConstruct that its MergedTopicMapView does no longer need it. Thus, its persistent representation (if it has one) may be deleted safely. This implementation does nothing. */ protected void forget() { } protected boolean hasOnlyExactlyOneComponent() { assert isValid(); return components.size()==1; } /** No guarantee which component will be returned. But no guarantee on randomness either. */ public I getRandomComponent() { assert isValid() : this+" is hollow and without state manager while it should not be."; assert components.size()>0; return components.get(0); } /** We basically have here two options: <ul> <li>Have the result readily available</li> <li> Compose the result on demand. However, this is no simple concatenation, as there may be duplicates, but the result is a set, not a collection. How shall duplicate removal be handled? <ul> <li> No handling at all. Just have duplicates and document this. </li> <li> Precompute the whole set and then return it. (However, the set may be very large, exceeding memory, and it might be that the set is not read fully by the caller.) </li> <li> Compute the set while it is consumed by an iterator. Each element which was already returned is temporarily stored and when a duplicate would be returned, it is not returned at computing is skipped to the next available element. This may satisfy partial readers efficiently (but for complete readers, it still takes lots of memory). Additionally, the size of the set is not known before having processed a full iteration. However, while the result may very large, it is not required that the result may be only present in memory. It may also be present on disk, like temporary tables in relational databases. </li> </ul> </li> </ul> */ @TMDM //@Override public Set<Locator> getItemIdentifiers() { return getItemIdentifiersSet(); } protected Collection<Set<Locator>> getItemIdentifiersSetCollection() { assert components!=null : this+".components==null"; MappedCollection<I,Set<Locator>> itemIdentifiersCollection = new MappedCollection<I,Set<Locator>>(components) { protected Set<Locator> map(I key) { return key.getItemIdentifiers(); } }; return itemIdentifiersCollection; } public Set<Locator> getItemIdentifiersSet() { return new MergedSet<Locator>(getItemIdentifiersSetCollection()); } public Collection<Locator> getItemIdentifiersCollection() { return new MergedCollection<Locator>(getItemIdentifiersSetCollection()); } /** so far only used for assertions. */ protected boolean containsItemIdentifier(Locator itemIdentifier) { return getItemIdentifiersCollection().contains(itemIdentifier); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedReifiable.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public abstract class MergedReifiable<I extends ReadableReifiable,K> extends MergedTopicMapConstruct<I> implements ReadableReifiable { protected K key; protected MergedReifiable(MergedTopicMapView container,K key) { super(container); this.key = key; } /* protected MergedReifiable(I firstComponent) { super(firstComponent); } */ protected MergedReifiable(MergedTopicMapView container,K key,I firstComponent) { super(container,firstComponent); this.key = key; } public Topic getReifier() { throw new UnsupportedOperationException(); // FIXME } protected K getKey() { return key; } protected void setKey(K to) { this.key = to; } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedScopeKey.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedScopeKey { protected Set<MergedTopic> scopingTopics; protected MergedScopeKey(Set<MergedTopic> scopingTopics) { this.scopingTopics = scopingTopics; } public Set<MergedTopic> getScopingTopics() { return scopingTopics; } public boolean equals(Object o) { return equals((MergedScopeKey) o); } public boolean equals(MergedScopeKey o) { if (scopingTopics==null) { return o.isEmpty(); } else if (o.scopingTopics==null) { return isEmpty(); } else { return scopingTopics.equals(o.scopingTopics); } } public boolean isEmpty() { return (scopingTopics==null)||(scopingTopics.isEmpty()); } public int hashCode() { return (scopingTopics!=null)?scopingTopics.hashCode():0; } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedAssociation.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Map; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; import com.mn.util.data.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedAssociation extends MergedScopeable<ReadableAssociation,MergedAssociationKey> implements ReadableAssociation { /* Have these Maps locally and not TopicMap-global, as this increases locality of accesses and thus should decrease access time. */ protected Map<MergedAssociationRoleKey,MergedAssociationRole> mergedAssociationRoleByKey; protected Map<ReadableAssociationRole,MergedAssociationRole> associationRoleToMergedAssociationRole; protected MergedAssociation(MergedTopicMapView container,MergedAssociationKey key,ReadableAssociation firstComponent) { super(container,key,firstComponent); mergedAssociationRoleByKey = getContainer().createMap(); associationRoleToMergedAssociationRole = getContainer().createMap(); } @TMDM @TMAPI public ReadableTopic getType() { throw new UnsupportedOperationException(); } @TMDM public Set<? extends MergedAssociationRole> getRoles() { /* return new MappedSet<ReadableAssociationRole,MergedAssociationRole>(getRandomComponent().getRoles()) { public MergedAssociationRole map(ReadableAssociationRole key) { return getContainer().getMergedAssociationRole(key); } }; */ return new CollectionAsSet<MergedAssociationRole>(mergedAssociationRoleByKey.values()); } @TMAPI public Set<? extends MergedAssociationRole> getAssociationRoles() { return getRoles(); } public ReadableTopicMap getParent() { throw new UnsupportedOperationException(); } public MergedAssociationRole getMergedAssociationRole(ReadableAssociationRole basicAssociationRole) { MergedAssociationRole result = associationRoleToMergedAssociationRole.get(basicAssociationRole); assert result!=null; return result; } public void notifyAssociationRoleCreated(ReadableAssociation association,ReadableAssociationRole associationRole) { indexAssociationRole(associationRole,true); } protected void internalIndexAssociationRole(ReadableAssociationRole associationRole,MergedAssociationRoleKey key,boolean notifyListener) { MergedAssociationRole mergedAssociationRole = mergedAssociationRoleByKey.get(key); if (mergedAssociationRole==null) { mergedAssociationRole = new MergedAssociationRole(getContainer(),key,associationRole); mergedAssociationRoleByKey.put(key,mergedAssociationRole); mergedAssociationRole.getType().addUsedAsAssociationRoleType(mergedAssociationRole); mergedAssociationRole.getType().addUsedAsAssociationRolePlayer(mergedAssociationRole); if (notifyListener) { getContainer().internalNotifyMergedAssociationRoleCreated(this,mergedAssociationRole); } } else { // instant merging mergedAssociationRole.addComponent(associationRole); } MergedAssociationRole oldValue = associationRoleToMergedAssociationRole.put(associationRole,mergedAssociationRole); assert oldValue==null; } protected void indexAssociationRole(ReadableAssociationRole associationRole,boolean notifyListener) { assert containsComponent(associationRole.getParent()); MergedAssociationRoleKey key = getContainer().createAssociationRoleKey(associationRole); MergedAssociationKey newAssociationKey = getKey().addRole(key,getContainer()); if (hasOnlyExactlyOneComponent()) { // we will be transitioning or removing getContainer().unindexMergedAssociationForTransition(this); setKey(newAssociationKey); MergedAssociation mergedAssociationForNewKey = getContainer().getMergedAssociation(newAssociationKey); if (mergedAssociationForNewKey==null) { // this is a real transition getContainer().indexMergedAssociationByKey(newAssociationKey,this,notifyListener); internalIndexAssociationRole(associationRole,key,notifyListener); } else { // this MergedAssociation will vanish, while its (only) component will go to the other MergedAssociation. // put this component to the new MergedAssociation getContainer().unindexAssociationForSplitAway(associationRole.getParent(),this); MergedAssociation newMergedAssociation = getContainer().indexIncomingAssociation(associationRole.getParent(),newAssociationKey,notifyListener); assert newMergedAssociation==mergedAssociationForNewKey; // delete this MergedAssociation. invalidate(); // maybe invalidate later? getContainer().internalNotifyMergedAssociationRemoved(this); } } else { // we will be splitting away getContainer().unindexAssociationForSplitAway(associationRole.getParent(),this); MergedAssociation newMergedAssociation = getContainer().indexIncomingAssociation(associationRole.getParent(),newAssociationKey,notifyListener); /* nothing to do here anymore, as the receiving MergedAssociation already fully represents the changed ReadableAssociation, including the changed ReadableAssociationRole. */ } } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedAssociationKey.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** An Association in context of one MergedTopicMap. @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedAssociationKey extends MergedScopeableKey { protected MergedTopic type; protected Set<MergedAssociationRoleKey> roles; protected int hashCode; private MergedAssociationKey(MergedTopic type,Set<MergedAssociationRoleKey> roles,MergedScopeKey scope,int hashCode) { super(scope); this.type = type; this.roles = roles; this.hashCode = hashCode; } protected MergedAssociationKey(MergedTopic type,Set<MergedAssociationRoleKey> roles,MergedScopeKey scope) { super(scope); this.type = type; this.roles = roles; assert type!=null; assert roles!=null; hashCode^=type.hashCode(); hashCode^=roles.hashCode(); hashCode^=super.hashCode(); // type.addUsedAsAssociationType(this); // FIXME: roles.. } /** only for assertions so far */ protected MergedTopic getType() { return type; } protected MergedAssociationKey changeType(MergedTopic newType) { return new MergedAssociationKey(newType,roles,scope); } protected MergedAssociationKey changeScope(MergedScopeKey newScope) { return new MergedAssociationKey(type,roles,newScope); } protected MergedAssociationKey addRole(MergedAssociationRoleKey role,MergedTopicMapView container) { Set<MergedAssociationRoleKey> newRoles = container.copy(this.roles); newRoles.add(role); return new MergedAssociationKey(type,newRoles,getScope(),hashCode^role.hashCode()); } @Override public boolean equals(Object o) { return equals((MergedAssociationKey) o); } public boolean equals(MergedAssociationKey o) { return type.equals(o.type)&&roles.equals(o.roles)&&super.equals(o); } /** */ @Override public int hashCode() { // return type.hashCode()^roles.hashCode()^super.hashCode(); return hashCode; } protected void destroy() { assert type!=null; if (type!=null) { // type.removeUsedAsAssociationType(this); type = null; } // FIXME: roles.. } public String toString() { return "MergedAssociationKey[type="+type+",roles="+roles+",scope="+getScope()+"]"; } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedScopeableKey.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public abstract class MergedScopeableKey { protected MergedScopeKey scope; protected MergedScopeableKey(MergedScopeKey scope) { this.scope = scope; } protected abstract MergedScopeableKey changeScope(MergedScopeKey newScope); protected MergedScopeKey getScope() { return scope; } public boolean equals(Object o) { return equals((MergedScopeableKey) o); } public boolean equals(MergedScopeableKey o) { if (scope==null) { return (o.scope==null)||(o.scope.isEmpty()); } else if (o.scope==null) { return scope.isEmpty(); } else { return scope.equals(o.scope); } } public int hashCode() { return scope.hashCode(); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: MergedOccurenceKey.java --- package org.tm4j.topicmap.tmdm.merged; import java.util.Set; import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.ArrayList; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; /** An Occurence in context of one MergedTopic. @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class MergedOccurenceKey extends MergedScopeableKey { protected MergedTopic parent; protected MergedTopic type; protected String value; // FIXME: variants missing // FIXME: scope missing protected MergedOccurenceKey(MergedTopic parent,MergedTopic type,String value,MergedScopeKey scope) { super(scope); this.parent = parent; this.type = type; this.value = value; // FIXME: register at MergedTopics // parent.addUsedAsOccurenceParent(this); } protected MergedAssociationRoleKey changeScope(MergedScopeKey newScope) { throw new UnsupportedOperationException(); } protected MergedTopic getParent() { return parent; } public boolean equals(Object o) { return equals((MergedOccurenceKey) o); } public boolean equals(MergedOccurenceKey o) { return parent.equals(o.parent)&&type.equals(o.type)&&value.equals(o.value); } public int hashCode() { return parent.hashCode()^type.hashCode()^value.hashCode(); } protected void destroy() { assert parent!=null; if (parent!=null) { // parent.removeUsedAsOccurenceParent(this); parent = null; } // FIXME: type.. } public String toString() { return "MergedOccurenceKey("+parent+","+type+",\""+value+"\")"; } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: |
From: Xuan B. <med...@us...> - 2008-01-21 11:13:44
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/basic In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27256/src/org/tm4j/topicmap/tmdm/basic Added Files: BasicAssociation.java BasicAssociationRole.java BasicOccurence.java BasicReifiable.java BasicScope.java BasicScopeable.java BasicTopic.java BasicTopicMap.java BasicTopicMapConstruct.java BasicTopicName.java BasicVariant.java TopicMapItems.java.txt package.jdo Log Message: This change introduces the new TMDM (re-)implementation towards TM4J 2.0. It consists of about 430KB, 9900 lines of code. It is written by Xuan Baldauf and depends on the package baldauf-common. --- NEW FILE: BasicVariant.java --- package org.tm4j.topicmap.tmdm.basic; import java.util.Set; import java.util.Iterator; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.*; /** This Variant may - in contradiction to TMDM - have no scoping topic at all. It's the job of the using application to ensure that this Variant actualle has a scoping topic. @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class BasicVariant extends BasicScopeable implements Variant { BasicTopicName parent; Locator datatype; String value; protected BasicVariant(BasicTopicName parent,Locator datatype,String value) { this.parent = parent; this.datatype = datatype; this.value = value; } @TMDM public BasicTopicName getParent() { return parent; } @TMDM public void setDatatype(Locator datatype) { Locator oldDatatype = this.datatype; this.datatype = datatype; // We do not treat cases where the old value equals the new value specially. getEventListener().notifyVariantDatatypeChanged(getContainingTopicMap(),getParent().getParent(),getParent(),this,oldDatatype,datatype); } @TMDM public Locator getDatatype() { return datatype; } @TMDM @TMAPI public void setValue(String value) { String oldValue = this.value; this.value = value; // We do not treat cases where the old value equals the new value specially. getEventListener().notifyVariantValueChanged(getContainingTopicMap(),getParent().getParent(),getParent(),this,oldValue,value); } @TMAPI public String getValue() { return value; } protected BasicTopicMap getContainingTopicMap() { return getParent().getContainingTopicMap(); } /** Remove as much as possible without conflicting with TMDM after this call. */ protected void internalPreRemove() { super.internalPreRemove(); } /** Remove everything else. */ protected void internalPostRemove() { super.internalPostRemove(); } protected void removeAtParent() { getParent().internalRemove(this); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: BasicTopic.java --- package org.tm4j.topicmap.tmdm.basic; import java.util.Set; import java.util.Iterator; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.*; import com.mn.util.diag.syslog.*; /** Note that this implementation does not fully conform to the TMDM-constraints: <ul> <li> "All topic items shall have a value for at least one of the [subject identifiers], [subject locators], and [item identifiers] properties that is not the empty set.". </li> <li> Associations always need to have at least one association role. </li> </li> Reasons for these nonconformances are to make creating Topic items and Association items more simple and straightforward. Thus, the using application has to ensure that these constraints are met. We keep some sets (like {@link #subjectLocators}, {@link #subjectIdentifiers}, {@link #occurences}, {@link #rolesPlayed}, {@link #topicNames}) as null if the set to be represented is empty for memory optimization reasons. (Thus, we can pack more topics in RAM and we are faster at disk accesses (and we should be faster even when only doing RAM accesses, as RAM is nowadays slower than CPUs).) The methods for adding and removing items to these sets currently return wether they succeeded. Possibly they should just always return void (or throw exceptions in case of failure), if reporting success makes other implementations inefficient or harder to implement. @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class BasicTopic extends BasicTopicMapConstruct implements Topic { BasicTopicMap parent; /** The set of subject locators. May be null, meaning that the represented set is empty. */ Set<Locator> subjectLocators; Set<Locator> subjectIdentifiers; Set<BasicOccurence> occurences; /** While rolesPlayed is specified in TMDM, it is redundant from a data completeness point of view. Wethere a Topic plays an AssociationRole in a particular Association can be determined by looking at the AssociationRoles of that Association. Thus, as BasicTopic should only provide a backend (and should not provide indexing functionality), one may actually consider not implementing rolesPlayed (in case indexing is done anyway by a listener of this topic map), thus saving overhead. */ Set<BasicAssociationRole> rolesPlayed; Set<BasicTopicName> topicNames; BasicReifiable reified; private BasicTopic() { // Syslog.log(this,Syslog.DEBUG5,"<init>()."); } protected BasicTopic(BasicTopicMap parent) { // Syslog.log(this,Syslog.DEBUG5,"<init>( )."); this.parent = parent; } @TMAPI public BasicTopicMap getTopicMap() { return getContainingTopicMap(); } protected BasicTopicMap getContainingTopicMap() { return getParent(); } @TMDM public BasicTopicMap getParent() { return parent; } public boolean addSubjectIdentifier(Locator subjectIdentifier) { if (subjectIdentifiers==null) { subjectIdentifiers = createSet(); } boolean success = subjectIdentifiers.add(subjectIdentifier); if (success) { getEventListener().notifySubjectIdentifierAdded(getContainingTopicMap(),this,subjectIdentifier); } return success; } public boolean removeSubjectIdentifier(Locator subjectIdentifier) { if (subjectIdentifiers!=null) { boolean success = subjectIdentifiers.remove(subjectIdentifier); if (success) { getEventListener().notifySubjectIdentifierRemoved(getContainingTopicMap(),this,subjectIdentifier); } return success; } else { return false; } } public void removeAllSubjectIdentifiers() { if (subjectIdentifiers!=null) { for (Iterator<Locator> i = subjectIdentifiers.iterator();i.hasNext();) { Locator subjectIdentifier = i.next(); i.remove(); /* We should not trigger a {@link java.util.ConcurrentModificationException} for the next iterator access by calling this method. However, this depends on the implementation of this method. */ getEventListener().notifySubjectIdentifierRemoved(getContainingTopicMap(),this,subjectIdentifier); } subjectIdentifiers = null; } } @TMDM @TMAPI public Set<Locator> getSubjectIdentifiers() { return maybeWrapUnmodifiable(subjectIdentifiers); } public boolean addSubjectLocator(Locator subjectLocator) { if (subjectLocators==null) { subjectLocators = createSet(); } boolean success = subjectLocators.add(subjectLocator); if (success) { getEventListener().notifySubjectLocatorAdded(getContainingTopicMap(),this,subjectLocator); } return success; } public boolean removeSubjectLocator(Locator subjectLocator) { if (subjectLocators!=null) { boolean success = subjectLocators.remove(subjectLocator); if (success) { getEventListener().notifySubjectLocatorRemoved(getContainingTopicMap(),this,subjectLocator); } return success; } else { return false; } } public void removeAllSubjectLocators() { if (subjectLocators!=null) { for (Iterator<Locator> i = subjectLocators.iterator();i.hasNext();) { Locator subjectLocator = i.next(); i.remove(); /* We should not trigger a {@link java.util.ConcurrentModificationException} for the next iterator access by calling this method. However, this depends on the implementation of this method. */ getEventListener().notifySubjectLocatorRemoved(getContainingTopicMap(),this,subjectLocator); } subjectLocators = null; } } @TMDM @TMAPI public Set<Locator> getSubjectLocators() { return maybeWrapUnmodifiable(subjectLocators); } public BasicOccurence createOccurence(Topic type,Locator datatype,String value) { return createOccurence((BasicTopic) type,datatype,value); } public BasicOccurence createOccurence(BasicTopic type,Locator datatype,String value) { assert type.getContainingTopicMap()==getContainingTopicMap(); BasicOccurence occurence = new BasicOccurence(this,type,datatype,value); occurences.add(occurence); getEventListener().notifyOccurenceCreated(getContainingTopicMap(),this,occurence); return occurence; } protected void internalRemove(BasicOccurence occurence) { boolean success = occurences.remove(occurence); assert success; getEventListener().notifyOccurenceRemoved(getContainingTopicMap(),this,occurence); } public void removeAllOccurences() { if (occurences!=null) { for (Iterator<BasicOccurence> i = occurences.iterator();i.hasNext();) { BasicOccurence occurence = i.next(); occurence.internalPreRemove(); i.remove(); getEventListener().notifyOccurenceRemoved(getContainingTopicMap(),this,occurence); occurence.internalPostRemove(); } occurences = null; } } public BasicTopicName createTopicName(String value) { return createTopicName(getParent().getDefaultNameTypeTopic(),value); } public BasicTopicName createTopicName(String value,Scope scope) { return createTopicName(value,(BasicScope) scope); } public BasicTopicName createTopicName(String value,BasicScope scope) { return createTopicName(getParent().getDefaultNameTypeTopic(),value,scope); } public BasicTopicName createTopicName(String value,Topic type,Scope scope) { return createTopicName((BasicTopic) type,value,(BasicScope) scope); } public BasicTopicName createTopicName(Topic type,String value) { return createTopicName((BasicTopic) type,value); } public BasicTopicName createTopicName(BasicTopic type,String value) { return createTopicName(type,value,null); } public BasicTopicName createTopicName(BasicTopic type,String value,BasicScope scope) { assert type.getContainingTopicMap()==getContainingTopicMap(); BasicTopicName topicName = new BasicTopicName(this,type,value,scope); if (topicNames==null) { topicNames = createSet(); } topicNames.add(topicName); getEventListener().notifyTopicNameCreated(getContainingTopicMap(),this,topicName); return topicName; } protected void internalRemove(BasicTopicName topicName) { boolean success = topicNames.remove(topicName); assert success; getEventListener().notifyTopicNameRemoved(getContainingTopicMap(),this,topicName); } public void removeAllTopicNames() { if (topicNames!=null) { for (Iterator<BasicTopicName> i = topicNames.iterator();i.hasNext();) { BasicTopicName topicName = i.next(); topicName.internalPreRemove(); i.remove(); getEventListener().notifyTopicNameRemoved(getContainingTopicMap(),this,topicName); topicName.internalPostRemove(); } topicNames = null; } } protected void addAssociationRolePlayed(BasicAssociationRole associationRole) { assert rolesPlayed!=null; if (rolesPlayed==null) { rolesPlayed = createSet(); } boolean success = rolesPlayed.add(associationRole); assert success; // Do not send notifications, the caller will do this for us. } protected void removeAssociationRolePlayed(BasicAssociationRole associationRole) { assert rolesPlayed!=null; boolean success = rolesPlayed.remove(associationRole); assert success; // Do not send notifications, the caller will do this for us. } public Set<BasicAssociationRole> getRolesPlayed() { return rolesPlayed; } public Set<BasicTopicName> getTopicNames() { return topicNames; } /** Called by reified.uncouple(); */ protected void internalUncoupleReified() { assert reified!=null; reified = null; } public BasicReifiable getReified() { return reified; } protected void internalPreRemove() { removeAllOccurences(); removeAllSubjectIdentifiers(); removeAllSubjectLocators(); super.internalPreRemove(); } protected void internalPostRemove() { super.internalPostRemove(); } protected void removeAtParent() { getParent().internalRemove(this); } public String toString() { return "BasicTopic[subjectIdentifiers="+subjectIdentifiers+"]@"+Integer.toString(System.identityHashCode(this),16); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: BasicAssociationRole.java --- package org.tm4j.topicmap.tmdm.basic; import java.util.Set; import java.util.Iterator; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class BasicAssociationRole extends BasicScopeable implements AssociationRole { BasicAssociation parent; BasicTopic type; BasicTopic player; protected BasicAssociationRole(BasicAssociation parent,BasicTopic type,BasicTopic player) { this.parent = parent; this.type = type; this.player = player; } @TMDM public BasicAssociation getParent() { return parent; } @TMAPI public BasicAssociation getAssociation() { return getParent(); } @TMDM @TMAPI public void setType(Topic type) { setType((BasicTopic) type); } public void setType(BasicTopic type) { assert type.getContainingTopicMap()==getContainingTopicMap(); BasicTopic oldType = this.type; this.type = type; // We do not treat cases where the old value equals the new value specially. getEventListener().notifyAssociationRoleTypeChanged(getContainingTopicMap(),getParent(),this,oldType,type); } @TMDM @TMAPI public BasicTopic getType() { return type; } @TMDM @TMAPI public void setPlayer(Topic player) { setPlayer((BasicTopic) player); } public void setPlayer(BasicTopic player) { assert player.getContainingTopicMap()==getContainingTopicMap(); BasicTopic oldPlayer = this.player; this.player.removeAssociationRolePlayed(this); this.player = player; this.player.addAssociationRolePlayed(this); // We do not treat cases where the old value equals the new value specially. getEventListener().notifyAssociationRolePlayerChanged(getContainingTopicMap(),getParent(),this,oldPlayer,player); } @TMDM @TMAPI public BasicTopic getPlayer() { return player; } protected BasicTopicMap getContainingTopicMap() { return getParent().getContainingTopicMap(); } /** Remove as much as possible without conflicting with TMDM after this call. */ protected void internalPreRemove() { super.internalPreRemove(); } /** Remove everything else. */ protected void internalPostRemove() { super.internalPostRemove(); } protected void removeAtParent() { getParent().internalRemove(this); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: BasicScope.java --- package org.tm4j.topicmap.tmdm.basic; import java.util.Set; import java.util.Iterator; import org.tm4j.topicmap.tmdm.*; /** From the semantics point of view, a null scope equals an empty scope. @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class BasicScope implements Scope { protected Set<BasicTopic> scope; public boolean internalAddScopingTopic(BasicScopeable user,BasicTopic scopingTopic) { return internalAddScopingTopic(user,scopingTopic,false); } protected boolean internalAddScopingTopic(BasicScopeable user,BasicTopic scopingTopic,boolean notifyListener) { if (scope==null) { scope = user.createSet(); } boolean success = scope.add(scopingTopic); if (notifyListener) { if (success) { user.getEventListener().notifyScopingTopicAdded(user.getContainingTopicMap(),user,scopingTopic); } } return success; } protected boolean addScopingTopic(BasicScopeable user,BasicTopic scopingTopic) { return internalAddScopingTopic(user,scopingTopic,true); } protected boolean removeScopingTopic(BasicScopeable user,BasicTopic scopingTopic) { if (scope!=null) { boolean success = scope.remove(scopingTopic); if (success) { user.getEventListener().notifyScopingTopicRemoved(user.getContainingTopicMap(),user,scopingTopic); } return success; } else { return false; } } /** May return null, which represents the empty scope. */ public Set<BasicTopic> getScopingTopics() { return scope; } /* protected void removeAllScopingTopics(BasicScopeable user) { if (scope!=null) { for (Iterator<BasicTopic> i = scope.iterator();i.hasNext();) { BasicTopic scopingTopic = i.next(); i.remove(); /* We should not trigger a {@link java.util.ConcurrentModificationException} for the next iterator access by calling this method However, this depends on the implementation of this method. * / user.getEventListener().notifyScopingTopicRemoved(user.getContainingTopicMap(),user,scopingTopic); } scope = null; } } */ } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: BasicTopicMapConstruct.java --- package org.tm4j.topicmap.tmdm.basic; import java.util.Set; import java.util.Iterator; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; import com.mn.util.data.CollectionsFactory; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public abstract class BasicTopicMapConstruct extends TMDMObject implements TopicMapConstruct { Set<Locator> itemIdentifiers; /** Returns the topic map to which this topic map construct belongs to. */ protected abstract BasicTopicMap getContainingTopicMap(); protected TopicMapEventListener getEventListener() { return getContainingTopicMap().getEventListener(); } /** We deliberately make this method not broader (like implementing topic equality or association equality here), so that we can store references to this TopicMapConstruct just by using a normal Java reference. */ public boolean equals(Object o) { return super.equals(o); } /** We deliberately make this method not broader (like implementing topic equality or association equality here), so that we can store references to this TopicMapConstruct just by using a normal Java reference. */ public int hashCode() { return super.hashCode(); } public <T> Set<T> createSet() { // return TMDMUtil.createSet(); return getCollectionsFactory().createHashSet(); } protected CollectionsFactory getCollectionsFactory() { return getContainingTopicMap().getCollectionsFactory(); } public boolean addItemIdentifier(Locator itemIdentifier) throws DuplicateItemIdentifierException { if (itemIdentifiers==null) { itemIdentifiers = createSet(); } boolean success = itemIdentifiers.add(itemIdentifier); if (success) { getEventListener().notifyItemIdentifierAdded(getContainingTopicMap(),this,itemIdentifier); } return success; } public boolean removeItemIdentifier(Locator itemIdentifier) { if (itemIdentifiers!=null) { boolean success = itemIdentifiers.remove(itemIdentifier); if (success) { getEventListener().notifyItemIdentifierRemoved(getContainingTopicMap(),this,itemIdentifier); } return success; } else { return false; } } public void removeAllItemIdentifiers() { if (itemIdentifiers!=null) { for (Iterator<Locator> i = itemIdentifiers.iterator();i.hasNext();) { Locator itemIdentifier = i.next(); i.remove(); /* We should not trigger a {@link java.util.ConcurrentModificationException} for the next iterator access by calling this method. However, this depends on the implementation of this method. */ getEventListener().notifyItemIdentifierRemoved(getContainingTopicMap(),this,itemIdentifier); } itemIdentifiers = null; } } @TMDM public Set<Locator> getItemIdentifiers() { return maybeWrapUnmodifiable(itemIdentifiers); } protected void internalPreRemove() { // Maybe we should not remove item identifiers at this stage, because of the TMDM-constraint "All topic items shall have a value for at least one of the [subject identifiers], [subject locators], and [item identifiers] properties that is not the empty set.". removeAllItemIdentifiers(); } protected void internalPostRemove() { } protected abstract void removeAtParent(); public void remove() { /* Remove works in 3 phases. (1) internalPreRemove(); (2) removeAtParent(); (3) internalPostRemove(); */ internalPreRemove(); removeAtParent(); internalPostRemove(); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: package.jdo --- <?xml version="1.0"?> <!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd"> <jdo> <package name="org.tm4j.topicmap.tmdm.basic"> <class name="BasicAssociation"> <field name="roles"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> </class> <class name="BasicAssociationRole" /> <class name="BasicOccurence"> <field persistence-modifier="persistent" name="datatype" /> </class> <class name="BasicReifiable" /> <class name="BasicScopeable" /> <class name="BasicScope"> <field name="scope"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> </class> <class name="BasicTopic"> <field name="subjectLocators"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="subjectIdentifiers"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="occurences"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="rolesPlayed"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="topicNames"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> </class> <class name="BasicTopicMapConstruct"> <field name="itemIdentifiers"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> </class> <class name="BasicTopicMap"> <field name="topics"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field name="associations"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> <field persistence-modifier="persistent" name="eventListener" /> <field persistence-modifier="persistent" name="defaultNameTypeTopic" /> <field persistence-modifier="persistent" name="locatorFactory" /> <field persistence-modifier="persistent" name="collectionsFactory" /> </class> <class name="BasicTopicName"> <field name="variants"> <extension vendor-name="jpox" key="is-second-class" value="false" /> </field> </class> <class name="BasicVariant"> <field persistence-modifier="persistent" name="datatype" /> </class> </package> </jdo> --- NEW FILE: BasicScopeable.java --- package org.tm4j.topicmap.tmdm.basic; import java.util.Set; import java.util.Iterator; import org.tm4j.topicmap.tmdm.*; /** From the semantics point of view, a null scope equals an empty scope. @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public abstract class BasicScopeable extends BasicReifiable implements Scopeable { /** may be null, representing the empty scope. */ protected BasicScope scope; protected BasicScopeable() { super(); } protected BasicScopeable(BasicScope scope) { super(); this.scope = scope; } @TMAPI public boolean addScopingTopic(Topic scopingTopic) { return addScopingTopic((BasicTopic) scopingTopic); } public boolean addScopingTopic(BasicTopic scopingTopic) { assert scopingTopic.getContainingTopicMap()==getContainingTopicMap(); if (scope==null) { scope = createScope(); } return scope.addScopingTopic(this,scopingTopic); } @TMAPI public boolean removeScopingTopic(Topic scopingTopic) { return removeScopingTopic((BasicTopic) scopingTopic); } public boolean removeScopingTopic(BasicTopic scopingTopic) { if (scope!=null) { return scope.removeScopingTopic(this,scopingTopic); } else { return false; } } // For what reason do we need this? /* public void removeAllScopingTopics() { if (scope!=null) { scope.removeAllScopingTopics(this); // scope.destroy(); scope = null; } } */ /** Only to make it clear that we decide to <u>not</u> remove the scoping topics one by one. The reason is that a scope of a scopeable cannot be removed, it can only be reset (to the default scope, which is The Unconstrained Scope). Thus, removing scoping topics would just result in unneccessary <u>change</u> of scope before removing the {@link Scopeable} itself. Because there is no reason for just changing a scope of a {@link Scopeable} just before it is destroyed, it is simply not done. */ protected void internalPreRemove() { super.internalPreRemove(); } protected void internalPostRemove() { super.internalPostRemove(); scope = null; // The intent here is not to change scope, but to just mark the object explicitly as unused, in case the object needs to know that. } @TMDM public BasicScope getScope() { return scope; } /* Some helper functions. - may be moved somewhere else. - are deliberately not static to be able to make them runtime-dependent. */ protected BasicScope createScope() { return new BasicScope(); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: BasicOccurence.java --- package org.tm4j.topicmap.tmdm.basic; import java.util.Set; import java.util.Iterator; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class BasicOccurence extends BasicScopeable implements Occurence { BasicTopic parent; BasicTopic type; Locator datatype; String value; protected BasicOccurence(BasicTopic parent,BasicTopic type,Locator datatype,String value) { this.parent = parent; this.type = type; this.datatype = datatype; this.value = value; } @TMDM public BasicTopic getParent() { return parent; } @TMDM @TMAPI public void setType(Topic type) { setType((BasicTopic) type); } public void setType(BasicTopic type) { assert type.getContainingTopicMap()==getContainingTopicMap(); BasicTopic oldType = this.type; this.type = type; // We do not treat cases where the old value equals the new value specially. getEventListener().notifyOccurenceTypeChanged(getContainingTopicMap(),getParent(),this,oldType,type); } @TMDM @TMAPI public BasicTopic getType() { return type; } @TMDM public void setDatatype(Locator datatype) { Locator oldDatatype = this.datatype; this.datatype = datatype; // We do not treat cases where the old value equals the new value specially. getEventListener().notifyOccurenceDatatypeChanged(getContainingTopicMap(),getParent(),this,oldDatatype,datatype); } @TMDM public Locator getDatatype() { return datatype; } @TMDM @TMAPI public void setValue(String value) { String oldValue = this.value; this.value = value; // We do not treat cases where the old value equals the new value specially. getEventListener().notifyOccurenceValueChanged(getContainingTopicMap(),getParent(),this,oldValue,value); } @TMAPI public String getValue() { return value; } protected BasicTopicMap getContainingTopicMap() { return getParent().getContainingTopicMap(); } /** Remove as much as possible without conflicting with TMDM after this call. */ protected void internalPreRemove() { super.internalPreRemove(); } /** Remove everything else. */ protected void internalPostRemove() { super.internalPostRemove(); } protected void removeAtParent() { getParent().internalRemove(this); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: TopicMapItems.java.txt --- package org.tm4j.topicmap.tmdm.basic; import java.util.Set; import org.tm4j.net.Locator; public abstract class BasicTopicMapConstruct { Set<Locator> itemIdentifiers; } public abstract class BasicReifiable extends BasicTopicMapConstruct { BasicTopic reifier; } public abstract class BasicScopeable extends BasicReifiable { Set<BasicTopic> scope; } public class BasicTopicMap extends BasicReifiable { Set<BasicTopic> BasicTopics; Set<BasicAssociation> BasicAssociations; } public class BasicTopic extends BasicTopicMapConstruct { BasicTopicMap parent; Set<Locator> subjectLocators; Set<Locator> subjectIdentifiers; Set<BasicOccurence> BasicOccurences; Set<BasicAssociationRole> rolesPlayed; Set<BasicTopicName> BasicTopicNames; BasicReifiable reified; } public class BasicAssociation extends BasicScopeable { BasicTopicMap parent; BasicTopic type; Set<BasicAssociationRole> roles; } public class BasicAssociationRole extends BasicReifiable { BasicAssociation parent; BasicTopic type; BasicTopic player; } public class BasicTopicName extends BasicScopeable { BasicTopic parent; BasicTopic type; String value; Set<BasicVariant> BasicVariants; } public class BasicVariant extends BasicScopeable { BasicTopicName parent; Locator datatype; String value; } public class BasicOccurence extends BasicScopeable { BasicTopic parent; BasicTopic type; Locator datatype; String value; } public class Locator { String value; } // :tabSize=2:indentSize=2: --- NEW FILE: BasicReifiable.java --- package org.tm4j.topicmap.tmdm.basic; import java.util.Set; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.Reifiable; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public abstract class BasicReifiable extends BasicTopicMapConstruct implements Reifiable { BasicTopic reifier; @TMDM @TMAPI public BasicTopic getReifier() { return reifier; } protected void uncouple() { if (reifier!=null) { BasicTopic oldReifier = reifier; getEventListener().notifyReificationUncouple(reifier.getContainingTopicMap(),reifier,this); reifier = null; oldReifier.internalUncoupleReified(); } } protected void internalPreRemove() { uncouple(); super.internalPreRemove(); } protected void internalPostRemove() { super.internalPostRemove(); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: BasicTopicMap.java --- package org.tm4j.topicmap.tmdm.basic; import java.util.Set; import org.tm4j.net.LocatorFactoryException; import org.tm4j.net.LocatorFactory; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.TopicMapEventListener; import org.tm4j.topicmap.tmdm.*; import com.mn.util.data.CollectionsFactory; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class BasicTopicMap extends BasicReifiable implements TopicMap { Set<BasicTopic> topics; Set<BasicAssociation> associations; TopicMapEventListener eventListener; BasicTopic defaultNameTypeTopic; LocatorFactory locatorFactory; CollectionsFactory collectionsFactory; public BasicTopicMap(LocatorFactory locatorFactory,CollectionsFactory collectionsFactory) { this.collectionsFactory = collectionsFactory; this.topics = createSet(); this.associations = createSet(); this.eventListener = TopicMapEventListenerUtil.getNullTopicMapEventListener(); this.locatorFactory = locatorFactory; } protected CollectionsFactory getCollectionsFactory() { return collectionsFactory; } /** */ protected BasicTopic getDefaultNameTypeTopic() { if (defaultNameTypeTopic==null) { defaultNameTypeTopic = createTopic(); try { defaultNameTypeTopic.addSubjectIdentifier(locatorFactory.createLocator("URI","http://psi.topicmaps.org/iso13250/model/topic-name")); } catch (LocatorFactoryException e) { throw new RuntimeException(e); } } return defaultNameTypeTopic; } public BasicTopic createTopic() { BasicTopic topic = new BasicTopic(this); topics.add(topic); getEventListener().notifyTopicCreated(this,topic); return topic; } public BasicAssociation createAssociation(Topic type) { return createAssociation((BasicTopic) type); } public BasicAssociation createAssociation(Topic type,Scope scope) { return createAssociation((BasicTopic) type,(BasicScope) scope); } public BasicAssociation createAssociation(BasicTopic type) { return createAssociation(type,null); } public BasicAssociation createAssociation(BasicTopic type,BasicScope scope) { BasicAssociation association = new BasicAssociation(this,type,scope); associations.add(association); getEventListener().notifyAssociationCreated(this,association); return association; } protected void internalRemove(BasicTopic topic) { boolean success = topics.remove(topic); assert success; getEventListener().notifyTopicRemoved(this,topic); } protected void internalRemove(BasicAssociation association) { boolean success = associations.remove(association); assert success; getEventListener().notifyAssociationRemoved(this,association); } protected BasicTopicMap getContainingTopicMap() { return this; } protected TopicMapEventListener getEventListener() { return eventListener; } public void setEventListener(TopicMapEventListener eventListener) { this.eventListener = eventListener; } protected void removeAtParent() { } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: BasicAssociation.java --- package org.tm4j.topicmap.tmdm.basic; import java.util.Set; import java.util.Iterator; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class BasicAssociation extends BasicScopeable implements Association { BasicTopicMap parent; BasicTopic type; Set<BasicAssociationRole> roles; protected BasicAssociation(BasicTopicMap parent,BasicTopic type,BasicScope scope) { super(scope); this.parent = parent; this.type = type; this.roles = createSet(); } protected BasicTopicMap getContainingTopicMap() { return getParent(); } public BasicTopicMap getParent() { return parent; } @TMDM @TMAPI public void setType(Topic type) { setType((BasicTopic) type); } public void setType(BasicTopic type) { assert type.getContainingTopicMap()==getContainingTopicMap(); BasicTopic oldType = this.type; this.type = type; // We do not treat cases where the old value equals the new value specially. getEventListener().notifyAssociationTypeChanged(getContainingTopicMap(),this,oldType,type); } @TMDM @TMAPI public BasicTopic getType() { return type; } /** Warning: player and type are reversed here. */ @TMAPI public BasicAssociationRole createAssociationRole(Topic player,Topic type) { return createRole((BasicTopic) type,(BasicTopic) player); } @TMDM public BasicAssociationRole createRole(Topic type,Topic player) { return createRole((BasicTopic) type,(BasicTopic) player); } public BasicAssociationRole createRole(BasicTopic type,BasicTopic player) { assert type.getContainingTopicMap()==getContainingTopicMap(); assert player.getContainingTopicMap()==getContainingTopicMap() : player+".getContainingTopicMap()="+player.getContainingTopicMap()+" while "+this+".getContainingTopicMap()="+getContainingTopicMap()+"."; BasicAssociationRole role = new BasicAssociationRole(this,type,player); roles.add(role); getEventListener().notifyAssociationRoleCreated(getContainingTopicMap(),this,role); return role; } @TMDM public Set<? extends AssociationRole> getRoles() { return maybeWrapUnmodifiable(roles); } @TMAPI public Set<? extends AssociationRole> getAssociationRoles() { return getRoles(); } protected void internalRemove(BasicAssociationRole role) { boolean success = roles.remove(role); assert success; getEventListener().notifyAssociationRoleRemoved(getContainingTopicMap(),this,role); } public void removeAllAssociationRoles() { if (roles!=null) { /* for (Iterator<BasicAssociationRole> i = roles.iterator();i.hasNext();) { BasicAssociationRole role = i.next(); role.internalPreRemove(); i.remove(); getEventListener().notifyAssociationRoleRemoved(getContainingTopicMap(),this,role); role.internalPostRemove(); } */ Iterator<BasicAssociationRole> i = roles.iterator(); while (i.hasNext()) { BasicAssociationRole role = i.next(); role.internalPreRemove(); i.remove(); getEventListener().notifyAssociationRoleRemoved(getContainingTopicMap(),this,role); role.internalPostRemove(); } } } /** Remove as much as possible without conflicting with invariants after this call. */ protected void internalPreRemove() { removeAllAssociationRoles(); super.internalPreRemove(); } protected void removeAtParent() { getParent().internalRemove(this); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: BasicTopicName.java --- package org.tm4j.topicmap.tmdm.basic; import java.util.Set; import java.util.Iterator; import org.tm4j.net.Locator; import org.tm4j.topicmap.tmdm.*; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class BasicTopicName extends BasicScopeable implements TopicName { BasicTopic parent; BasicTopic type; String value; Set<BasicVariant> variants; protected BasicTopicName(BasicTopic parent,BasicTopic type,String value) { this.parent = parent; this.type = type; this.value = value; } protected BasicTopicName(BasicTopic parent,BasicTopic type,String value,BasicScope scope) { super(scope); this.parent = parent; this.type = type; this.value = value; } @TMDM public BasicTopic getParent() { return parent; } @TMDM @TMAPI public void setType(Topic type) { setType((BasicTopic) type); } public void setType(BasicTopic type) { assert type.getContainingTopicMap()==getContainingTopicMap(); BasicTopic oldType = this.type; this.type = type; // We do not treat cases where the old value equals the new value specially. getEventListener().notifyTopicNameTypeChanged(getContainingTopicMap(),getParent(),this,oldType,type); } @TMDM @TMAPI public BasicTopic getType() { return type; } @TMDM @TMAPI public void setValue(String value) { String oldValue = this.value; this.value = value; // We do not treat cases where the old value equals the new value specially. getEventListener().notifyTopicNameValueChanged(getContainingTopicMap(),getParent(),this,oldValue,value); } @TMAPI public String getValue() { return value; } public BasicVariant createVariant(Locator datatype,String value) { BasicVariant variant = new BasicVariant(this,datatype,value); variants.add(variant); getEventListener().notifyVariantCreated(getContainingTopicMap(),getParent(),this,variant); return variant; } protected void internalRemove(BasicVariant variant) { boolean success = variants.remove(variant); assert success; getEventListener().notifyVariantRemoved(getContainingTopicMap(),getParent(),this,variant); } public void removeAllVariants() { if (variants!=null) { for (Iterator<BasicVariant> i = variants.iterator();i.hasNext();) { BasicVariant variant = i.next(); variant.internalPreRemove(); i.remove(); getEventListener().notifyVariantRemoved(getContainingTopicMap(),getParent(),this,variant); variant.internalPostRemove(); } variants = null; } } protected BasicTopicMap getContainingTopicMap() { return getParent().getContainingTopicMap(); } /** Remove as much as possible without conflicting with TMDM after this call. */ protected void internalPreRemove() { super.internalPreRemove(); } /** Remove everything else. */ protected void internalPostRemove() { super.internalPostRemove(); } protected void removeAtParent() { getParent().internalRemove(this); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: |
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27256/src/org/tm4j/topicmap/tmdm Added Files: Association.java AssociationRole.java DuplicateItemIdentifierException.java NestedTransactionManager.java NestedTransactionManaging.java Occurence.java ReadableAssociation.java ReadableAssociationRole.java ReadableOccurence.java ReadableReifiable.java ReadableScope.java ReadableScopeable.java ReadableTopic.java ReadableTopicMap.java ReadableTopicMapConstruct.java ReadableTopicName.java ReadableVariant.java Reifiable.java Scope.java Scopeable.java TMAPI.java TMDM.java TMDMException.java TMDMObject.java TMDMUtil.java Topic.java TopicMap.java TopicMapConstruct.java TopicMapEventAdapter.java TopicMapEventListener.java TopicMapEventListener.java.v0 TopicMapEventListenerUtil.java TopicName.java Variant.java package.jdo Log Message: This change introduces the new TMDM (re-)implementation towards TM4J 2.0. It consists of about 430KB, 9900 lines of code. It is written by Xuan Baldauf and depends on the package baldauf-common. --- NEW FILE: ReadableTopicName.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface ReadableTopicName extends ReadableScopeable { @TMDM @TMAPI public ReadableTopic getType(); @TMDM @TMAPI public String getValue(); /** FIXME: it is unclear wether we should expose this method in this interface. */ @TMDM public ReadableTopic getParent(); /* @TMDM public Variant createVariant(Locator datatype,String value); @TMDM public Set<? extends Variant> getVariants(); */ } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: ReadableAssociation.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface ReadableAssociation extends ReadableScopeable { @TMDM @TMAPI public ReadableTopic getType(); @TMDM public ReadableTopicMap getParent(); @TMDM public Set<? extends ReadableAssociationRole> getRoles(); @TMAPI public Set<? extends ReadableAssociationRole> getAssociationRoles(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: ReadableReifiable.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface ReadableReifiable extends ReadableTopicMapConstruct { public Topic getReifier(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: package.jdo --- <?xml version="1.0"?> <!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd"> <jdo> <package name="org.tm4j.topicmap.tmdm"> <class name="TMDMObject" /> <class name="TMDMUtil" /> <class name="TopicMapEventAdapter" /> <class name="TopicMapEventListenerUtil" /> <!-- The following, once modified by BCEL or ASM, are not accepted by the JVM. This may be as these class files are interfaces, not true classes. Maybe they are just modified to contain nonabstract methods. But not enhancing these interfaces has some implications, as then the enhancer also thinks that fields which have one of these interface types actually have values which are _not_ persistence capable, which is plainly wrong. --> <!-- <class name="Association" /> <class name="AssociationRole" /> <class name="Occurence" /> <class name="Reifiable" /> <class name="Scopeable" /> <class name="Scope" /> <class name="Topic" /> <class name="TopicMapConstruct" /> <class name="TopicMap" /> <class name="TopicName" /> <class name="Variant" /> <class name="TopicMapEventListener" /> <class name="TMAPI" /> <class name="TMDM" /> <class name="TMDMException" /> <class name="DuplicateItemIdentifierException" /> <class name="ReadableAssociation" /> <class name="ReadableAssociationRole" /> <class name="ReadableOccurence" /> <class name="ReadableReifiable" /> <class name="ReadableScopeable" /> <class name="ReadableScope" /> <class name="ReadableTopic" /> <class name="ReadableTopicMapConstruct" /> <class name="ReadableTopicMap" /> <class name="ReadableTopicName" /> <class name="ReadableVariant" /> --> </package> </jdo> --- NEW FILE: Association.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface Association extends ReadableAssociation,Scopeable { @TMDM @TMAPI public void setType(Topic type); @TMDM @TMAPI public Topic getType(); @TMDM public TopicMap getParent(); @TMDM public AssociationRole createRole(Topic type, Topic player); @TMDM public Set<? extends AssociationRole> getRoles(); /** Warning: player and type are reversed here. */ @TMAPI public AssociationRole createAssociationRole(Topic player, Topic type); @TMAPI public Set<? extends AssociationRole> getAssociationRoles(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: TopicMapEventListenerUtil.java --- package org.tm4j.topicmap.tmdm; import java.lang.reflect.Proxy; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.util.Collection; import org.tm4j.topicmap.tmdm.util.ListenerDispatcher; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class TopicMapEventListenerUtil { protected static InvocationHandler nullInvocationHandler = new InvocationHandler() { public Object invoke(Object proxy, Method method, Object[] args) { return null; } }; protected static TopicMapEventListener nullTopicMapEventListener = (TopicMapEventListener) Proxy.newProxyInstance(TopicMapEventListenerUtil.class.getClassLoader(),new Class<?>[] { TopicMapEventListener.class },nullInvocationHandler); @SuppressWarnings("unchecked") public static <TM extends ReadableTopicMap,T extends ReadableTopic,A extends ReadableAssociation,O extends ReadableOccurence,TMC extends ReadableTopicMapConstruct,TN extends ReadableTopicName,V extends ReadableVariant,AR extends ReadableAssociationRole> TopicMapEventListener<TM,T,A,O,TMC,TN,V,AR> getNullTopicMapEventListener() { return (TopicMapEventListener<TM,T,A,O,TMC,TN,V,AR>) nullTopicMapEventListener; } public static ListenerDispatcher<TopicMapEventListener> createTopicMapEventListenerDispatcher(Collection<TopicMapEventListener> clientListeners) { return new ListenerDispatcher<TopicMapEventListener>(TopicMapEventListener.class,clientListeners); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: NestedTransactionManager.java --- package org.tm4j.topicmap.tmdm; import java.util.Properties; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.HashMap; import org.tm4j.net.LocatorFactory; import org.tm4j.net.Locator; import org.tm4j.topicmap.TopicMapProvider; import org.tm4j.topicmap.TopicMapProviderException; import org.tm4j.topicmap.TopicMapProviderBase; import org.tm4j.topicmap.ProviderTransaction; import org.tm4j.net.memory.LocatorFactoryImpl; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface NestedTransactionManager extends NestedTransactionManaging { public void nestedTransactionSuccessAndEnd(); public void nestedTransactionNoSuccessAndEnd(); public void close(); public boolean isTransactionOpen(); public Object makePersistent(Object o); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: DuplicateItemIdentifierException.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class DuplicateItemIdentifierException extends TMDMException { public DuplicateItemIdentifierException(String message) { super(message); } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: ReadableAssociationRole.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface ReadableAssociationRole extends ReadableScopeable { @TMDM @TMAPI public ReadableTopic getType(); @TMDM @TMAPI public ReadableTopic getPlayer(); @TMDM public ReadableAssociation getParent(); @TMAPI public ReadableAssociation getAssociation(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: TopicMapEventAdapter.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public abstract class TopicMapEventAdapter<TM extends ReadableTopicMap,T extends ReadableTopic,A extends ReadableAssociation,O extends ReadableOccurence,TMC extends ReadableTopicMapConstruct,TN extends ReadableTopicName,V extends ReadableVariant,AR extends AssociationRole> implements TopicMapEventListener<TM,T,A,O,TMC,TN,V,AR> { /** Note that, at this stage, the topic may be "naked" (e.g. having no property set, not even an item identifier, which is in conflict to the TMDM-constraint "All topic items shall have a value for at least one of the [subject identifiers], [subject locators], and [item identifiers] properties that is not the empty set.".) */ public void notifyTopicCreated(TM topicMap,T topic) { } /** Note that, at this stage, the topic may be "naked" (e.g. having no property set, not even an item identifier, which is in conflict to the TMDM-constraint "All topic items shall have a value for at least one of the [subject identifiers], [subject locators], and [item identifiers] properties that is not the empty set.".) */ public void notifyTopicRemoved(TM topicMap,T topic) { } public void notifySubjectIdentifierAdded(TM topicMap,T topic,Locator subjectIdentifier) { } public void notifySubjectIdentifierRemoved(TM topicMap,T topic,Locator subjectIdentifier) { } public void notifySubjectLocatorAdded(TM topicMap,T topic,Locator subjectLocator) { } public void notifySubjectLocatorRemoved(TM topicMap,T topic,Locator subjectLocator) { } public void notifyItemIdentifierAdded(TM topicMap,TMC topicMapConstruct,Locator itemIdentifier) throws DuplicateItemIdentifierException { } public void notifyItemIdentifierRemoved(TM topicMap,TMC topicMapConstruct,Locator itemIdentifier) { } public void notifyScopingTopicAdded(TM topicMap,Scopeable scopeable,T scopingTopic) { } public void notifyScopingTopicRemoved(TM topicMap,Scopeable scopeable,T scopingTopic) { } /** Notifies this listener after an occurence has been created. Please note that, at the time of this call, this occurence has its properties, which are required to be set by TMDM, already set. This also implies <ul> <li> that this call represents the establishment of the occurence, </li> <li> that this call represents the establishment of the link between the occurence and its parent, </li> <li> that this call represents the establishment of the link between the occurence and its type. </li> </ul> */ public void notifyOccurenceCreated(TM topicMap,T topic,O occurence) { } /** Notifies this listener after an occurence has been removed from its topic. Please note that, at the time of this call, this occurence still has its properties, which are required to be set by TMDM, set. This also implies <ul> <li> that this call represents the destruction of the link between the occurence and its type, </li> <li> that this call represents the destruction of the link between the occurence and its parent, </li> <li> that this call represents the destruction of the occurence </li> </ul> even when parts of the destruction happen after this call. */ public void notifyOccurenceRemoved(TM topicMap,T topic,O occurence) { } public void notifyOccurenceTypeChanged(TM topicMap,T topic,O occurence,T oldType,T newType) { } public void notifyOccurenceDatatypeChanged(TM topicMap,T topic,O occurence,Locator oldDatatype,Locator newDatatype) { } public void notifyOccurenceValueChanged(TM topicMap,T topic,O occurence,String oldValue,String newValue) { } public void notifyVariantCreated(TM topicMap,T topic,TN topicName,V variant) { } public void notifyVariantRemoved(TM topicMap,T topic,TN topicName,V variant) { } public void notifyVariantDatatypeChanged(TM topicMap,T topic,TN topicName,V variant,Locator oldDatatype,Locator newDatatype) { } public void notifyVariantValueChanged(TM topicMap,T topic,TN topicName,V variant,String oldValue,String newValue) { } public void notifyTopicNameCreated(TM topicMap,T topic,TN topicName) { } public void notifyTopicNameRemoved(TM topicMap,T topic,TN topicName) { } public void notifyTopicNameTypeChanged(TM topicMap,T topic,TN topicName,T oldType,T newType) { } public void notifyTopicNameDatatypeChanged(TM topicMap,T topic,TN topicName,Locator oldDatatype,Locator newDatatype) { } public void notifyTopicNameValueChanged(TM topicMap,T topic,TN topicName,String oldValue,String newValue) { } public void notifyReificationUncouple(TM topicMap,T reifier,Reifiable reified) { } /** Notifies this listener after an occurence has been created. Please note that, at the time of this call, this occurence has its type already set. This also implies <ul> <li> that this call represents the establishment of the association, </li> <li> that this call represents the establishment of the link between the association and its parent, </li> <li> that this call represents the establishment of the link between the association and its type. </li> </ul> */ public void notifyAssociationCreated(TM topicMap,A association) { } public void notifyAssociationRemoved(TM topicMap,A association) { } public void notifyAssociationTypeChanged(TM topicMap,A association,T oldType,T newType) { } public void notifyAssociationRoleCreated(TM topicMap,A association,AR associationRole) { } public void notifyAssociationRoleRemoved(TM topicMap,A association,AR associationRole) { } public void notifyAssociationRoleTypeChanged(TM topicMap,A association,AR associationRole,T oldType,T newType) { } public void notifyAssociationRolePlayerChanged(TM topicMap,A association,AR associationRole,T oldPlayer,T newPlayer) { } public void notifyTopicsMerged(TM topicMap,T source0,T source1,T destination) { } public void notifyTopicSplitted(TM topicMap,T source,T destination0,T destination1) { } /** This method is called if a topic changed its identity. That is: everywhere where the old topic was used is now the new topic used. The new topic has also the same properties as the old topic (except regarding changes which are just in progress and the cause for the transition). Transitions may happen when a change of some topic property may lead to a split of one Topic into two Topics, but the actual split did not happen because of other reasons for the merged topic to remain merged. A listener which supports listening to split events (whe the old merged topic vanishes as well) should also be able support listening to non-split-events. As non-split-transitions are even simpler than split-transitions, it is deemed acceptable to leave the burden of handling non-splits (as some kind of identity transformation) at the event listener, not at the event source, as the event source may not be able to suppress non-split-transitions without significant overhead. */ public void notifyTopicTransitioned(TM topicMap,T source,T destination) { } public void notifyAssociationsMerged(TM topicMap,A source0,A source1,A destination) { } public void notifyAssociationSplitted(TM topicMap,A source,A destination0,A destination1) { } public void notifyAssociationRolesMerged(TM topicMap,AR source0,AR source1,AR destination) { } public void notifyAssociationRoleSplitted(TM topicMap,AR source,AR destination0,AR destination1) { } public void notifyOccurencesMerged(TM topicMap,O source0,O source1,O destination) { } public void notifyOccurenceSplitted(TM topicMap,O source,O destination0,O destination1) { } public void notifyTopicNamesMerged(TM topicMap,TN source0,TN source1,TN destination) { } public void notifyTopicNameSplitted(TM topicMap,TN source,TN destination0,TN destination1) { } public void notifyVariantsMerged(TM topicMap,V source0,V source1,V destination) { } public void notifyVariantSplitted(TM topicMap,V source,V destination0,V destination1) { } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: ReadableScope.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface ReadableScope { /** May return null, which represents the empty scope. */ public Set<? extends ReadableTopic> getScopingTopics(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: TopicMapEventListener.java.v0 --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; public interface TopicMapEventListener { /** Note that, at this stage, the topic may be "naked" (e.g. having no property set, not even an item identifier, which is in conflict to the TMDM-constraint "All topic items shall have a value for at least one of the [subject identifiers], [subject locators], and [item identifiers] properties that is not the empty set.".) */ public void notifyTopicCreated(TopicMap topicMap,Topic topic); /** Note that, at this stage, the topic may be "naked" (e.g. having no property set, not even an item identifier, which is in conflict to the TMDM-constraint "All topic items shall have a value for at least one of the [subject identifiers], [subject locators], and [item identifiers] properties that is not the empty set.".) */ public void notifyTopicRemoved(TopicMap topicMap,Topic topic); public void notifySubjectIdentifierAdded(TopicMap topicMap,Topic topic,Locator subjectIdentifier); public void notifySubjectIdentifierRemoved(TopicMap topicMap,Topic topic,Locator subjectIdentifier); public void notifySubjectLocatorAdded(TopicMap topicMap,Topic topic,Locator subjectLocator); public void notifySubjectLocatorRemoved(TopicMap topicMap,Topic topic,Locator subjectLocator); public void notifyItemIdentifierAdded(TopicMap topicMap,TopicMapConstruct topicMapConstruct,Locator itemIdentifier); public void notifyItemIdentifierRemoved(TopicMap topicMap,TopicMapConstruct topicMapConstruct,Locator itemIdentifier); public void notifyScopingTopicAdded(TopicMap topicMap,Scopeable scopeable,Topic scopingTopic); public void notifyScopingTopicRemoved(TopicMap topicMap,Scopeable scopeable,Topic scopingTopic); /** Notifies this listener after an occurence has been created. Please note that, at the time of this call, this occurence has its properties, which are required to be set by TMDM, already set. This also implies <ul> <li> that this call represents the establishment of the occurence, </li> <li> that this call represents the establishment of the link between the occurence and its parent, </li> <li> that this call represents the establishment of the link between the occurence and its type. </li> </ul> */ public void notifyOccurenceCreated(TopicMap topicMap,Topic topic,Occurence occurence); /** Notifies this listener after an occurence has been removed from its topic. Please note that, at the time of this call, this occurence still has its properties, which are required to be set by TMDM, set. This also implies <ul> <li> that this call represents the destruction of the link between the occurence and its type, </li> <li> that this call represents the destruction of the link between the occurence and its parent, </li> <li> that this call represents the destruction of the occurence </li> </ul> even when parts of the destruction happen after this call. */ public void notifyOccurenceRemoved(TopicMap topicMap,Topic topic,Occurence occurence); public void notifyOccurenceTypeChanged(TopicMap topicMap,Topic topic,Occurence occurence,Topic oldType,Topic newType); public void notifyOccurenceValueChanged(TopicMap topicMap,Topic topic,Occurence occurence,String oldValue,String newValue); public void notifyVariantCreated(TopicMap topicMap,Topic topic,TopicName topicName,Variant variant); public void notifyVariantRemoved(TopicMap topicMap,Topic topic,TopicName topicName,Variant variant); public void notifyVariantDatatypeChanged(TopicMap topicMap,Topic topic,TopicName topicName,Variant variant,Locator oldDatatype,Locator newDatatype); public void notifyVariantValueChanged(TopicMap topicMap,Topic topic,TopicName topicName,Variant variant,String oldValue,String newValue); public void notifyTopicNameCreated(TopicMap topicMap,Topic topic,TopicName topicName); public void notifyTopicNameRemoved(TopicMap topicMap,Topic topic,TopicName topicName); public void notifyTopicNameTypeChanged(TopicMap topicMap,Topic topic,TopicName topicName,Topic oldType,Topic newType); public void notifyTopicNameDatatypeChanged(TopicMap topicMap,Topic topic,TopicName topicName,Locator oldDatatype,Locator newDatatype); public void notifyTopicNameValueChanged(TopicMap topicMap,Topic topic,TopicName topicName,String oldValue,String newValue); public void notifyReificationUncouple(TopicMap topicMap,Topic reifier,Reifiable reified); /** Notifies this listener after an occurence has been created. Please note that, at the time of this call, this occurence has its type already set. This also implies <ul> <li> that this call represents the establishment of the association, </li> <li> that this call represents the establishment of the link between the association and its parent, </li> <li> that this call represents the establishment of the link between the association and its type. </li> </ul> */ public void notifyAssociationCreated(TopicMap topicMap,Association association); public void notifyAssociationRemoved(TopicMap topicMap,Association association); public void notifyAssociationTypeChanged(TopicMap topicMap,Association association,Topic oldType,Topic newType); public void notifyAssociationRoleCreated(TopicMap topicMap,Association association,AssociationRole associationRole); public void notifyAssociationRoleRemoved(TopicMap topicMap,Association association,AssociationRole associationRole); public void notifyAssociationRoleTypeChanged(TopicMap topicMap,Association association,AssociationRole associationRole,Topic oldType,Topic newType); public void notifyAssociationRolePlayerChanged(TopicMap topicMap,Association association,AssociationRole associationRole,Topic oldPlayer,Topic newPlayer); public void notifyTopicsMerged(TopicMap topicMap,Topic source0,Topic source1,Topic destination); public void notifyTopicSplitted(TopicMap topicMap,Topic source,Topic destination0,Topic destination1); /** This method is called if a topic changed its identity. That is: everywhere where the old topic was used is now the new topic used. The new topic has also the same properties as the old topic (except regarding changes which are just in progress and the cause for the transition). Transitions may happen when a change of some topic property may lead to a split of one Topic into two Topics, but the actual split did not happen because of other reasons for the merged topic to remain merged. A listener which supports listening to split events (whe the old merged topic vanishes as well) should also be able support listening to non-split-events. As non-split-transitions are even simpler than split-transitions, it is deemed acceptable to leave the burden of handling non-splits (as some kind of identity transformation) at the event listener, not at the event source, as the event source may not be able to suppress non-split-transitions without significant overhead. */ public void notifyTopicTransitioned(TopicMap topicMap,Topic source,Topic destination); public void notifyAssociationsMerged(TopicMap topicMap,Association source0,Association source1,Association destination); public void notifyAssociationSplitted(TopicMap topicMap,Association source,Association destination0,Association destination1); public void notifyAssociationRolesMerged(TopicMap topicMap,AssociationRole source0,AssociationRole source1,AssociationRole destination); public void notifyAssociationRoleSplitted(TopicMap topicMap,AssociationRole source,AssociationRole destination0,AssociationRole destination1); public void notifyOccurencesMerged(TopicMap topicMap,Occurence source0,Occurence source1,Occurence destination); public void notifyOccurenceSplitted(TopicMap topicMap,Occurence source,Occurence destination0,Occurence destination1); public void notifyTopicNamesMerged(TopicMap topicMap,TopicName source0,TopicName source1,TopicName destination); public void notifyTopicNameSplitted(TopicMap topicMap,TopicName source,TopicName destination0,TopicName destination1); public void notifyVariantsMerged(TopicMap topicMap,Variant source0,Variant source1,Variant destination); public void notifyVariantSplitted(TopicMap topicMap,Variant source,Variant destination0,Variant destination1); } // :tabSize=2:indentSize=2: --- NEW FILE: ReadableVariant.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface ReadableVariant extends ReadableScopeable { @TMDM public Locator getDatatype(); @TMDM @TMAPI public String getValue(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: Variant.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface Variant extends ReadableVariant,Scopeable { @TMDM public void setDatatype(Locator datatype); @TMDM public Locator getDatatype(); @TMDM @TMAPI public void setValue(String value); @TMDM @TMAPI public String getValue(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: TopicName.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface TopicName extends ReadableTopicName,Scopeable { @TMDM @TMAPI public void setType(Topic type); @TMDM @TMAPI public Topic getType(); @TMDM @TMAPI public void setValue(String value); @TMDM @TMAPI public String getValue(); /** FIXME: it is unclear wether we should expose this method in this interface. */ @TMDM public Topic getParent(); /* @TMDM public Variant createVariant(Locator datatype,String value); @TMDM public Set<? extends Variant> getVariants(); */ } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: ReadableOccurence.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface ReadableOccurence extends ReadableScopeable { @TMDM @TMAPI public Topic getType(); @TMDM public Locator getDatatype(); @TMDM @TMAPI public String getValue(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: TMDM.java --- package org.tm4j.topicmap.tmdm; /** Methods annotated with TMDM are there because the method implements a particular TMAPI interface. @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public @interface TMDM { } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: ReadableTopicMapConstruct.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface ReadableTopicMapConstruct { @TMDM public Set<Locator> getItemIdentifiers(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: TMAPI.java --- package org.tm4j.topicmap.tmdm; /** Methods annotated with TMAPI are there because the method implements a particular TMAPI interface. @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public @interface TMAPI { } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: AssociationRole.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface AssociationRole extends ReadableAssociationRole,Scopeable { @TMDM @TMAPI public void setType(Topic type); @TMDM @TMAPI public void setPlayer(Topic player); @TMDM @TMAPI public Topic getType(); @TMDM @TMAPI public Topic getPlayer(); @TMDM public Association getParent(); @TMAPI public Association getAssociation(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: Occurence.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface Occurence extends ReadableOccurence,Scopeable { @TMDM @TMAPI public void setType(Topic type); @TMDM @TMAPI public Topic getType(); @TMDM public void setDatatype(Locator datatype); @TMDM public Locator getDatatype(); @TMDM @TMAPI public void setValue(String value); @TMDM @TMAPI public String getValue(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: TopicMapConstruct.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface TopicMapConstruct extends ReadableTopicMapConstruct { @TMDM public boolean addItemIdentifier(Locator itemIdentifier) throws DuplicateItemIdentifierException; @TMDM public boolean removeItemIdentifier(Locator itemIdentifier); @TMDM public Set<Locator> getItemIdentifiers(); @TMAPI public void remove(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: Topic.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface Topic extends ReadableTopic,TopicMapConstruct { @TMDM @TMAPI public boolean addSubjectIdentifier(Locator subjectIdentifier); @TMDM @TMAPI public boolean removeSubjectIdentifier(Locator subjectIdentifier); @TMDM @TMAPI public Set<Locator> getSubjectIdentifiers(); //public void removeAllSubjectIdentifiers(); @TMDM @TMAPI public boolean addSubjectLocator(Locator subjectLocator); @TMDM @TMAPI public boolean removeSubjectLocator(Locator subjectLocator); @TMDM @TMAPI public Set<Locator> getSubjectLocators(); //public void removeAllSubjectLocators(); public TopicName createTopicName(String value,Scope scope); public TopicName createTopicName(String value,Topic type,Scope scope); @TMDM public Occurence createOccurence(Topic type,Locator datatype,String value); @TMDM public TopicMap getParent(); @TMAPI public TopicMap getTopicMap(); @TMDM public Set<? extends TopicName> getTopicNames(); @TMDM public Set<? extends AssociationRole> getRolesPlayed(); /* This conflicts with TMAPI 1.0 */ @TMDM public Reifiable getReified(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: TopicMap.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface TopicMap extends ReadableTopicMap,TopicMapConstruct,Reifiable { public Topic createTopic(); public Association createAssociation(Topic type); /** @param scope may be null. */ public Association createAssociation(Topic type,Scope scope); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: ReadableTopicMap.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface ReadableTopicMap extends ReadableReifiable { } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: NestedTransactionManaging.java --- package org.tm4j.topicmap.tmdm; import java.util.Properties; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.HashMap; import org.tm4j.net.LocatorFactory; import org.tm4j.net.Locator; import org.tm4j.topicmap.TopicMapProvider; import org.tm4j.topicmap.TopicMapProviderException; import org.tm4j.topicmap.TopicMapProviderBase; import org.tm4j.topicmap.ProviderTransaction; import org.tm4j.net.memory.LocatorFactoryImpl; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface NestedTransactionManaging { /** Called when a transaction may begin, if it has not already begun. The idea is: nestedTransactionBegin(); try { // do work nestedTransactionSuccess(); } finally { nestedTransactionEnd(); } */ public void nestedTransactionBegin(); /** Called when the transaction-part at this nesting level was successful. */ public void nestedTransactionSuccess(); /** Called in every case when leaving a transaction-nesting level. If called after nestTransactionSuccess(), the current sub-transaction is considered to be successful. If called after nestTransactionBegin() or after nestTransactionEnd(), the current sub-transaction is considered to be not successful. */ public void nestedTransactionEnd(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: Reifiable.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface Reifiable extends ReadableReifiable,TopicMapConstruct { public Topic getReifier(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: --- NEW FILE: ReadableScopeable.java --- package org.tm4j.topicmap.tmdm; import java.util.Set; import org.tm4j.net.Locator; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public interface ReadableScopeable extends ReadableReifiable { /** May return null, representing the empty scope. */ @TMDM public ReadableScope getScope(); } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. Th... [truncated message content] |
From: Xuan B. <med...@us...> - 2008-01-21 11:13:44
|
Update of /cvsroot/tm4j/tm4j In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27256 Modified Files: build.xml Log Message: This change introduces the new TMDM (re-)implementation towards TM4J 2.0. It consists of about 430KB, 9900 lines of code. It is written by Xuan Baldauf and depends on the package baldauf-common. Index: build.xml =================================================================== RCS file: /cvsroot/tm4j/tm4j/build.xml,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -d -r1.142 -r1.143 *** build.xml 21 Jan 2008 09:09:16 -0000 1.142 --- build.xml 21 Jan 2008 11:13:44 -0000 1.143 *************** *** 726,729 **** --- 726,733 ---- <include name="org/tm4j/topicmap/memory/index/*.java"/> <include name="org/tm4j/topicmap/unified/**/*.java"/> + <include name="org/tm4j/topicmap/tmdm/**/*.java"/> + <!-- For now, do not enable JDO support, as JDO support requires a whole bunch of dependencies --> + <exclude name="org/tm4j/topicmap/tmdm/jdo/**"/> + <!-- The following packages can only be built after all backends are built --> <exclude name="org/tm4j/topicmap/index/test/*.java"/> *************** *** 753,756 **** --- 757,761 ---- <include name="org/tm4j/topicmap/memory/index/*.class"/> <include name="org/tm4j/topicmap/unified/**/*.class"/> + <include name="org/tm4j/topicmap/tmdm/**/*.class"/> </patternset> |
From: Xuan B. <med...@us...> - 2008-01-21 11:13:44
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/utils In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27256/src/org/tm4j/topicmap/utils Added Files: package.jdo Log Message: This change introduces the new TMDM (re-)implementation towards TM4J 2.0. It consists of about 430KB, 9900 lines of code. It is written by Xuan Baldauf and depends on the package baldauf-common. --- NEW FILE: package.jdo --- <?xml version="1.0"?> <!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd"> <jdo> <package name="org.tm4j.topicmap.utils"> <class name="IDGeneratorImpl" /> </package> </jdo> |
From: Xuan B. <med...@us...> - 2008-01-21 11:13:44
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/net In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27256/src/org/tm4j/net Added Files: package.jdo Log Message: This change introduces the new TMDM (re-)implementation towards TM4J 2.0. It consists of about 430KB, 9900 lines of code. It is written by Xuan Baldauf and depends on the package baldauf-common. --- NEW FILE: package.jdo --- <?xml version="1.0"?> <!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN" "http://java.sun.com/dtd/jdo_2_0.dtd"> <jdo> <package name="org.tm4j.net"> <class name="LocatorBase" /> <class name="LocatorFactoryBase" /> </package> </jdo> |
From: Xuan B. <med...@us...> - 2008-01-21 11:13:44
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/util In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27256/src/org/tm4j/topicmap/tmdm/util Added Files: ListenerDispatcher.java Log Message: This change introduces the new TMDM (re-)implementation towards TM4J 2.0. It consists of about 430KB, 9900 lines of code. It is written by Xuan Baldauf and depends on the package baldauf-common. --- NEW FILE: ListenerDispatcher.java --- package org.tm4j.topicmap.tmdm.util; import java.lang.reflect.Proxy; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; /** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ public class ListenerDispatcher<T> { protected ArrayList<T> clientListeners; protected T serverListener; public ListenerDispatcher(Class<T> listenerInterface,Collection<T> clientListeners) { clientListeners = new ArrayList<T>(clientListeners); serverListener = (T) Proxy.newProxyInstance(ListenerDispatcher.class.getClassLoader(),new Class<?>[] { listenerInterface },new InvocationHandler() { public Object invoke(Object proxy, Method method, Object[] args) throws IllegalAccessException,InvocationTargetException { for (T clientListener : ListenerDispatcher.this.clientListeners) { Object result = method.invoke(clientListener,args); // throw away the result } return null; // always return null } }); } public T getServerListener() { return serverListener; } } /* Copyright (c) 2007-2008 Xuân Baldauf. This software is licensed, under the terms of * Apache 2 License * GPL v2 License * GPL v3 License * LGPL v2.1 License * MPL v1.1 License as well as each later version of these licenses. This means: (1) If you are using this software, you can choose any subset of the licenses mentioned, and you can choose any version of each of these licenses (starting with the respective version indicated). (Note that, however, choosing the empty set of licenses means that you do not have any right granted by any license at all.) (2) If you are committing contributions to this software (i.e. this software as part of the official TM4J sourcecode), then you agree to each of these licenses for your contribution (such that each user of this software has still at least the same set of rights and licenses when using this software together with you contribution compared to when using this software without your contribution). */ // :tabSize=2:indentSize=2: |
From: Xuan B. <med...@us...> - 2008-01-21 10:57:47
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/basic In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19826/src/org/tm4j/topicmap/tmdm/basic Log Message: Directory /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/basic added to the repository |
From: Xuan B. <med...@us...> - 2008-01-21 10:57:47
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/merged In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19826/src/org/tm4j/topicmap/tmdm/merged Log Message: Directory /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/merged added to the repository |
From: Xuan B. <med...@us...> - 2008-01-21 10:57:46
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1 In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19826/src/org/tm4j/topicmap/tmdm/tm4j1 Log Message: Directory /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1 added to the repository |
From: Xuan B. <med...@us...> - 2008-01-21 10:57:46
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/util In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19826/src/org/tm4j/topicmap/tmdm/util Log Message: Directory /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/util added to the repository |
From: Xuan B. <med...@us...> - 2008-01-21 10:57:46
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/jdo In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19826/src/org/tm4j/topicmap/tmdm/jdo Log Message: Directory /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/jdo added to the repository |
From: Xuan B. <med...@us...> - 2008-01-21 10:57:31
|
Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19766/src/org/tm4j/topicmap/tmdm Log Message: Directory /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm added to the repository |
From: Xuan B. <med...@us...> - 2008-01-21 09:09:14
|
Update of /cvsroot/tm4j/tm4j In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv3842 Modified Files: build.xml Log Message: Make it easy to enable debugging for tmapi-test. Index: build.xml =================================================================== RCS file: /cvsroot/tm4j/tm4j/build.xml,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** build.xml 21 Jan 2008 09:02:49 -0000 1.141 --- build.xml 21 Jan 2008 09:09:16 -0000 1.142 *************** *** 1652,1655 **** --- 1652,1658 ---- </classpath> <formatter type="plain"/> + <!-- + <jvmarg value="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y"/> + --> <jvmarg value="-Dtestdir=resource/tests/"/> <jvmarg value="-Dbackends=${backends}"/> |
From: Xuan B. <med...@us...> - 2008-01-21 09:02:54
|
Update of /cvsroot/tm4j/tm4j In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv378 Modified Files: build.xml Log Message: Indent build.xml according to indentation standard. Index: build.xml =================================================================== RCS file: /cvsroot/tm4j/tm4j/build.xml,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** build.xml 21 Jan 2008 08:56:31 -0000 1.140 --- build.xml 21 Jan 2008 09:02:49 -0000 1.141 *************** *** 835,839 **** <copy todir="${classdir}"> <fileset dir="src"> ! <patternset refid="tm4j.resources"/> </fileset> </copy> --- 835,839 ---- <copy todir="${classdir}"> <fileset dir="src"> ! <patternset refid="tm4j.resources"/> </fileset> </copy> *************** *** 846,851 **** <delete> <fileset dir="${classdir}"> ! <patternset refid="tm4j.classes"/> ! <patternset refid="tm4j.resources"/> </fileset> </delete> --- 846,851 ---- <delete> <fileset dir="${classdir}"> ! <patternset refid="tm4j.classes"/> ! <patternset refid="tm4j.resources"/> </fileset> </delete> *************** *** 859,863 **** <delete> <fileset dir="${classdir}"> ! <patternset refid="tm4j.test.classes"/> </fileset> </delete> --- 859,863 ---- <delete> <fileset dir="${classdir}"> ! <patternset refid="tm4j.test.classes"/> </fileset> </delete> *************** *** 870,875 **** <junit printsummary="yes" fork="yes" showoutput="yes"> <classpath> ! <pathelement location="build/classes/"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> --- 870,875 ---- <junit printsummary="yes" fork="yes" showoutput="yes"> <classpath> ! <pathelement location="build/classes/"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> *************** *** 889,894 **** <junit printsummary="yes" fork="yes"> <classpath> ! <pathelement location="build/classes/"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> --- 889,894 ---- <junit printsummary="yes" fork="yes"> <classpath> ! <pathelement location="build/classes/"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> *************** *** 908,913 **** <junit printsummary="yes" fork="yes"> <classpath> ! <pathelement location="build/classes/"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> --- 908,913 ---- <junit printsummary="yes" fork="yes"> <classpath> ! <pathelement location="build/classes/"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> *************** *** 928,933 **** <junit printsummary="yes" fork="yes"> <classpath> ! <pathelement location="build/classes"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> --- 928,933 ---- <junit printsummary="yes" fork="yes"> <classpath> ! <pathelement location="build/classes"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> *************** *** 968,973 **** <junit printsummary="yes" fork="yes"> <classpath> ! <pathelement location="build/classes"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> --- 968,973 ---- <junit printsummary="yes" fork="yes"> <classpath> ! <pathelement location="build/classes"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> *************** *** 989,996 **** <condition property="buildfiletest.available"> <available classname="org.apache.tools.ant.BuildFileTest"> ! <classpath> ! <pathelement location="build/classes"/> ! <path refid="test.class.path"/> ! </classpath> </available> </condition> --- 989,996 ---- <condition property="buildfiletest.available"> <available classname="org.apache.tools.ant.BuildFileTest"> ! <classpath> ! <pathelement location="build/classes"/> ! <path refid="test.class.path"/> ! </classpath> </available> </condition> *************** *** 1005,1010 **** <junit printsummary="yes" fork="yes" showoutput="yes"> <classpath> ! <pathelement location="build/classes"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> --- 1005,1010 ---- <junit printsummary="yes" fork="yes" showoutput="yes"> <classpath> ! <pathelement location="build/classes"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> *************** *** 1042,1046 **** <copy todir="${classdir}"> <fileset dir="src"> ! <include name="org/tm4j/ant/dbtasks/antlib.xml"/> </fileset> </copy> --- 1042,1046 ---- <copy todir="${classdir}"> <fileset dir="src"> ! <include name="org/tm4j/ant/dbtasks/antlib.xml"/> </fileset> </copy> *************** *** 1054,1061 **** <jar jarfile="${dist}/lib/tm4j-${version}.jar"> <fileset dir="${classdir}"> ! <patternset refid="tm4j.classes"/> ! <patternset refid="tm4j.net.classes"/> ! <patternset refid="tm4j.resources"/> ! <include name="log4j.properties"/> </fileset> </jar> --- 1054,1061 ---- <jar jarfile="${dist}/lib/tm4j-${version}.jar"> <fileset dir="${classdir}"> ! <patternset refid="tm4j.classes"/> ! <patternset refid="tm4j.net.classes"/> ! <patternset refid="tm4j.resources"/> ! <include name="log4j.properties"/> </fileset> </jar> *************** *** 1069,1074 **** <jar jarfile="${dist}/lib/tm4j-anttasks-${version}.jar"> <fileset dir="${classdir}"> ! <patternset refid="tm4j.anttasks.classes"/> ! <include name="log4j.properties"/> </fileset> </jar> --- 1069,1074 ---- <jar jarfile="${dist}/lib/tm4j-anttasks-${version}.jar"> <fileset dir="${classdir}"> ! <patternset refid="tm4j.anttasks.classes"/> ! <include name="log4j.properties"/> </fileset> </jar> *************** *** 1082,1087 **** <jar jarfile="${dist}/lib/tm4j-antdbtasks-${version}.jar"> <fileset dir="${classdir}"> ! <patternset refid="tm4j.antdbtasks.classes"/> ! <include name="log4j.properties"/> </fileset> </jar> --- 1082,1087 ---- <jar jarfile="${dist}/lib/tm4j-antdbtasks-${version}.jar"> <fileset dir="${classdir}"> ! <patternset refid="tm4j.antdbtasks.classes"/> ! <include name="log4j.properties"/> </fileset> </jar> *************** *** 1151,1164 **** <junit printsummary="yes" fork="yes"> <classpath> ! <pathelement location="build/classes/"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> <jvmarg value="-Dtestdir=${test.resource.dir}"/> <batchtest fork="yes" todir="resource/testoutput"> ! <fileset dir="src"> ! <include name="org/tm4j/net/test/**/*Test.java"/> ! <exclude name="org/tm4j/net/ozone/test/**/*Test.java"/> ! </fileset> </batchtest> <assertions> --- 1151,1164 ---- <junit printsummary="yes" fork="yes"> <classpath> ! <pathelement location="build/classes/"/> ! <path refid="test.class.path"/> </classpath> <formatter type="plain"/> <jvmarg value="-Dtestdir=${test.resource.dir}"/> <batchtest fork="yes" todir="resource/testoutput"> ! <fileset dir="src"> ! <include name="org/tm4j/net/test/**/*Test.java"/> ! <exclude name="org/tm4j/net/ozone/test/**/*Test.java"/> ! </fileset> </batchtest> <assertions> *************** *** 1175,1179 **** <delete> <fileset dir="${classdir}"> ! <include name="org/tm4j/net/**/*.class"/> </fileset> </delete> --- 1175,1179 ---- <delete> <fileset dir="${classdir}"> ! <include name="org/tm4j/net/**/*.class"/> </fileset> </delete> *************** *** 1187,1191 **** <delete> <fileset dir="${classdir}"> ! <patternset refid="tm4j.anttasks.classes"/> </fileset> </delete> --- 1187,1191 ---- <delete> <fileset dir="${classdir}"> ! <patternset refid="tm4j.anttasks.classes"/> </fileset> </delete> *************** *** 1199,1203 **** <delete> <fileset dir="${classdir}"> ! <patternset refid="tm4j.antdbtasks.classes"/> </fileset> </delete> --- 1199,1203 ---- <delete> <fileset dir="${classdir}"> ! <patternset refid="tm4j.antdbtasks.classes"/> </fileset> </delete> *************** *** 1310,1326 **** <!-- compile all the previously generated proxies --> ! <javac srcdir="${srcdir}" ! classpathref="ozone.project.classpath" ! destdir="${classdir}" ! includes="org/tm4j/topicmap/ozone/*_Proxy.java, ! org/tm4j/topicmap/ozone/index/*_Proxy.java" ! deprecation="${build.deprecation}" ! debug="${build.debug}"> </javac> </target> <target name="ozone-jar" depends="ozone-build"> ! <jar jarfile="${dist}/lib/tm4ozone-${version}.jar" ! basedir="${classdir}"> <patternset refid="ozone.classes"/> <patternset refid="ozone.net.classes"/> --- 1310,1326 ---- <!-- compile all the previously generated proxies --> ! <javac srcdir="${srcdir}" ! classpathref="ozone.project.classpath" ! destdir="${classdir}" ! includes="org/tm4j/topicmap/ozone/*_Proxy.java, ! org/tm4j/topicmap/ozone/index/*_Proxy.java" ! deprecation="${build.deprecation}" ! debug="${build.debug}"> </javac> </target> <target name="ozone-jar" depends="ozone-build"> ! <jar jarfile="${dist}/lib/tm4ozone-${version}.jar" ! basedir="${classdir}"> <patternset refid="ozone.classes"/> <patternset refid="ozone.net.classes"/> *************** *** 1406,1412 **** <!-- compile only the implementation --> <target name="ozone-net-base" depends="tm4j-build, tm4j-net-build"> ! <javac srcdir="src" ! classpathref="ozone.project.classpath" ! destdir="${classdir}" deprecation="${build.deprecation}" debug="${build.debug}" --- 1406,1412 ---- <!-- compile only the implementation --> <target name="ozone-net-base" depends="tm4j-build, tm4j-net-build"> ! <javac srcdir="src" ! classpathref="ozone.project.classpath" ! destdir="${classdir}" deprecation="${build.deprecation}" debug="${build.debug}" *************** *** 1421,1426 **** <property name="net.proxies" value=" org.tm4j.net.ozone.OzoneLocatorBase ! org.tm4j.net.ozone.OzoneLocatorFactoryImpl ! org.tm4j.net.ozone.OzoneURILocatorImpl "/> --- 1421,1426 ---- <property name="net.proxies" value=" org.tm4j.net.ozone.OzoneLocatorBase ! org.tm4j.net.ozone.OzoneLocatorFactoryImpl ! org.tm4j.net.ozone.OzoneURILocatorImpl "/> *************** *** 1574,1587 **** <sysproperty key="backends" value="${backends}"/> <classpath> ! <fileset dir="lib"> ! <include name="**/*.jar"/> ! </fileset> ! <pathelement location="${classdir}"/> </classpath> <formatter type="plain"/> <!-- Tests --> <!-- test name="org.tm4j.topicmap.hibernate.test.HibernateProviderTest" ! outfile="testresult"/--> ! <test name="org.tm4j.topicmap.hibernate.utils.DataObjectWalkerTest" outfile="testresult"/> <assertions> <enable/> --- 1574,1587 ---- <sysproperty key="backends" value="${backends}"/> <classpath> ! <fileset dir="lib"> ! <include name="**/*.jar"/> ! </fileset> ! <pathelement location="${classdir}"/> </classpath> <formatter type="plain"/> <!-- Tests --> <!-- test name="org.tm4j.topicmap.hibernate.test.HibernateProviderTest" ! outfile="testresult"/--> ! <test name="org.tm4j.topicmap.hibernate.utils.DataObjectWalkerTest" outfile="testresult"/> <assertions> <enable/> *************** *** 1618,1622 **** <copy todir="build/classes"> <fileset dir="src"> ! <include name="META-INF/**"/> </fileset> </copy> --- 1618,1622 ---- <copy todir="build/classes"> <fileset dir="src"> ! <include name="META-INF/**"/> </fileset> </copy> *************** *** 1632,1636 **** <patternset refid="tmapi.classes"/> <fileset dir="src"> ! <patternset refid="tm4j.manifest"/> </fileset> </jar> --- 1632,1636 ---- <patternset refid="tmapi.classes"/> <fileset dir="src"> ! <patternset refid="tm4j.manifest"/> </fileset> </jar> *************** *** 1695,1699 **** <!--fileset dir="src/org/tm4j/tolog/parser" includes="**/Simple*.java"/--> <fileset dir="src"> ! <patternset refid="tolog.generated"/> </fileset> </delete> --- 1695,1699 ---- <!--fileset dir="src/org/tm4j/tolog/parser" includes="**/Simple*.java"/--> <fileset dir="src"> ! <patternset refid="tolog.generated"/> </fileset> </delete> *************** *** 1822,1826 **** <copy todir="build/classes"> <fileset dir="src"> ! <patternset refid="tmc.res"/> </fileset> </copy> --- 1822,1826 ---- <copy todir="build/classes"> <fileset dir="src"> ! <patternset refid="tmc.res"/> </fileset> </copy> *************** *** 1842,1847 **** <delete> <fileset dir="build/classes"> ! <patternset refid="tmc.classes"/> ! <patternset refid="tmc.res"/> </fileset> </delete> --- 1842,1847 ---- <delete> <fileset dir="build/classes"> ! <patternset refid="tmc.classes"/> ! <patternset refid="tmc.res"/> </fileset> </delete> *************** *** 1906,1916 **** <java classname="org.apache.fop.apps.Fop" fork="yes"> <classpath> ! <fileset dir="${fop.dir}"> ! <patternset> ! <include name="lib/*.jar"/> ! <include name="build/*.jar" if="fop.build.dir"/> ! <include name="*.jar" unless="fop.build.dir"/> ! </patternset> ! </fileset> </classpath> <arg line="-c ${fop.dir}/conf/userconfig.xml -fo docs/src/admintool/admintool.fo -pdf docs/admintool.pdf"/> --- 1906,1916 ---- <java classname="org.apache.fop.apps.Fop" fork="yes"> <classpath> ! <fileset dir="${fop.dir}"> ! <patternset> ! <include name="lib/*.jar"/> ! <include name="build/*.jar" if="fop.build.dir"/> ! <include name="*.jar" unless="fop.build.dir"/> ! </patternset> ! </fileset> </classpath> <arg line="-c ${fop.dir}/conf/userconfig.xml -fo docs/src/admintool/admintool.fo -pdf docs/admintool.pdf"/> *************** *** 1936,1943 **** property="prefix.resolver.available"/> <fail unless="prefix.resolver.available" ! message="Could not find required Xalan class org.apache.xml.utils.PrefixResolver. ! JDK 1.3 users must download Xalan and include xalan.jar in the lib directory."/> <javac srcdir="src" destdir="build/classes" ! classpathref="project.class.path"> <patternset refid="xalanutils.sources"/> </javac> --- 1936,1943 ---- property="prefix.resolver.available"/> <fail unless="prefix.resolver.available" ! message="Could not find required Xalan class org.apache.xml.utils.PrefixResolver. ! JDK 1.3 users must download Xalan and include xalan.jar in the lib directory."/> <javac srcdir="src" destdir="build/classes" ! classpathref="project.class.path"> <patternset refid="xalanutils.sources"/> </javac> *************** *** 1945,1950 **** <target name="xalanutils-jar" depends="xalanutils-build,init" > ! <jar jarfile="build/lib/tm4j-xalanutils-${version}.jar" ! basedir="build/classes"> <patternset refid="xalanutils.classes"/> </jar> --- 1945,1950 ---- <target name="xalanutils-jar" depends="xalanutils-build,init" > ! <jar jarfile="build/lib/tm4j-xalanutils-${version}.jar" ! basedir="build/classes"> <patternset refid="xalanutils.classes"/> </jar> *************** *** 1954,1958 **** <delete> <fileset dir="build/classes"> ! <patternset refid="xalanutils.classes"/> </fileset> </delete> --- 1954,1958 ---- <delete> <fileset dir="build/classes"> ! <patternset refid="xalanutils.classes"/> </fileset> </delete> *************** *** 2015,2019 **** <target name="import-performance-tests" unless="profile"> <java fork="yes" classname="org.tm4j.topicmap.test.perf.PerformanceTester" ! maxmemory="512M" classpathref="test.class.path"> <jvmarg value="-Dbackend=${backend}"/> <jvmarg value="-Dprops=resource/performance/test.properties"/> --- 2015,2019 ---- <target name="import-performance-tests" unless="profile"> <java fork="yes" classname="org.tm4j.topicmap.test.perf.PerformanceTester" ! maxmemory="512M" classpathref="test.class.path"> <jvmarg value="-Dbackend=${backend}"/> <jvmarg value="-Dprops=resource/performance/test.properties"/> *************** *** 2024,2028 **** <target name="import-performance-tests-profile" if="profile"> <java fork="yes" classname="org.tm4j.topicmap.test.perf.PerformanceTester" ! maxmemory="512M" classpathref="test.class.path"> <jvmarg value="-Dbackend=${backend}"/> <jvmarg value="-Dprops=resource/performance/test.properties"/> --- 2024,2028 ---- <target name="import-performance-tests-profile" if="profile"> <java fork="yes" classname="org.tm4j.topicmap.test.perf.PerformanceTester" ! maxmemory="512M" classpathref="test.class.path"> <jvmarg value="-Dbackend=${backend}"/> <jvmarg value="-Dprops=resource/performance/test.properties"/> *************** *** 2034,2038 **** <target name="deletion-performance-tests" unless="profile"> <java fork="yes" classname="org.tm4j.topicmap.test.perf.PerformanceTester" ! maxmemory="512M" classpathref="test.class.path"> <jvmarg value="-Dbackend=${backend}"/> <jvmarg value="-Dprops=resource/performance/test.properties"/> --- 2034,2038 ---- <target name="deletion-performance-tests" unless="profile"> <java fork="yes" classname="org.tm4j.topicmap.test.perf.PerformanceTester" ! maxmemory="512M" classpathref="test.class.path"> <jvmarg value="-Dbackend=${backend}"/> <jvmarg value="-Dprops=resource/performance/test.properties"/> *************** *** 2043,2047 **** <target name="deletion-performance-tests-profile" if="profile"> <java fork="yes" classname="org.tm4j.topicmap.test.perf.PerformanceTester" ! maxmemory="512M" classpathref="test.class.path"> <jvmarg value="-Dbackend=${backend}"/> <jvmarg value="-Dprops=resource/performance/test.properties"/> --- 2043,2047 ---- <target name="deletion-performance-tests-profile" if="profile"> <java fork="yes" classname="org.tm4j.topicmap.test.perf.PerformanceTester" ! maxmemory="512M" classpathref="test.class.path"> <jvmarg value="-Dbackend=${backend}"/> <jvmarg value="-Dprops=resource/performance/test.properties"/> *************** *** 2053,2057 **** <target name="walker-performance-tests" unless="profile"> <java fork="yes" classname="org.tm4j.topicmap.test.perf.PerformanceTester" ! maxmemory="512M" classpathref="test.class.path"> <jvmarg value="-Dbackend=${backend}"/> <jvmarg value="-Dprops=resource/performance/test.properties"/> --- 2053,2057 ---- <target name="walker-performance-tests" unless="profile"> <java fork="yes" classname="org.tm4j.topicmap.test.perf.PerformanceTester" ! maxmemory="512M" classpathref="test.class.path"> <jvmarg value="-Dbackend=${backend}"/> <jvmarg value="-Dprops=resource/performance/test.properties"/> *************** *** 2062,2066 **** <target name="walker-performance-tests-profile" if="profile"> <java fork="yes" classname="org.tm4j.topicmap.test.perf.PerformanceTester" ! maxmemory="512M" classpathref="test.class.path"> <jvmarg value="-Dbackend=${backend}"/> <jvmarg value="-Dprops=resource/performance/test.properties"/> --- 2062,2066 ---- <target name="walker-performance-tests-profile" if="profile"> <java fork="yes" classname="org.tm4j.topicmap.test.perf.PerformanceTester" ! maxmemory="512M" classpathref="test.class.path"> <jvmarg value="-Dbackend=${backend}"/> <jvmarg value="-Dprops=resource/performance/test.properties"/> *************** *** 2071,2083 **** <target name="eclipse" description="Generates project files for the Eclipse IDE." ! depends="tm4j-build,tm4j-anttasks-build"> ! <taskdef name="eclipse" ! classname="org.tm4j.ant.taskdefs.EclipseProjectTask" ! classpathref="project.class.path"/> ! <eclipse destdir="${basedir}" ! output="${classdir}" ! backup="true"> <classpath> <path refid="project.class.path"/> --- 2071,2083 ---- <target name="eclipse" description="Generates project files for the Eclipse IDE." ! depends="tm4j-build,tm4j-anttasks-build"> ! <taskdef name="eclipse" ! classname="org.tm4j.ant.taskdefs.EclipseProjectTask" ! classpathref="project.class.path"/> ! <eclipse destdir="${basedir}" ! output="${classdir}" ! backup="true"> <classpath> <path refid="project.class.path"/> *************** *** 2089,2094 **** </src> </eclipse> ! ! </target> <!-- ================================================ --> --- 2089,2093 ---- </src> </eclipse> ! </target> <!-- ================================================ --> *************** *** 2102,2107 **** </antlr> <javac srcdir="src" destdir="build/classes" ! classpathref="project.class.path" ! debug="true"> <include name="org/tm4j/tologx/**/*.java"/> </javac> --- 2101,2106 ---- </antlr> <javac srcdir="src" destdir="build/classes" ! classpathref="project.class.path" ! debug="true"> <include name="org/tm4j/tologx/**/*.java"/> </javac> |
From: Xuan B. <med...@us...> - 2008-01-21 08:56:29
|
Update of /cvsroot/tm4j/tm4j In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv30014 Modified Files: build.xml Log Message: Set build.xml indentation standard. Index: build.xml =================================================================== RCS file: /cvsroot/tm4j/tm4j/build.xml,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -d -r1.139 -r1.140 *** build.xml 21 Jan 2008 08:54:22 -0000 1.139 --- build.xml 21 Jan 2008 08:56:31 -0000 1.140 *************** *** 2135,2136 **** --- 2135,2137 ---- </target> </project> + <!-- :indentSize=2:tabSize=2: --> |
From: Xuan B. <med...@us...> - 2008-01-21 08:54:18
|
Update of /cvsroot/tm4j/tm4j In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29086 Modified Files: build.xml Log Message: Set debug options more fine-grained. Index: build.xml =================================================================== RCS file: /cvsroot/tm4j/tm4j/build.xml,v retrieving revision 1.138 retrieving revision 1.139 diff -C2 -d -r1.138 -r1.139 *** build.xml 21 Jan 2008 08:51:38 -0000 1.138 --- build.xml 21 Jan 2008 08:54:22 -0000 1.139 *************** *** 827,831 **** destdir="${classdir}" deprecation="${build.deprecation}" ! debug="${build.debug}"> <patternset refid="tm4j.sources"/> </javac> --- 827,834 ---- destdir="${classdir}" deprecation="${build.deprecation}" ! debug="${build.debug}" ! debuglevel="source,lines,vars" ! > ! <!-- The debuglevel restriction is currently needed to workaround BCEL bugs. BCEL does not accept .class files with generic types in method signatures. --> <patternset refid="tm4j.sources"/> </javac> |
From: Xuan B. <med...@us...> - 2008-01-21 08:51:40
|
Update of /cvsroot/tm4j/tm4j In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27714 Modified Files: build.xml Log Message: Document "tm4j-test" ant target. Index: build.xml =================================================================== RCS file: /cvsroot/tm4j/tm4j/build.xml,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** build.xml 21 Jul 2007 23:17:33 -0000 1.137 --- build.xml 21 Jan 2008 08:51:38 -0000 1.138 *************** *** 94,97 **** --- 94,98 ---- <echo message=" distrib-all --> generates the TM4J source and binary distributions"/> <echo message=" clean-all --> cleans up all compiled classes"/> + <echo message=" tm4j-test --> runs tests on TM4J"/> <echo message=" usage --> show this message (default)"/> <echo message=""/> |