You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
(48) |
May
(21) |
Jun
(3) |
Jul
(10) |
Aug
(66) |
Sep
(11) |
Oct
(7) |
Nov
(73) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(3) |
Feb
(17) |
Mar
(19) |
Apr
(1) |
May
(4) |
Jun
|
Jul
(43) |
Aug
(18) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
|
2010 |
Jan
(3) |
Feb
(7) |
Mar
(21) |
Apr
(2) |
May
(1) |
Jun
(1) |
Jul
(6) |
Aug
(6) |
Sep
(7) |
Oct
|
Nov
(1) |
Dec
|
2011 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <lh...@us...> - 2008-04-20 15:34:45
|
Revision: 18 http://tinytim.svn.sourceforge.net/tinytim/?rev=18&view=rev Author: lheuer Date: 2008-04-20 08:21:48 -0700 (Sun, 20 Apr 2008) Log Message: ----------- - Added locator impl - Removed unnecessary generics from _topicmaps initialization Modified Paths: -------------- tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java Added Paths: ----------- tinytim/trunk/main/java/org/tinytim/IRI.java Added: tinytim/trunk/main/java/org/tinytim/IRI.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/IRI.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/IRI.java 2008-04-20 15:21:48 UTC (rev 18) @@ -0,0 +1,97 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import java.net.URI; + +import org.tmapi.core.Locator; + +/** + * Immutable representation of an IRI. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public final class IRI implements Locator { + + private final URI _uri; + + public IRI(String reference) { + this(URI.create(reference)); + } + + private IRI(URI uri) { + _uri = uri; + } + + /* (non-Javadoc) + * @see org.tmapi.core.Locator#getNotation() + */ + public String getNotation() { + return "URI"; + } + + /* (non-Javadoc) + * @see org.tmapi.core.Locator#getReference() + */ + public String getReference() { + return _uri.toString(); + } + + /* (non-Javadoc) + * @see org.tmapi.core.Locator#resolveRelative(java.lang.String) + */ + public Locator resolveRelative(String reference) { + return new IRI(_uri.resolve(reference)); + } + + /* (non-Javadoc) + * @see org.tmapi.core.Locator#toExternalForm() + */ + public String toExternalForm() { + return _uri.toASCIIString(); + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + return this == obj || (obj instanceof IRI && _uri.equals(((IRI) obj)._uri)); + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return _uri.hashCode(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return _uri.toString(); + } + +} Property changes on: tinytim/trunk/main/java/org/tinytim/IRI.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Modified: tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java 2008-04-20 15:11:15 UTC (rev 17) +++ tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java 2008-04-20 15:21:48 UTC (rev 18) @@ -34,7 +34,7 @@ * {@link org.tmapi.core.TopicMapSystem} implementation. * * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> - * @version $Rev:$ - $Date:$ + * @version $Rev$ - $Date$ */ final class TopicMapSystemImpl implements TopicMapSystem { @@ -48,7 +48,7 @@ _collectionFactory = collFactory; _features = features; _properties = properties; - _topicMaps = collFactory.<Locator, TopicMap>createMap(); + _topicMaps = collFactory.createMap(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-20 15:33:35
|
Revision: 19 http://tinytim.svn.sourceforge.net/tinytim/?rev=19&view=rev Author: lheuer Date: 2008-04-20 08:30:50 -0700 (Sun, 20 Apr 2008) Log Message: ----------- Initial (partially) import of the index package Added Paths: ----------- tinytim/trunk/main/java/org/tinytim/index/ tinytim/trunk/main/java/org/tinytim/index/IIndex.java tinytim/trunk/main/java/org/tinytim/index/IScopedIndex.java tinytim/trunk/main/java/org/tinytim/index/ITypeInstanceIndex.java tinytim/trunk/main/java/org/tinytim/index/IndexFlagsImpl.java Added: tinytim/trunk/main/java/org/tinytim/index/IIndex.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/index/IIndex.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/index/IIndex.java 2008-04-20 15:30:50 UTC (rev 19) @@ -0,0 +1,57 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim.index; + +/** + * Simplified interface for indexes. + * + * Copied from the TMAPIX-project. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public interface IIndex { + + /** + * Returns if this index is automatically kept in sync. with the + * topic map values. + * + * @return <code>true</code> if the index synchronizes itself with the + * underlying topic map, otherwise <code>false</code> + */ + public boolean isAutoUpdated(); + + /** + * Resynchronizes this index with the data in the topic map. + * + * Indexes that are automatically kept in sync should ignore this. + */ + public void reindex(); + + /** + * Closes the index. + * + * This operation is optional but useful to release resources. + * After closing the index must not be used further. + */ + public void close(); + +} Property changes on: tinytim/trunk/main/java/org/tinytim/index/IIndex.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/index/IScopedIndex.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/index/IScopedIndex.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/index/IScopedIndex.java 2008-04-20 15:30:50 UTC (rev 19) @@ -0,0 +1,79 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim.index; + +import java.util.Collection; + +import org.tinytim.AssociationImpl; +import org.tinytim.OccurrenceImpl; +import org.tinytim.TopicNameImpl; +import org.tinytim.VariantImpl; +import org.tmapi.core.Topic; + +/** + * Index for all scoped Topic Maps Constructs. + * + * Copied from the TMAPIX-project, this interface is not meant to be used + * outside of the tinyTiM package. Once TMAPI exposes <code>ITyped</code> this + * interface should be changed to return interfaces rather than the + * implementations. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public interface IScopedIndex extends IIndex { + + /** + * Returns all associations which use the specified topic as theme. + * + * @param theme The theme. + * @return A (maybe empty) collection of associations which use the theme + * in their [scope] property. + */ + public Collection<AssociationImpl> getAssociationsByTheme(Topic theme); + + /** + * Returns all occurrences which use the specified topic as theme. + * + * @param theme The theme. + * @return A (maybe empty) collection of occurrences which use the theme + * in their [scope] property. + */ + public Collection<OccurrenceImpl> getOccurrencesByTheme(Topic theme); + + /** + * Returns all names which use the specified topic as theme. + * + * @param theme The theme. + * @return A (maybe empty) collection of names which use the theme + * in their [scope] property. + */ + public Collection<TopicNameImpl> getNamesByTheme(Topic theme); + + /** + * Returns all variants which use the specified topic as theme. + * + * @param theme The theme. + * @return A (maybe empty) collection of variants which use the theme + * in their [scope] property. + */ + public Collection<VariantImpl> getVariantsByTheme(Topic theme); +} Property changes on: tinytim/trunk/main/java/org/tinytim/index/IScopedIndex.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/index/ITypeInstanceIndex.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/index/ITypeInstanceIndex.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/index/ITypeInstanceIndex.java 2008-04-20 15:30:50 UTC (rev 19) @@ -0,0 +1,138 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim.index; + +import java.util.Collection; + +import org.tinytim.AssociationImpl; +import org.tinytim.AssociationRoleImpl; +import org.tinytim.OccurrenceImpl; +import org.tinytim.TopicNameImpl; +import org.tmapi.core.Topic; + +/** + * Type-instance index. This index allows the retrieval of all typed Topic Maps + * constructs and topics. + * + * Copied from the TMAPIX-project, this interface is not meant to be used + * outside of the tinyTiM package. Once TMAPI exposes <code>ITyped</code> this + * interface should be changed to return interfaces rather than the + * implementations. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public interface ITypeInstanceIndex extends IIndex { + + /** + * Returns the topics that include the <code>type</code> as one of + * their types. + * + * @param type The type of topics to be returned. If <code>type</code> is + * <code>null</code> all untyped topics will be returned. + * @return A (maybe empty) collection of topic instances. + */ + public Collection<Topic> getTopics(Topic... type); + + /** + * Returns the associations that are typed by the {@link org.tmapi.core.Topic} + * <code>type</code>. + * + * @param type The type of associations to be returned. + * If <code>type</code> is <code>null</code> all untyped + * associations will be returned. + * @return A (maybe empty) collection of topic instances. + */ + public Collection<AssociationImpl> getAssociations(Topic type); + + /** + * Returns the association roles that are typed by the + * {@link org.tmapi.core.Topic} <code>type</code>. + * + * @param type The type of association roles to be returned. + * If <code>type</code> is <code>null</code> all untyped + * association roles will be returned. + * @return A (maybe empty) collection of topic instances. + */ + public Collection<AssociationRoleImpl> getRoles(Topic type); + + /** + * Returns the occurrences that are typed by the {@link org.tmapi.core.Topic} + * <code>type</code>. + * + * @param type The type of occurrences to be returned. + * If <code>type</code> is <code>null</code> all untyped + * occurrences will be returned. + * @return A (maybe empty) collection of topic instances. + */ + public Collection<OccurrenceImpl> getOccurrences(Topic type); + + /** + * Returns the topic names that are typed by the {@link org.tmapi.core.Topic} + * <code>type</code>. + * + * @param type The type of topic names to be returned. + * If <code>type</code> is <code>null</code> all untyped + * topic names will be returned. + * @return A (maybe empty) collection of topic instances. + */ + public Collection<TopicNameImpl> getNames(Topic type); + + /** + * Returns the topics that are used as type of {@link org.tmapi.core.Topic}s. + * + * @return A (maybe empty) collection of topic instances. + */ + public Collection<Topic> getTopicTypes(); + + /** + * Returns the topics that are used as type of + * {@link org.tmapi.core.Association}s. + * + * @return A (maybe empty) collection of topic instances. + */ + public Collection<Topic> getAssociationTypes(); + + /** + * Returns the topics that are used as type of + * {@link org.tmapi.core.AssociationRole}s. + * + * @return A (maybe empty) collection of topic instances. + */ + public Collection<Topic> getRoleTypes(); + + /** + * Returns the topics that are used as type of + * {@link org.tmapi.core.Occurrence}s. + * + * @return A (maybe empty) collection of topic instances. + */ + public Collection<Topic> getOccurrenceTypes(); + + /** + * Returns the topics that are used as type of + * {@link org.tmapi.core.TopicName}s. + * + * @return A (maybe empty) collection of topic instances. + */ + public Collection<Topic> getNameTypes(); + +} Property changes on: tinytim/trunk/main/java/org/tinytim/index/ITypeInstanceIndex.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/index/IndexFlagsImpl.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/index/IndexFlagsImpl.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/index/IndexFlagsImpl.java 2008-04-20 15:30:50 UTC (rev 19) @@ -0,0 +1,51 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim.index; + +import org.tmapi.index.IndexFlags; + +/** + * Immutable {@link org.tmapi.index.IndexFlags} implementation. + * + * Use {@link #AUTOUPDATED} or {@link #NOT_AUTOUPDATED} + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class IndexFlagsImpl implements IndexFlags { + + public static IndexFlags AUTOUPDATED = new IndexFlagsImpl(true); + public static IndexFlags NOT_AUTOUPDATED = new IndexFlagsImpl(false); + + private final boolean _autoUpdated; + + private IndexFlagsImpl(boolean autoUpdated) { + _autoUpdated = autoUpdated; + } + + /* (non-Javadoc) + * @see org.tmapi.index.IndexFlags#isAutoUpdated() + */ + public boolean isAutoUpdated() { + return _autoUpdated; + } + +} Property changes on: tinytim/trunk/main/java/org/tinytim/index/IndexFlagsImpl.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-20 15:11:31
|
Revision: 17 http://tinytim.svn.sourceforge.net/tinytim/?rev=17&view=rev Author: lheuer Date: 2008-04-20 08:11:15 -0700 (Sun, 20 Apr 2008) Log Message: ----------- Moved iid set creation behind the event Modified Paths: -------------- tinytim/trunk/main/java/org/tinytim/Construct.java Modified: tinytim/trunk/main/java/org/tinytim/Construct.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/Construct.java 2008-04-20 15:07:46 UTC (rev 16) +++ tinytim/trunk/main/java/org/tinytim/Construct.java 2008-04-20 15:11:15 UTC (rev 17) @@ -32,7 +32,7 @@ * Base class for all Topic Maps constructs. * * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> - * @version $Rev:$ - $Date:$ + * @version $Rev$ - $Date$ */ abstract class Construct implements TopicMapObject, IConstruct { @@ -100,13 +100,13 @@ * @see org.tinytim.IConstruct#addItemIdentifier(org.tmapi.core.Locator) */ public void addItemIdentifier(Locator itemIdentifier) { + if (_iids != null && _iids.contains(itemIdentifier)) { + return; + } + _fireEvent(Event.ADD_IID, null, itemIdentifier); if (_iids == null) { _iids = _tm.getCollectionFactory().createSet(); } - if (_iids.contains(itemIdentifier)) { - return; - } - _fireEvent(Event.ADD_IID, null, itemIdentifier); _iids.add(itemIdentifier); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-20 15:07:45
|
Revision: 16 http://tinytim.svn.sourceforge.net/tinytim/?rev=16&view=rev Author: lheuer Date: 2008-04-20 08:07:46 -0700 (Sun, 20 Apr 2008) Log Message: ----------- Construct test added Added Paths: ----------- tinytim/trunk/test/java/org/tinytim/TestConstruct.java Added: tinytim/trunk/test/java/org/tinytim/TestConstruct.java =================================================================== --- tinytim/trunk/test/java/org/tinytim/TestConstruct.java (rev 0) +++ tinytim/trunk/test/java/org/tinytim/TestConstruct.java 2008-04-20 15:07:46 UTC (rev 16) @@ -0,0 +1,117 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import org.tmapi.core.Association; +import org.tmapi.core.AssociationRole; +import org.tmapi.core.Locator; +import org.tmapi.core.Occurrence; +import org.tmapi.core.Topic; +import org.tmapi.core.TopicName; +import org.tmapi.core.Variant; + +/** + * Tests against {@link IConstruct}. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class TestConstruct extends TinyTimTestCase { + + /** + * Tests against the topic map. + */ + public void testTopicMap() { + _testConstruct((IConstruct) _tm); + } + + /** + * Tests against the topic. + */ + public void testTopic() { + _testConstruct((IConstruct) _tm.createTopic()); + } + + /** + * Tests against the association. + */ + public void testAssociation() { + _testConstruct((IConstruct) _tm.createAssociation()); + } + + /** + * Tests against the role. + */ + public void testRole() { + Association assoc = _tm.createAssociation(); + AssociationRole role = assoc.createAssociationRole(null, null); + _testConstruct((IConstruct) role); + } + + /** + * Tests against an occurrence. + */ + public void testOccurrence() { + Topic topic = _tm.createTopic(); + Occurrence occ = topic.createOccurrence("tinyTiM", null, null); + _testConstruct((IConstruct) occ); + } + + /** + * Tests against a name. + */ + public void testName() { + Topic topic = _tm.createTopic(); + TopicName name = topic.createTopicName("tinyTiM", null, null); + _testConstruct((IConstruct) name); + } + + /** + * Tests against a variant. + */ + public void testVariant() { + Topic topic = _tm.createTopic(); + TopicName name = topic.createTopicName("tinyTiM", null, null); + Variant variant = name.createVariant("tinyTiM", null); + _testConstruct((IConstruct) variant); + } + + /** + * Tests adding / removing item identifiers, retrieval by item identifier. + * + * @param construct The Topic Maps construct to test. + */ + private void _testConstruct(IConstruct construct) { + assertEquals(0, construct.getItemIdentifiers().size()); + Locator iid = _tm.createLocator("http://sf.net/projects/tinytim/#test"); + construct.addItemIdentifier(iid); + assertEquals(1, construct.getItemIdentifiers().size()); + assertTrue(construct.getItemIdentifiers().contains(iid)); + assertEquals(construct, _tm.getObjectByItemIdentifier(iid)); + construct.removeItemIdentifier(iid); + assertEquals(0, construct.getItemIdentifiers().size()); + assertFalse(construct.getItemIdentifiers().contains(iid)); + assertNull(_tm.getObjectByItemIdentifier(iid)); + + String id = construct.getObjectId(); + assertEquals(construct, _tm.getObjectById(id)); + } +} Property changes on: tinytim/trunk/test/java/org/tinytim/TestConstruct.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-20 14:35:31
|
Revision: 15 http://tinytim.svn.sourceforge.net/tinytim/?rev=15&view=rev Author: lheuer Date: 2008-04-20 07:35:37 -0700 (Sun, 20 Apr 2008) Log Message: ----------- Initial import of the base classes for Topic Maps constructs. Added Paths: ----------- tinytim/trunk/main/java/org/tinytim/Construct.java tinytim/trunk/main/java/org/tinytim/IScoped.java tinytim/trunk/main/java/org/tinytim/ITyped.java tinytim/trunk/main/java/org/tinytim/Scoped.java tinytim/trunk/main/java/org/tinytim/Typed.java Added: tinytim/trunk/main/java/org/tinytim/Construct.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/Construct.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/Construct.java 2008-04-20 14:35:37 UTC (rev 15) @@ -0,0 +1,170 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import java.util.Collections; +import java.util.Set; + +import org.tmapi.core.DuplicateSourceLocatorException; +import org.tmapi.core.Locator; +import org.tmapi.core.TopicMap; +import org.tmapi.core.TopicMapObject; + +/** + * Base class for all Topic Maps constructs. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +abstract class Construct implements TopicMapObject, IConstruct { + + protected String _id; + protected TopicMapImpl _tm; + protected IConstruct _parent; + private Set<Locator> _iids; + + Construct(TopicMapImpl topicMap) { + _tm = topicMap; + } + + /* (non-Javadoc) + * @see org.tinytim.IConstruct#getParent() + */ + public IConstruct getParent() { + return _parent; + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapObject#getObjectId() + */ + public String getObjectId() { + return _id; + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapObject#getSourceLocators() + */ + public Set<Locator> getSourceLocators() { + return getItemIdentifiers(); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapObject#addSourceLocator(org.tmapi.core.Locator) + */ + public void addSourceLocator(Locator loc) + throws DuplicateSourceLocatorException { + addItemIdentifier(loc); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapObject#removeSourceLocator(org.tmapi.core.Locator) + */ + public void removeSourceLocator(Locator loc) { + removeItemIdentifier(loc); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapObject#getTopicMap() + */ + public TopicMap getTopicMap() { + return _tm; + } + + /* (non-Javadoc) + * @see org.tinytim.IConstruct#getItemIdentifiers() + */ + public Set<Locator> getItemIdentifiers() { + return _iids == null ? Collections.<Locator>emptySet() + : Collections.unmodifiableSet(_iids); + } + + /* (non-Javadoc) + * @see org.tinytim.IConstruct#addItemIdentifier(org.tmapi.core.Locator) + */ + public void addItemIdentifier(Locator itemIdentifier) { + if (_iids == null) { + _iids = _tm.getCollectionFactory().createSet(); + } + if (_iids.contains(itemIdentifier)) { + return; + } + _fireEvent(Event.ADD_IID, null, itemIdentifier); + _iids.add(itemIdentifier); + } + + /* (non-Javadoc) + * @see org.tinytim.IConstruct#removeItemIdentifier(org.tmapi.core.Locator) + */ + public void removeItemIdentifier(Locator itemIdentifier) { + if (_iids == null || !_iids.contains(itemIdentifier)) { + return; + } + _fireEvent(Event.REMOVE_IID, itemIdentifier, null); + _iids.remove(itemIdentifier); + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + return (obj instanceof Construct) && _id.equals(((Construct) obj)._id); + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return _id.hashCode(); + } + + /** + * Notifies the topic map about an event. + * + * If the topic map is <code>null</code>, no event is sent. + * + * @param evt The event. + * @param oldValue The old value. + * @param newValue The new value. + */ + protected void _fireEvent(Event evt, Object oldValue, Object newValue) { + if (_tm != null) { + _tm.handleEvent(evt, this, oldValue, newValue); + } + } + + /** + * Releases used resources. + * + * Should be called in the {@link org.tmapi.core.TopicMapObject#remove()} + * method. + */ + protected void dispose() { + _tm = null; + _parent = null; + _iids = null; + } + +} Property changes on: tinytim/trunk/main/java/org/tinytim/Construct.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/IScoped.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/IScoped.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/IScoped.java 2008-04-20 14:35:37 UTC (rev 15) @@ -0,0 +1,57 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import java.util.Set; + +import org.tmapi.core.ScopedObject; +import org.tmapi.core.Topic; + +/** + * Scoped Topic Maps construct. + * + * Associations, occurrences, names and variants are scoped Topic Maps + * constructs. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +interface IScoped extends IConstruct, ScopedObject { + + /* (non-Javadoc) + * @see org.tmapi.core.ScopedObject#getScope() + */ + public Set<Topic> getScope(); + + /** + * Adds a theme to the scope. + * + * @param theme The theme to add. + */ + public void addTheme(Topic theme); + + /** + * Removes a theme from the scope. + * + * @param theme The theme to remove. + */ + public void removeTheme(Topic theme); +} Property changes on: tinytim/trunk/main/java/org/tinytim/IScoped.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/ITyped.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/ITyped.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/ITyped.java 2008-04-20 14:35:37 UTC (rev 15) @@ -0,0 +1,48 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import org.tmapi.core.Topic; + +/** + * Typed Topic Maps construct. + * + * Associations, roles, occurrences, and names are typed Topic Maps constructs. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +interface ITyped extends IConstruct { + + /** + * Returns the type of the construct. + * + * @return The typing topic or <code>null</code>. + */ + public Topic getType(); + + /** + * Sets the type of the construct. + * + * @param type The topic or <code>null</code>. + */ + public void setType(Topic type); +} Property changes on: tinytim/trunk/main/java/org/tinytim/ITyped.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/Scoped.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/Scoped.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/Scoped.java 2008-04-20 14:35:37 UTC (rev 15) @@ -0,0 +1,135 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import java.util.Collection; +import java.util.Collections; +import java.util.Set; + +import org.tmapi.core.Topic; + +/** + * Class that provides a "scope" property and sends events if that + * scope property changes. Additionally, this class provides + * a {@link IReifiable} implementation. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +abstract class Scoped extends Construct implements IReifiable { + + //NOTE: This class does NOT implement IScoped by intention! + // Typed extends this class and roles are not IScoped! + + private Set<Topic> _scope; + private Topic _reifier; + + Scoped(TopicMapImpl topicMap, Collection<Topic> scope) { + super(topicMap); + if (scope != null) { + for(Topic theme: scope) { + addTheme(theme); + } + } + } + + /* (non-Javadoc) + * @see org.tmapi.core.ScopedObject#getScope() + */ + public Set<Topic> getScope() { + return _scope == null ? Collections.<Topic>emptySet() + : Collections.unmodifiableSet(_scope); + } + + /* (non-Javadoc) + * @see org.tinytim.IScoped#addTheme(org.tmapi.core.Topic) + */ + public void addTheme(Topic theme) { + if (_scope != null && _scope.contains(theme)) { + return; + } + _fireEvent(Event.ADD_THEME, null, theme); + if (_scope == null) { + _scope = _tm.getCollectionFactory().createSet(4); + } + _scope.add(theme); + } + + /* (non-Javadoc) + * @see org.tinytim.IScoped#removeTheme(org.tmapi.core.Topic) + */ + public void removeTheme(Topic theme) { + if (_scope == null || _scope.isEmpty()) { + return; + } + _fireEvent(Event.REMOVE_THEME, theme, null); + _scope.remove(theme); + } + + /* (non-Javadoc) + * @see org.tmapi.core.ScopedObject#addScopingTopic(org.tmapi.core.Topic) + */ + public void addScopingTopic(Topic theme) { + addTheme(theme); + } + + /* (non-Javadoc) + * @see org.tmapi.core.ScopedObject#removeScopingTopic(org.tmapi.core.Topic) + */ + public void removeScopingTopic(Topic theme) { + removeTheme(theme); + } + + /* (non-Javadoc) + * @see org.tmapi.core.Association#getReifier() + */ + public Topic getReifier() { + return _reifier; + } + + /* (non-Javadoc) + * @see org.tinytim.IReifiable#setReifier(org.tmapi.core.Topic) + */ + public void setReifier(Topic reifier) { + if (_reifier == reifier) { + return; + } + _fireEvent(Event.SET_REIFIER, _reifier, reifier); + if (_reifier != null) { + ((TopicImpl) _reifier)._reified = null; + } + _reifier = reifier; + if (reifier != null) { + ((TopicImpl) reifier)._reified = this; + } + } + + /* (non-Javadoc) + * @see org.tinytim.Construct#dispose() + */ + @Override + protected void dispose() { + _scope = null; + _reifier = null; + super.dispose(); + } + +} Property changes on: tinytim/trunk/main/java/org/tinytim/Scoped.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/Typed.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/Typed.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/Typed.java 2008-04-20 14:35:37 UTC (rev 15) @@ -0,0 +1,73 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import java.util.Collection; + +import org.tmapi.core.Topic; + +/** + * Class that provides a "type" property and fires and event if that type + * property changes. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +abstract class Typed extends Scoped { + + //NOTE: This class does NOT implement ITyped by intention! + // DatatypeAwareConstruct extends this class and variants are not ITyped! + + private Topic _type; + + Typed(TopicMapImpl topicMap, Topic type, Collection<Topic> scope) { + super(topicMap, scope); + _type = type; + } + + /* (non-Javadoc) + * @see org.tinytim.ITyped#getType() + */ + public Topic getType() { + return _type; + } + + /* (non-Javadoc) + * @see org.tinytim.ITyped#setType(org.tmapi.core.Topic) + */ + public void setType(Topic type) { + if (_type == type) { + return; + } + _fireEvent(Event.SET_TYPE, _type, type); + _type = type; + } + + /* (non-Javadoc) + * @see org.tinytim.Scoped#dispose() + */ + @Override + protected void dispose() { + _type = null; + super.dispose(); + } + +} Property changes on: tinytim/trunk/main/java/org/tinytim/Typed.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-20 13:46:55
|
Revision: 13 http://tinytim.svn.sourceforge.net/tinytim/?rev=13&view=rev Author: lheuer Date: 2008-04-20 06:25:43 -0700 (Sun, 20 Apr 2008) Log Message: ----------- Unused import removed Modified Paths: -------------- tinytim/trunk/main/java/org/tinytim/SignatureGenerator.java Modified: tinytim/trunk/main/java/org/tinytim/SignatureGenerator.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/SignatureGenerator.java 2008-04-20 13:23:18 UTC (rev 12) +++ tinytim/trunk/main/java/org/tinytim/SignatureGenerator.java 2008-04-20 13:25:43 UTC (rev 13) @@ -26,7 +26,6 @@ import org.tmapi.core.Association; import org.tmapi.core.AssociationRole; import org.tmapi.core.Occurrence; -import org.tmapi.core.ScopedObject; import org.tmapi.core.Topic; import org.tmapi.core.TopicName; import org.tmapi.core.Variant; @@ -42,7 +41,7 @@ * are taken into account. * * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> - * @version $Rev:$ - $Date:$ + * @version $Rev$ - $Date$ */ final class SignatureGenerator { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-20 13:41:34
|
Revision: 14 http://tinytim.svn.sourceforge.net/tinytim/?rev=14&view=rev Author: lheuer Date: 2008-04-20 06:28:10 -0700 (Sun, 20 Apr 2008) Log Message: ----------- Initial import of the TopicMapsSystem and the TMSysFactory Added Paths: ----------- tinytim/trunk/main/java/org/tinytim/TopicMapSystemFactoryImpl.java tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java Added: tinytim/trunk/main/java/org/tinytim/TopicMapSystemFactoryImpl.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/TopicMapSystemFactoryImpl.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/TopicMapSystemFactoryImpl.java 2008-04-20 13:28:10 UTC (rev 14) @@ -0,0 +1,191 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.tmapi.core.FeatureNotRecognizedException; +import org.tmapi.core.FeatureNotSupportedException; +import org.tmapi.core.TMAPIException; +import org.tmapi.core.TopicMapSystem; +import org.tmapi.core.TopicMapSystemFactory; + +/** + * {@link org.tmapi.core.TopicMapSystemFactory} implementation. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public final class TopicMapSystemFactoryImpl extends TopicMapSystemFactory { + + private static final String _COLL_FACTORY_JAVA = "org.tinytim.JavaCollectionFactory"; + private static final String _COLL_FACTORY_TROVE = "org.tinytim.TroveCollectionFactory"; + private static final FeatureInfo[] _FEATURES = new FeatureInfo[] { + // Feature IRI, default value, fixed? + new FeatureInfo(TMAPIFeature.NOTATION_URI, true, true), + new FeatureInfo(TMAPIFeature.XTM_1_0, false, true), + new FeatureInfo(TMAPIFeature.XTM_1_1, true, true), + new FeatureInfo(TMAPIFeature.AUTOMERGE, false, true), + new FeatureInfo(TMAPIFeature.TNC, false, true), + new FeatureInfo(TMAPIFeature.READ_ONLY, false, true) + }; + + private Properties _properties; + private Map<String, Boolean> _features; + + public TopicMapSystemFactoryImpl() { + _properties = new Properties(); + _features = new HashMap<String, Boolean>(_FEATURES.length); + for (FeatureInfo feature: _FEATURES) { + _features.put(feature.name, feature.defaultValue); + } + _properties.setProperty(Property.COLLECTION_FACTORY, _COLL_FACTORY_JAVA); + try { + // Probe if Trove is available. + Class.forName("gnu.trove.THashSet"); + _properties.setProperty(Property.COLLECTION_FACTORY, _COLL_FACTORY_TROVE); + } + catch (Exception ex) { + // noop. + } + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystemFactory#newTopicMapSystem() + */ + @Override + public TopicMapSystem newTopicMapSystem() throws TMAPIException { + return new TopicMapSystemImpl(_createCollectionFactory(), new HashMap<String, Boolean>(_features), new Properties(_properties)); + } + + /** + * Creates a collection factory based according to the + * {@link Property#COLLECTION_FACTORY} value. If the collection factory + * is not available, a default collection factory implementation is returned. + * + * @return A collection factory. + */ + private ICollectionFactory _createCollectionFactory() { + String className = _properties.getProperty(Property.COLLECTION_FACTORY, _COLL_FACTORY_JAVA); + try { + return (ICollectionFactory) Class.forName(className).newInstance(); + } + catch (Exception ex) { + // Irgendwas geht immer ;) + return new JavaCollectionFactory(); + } + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystemFactory#getFeature(java.lang.String) + */ + @Override + public boolean getFeature(String featureName) throws FeatureNotRecognizedException { + final Boolean supported = _features.get(featureName); + if (supported == null) { + reportFeatureNotRecognized(featureName); + } + return supported.booleanValue(); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystemFactory#hasFeature(java.lang.String) + */ + @Override + public boolean hasFeature(String featureName) { + return _features.containsKey(featureName); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystemFactory#setFeature(java.lang.String, boolean) + */ + @Override + public void setFeature(String featureName, boolean enabled) + throws FeatureNotSupportedException, FeatureNotRecognizedException { + if (!_features.containsKey(featureName)) { + reportFeatureNotRecognized(featureName); + } + FeatureInfo feature = null; + for (FeatureInfo feature_: _FEATURES) { + if (feature_.name.equals(featureName)) { + feature = feature_; + } + } + if (feature.fixed && feature.defaultValue != enabled) { + throw new FeatureNotSupportedException("The feature '" + featureName + "' cannot be changed."); + } + _features.put(featureName, enabled); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystemFactory#getProperty(java.lang.String) + */ + @Override + public String getProperty(String propertyName) { + return _properties.getProperty(propertyName); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystemFactory#setProperties(java.util.Properties) + */ + @Override + public void setProperties(Properties properties) { + _properties = new Properties(properties); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystemFactory#setProperty(java.lang.String, java.lang.String) + */ + @Override + public void setProperty(String propertyName, String value) { + _properties.setProperty(propertyName, value); + } + + /** + * Throws a {@link org.tmapi.core.FeatureNotRecognizedException} with a + * message. + * + * @param featureName The name of the feature which is unknown. + * @throws FeatureNotRecognizedException Thrown in any case. + */ + static void reportFeatureNotRecognized(String featureName) throws FeatureNotRecognizedException { + throw new FeatureNotRecognizedException("The feature '" + featureName + "' is unknown"); + } + + /** + * Simple structure that holds a feature name, the default value and an + * indication if the feature is changable. + */ + private static class FeatureInfo { + String name; + boolean defaultValue; + boolean fixed; + + FeatureInfo(String name, boolean defaultValue, boolean fixed) { + this.name = name; + this.defaultValue = defaultValue; + this.fixed = fixed; + } + } + +} Property changes on: tinytim/trunk/main/java/org/tinytim/TopicMapSystemFactoryImpl.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java 2008-04-20 13:28:10 UTC (rev 14) @@ -0,0 +1,166 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.tmapi.core.FeatureNotRecognizedException; +import org.tmapi.core.Locator; +import org.tmapi.core.TopicMap; +import org.tmapi.core.TopicMapExistsException; +import org.tmapi.core.TopicMapSystem; + +/** + * {@link org.tmapi.core.TopicMapSystem} implementation. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +final class TopicMapSystemImpl implements TopicMapSystem { + + private Map<Locator, TopicMap> _topicMaps; + private Properties _properties; + private Map<String, Boolean> _features; + private ICollectionFactory _collectionFactory; + + + TopicMapSystemImpl(ICollectionFactory collFactory, Map<String, Boolean> features, Properties properties) { + _collectionFactory = collFactory; + _features = features; + _properties = properties; + _topicMaps = collFactory.<Locator, TopicMap>createMap(); + } + + /** + * Returns the collection factory. + * + * @return The collection factory. + */ + ICollectionFactory getCollectionFactory() { + return _collectionFactory; + } + + /** + * Removes a topic map from this system. + * + * @param tm The topic map to remove. + */ + void removeTopicMap(TopicMap tm) { + _topicMaps.remove(tm.getBaseLocator()); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystem#createTopicMap(java.lang.String) + */ + public TopicMap createTopicMap(String baseLocator) throws TopicMapExistsException { + return _createTopicMap(new IRI(baseLocator)); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystem#createTopicMap(java.lang.String, java.lang.String) + */ + public TopicMap createTopicMap(String reference, String notation) + throws TopicMapExistsException { + assert "URI".equals(notation); + return _createTopicMap(new IRI(reference)); + } + + /** + * Creates a topic map with the specified <code>locator</code>. + * + * @param locator The locator which is used to address the topic map. + * @return A newly created topic map instance. + * @throws TopicMapExistsException If a topic map with the specified <code>locator</code> + * exists. + */ + private TopicMap _createTopicMap(Locator locator) throws TopicMapExistsException { + if (_topicMaps.containsKey(locator)) { + throw new TopicMapExistsException("A topic map with the IRI + '" + locator.getReference() + "' exists in the system"); + } + TopicMap tm = new TopicMapImpl(this, locator); + _topicMaps.put(locator, tm); + return tm; + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystem#getBaseLocators() + */ + public Set<Locator> getBaseLocators() { + //FIXME: For some reason the TMAPI tests assume that this method returns a copy + Set<Locator> locs = _topicMaps.keySet(); + Set<Locator> locators = _collectionFactory.createSet(locs.size()); + locators.addAll(locs); + return locators; + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystem#getFeature(java.lang.String) + */ + public boolean getFeature(String featureName) throws FeatureNotRecognizedException { + final Boolean supported = _features.get(featureName); + if (supported == null) { + TopicMapSystemFactoryImpl.reportFeatureNotRecognized(featureName); + } + return supported; + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystem#getProperty(java.lang.String) + */ + public String getProperty(String propertyName) { + return _properties.getProperty(propertyName); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystem#getTopicMap(java.lang.String) + */ + public TopicMap getTopicMap(String reference) { + return getTopicMap(new IRI(reference)); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystem#getTopicMap(org.tmapi.core.Locator) + */ + public TopicMap getTopicMap(Locator iri) { + return _topicMaps.get(iri); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystem#getTopicMap(java.lang.String, java.lang.String) + */ + public TopicMap getTopicMap(String reference, String notation) { + assert "URI".equals(notation); + return getTopicMap(new IRI(reference)); + } + + /* (non-Javadoc) + * @see org.tmapi.core.TopicMapSystem#close() + */ + public void close() { + _features = null; + _properties = null; + _topicMaps = null; + _collectionFactory = null; + } + +} Property changes on: tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-20 13:37:15
|
Revision: 12 http://tinytim.svn.sourceforge.net/tinytim/?rev=12&view=rev Author: lheuer Date: 2008-04-20 06:23:18 -0700 (Sun, 20 Apr 2008) Log Message: ----------- Initial import of classes / interfaces which are considered as stable Added Paths: ----------- tinytim/trunk/main/ tinytim/trunk/main/java/ tinytim/trunk/main/java/org/ tinytim/trunk/main/java/org/tinytim/ tinytim/trunk/main/java/org/tinytim/Event.java tinytim/trunk/main/java/org/tinytim/ICollectionFactory.java tinytim/trunk/main/java/org/tinytim/IConstruct.java tinytim/trunk/main/java/org/tinytim/IEventHandler.java tinytim/trunk/main/java/org/tinytim/IEventPublisher.java tinytim/trunk/main/java/org/tinytim/IReifiable.java tinytim/trunk/main/java/org/tinytim/JavaCollectionFactory.java tinytim/trunk/main/java/org/tinytim/Property.java tinytim/trunk/main/java/org/tinytim/SignatureGenerator.java tinytim/trunk/main/java/org/tinytim/TMAPIFeature.java tinytim/trunk/main/java/org/tinytim/TroveCollectionFactory.java Added: tinytim/trunk/main/java/org/tinytim/Event.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/Event.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/Event.java 2008-04-20 13:23:18 UTC (rev 12) @@ -0,0 +1,156 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +/** + * Event constants. + * + * All events are sent before a change happens. This allows to check + * some constraints. + * + * This class is not meant to be used outside of the tinyTiM package. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public enum Event { + + /** + * Notification that a topic should be added. + */ + ADD_TOPIC, + /** + * Notification that a topic should be removed. + */ + REMOVE_TOPIC, + /** + * Notification that an association should be added. + */ + ADD_ASSOCIATION, + /** + * Notification that an association should be removed. + */ + REMOVE_ASSOCIATION, + /** + * Notification that a role should be added. + */ + ADD_ROLE, + /** + * Notification that a role should be removed. + */ + REMOVE_ROLE, + /** + * Notification that an occurrence should be added. + */ + ADD_OCCURRENCE, + /** + * Notification that an occurrence should be removed. + */ + REMOVE_OCCURRENCE, + /** + * Notification that a name should be added. + */ + ADD_NAME, + /** + * Notification that a name should be removed. + */ + REMOVE_NAME, + /** + * Notification that a variant should be added. + */ + ADD_VARIANT, + /** + * Notification that a variant should be removed. + */ + REMOVE_VARIANT, + + /** + * Notification that a subject identifier should be added. + */ + ADD_SID, + /** + * Notification that a subject identifier should be removed. + */ + REMOVE_SID, + /** + * Notification that a subject locator should be added. + */ + ADD_SLO, + /** + * Notification that a subject locator should be removed. + */ + REMOVE_SLO, + /** + * Notification that an item identifier should be added. + */ + ADD_IID, + /** + * Notification that an item identifier should be removed. + */ + REMOVE_IID, + + /** + * Notification that a type should be added to a topic. + */ + ADD_TYPE, + /** + * Notification that a type should be removed from a topic. + */ + REMOVE_TYPE, + /** + * Notification that the type of a {@link ITyped} construct should be set. + */ + SET_TYPE, + + /** + * Notification that a theme should be added to a {@link IScoped} construct. + */ + ADD_THEME, + /** + * Notification that a theme should be removed from a + * {@link IScoped} construct. + */ + REMOVE_THEME, + + /** + * Notification that the value of a name, an occurrence or variant + * should be set. + */ + SET_VALUE, + + /** + * Notification that the player of a role should be set. + */ + SET_PLAYER, + + /** + * Notification that the reifier of a {@link IReifiable} construct + * should be set. + */ + SET_REIFIER, + + /** + * Notification that the "resource" of an occurrence or variant should be + * set. + */ + SET_LOCATOR; //TODO: Remove this once we have a TMDM-compatible version + +} Property changes on: tinytim/trunk/main/java/org/tinytim/Event.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/ICollectionFactory.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/ICollectionFactory.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/ICollectionFactory.java 2008-04-20 13:23:18 UTC (rev 12) @@ -0,0 +1,72 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import java.util.Map; +import java.util.Set; + +/** + * Factory for collections. + * + * Implementations of this interface must provide a default constructor. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public interface ICollectionFactory { + + /** + * Creates a Set with the specified initial <code>size</code>. + * + * @param <E> + * @param size The initial capacity. + * @return + */ + <E> Set<E> createSet(int size); + + /** + * Creates a Set. + * + * @param <E> + * @return + */ + <E> Set<E> createSet(); + + /** + * Creates a Map. + * + * @param <K> + * @param <V> + * @return + */ + <K, V> Map<K, V> createMap(); + + /** + * Creates a Map with the specified initial <code>size</code>. + * + * @param <K> + * @param <V> + * @param size The initial capacity. + * @return + */ + <K, V> Map<K, V> createMap(int size); + +} Property changes on: tinytim/trunk/main/java/org/tinytim/ICollectionFactory.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/IConstruct.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/IConstruct.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/IConstruct.java 2008-04-20 13:23:18 UTC (rev 12) @@ -0,0 +1,66 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import java.util.Set; + +import org.tmapi.core.Locator; +import org.tmapi.core.TopicMapObject; + +/** + * The Topic Maps construct. + * + * This interface is not meant to be used outside of the tinyTiM package. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public interface IConstruct extends TopicMapObject { + + /** + * Returns the parent of the Topic Maps construct. + * + * @return The parent of a Topic Maps construct or <code>null</code>. + */ + public IConstruct getParent(); + + /** + * Returns the item identifiers of the Topic Maps construct. + * + * @return A (maybe empty) immutable Set of item identifiers. + */ + public Set<Locator> getItemIdentifiers(); + + /** + * Adds an item identifier to the Topic Maps construct. + * + * @param itemIdentifier The item identifier to add. + */ + public void addItemIdentifier(Locator itemIdentifier); + + /** + * Removes an item identifier from the Topic Maps construct. + * + * @param itemIdentifier The item identifier to remove. + */ + public void removeItemIdentifier(Locator itemIdentifier); + +} Property changes on: tinytim/trunk/main/java/org/tinytim/IConstruct.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/IEventHandler.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/IEventHandler.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/IEventHandler.java 2008-04-20 13:23:18 UTC (rev 12) @@ -0,0 +1,47 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +/** + * Event handler that is able to handle Topic Maps events. + * + * This interface is not meant to be used outside of the tinyTiM package. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public interface IEventHandler { + + /** + * Callback method if a {@link IEventPublisher} sends an event to which + * this handler is subscribed to. + * + * @param evt The event. + * @param sender The sender of the event (this is not necessarily the + * publisher). + * @param oldValue The old value or <code>null</code> if the old value + * is not available or was <code>null</code>. + * @param newValue The new value or <code>null</code> if the new value + * is not available or should become <code>null</code>. + */ + public void handleEvent(Event evt, IConstruct sender, Object oldValue, Object newValue); + +} Property changes on: tinytim/trunk/main/java/org/tinytim/IEventHandler.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/IEventPublisher.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/IEventPublisher.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/IEventPublisher.java 2008-04-20 13:23:18 UTC (rev 12) @@ -0,0 +1,48 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +/** + * Publisher for Topic Maps events. + * + * This interface is not meant to be used outside of the tinyTiM package. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public interface IEventPublisher { + + /** + * Subscribes the handler for the specified event. + * + * @param event The event of interesst. + * @param handler The event handler. + */ + public void subscribe(Event event, IEventHandler handler); + + /** + * Removes the handler from the publisher. + * + * @param event The event. + * @param handler The event handler. + */ + public void unsubscribe(Event event, IEventHandler handler); +} Property changes on: tinytim/trunk/main/java/org/tinytim/IEventPublisher.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/IReifiable.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/IReifiable.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/IReifiable.java 2008-04-20 13:23:18 UTC (rev 12) @@ -0,0 +1,52 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import org.tmapi.core.Topic; + +/** + * Reifiable Topic Maps construct. + * + * Every Topic Maps construct != topic is reifiable. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public interface IReifiable extends IConstruct { + + /** + * Returns the reifier of this construct. + * + * @return The topic that reifies this construct or <code>null</code> if + * this construct has no reifier. + */ + public Topic getReifier(); + + /** + * Sets the reifier of this construct. + * + * If the <code>reifier</code> reifies another Topic Maps construct, a + * {@link org.tmapi.core.ModelConstraintException} is thrown. + * + * @param reifier The reifier or <code>null</code>. + */ + public void setReifier(Topic reifier); +} Property changes on: tinytim/trunk/main/java/org/tinytim/IReifiable.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/JavaCollectionFactory.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/JavaCollectionFactory.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/JavaCollectionFactory.java 2008-04-20 13:23:18 UTC (rev 12) @@ -0,0 +1,64 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * {@link ICollectionFactory} which uses the standard Java collections. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +final class JavaCollectionFactory implements ICollectionFactory { + + /* (non-Javadoc) + * @see org.tinytim.ICollectionFactory#createMap(int) + */ + public <K, V> Map<K, V> createMap(int size) { + return new HashMap<K, V>(size); + } + + /* (non-Javadoc) + * @see org.tinytim.ICollectionFactory#createMap() + */ + public <K, V> Map<K, V> createMap() { + return new HashMap<K, V>(); + } + + /* (non-Javadoc) + * @see org.tinytim.ICollectionFactory#createSet(int) + */ + public <E> Set<E> createSet(int size) { + return new HashSet<E>(size); + } + + /* (non-Javadoc) + * @see org.tinytim.ICollectionFactory#createSet() + */ + public <E> Set<E> createSet() { + return new HashSet<E>(); + } + +} Property changes on: tinytim/trunk/main/java/org/tinytim/JavaCollectionFactory.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/Property.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/Property.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/Property.java 2008-04-20 13:23:18 UTC (rev 12) @@ -0,0 +1,44 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +/** + * Provides constants for all tinyTiM-specific TMAPI properties. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public final class Property { + + private Property() { + // noop. + } + + /** + * Property which indicates the {@link org.tinytim.ICollectionFactory} to use. + * + * The default value of this property depends on the environment: If + * the <a href="http://trove4j.sourceforge.net/">Trove4J</a> lib is found, + * that lib used, otherwise a collection factory which depends on the + * default Java collections. + */ + public static final String COLLECTION_FACTORY = "org.tinytim.CollectionFactory"; +} Property changes on: tinytim/trunk/main/java/org/tinytim/Property.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/SignatureGenerator.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/SignatureGenerator.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/SignatureGenerator.java 2008-04-20 13:23:18 UTC (rev 12) @@ -0,0 +1,199 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import java.util.Arrays; +import java.util.Set; + +import org.tmapi.core.Association; +import org.tmapi.core.AssociationRole; +import org.tmapi.core.Occurrence; +import org.tmapi.core.ScopedObject; +import org.tmapi.core.Topic; +import org.tmapi.core.TopicName; +import org.tmapi.core.Variant; + +/** + * Generates signatures for Topic Maps constructs. + * + * This class can be used to detect duplicates: If two Topic Maps constructs + * have the same signature, they should be merged (if they belong to the same + * parent). + * + * Neither the topic map, the parent, the reifier, nor item identifiers + * are taken into account. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +final class SignatureGenerator { + + private SignatureGenerator() { + // noop. + } + + /** + * Returns the signature of an association. + * + * Beside of the type and scope of the association, the roles are + * taken into account. + * The parent is not taken into account. + * + * @param assoc The association to generate the signature for. + * @return The association's signature. + */ + @SuppressWarnings("unchecked") + public static String generateSignature(Association assoc) { + StringBuilder sb = new StringBuilder(); + sb.append(_generateTypeSignature((ITyped)assoc)) + .append('s') + .append(_generateScopeSignature((IScoped)assoc)) + .append('.'); + Set<AssociationRole> roles = assoc.getAssociationRoles(); + String[] roleSigs = new String[roles.size()]; + int i = 0; + for (AssociationRole role : roles) { + roleSigs[i++] = generateSignature(role); + } + Arrays.sort(roleSigs); + for (String sig : roleSigs) { + sb.append(sig) + .append('.'); + } + return sb.toString(); + } + + /** + * Generates the signature of a role. + * + * @param role The role to generate the signature for. + * @return The role's signature. + */ + public static String generateSignature(AssociationRole role) { + StringBuilder sb = new StringBuilder(); + sb.append(_generateTypeSignature((ITyped)role)) + .append('p') + .append(role.getPlayer() == null ? "" : role.getPlayer().getObjectId()); + return sb.toString(); + } + + /** + * Generates the signature for an occurrence. + * + * @param occ The occurrence to create the signature for. + * @return The signature of the occurrence. + */ + public static String generateSignature(Occurrence occ) { + StringBuilder sb = new StringBuilder(); + sb.append(_generateTypeSignature((ITyped)occ)) + .append('s') + .append(_generateScopeSignature((IScoped)occ)) + .append('v') + .append(_generateDataSignature((IDatatypeAwareConstruct) occ)); + return sb.toString(); + } + + /** + * Generates a signature for the specified <code>name</code>. + * + * The parent and the variants are not taken into account. + * + * @param name The name to generate the signature for. + * @return A signature for the name. + */ + public static String generateSignature(TopicName name) { + StringBuilder sb = new StringBuilder(); + sb.append(_generateTypeSignature((ITyped)name)) + .append('s') + .append(_generateScopeSignature((IScoped)name)) + .append('v') + .append(name.getValue() == null ? "" : name.getValue()); + return sb.toString(); + } + + /** + * Generates a signature for the specified <code>variant</code>. + * + * @param variant The variant to generate the signature for. + * @return A signature for the variant. + */ + public static String generateSignature(Variant variant) { + StringBuilder sb = new StringBuilder(); + sb.append(_generateScopeSignature((IScoped)variant)) + .append('v') + .append(_generateDataSignature((IDatatypeAwareConstruct) variant)); + return sb.toString(); + } + + /** + * Returns a signature for a value/datatype pair. + * + * @param construct An occurrence or variant. + * @return The signature. + */ + private static String _generateDataSignature(IDatatypeAwareConstruct construct) { + StringBuilder sb = new StringBuilder(); + sb.append(construct.getValue2()) + .append('.') + .append(construct.getDatatype().getReference()); + return sb.toString(); + } + + /** + * Returns a signature for the type of a typed Topic Maps construct. + * + * @param typed The typed Topic Maps construct. + * @return The signature. + */ + private static String _generateTypeSignature(ITyped typed) { + Topic type = typed.getType(); + return type == null ? "" : type.getObjectId(); + } + + /** + * Returns a signature for the scope of a scoped Topic Maps construct. + * + * This function returns the signature for the scope, only! No other + * properties of the scoped Topic Maps construct are taken into account! + * + * @param scoped The scoped Topic Maps construct. + * @return The signature. + */ + private static String _generateScopeSignature(IScoped scoped) { + Set<Topic> scope = scoped.getScope(); + if (scope.isEmpty()) { + return ""; + } + String[] ids = new String[scope.size()]; + int i = 0; + for (Topic topic : scope) { + ids[i++] = topic.getObjectId(); + } + Arrays.sort(ids); + StringBuilder sb = new StringBuilder(); + for (String id : ids) { + sb.append(id) + .append('.'); + } + return sb.toString(); + } + +} Property changes on: tinytim/trunk/main/java/org/tinytim/SignatureGenerator.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/TMAPIFeature.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/TMAPIFeature.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/TMAPIFeature.java 2008-04-20 13:23:18 UTC (rev 12) @@ -0,0 +1,92 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +/** + * This class provides access to the feature strings that TMAPI-compatible + * Topic Maps processors must recognize (but not necessarily support). + * + * Copied from the TMAPIX-project. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +final class TMAPIFeature { + + private TMAPIFeature() { + // noop. + } + + private static final String _FEATURE_BASE = "http://tmapi.org/features/"; + + /** + * An implementation which supports this feature can process locator + * addresses in URI notation as defined by RFC 2396. + * + * An implementation that supports URI notation locators MUST support + * the expansion of relative URIs that use a hierarchical URI scheme to + * fully specified URIs against a specified base URI, and MAY support + * the expansion of relative URIs that use other scheme-specific mechansims + * for relative URI expansion. + */ + public static final String NOTATION_URI= _FEATURE_BASE + "notation/URI"; + + /** + * An implementation which supports this feature supports the Topic Maps + * data model defined by the XTM 1.0 specification. + */ + public static final String XTM_1_0 = _FEATURE_BASE + "model/xtm1.0"; + + /** + * An implementation which supports this feature supports the + * <a href="http://www.isotopicmaps.org/sam/sam-model/">Topic Maps + * Data Model (TMDM) ISO/IEC 13250-2</a>. + */ + public static final String XTM_1_1 = _FEATURE_BASE + "model/xtm1.1"; + + /** + * An implementation which supports this feature MUST detect when two + * topic instances have topic names which match both in the scope of the + * name and the value of the name string, and, if XTM 1.1 is supported, + * the types are equal. Topics which have matching names must either be + * merged or a {@link org.tmapi.core.TopicsMustMergeException} must be + * raised, depending on the value of the + * <a href="http://tmapi.org/features/automerge">http://tmapi.org/features/automerge</a> + * feature. + */ + public static final String TNC = _FEATURE_BASE + "merge/byTopicName"; + + /** + * This feature indicates that the underlying + * {@link org.tmapi.core.TopicMapSystem} cannot be modified. + */ + public static final String READ_ONLY = _FEATURE_BASE + "readOnly"; + + /** + * If an implementation supports this feature, then whenever the + * implementation detects that two Topics should be merged (by one or more + * of the merge features defined under + * <a href="http://tmapi.org/features/merge/">http://tmapi.org/features/merge/</a>), + * then the implementation MUST merge the properties of these two Topics + * automatically and transparently to the API client. + */ + public static final String AUTOMERGE = _FEATURE_BASE + "automerge"; +} Property changes on: tinytim/trunk/main/java/org/tinytim/TMAPIFeature.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/TroveCollectionFactory.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/TroveCollectionFactory.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/TroveCollectionFactory.java 2008-04-20 13:23:18 UTC (rev 12) @@ -0,0 +1,66 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import gnu.trove.THashMap; +import gnu.trove.THashSet; + +import java.util.Map; +import java.util.Set; + +/** + * {@link ICollectionFactory} which uses the + * <a href="http://sourceforge.net/projects/trove4j/">Trove library </a>. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +final class TroveCollectionFactory implements ICollectionFactory { + + /* (non-Javadoc) + * @see org.tinytim.ICollectionFactory#createMap(int) + */ + public <K, V> Map<K, V> createMap(int size) { + return new THashMap<K,V>(size); + } + + /* (non-Javadoc) + * @see org.tinytim.ICollectionFactory#createMap() + */ + public <K, V> Map<K, V> createMap() { + return new THashMap<K, V>(); + } + + /* (non-Javadoc) + * @see org.tinytim.ICollectionFactory#createSet(int) + */ + public <E> Set<E> createSet(int size) { + return new THashSet<E>(size); + } + + /* (non-Javadoc) + * @see org.tinytim.ICollectionFactory#createSet() + */ + public <E> Set<E> createSet() { + return new THashSet<E>(); + } + +} Property changes on: tinytim/trunk/main/java/org/tinytim/TroveCollectionFactory.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-20 12:06:28
|
Revision: 11 http://tinytim.svn.sourceforge.net/tinytim/?rev=11&view=rev Author: lheuer Date: 2008-04-20 05:06:28 -0700 (Sun, 20 Apr 2008) Log Message: ----------- Initial test case import Added Paths: ----------- tinytim/trunk/test/ tinytim/trunk/test/java/ tinytim/trunk/test/java/org/ tinytim/trunk/test/java/org/tinytim/ tinytim/trunk/test/java/org/tinytim/TMAPITestCase.java tinytim/trunk/test/java/org/tinytim/TestReifiable.java tinytim/trunk/test/java/org/tinytim/TestScoped.java tinytim/trunk/test/java/org/tinytim/TestSignatureGenerator.java tinytim/trunk/test/java/org/tinytim/TestTMAPICore.java tinytim/trunk/test/java/org/tinytim/TestTMAPIIndex.java tinytim/trunk/test/java/org/tinytim/TestTopicMapSystemFactoryImpl.java tinytim/trunk/test/java/org/tinytim/TestTopicMerge.java tinytim/trunk/test/java/org/tinytim/TestTopicMergeDetection.java tinytim/trunk/test/java/org/tinytim/TestTyped.java tinytim/trunk/test/java/org/tinytim/TinyTimTestCase.java Added: tinytim/trunk/test/java/org/tinytim/TMAPITestCase.java =================================================================== --- tinytim/trunk/test/java/org/tinytim/TMAPITestCase.java (rev 0) +++ tinytim/trunk/test/java/org/tinytim/TMAPITestCase.java 2008-04-20 12:06:28 UTC (rev 11) @@ -0,0 +1,36 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import junit.framework.TestCase; + +/** + * Base class for all TMAPI-related test cases. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class TMAPITestCase extends TestCase { + + static { + System.setProperty("org.tmapi.core.TopicMapSystemFactory", "org.tinytim.TopicMapSystemFactoryImpl"); + } +} Property changes on: tinytim/trunk/test/java/org/tinytim/TMAPITestCase.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/test/java/org/tinytim/TestReifiable.java =================================================================== --- tinytim/trunk/test/java/org/tinytim/TestReifiable.java (rev 0) +++ tinytim/trunk/test/java/org/tinytim/TestReifiable.java 2008-04-20 12:06:28 UTC (rev 11) @@ -0,0 +1,151 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import org.tmapi.core.Association; +import org.tmapi.core.AssociationRole; +import org.tmapi.core.ModelConstraintException; +import org.tmapi.core.Occurrence; +import org.tmapi.core.Topic; +import org.tmapi.core.TopicMap; +import org.tmapi.core.TopicName; +import org.tmapi.core.Variant; + +/** + * Tests against the {@link org.tinytim.IReifiable} interface. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class TestReifiable extends TinyTimTestCase { + + /** + * Tests if a Topic Maps construct is an instance of IReifiable. + */ + public void testInstanceOf() { + assertTrue(((TopicMap)_tm) instanceof IReifiable); + Topic topic = _tm.createTopic(); + assertFalse(topic instanceof IReifiable); + Association assoc = _tm.createAssociation(); + assertTrue(assoc instanceof IReifiable); + AssociationRole role = assoc.createAssociationRole(_tm.createTopic(), _tm.createTopic()); + assertTrue(role instanceof IReifiable); + Occurrence occ = topic.createOccurrence("tinyTiM", null, null); + assertTrue(occ instanceof IReifiable); + TopicName name = topic.createTopicName("tinyTiM", null); + assertTrue(name instanceof IReifiable); + Variant variant = name.createVariant("tinyTiM", null); + assertTrue(variant instanceof IReifiable); + } + + /** + * Tests setting and getting the reifier of a topic map. + */ + public void testTopicMap() { + _testSetGet((IReifiable)_tm); + } + + /** + * Tests setting and getting the reifier of an association. + */ + public void testAssociation() { + _testSetGet((IReifiable)_tm.createAssociation()); + } + + /** + * Tests setting and getting the reifier of a role. + */ + public void testRole() { + Association assoc = _tm.createAssociation(); + AssociationRole role = assoc.createAssociationRole(_tm.createTopic(), _tm.createTopic()); + _testSetGet((IReifiable)role); + } + + /** + * Tests setting and getting the reifier of an occurrence. + */ + public void testOccurrence() { + Topic topic = _tm.createTopic(); + Occurrence occ = topic.createOccurrence("tinyTiM", null, null); + _testSetGet((IReifiable)occ); + } + + /** + * Tests setting and getting the reifier of a name. + */ + public void testName() { + Topic topic = _tm.createTopic(); + TopicName name = topic.createTopicName("tinyTiM", null, null); + _testSetGet((IReifiable)name); + } + + /** + * Tests setting and getting the reifier of a variant. + */ + public void testVariant() { + Topic topic = _tm.createTopic(); + TopicName name = topic.createTopicName("tinyTiM", null, null); + Variant variant = name.createVariant("tinyTiM", null); + _testSetGet((IReifiable)variant); + } + + /** + * Tests setting and getting the reifier of a reifiable Topic Maps construct. + * + * @param reifiable The Topic Maps construct to test. + */ + private void _testSetGet(IReifiable reifiable) { + assertNull(reifiable.getReifier()); + TopicImpl reifier = (TopicImpl) _tm.createTopic(); + assertEquals(0, reifier.getReified().size()); + reifiable.setReifier(reifier); + assertEquals(reifier, reifiable.getReifier()); + assertEquals(reifiable, reifier._reified); + assertEquals(1, reifier.getReified().size()); + assertTrue(reifier.getReified().contains(reifiable)); + reifiable.setReifier(null); + assertNull(reifiable.getReifier()); + assertNull(reifier._reified); + assertEquals(0, reifier.getReified().size()); + + TopicImpl reifier2 = (TopicImpl) _tm.createTopic(); + IReifiable assoc = (IReifiable) _tm.createAssociation(); + assoc.setReifier(reifier2); + assertEquals(reifier2, assoc.getReifier()); + assertEquals(assoc, reifier2._reified); + try { + reifiable.setReifier(reifier2); + fail("Expected an exception. The reifier reifies another Topic Maps construct"); + } + catch (ModelConstraintException ex) { + // noop. + } + assoc.setReifier(null); + assertNull(assoc.getReifier()); + assertNull(reifier2._reified); + reifiable.setReifier(reifier); + assertEquals(reifier, reifiable.getReifier()); + assertEquals(reifiable, reifier._reified); + reifiable.setReifier(reifier2); + assertEquals(reifier2, reifiable.getReifier()); + assertEquals(reifiable, reifier2._reified); + } +} Property changes on: tinytim/trunk/test/java/org/tinytim/TestReifiable.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/test/java/org/tinytim/TestScoped.java =================================================================== --- tinytim/trunk/test/java/org/tinytim/TestScoped.java (rev 0) +++ tinytim/trunk/test/java/org/tinytim/TestScoped.java 2008-04-20 12:06:28 UTC (rev 11) @@ -0,0 +1,119 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import org.tmapi.core.Association; +import org.tmapi.core.AssociationRole; +import org.tmapi.core.Occurrence; +import org.tmapi.core.Topic; +import org.tmapi.core.TopicMap; +import org.tmapi.core.TopicName; +import org.tmapi.core.Variant; + +/** + * Tests against the {@link org.tinytim.IScoped} interface. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class TestScoped extends TinyTimTestCase { + + /** + * Tests if a Topic Maps construct is an instance of IScoped. + */ + public void testInstanceOf() { + assertFalse(((TopicMap)_tm) instanceof IScoped); + Topic topic = _tm.createTopic(); + assertFalse(topic instanceof IScoped); + Association assoc = _tm.createAssociation(); + assertTrue(assoc instanceof IScoped); + AssociationRole role = assoc.createAssociationRole(_tm.createTopic(), _tm.createTopic()); + assertFalse(role instanceof IScoped); + Occurrence occ = topic.createOccurrence("tinyTiM", null, null); + assertTrue(occ instanceof IScoped); + TopicName name = topic.createTopicName("tinyTiM", null); + assertTrue(name instanceof IScoped); + Variant variant = name.createVariant("tinyTiM", null); + assertTrue(variant instanceof IScoped); + } + + /** + * Tests against an association. + */ + public void testAssociation() { + Association assoc = _tm.createAssociation(); + _testScoped((IScoped) assoc); + } + + /** + * Tests against an occurrence. + */ + public void testOccurrence() { + Topic topic = _tm.createTopic(); + Occurrence occ = topic.createOccurrence("tinyTiM", null, null); + _testScoped((IScoped) occ); + } + + /** + * Tests against a name. + */ + public void testName() { + Topic topic = _tm.createTopic(); + TopicName name = topic.createTopicName("tinyTiM", null, null); + _testScoped((IScoped) name); + } + + /** + * Tests against a variant. + */ + public void testVariant() { + Topic topic = _tm.createTopic(); + TopicName name = topic.createTopicName("tinyTiM", null, null); + Variant variant = name.createVariant("tinyTiM", null); + _testScoped((IScoped) variant); + } + + /** + * Tests adding / removing themes. + * + * @param scoped The scoped Topic Maps construct to test. + */ + private void _testScoped(IScoped scoped) { + //TODO: This may fail in the future for variants + assertEquals(0, scoped.getScope().size()); + Topic theme1 = _tm.createTopic(); + scoped.addTheme(theme1); + assertEquals(1, scoped.getScope().size()); + assertTrue(scoped.getScope().contains(theme1)); + Topic theme2 = _tm.createTopic(); + assertFalse(scoped.getScope().contains(theme2)); + scoped.addTheme(theme2); + assertEquals(2, scoped.getScope().size()); + assertTrue(scoped.getScope().contains(theme1)); + assertTrue(scoped.getScope().contains(theme2)); + scoped.removeTheme(theme2); + assertEquals(1, scoped.getScope().size()); + assertTrue(scoped.getScope().contains(theme1)); + assertFalse(scoped.getScope().contains(theme2)); + scoped.removeTheme(theme1); + assertEquals(0, scoped.getScope().size()); + } +} Property changes on: tinytim/trunk/test/java/org/tinytim/TestScoped.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/test/java/org/tinytim/TestSignatureGenerator.java =================================================================== --- tinytim/trunk/test/java/org/tinytim/TestSignatureGenerator.java (rev 0) +++ tinytim/trunk/test/java/org/tinytim/TestSignatureGenerator.java 2008-04-20 12:06:28 UTC (rev 11) @@ -0,0 +1,117 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import org.tinytim.SignatureGenerator; +import org.tmapi.core.Association; +import org.tmapi.core.AssociationRole; +import org.tmapi.core.Occurrence; +import org.tmapi.core.Topic; +import org.tmapi.core.TopicName; +import org.tmapi.core.Variant; + +/** + * Tests against the {@link org.tinytim.SignatureGenerator}. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class TestSignatureGenerator extends TinyTimTestCase { + + /** + * Tests if an association with no initialized properties returns the same + * signature. + */ + public void testAssociationBasic() { + Association assoc = _tm.createAssociation(); + Association assoc2 = _tm.createAssociation(); + assertFalse(assoc.getObjectId().equals(assoc2.getObjectId())); + String sig = SignatureGenerator.generateSignature(assoc); + assertEquals(sig, SignatureGenerator.generateSignature(assoc2)); + } + + /** + * Tests if a role with no initialized properties returns the same + * signature. + */ + public void testRoleBasic() { + Association assoc = _tm.createAssociation(); + AssociationRole role = assoc.createAssociationRole(null, null); + AssociationRole role2 = assoc.createAssociationRole(null, null); + assertFalse(role.getObjectId().equals(role2.getObjectId())); + String sig = SignatureGenerator.generateSignature(role); + assertEquals(sig, SignatureGenerator.generateSignature(role2)); + } + + /** + * Tests if an occurrence with no initialized properties returns the same + * signature. + */ + public void testOccurrenceBasic() { + Topic topic = _tm.createTopic(); + Occurrence occ = topic.createOccurrence((String) null, null, null); + Occurrence occ2 = topic.createOccurrence((String) null, null, null); + assertFalse(occ.getObjectId().equals(occ2.getObjectId())); + String sig = SignatureGenerator.generateSignature(occ); + assertEquals(sig, SignatureGenerator.generateSignature(occ2)); + } + + /** + * Tests if a name with no initialized properties returns the same + * signature. + */ + public void testNameBasic() { + Topic topic = _tm.createTopic(); + TopicName name = topic.createTopicName(null, null); + TopicName name2 = topic.createTopicName(null, null); + assertFalse(name.getObjectId().equals(name2.getObjectId())); + String sig = SignatureGenerator.generateSignature(name); + assertEquals(sig, SignatureGenerator.generateSignature(name2)); + } + + /** + * Tests if a variant with no initialized properties returns the same + * signature. + */ + public void testVariantBasic() { + Topic topic = _tm.createTopic(); + TopicName name = topic.createTopicName("tinyTiM", null); + Variant variant = name.createVariant("tiny Topic Maps", null); + String sig = SignatureGenerator.generateSignature(variant); + assertEquals(sig, SignatureGenerator.generateSignature(variant)); + } + + /** + * Tests if associations with the same type return the same signature. + */ + public void testAssociationTyped() { + Association assoc = _tm.createAssociation(); + String sigBefore = SignatureGenerator.generateSignature(assoc); + Topic type = _tm.createTopic(); + assoc.setType(type); + String sigAfter = SignatureGenerator.generateSignature(assoc); + assertFalse(sigBefore.equals(sigAfter)); + Association assoc2 = _tm.createAssociation(); + assertEquals(sigBefore, SignatureGenerator.generateSignature(assoc2)); + assoc2.setType(type); + assertEquals(sigAfter, SignatureGenerator.generateSignature(assoc2)); + } +} Property changes on: tinytim/trunk/test/java/org/tinytim/TestSignatureGenerator.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/test/java/org/tinytim/TestTMAPICore.java =================================================================== --- tinytim/trunk/test/java/org/tinytim/TestTMAPICore.java (rev 0) +++ tinytim/trunk/test/java/org/tinytim/TestTMAPICore.java 2008-04-20 12:06:28 UTC (rev 11) @@ -0,0 +1,45 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import org.tmapi.core.test.AllTMAPITests; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Runs the TMAPI core test suite against tinyTiM. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class TestTMAPICore extends TMAPITestCase { + + public static void main(String[] args) { + junit.textui.TestRunner.run(suite()); + } + + public static Test suite() { + TestSuite suite = new TestSuite(); + suite.addTest(AllTMAPITests.suite()); + return suite; + } +} Property changes on: tinytim/trunk/test/java/org/tinytim/TestTMAPICore.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/test/java/org/tinytim/TestTMAPIIndex.java =================================================================== --- tinytim/trunk/test/java/org/tinytim/TestTMAPIIndex.java (rev 0) +++ tinytim/trunk/test/java/org/tinytim/TestTMAPIIndex.java 2008-04-20 12:06:28 UTC (rev 11) @@ -0,0 +1,45 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import org.tmapi.index.core.test.AllTMAPIIndexTests; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Runs the TMAPI index test suite against tinyTiM. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class TestTMAPIIndex extends TMAPITestCase { + + public static void main(String[] args) { + junit.textui.TestRunner.run(suite()); + } + + public static Test suite() { + TestSuite suite = new TestSuite(); + suite.addTest(AllTMAPIIndexTests.suite()); + return suite; + } +} Property changes on: tinytim/trunk/test/java/org/tinytim/TestTMAPIIndex.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/test/java/org/tinytim/TestTopicMapSystemFactoryImpl.java =================================================================== --- tinytim/trunk/test/java/org/tinytim/TestTopicMapSystemFactoryImpl.java (rev 0) +++ tinytim/trunk/test/java/org/tinytim/TestTopicMapSystemFactoryImpl.java 2008-04-20 12:06:28 UTC (rev 11) @@ -0,0 +1,179 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.tinytim.ICollectionFactory; +import org.tinytim.JavaCollectionFactory; +import org.tinytim.Property; +import org.tinytim.TMAPIFeature; +import org.tinytim.TopicMapSystemImpl; +import org.tmapi.core.FeatureNotRecognizedException; +import org.tmapi.core.FeatureNotSupportedException; + +/** + * Tests against the {@link org.tinytim.TopicMapSystemFactoryImpl}. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class TestTopicMapSystemFactoryImpl extends TinyTimTestCase { + + /** + * Tests the default feature values. + * + * @throws Exception + */ + public void testDefaultFeatureValues() throws Exception { + assertTrue(_sysFactory.getFeature(TMAPIFeature.NOTATION_URI)); + assertTrue(_sysFactory.getFeature(TMAPIFeature.XTM_1_1)); + assertFalse(_sysFactory.getFeature(TMAPIFeature.XTM_1_0)); + assertFalse(_sysFactory.getFeature(TMAPIFeature.READ_ONLY)); + assertFalse(_sysFactory.getFeature(TMAPIFeature.AUTOMERGE)); + assertFalse(_sysFactory.getFeature(TMAPIFeature.TNC)); + } + + + private void _setFeatureToAcceptedValue(String featureName, boolean value) throws Exception { + try { + _sysFactory.setFeature(featureName, value); + } + catch (FeatureNotSupportedException ex) { + fail("Unexpected exception while setting '" + featureName + "' to '" + value + "'"); + } + } + + private void _setFeatureToUnacceptedValue(String featureName, boolean value) throws Exception { + try { + _sysFactory.setFeature(featureName, value); + fail("Expected exception while setting '" + featureName + "' to '" + value + "'"); + } + catch (FeatureNotSupportedException ex) { + // noop. + } + } + + /** + * Tests if enabling / disabling of various features delivers the expected + * results. + * + * @throws Exception + */ + public void testSetFeatureValues() throws Exception { + _setFeatureToAcceptedValue(TMAPIFeature.NOTATION_URI, true); + _setFeatureToUnacceptedValue(TMAPIFeature.NOTATION_URI, false); + _setFeatureToAcceptedValue(TMAPIFeature.XTM_1_0, false); + _setFeatureToUnacceptedValue(TMAPIFeature.XTM_1_0, true); + _setFeatureToAcceptedValue(TMAPIFeature.XTM_1_1, true); + _setFeatureToUnacceptedValue(TMAPIFeature.XTM_1_1, false); + _setFeatureToAcceptedValue(TMAPIFeature.READ_ONLY, false); + _setFeatureToUnacceptedValue(TMAPIFeature.READ_ONLY, true); + _setFeatureToAcceptedValue(TMAPIFeature.AUTOMERGE, false); + _setFeatureToUnacceptedValue(TMAPIFeature.AUTOMERGE, true); + _setFeatureToAcceptedValue(TMAPIFeature.TNC, false); + _setFeatureToUnacceptedValue(TMAPIFeature.TNC, true); + } + + /** + * Tests if an unknown feature throws the expected exception. + * + * @throws Exception + */ + public void testUnrecognizedFeature() throws Exception { + try { + String unknownFeatureName = "http://www.semagia.com/tinyTiM/unknownTMAPIFeature"; + _sysFactory.setFeature(unknownFeatureName, true); + fail("Expected an exception while setting a unknown feature"); + } + catch (FeatureNotRecognizedException ex) { + // noop. + } + } + + /** + * Tests if the collection factory property is set. + * + * @throws Exception + */ + public void testCollectionFactoryProperty() throws Exception { + boolean troveAvailable = false; + try { + Class.forName("gnu.trove.THashSet"); + troveAvailable = true; + } + catch (Exception ex) { + // noop. + } + if (troveAvailable) { + assertEquals("org.tinytim.TroveCollectionFactory", _sysFactory.getProperty(Property.COLLECTION_FACTORY)); + } + else { + assertEquals("org.tinytim.JavaCollectionFactory", _sysFactory.getProperty(Property.COLLECTION_FACTORY)); + assertTrue(((TopicMapSystemImpl) _sysFactory.newTopicMapSystem()).getCollectionFactory() instanceof JavaCollectionFactory); + } + } + + /** + * Tests if the TopicMapSystemFactory creates automatically a default + * CollectionFactory iff the class name in the property is invaild / + * not resolvable. + * + * @throws Exception + */ + public void testCollectionFactoryFallback() throws Exception { + _sysFactory.setProperty(Property.COLLECTION_FACTORY, "a.non.existent.CollectionFactory"); + TopicMapSystemImpl sys = (TopicMapSystemImpl) _sysFactory.newTopicMapSystem(); + assertTrue(sys.getCollectionFactory() instanceof JavaCollectionFactory); + } + + /** + * Sets the setting of a custom {@link ICollectionFactory}. + * + * @throws Exception + */ + public void testCustomCollectionFactory() throws Exception { + _sysFactory.setProperty(Property.COLLECTION_FACTORY, MyCollectionFactory.class.getName()); + TopicMapSystemImpl sys = (TopicMapSystemImpl) _sysFactory.newTopicMapSystem(); + assertTrue(sys.getCollectionFactory() instanceof MyCollectionFactory); + } + + /** + * {@link ICollectionFactory} implementation that uses the Java collections. + */ + public static final class MyCollectionFactory implements ICollectionFactory { + public <K, V> Map<K, V> createMap() { + return new HashMap<K, V>(); + } + public <K, V> Map<K, V> createMap(int size) { + return createMap(); + } + public <E> Set<E> createSet(int size) { + return createSet(); + } + public <E> Set<E> createSet() { + return new HashSet<E>(); + } + } +} Property changes on: tinytim/trunk/test/java/org/tinytim/TestTopicMapSystemFactoryImpl.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/test/java/org/tinytim/TestTopicMerge.java =================================================================== --- tinytim/trunk/test/java/org/tinytim/TestTopicMerge.java (rev 0) +++ tinytim/trunk/test/java/org/tinytim/TestTopicMerge.java 2008-04-20 12:06:28 UTC (rev 11) @@ -0,0 +1,159 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import org.tmapi.core.Association; +import org.tmapi.core.AssociationRole; +import org.tmapi.core.Locator; +import org.tmapi.core.ModelConstraintException; +import org.tmapi.core.Topic; +import org.tmapi.core.TopicName; + +/** + * Tests merging of topics. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class TestTopicMerge extends TinyTimTestCase { + + /** + * If topics reify different Topic Maps constructs they cannot be merged. + */ + public void testReifiedClash() { + Topic topic1 = _tm.createTopic(); + Topic topic2 = _tm.createTopic(); + Association assoc1 = _tm.createAssociation(); + Association assoc2 = _tm.createAssociation(); + Topic type1 = _tm.createTopic(); + Topic type2 = _tm.createTopic(); + assoc1.setType(type1); + assoc2.setType(type2); + ((IReifiable) assoc1).setReifier(topic1); + ((IReifiable) assoc2).setReifier(topic2); + assertEquals(type1, assoc1.getType()); + assertEquals(type2, assoc2.getType()); + assertEquals(topic1, assoc1.getReifier()); + assertEquals(topic2, assoc2.getReifier()); + try { + topic1.mergeIn(topic2); + fail("The topics reify different Topic Maps constructs and cannot be merged"); + } + catch (ModelConstraintException ex) { + // noop. + } + } + + /** + * Tests if a topic overtakes all roles played of the other topic. + */ + public void testRolePlaying() { + Topic topic1 = _tm.createTopic(); + Topic topic2 = _tm.createTopic(); + Association assoc = _tm.createAssociation(); + assoc.setType(_tm.createTopic()); + AssociationRole role = assoc.createAssociationRole(topic2, _tm.createTopic()); + assertEquals(4, _tm.getTopics().size()); + assertFalse(topic1.getRolesPlayed().contains(role)); + assertTrue(topic2.getRolesPlayed().contains(role)); + topic1.mergeIn(topic2); + assertEquals(3, _tm.getTopics().size()); + assertTrue(topic1.getRolesPlayed().contains(role)); + } + + /** + * Tests if the subject identifiers are overtaken. + */ + public void testIdentitySubjectIdentifier() { + Topic topic1 = _tm.createTopic(); + Topic topic2 = _tm.createTopic(); + Locator sid1 = _tm.createLocator("http://psi.exmaple.org/sid-1"); + Locator sid2 = _tm.createLocator("http://psi.exmaple.org/sid-2"); + topic1.addSubjectIdentifier(sid1); + topic2.addSubjectIdentifier(sid2); + assertTrue(topic1.getSubjectIdentifiers().contains(sid1)); + assertFalse(topic1.getSubjectIdentifiers().contains(sid2)); + assertFalse(topic2.getSubjectIdentifiers().contains(sid1)); + assertTrue(topic2.getSubjectIdentifiers().contains(sid2)); + topic1.mergeIn(topic2); + assertEquals(2, topic1.getSubjectIdentifiers().size()); + assertTrue(topic1.getSubjectIdentifiers().contains(sid1)); + assertTrue(topic1.getSubjectIdentifiers().contains(sid2)); + } + + /** + * Tests if the subject locator are overtaken. + */ + public void testIdentitySubjectLocator() { + Topic topic1 = _tm.createTopic(); + Topic topic2 = _tm.createTopic(); + Locator slo1 = _tm.createLocator("http://tinytim.sf.net"); + Locator slo2 = _tm.createLocator("http://tinytim.sourceforge.net"); + topic1.addSubjectLocator(slo1); + topic2.addSubjectLocator(slo2); + assertTrue(topic1.getSubjectLocators().contains(slo1)); + assertFalse(topic1.getSubjectLocators().contains(slo2)); + assertFalse(topic2.getSubjectLocators().contains(slo1)); + assertTrue(topic2.getSubjectLocators().contains(slo2)); + topic1.mergeIn(topic2); + assertEquals(2, topic1.getSubjectLocators().size()); + assertTrue(topic1.getSubjectLocators().contains(slo1)); + assertTrue(topic1.getSubjectLocators().contains(slo2)); + } + + /** + * Tests if the item identifiers are overtaken. + */ + public void testIdentityItemIdentifier() { + Topic topic1 = _tm.createTopic(); + Topic topic2 = _tm.createTopic(); + Locator iid1 = _tm.createLocator("http://tinytim.sf.net/test#1"); + Locator iid2 = _tm.createLocator("http://tinytim.sf.net/test#2"); + topic1.addSourceLocator(iid1); + topic2.addSourceLocator(iid2); + assertTrue(topic1.getSourceLocators().contains(iid1)); + assertFalse(topic1.getSourceLocators().contains(iid2)); + assertFalse(topic2.getSourceLocators().contains(iid1)); + assertTrue(topic2.getSourceLocators().contains(iid2)); + topic1.mergeIn(topic2); + assertEquals(2, topic1.getSourceLocators().size()); + assertTrue(topic1.getSourceLocators().contains(iid1)); + assertTrue(topic1.getSourceLocators().contains(iid2)); + } + + /** + * Tests if merging detects duplicate names. + */ + public void testDuplicateSuppressionName() { + Topic topic1 = _tm.createTopic(); + Topic topic2 = _tm.createTopic(); + TopicName name1 = topic1.createTopicName("tinyTiM", null, null); + TopicName name2 = topic2.createTopicName("tinyTiM", null, null); + TopicName name3 = topic2.createTopicName("tiny Topic Maps engine", null, null); + assertEquals(1, topic1.getTopicNames().size()); + assertTrue(topic1.getTopicNames().contains(name1)); + assertEquals(2, topic2.getTopicNames().size()); + assertTrue(topic2.getTopicNames().contains(name2)); + assertTrue(topic2.getTopicNames().contains(name3)); + topic1.mergeIn(topic2); + assertEquals(2, topic1.getTopicNames().size()); + } +} Property changes on: tinytim/trunk/test/java/org/tinytim/TestTopicMerge.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/test/java/org/tinytim/TestTopicMergeDetection.java =================================================================== --- tinytim/trunk/test/java/org/tinytim/TestTopicMergeDetection.java (rev 0) +++ tinytim/trunk/test/java/org/tinytim/TestTopicMergeDetection.java 2008-04-20 12:06:28 UTC (rev 11) @@ -0,0 +1,141 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import org.tmapi.core.Locator; +import org.tmapi.core.Topic; +import org.tmapi.core.TopicsMustMergeException; + +/** + * Tests if merging situations are detected. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class TestTopicMergeDetection extends TinyTimTestCase { + + /** + * Tests if adding a duplicate subject identifier is detected. + */ + public void testExistingSubjectIdentifier() { + Topic topic1 = _tm.createTopic(); + Topic topic2 = _tm.createTopic(); + Locator loc = _tm.createLocator("http://sf.net/projects/tinytim"); + topic1.addSubjectIdentifier(loc); + assertTrue(topic1.getSubjectIdentifiers().contains(loc)); + assertEquals(topic1, _tm.getTopicBySubjectIdentifier(loc)); + try { + topic2.addSubjectIdentifier(loc); + fail("The duplicate subject identifier '" + loc + "' is not detected"); + } + catch (TopicsMustMergeException ex) { + // noop. + } + } + + /** + * Tests if adding a duplicate subject identifier on the SAME topic is ignored. + */ + public void testExistingSubjectIdentifierLegal() { + Topic topic1 = _tm.createTopic(); + Locator loc = _tm.createLocator("http://sf.net/projects/tinytim"); + topic1.addSubjectIdentifier(loc); + assertEquals(1, topic1.getSubjectIdentifiers().size()); + assertTrue(topic1.getSubjectIdentifiers().contains(loc)); + assertEquals(topic1, _tm.getTopicBySubjectIdentifier(loc)); + topic1.addSubjectIdentifier(loc); + assertEquals(1, topic1.getSubjectIdentifiers().size()); + } + + /** + * Tests if adding a duplicate subject locator is detected. + */ + public void testExistingSubjectLocator() { + Topic topic1 = _tm.createTopic(); + Topic topic2 = _tm.createTopic(); + Locator loc = _tm.createLocator("http://sf.net/projects/tinytim"); + topic1.addSubjectLocator(loc); + assertTrue(topic1.getSubjectLocators().contains(loc)); + assertEquals(topic1, _tm.getTopicBySubjectLocator(loc)); + try { + topic2.addSubjectLocator(loc); + fail("The duplicate subject locator '" + loc + "' is not detected"); + } + catch (TopicsMustMergeException ex) { + // noop. + } + } + + /** + * Tests if adding a duplicate subject locator at the SAME topic is ignored. + */ + public void testExistingSubjectLocatorLegal() { + Topic topic1 = _tm.createTopic(); + Locator loc = _tm.createLocator("http://sf.net/projects/tinytim"); + topic1.addSubjectLocator(loc); + assertEquals(1, topic1.getSubjectLocators().size()); + assertTrue(topic1.getSubjectLocators().contains(loc)); + assertEquals(topic1, _tm.getTopicBySubjectLocator(loc)); + topic1.addSubjectLocator(loc); + assertEquals(1, topic1.getSubjectLocators().size()); + } + + /** + * Tests if adding a subject identifier equals to an item identifier is detected. + */ + public void testExistingSubjectIdentifierItemIdentifier() { + Topic topic1 = _tm.createTopic(); + Topic topic2 = _tm.createTopic(); + Locator loc = _tm.createLocator("http://sf.net/projects/tinytim"); + topic1.addSubjectIdentifier(loc); + assertTrue(topic1.getSubjectIdentifiers().contains(loc)); + assertEquals(topic1, _tm.getTopicBySubjectIdentifier(loc)); + try { + topic2.addSourceLocator(loc); + fail("A topic with a subject identifier equals to the item identifier '" + loc + "' exists."); + } + catch (TopicsMustMergeException ex) { + // noop. + } + } + + /** + * Tests if adding a subject identifier equals to an item identifier + * on the SAME topic is accepted + */ + public void testExistingSubjectIdentifierItemIdentifierLegal() { + Topic topic1 = _tm.createTopic(); + Locator loc = _tm.createLocator("http://sf.net/projects/tinytim"); + topic1.addSubjectIdentifier(loc); + assertEquals(1, topic1.getSubjectIdentifiers().size()); + assertEquals(0, topic1.getSourceLocators().size()); + assertTrue(topic1.getSubjectIdentifiers().contains(loc)); + assertEquals(topic1, _tm.getTopicBySubjectIdentifier(loc)); + assertNull(_tm.getObjectByItemIdentifier(loc)); + topic1.addSourceLocator(loc); + assertEquals(1, topic1.getSubjectIdentifiers().size()); + assertEquals(1, topic1.getSourceLocators().size()); + assertTrue(topic1.getSubjectIdentifiers().contains(loc)); + assertTrue(topic1.getSourceLocators().contains(loc)); + assertEquals(topic1, _tm.getTopicBySubjectIdentifier(loc)); + assertEquals(topic1, _tm.getObjectByItemIdentifier(loc)); + } +} Property changes on: tinytim/trunk/test/java/org/tinytim/TestTopicMergeDetection.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/test/java/org/tinytim/TestTyped.java =================================================================== --- tinytim/trunk/test/java/org/tinytim/TestTyped.java (rev 0) +++ tinytim/trunk/test/java/org/tinytim/TestTyped.java 2008-04-20 12:06:28 UTC (rev 11) @@ -0,0 +1,111 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import org.tmapi.core.Association; +import org.tmapi.core.AssociationRole; +import org.tmapi.core.Occurrence; +import org.tmapi.core.Topic; +import org.tmapi.core.TopicMap; +import org.tmapi.core.TopicName; +import org.tmapi.core.Variant; + +/** + * Tests against the {@link org.tinytim.ITyped} interface. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class TestTyped extends TinyTimTestCase { + + /** + * Tests if a Topic Maps construct is an instance of ITyped. + */ + public void testInstanceOf() { + assertFalse(((TopicMap)_tm) instanceof ITyped); + Topic topic = _tm.createTopic(); + assertFalse(topic instanceof ITyped); + Association assoc = _tm.createAssociation(); + assertTrue(assoc instanceof ITyped); + AssociationRole role = assoc.createAssociationRole(_tm.createTopic(), _tm.createTopic()); + assertTrue(role instanceof ITyped); + Occurrence occ = topic.createOccurrence("tinyTiM", null, null); + assertTrue(occ instanceof ITyped); + TopicName name = topic.createTopicName("tinyTiM", null); + assertTrue(name instanceof ITyped); + Variant variant = name.createVariant("tinyTiM", null); + assertFalse(variant instanceof ITyped); + } + + /** + * Tests setting and getting the type of an association. + */ + public void testAssociation() { + _testSetGet((ITyped)_tm.createAssociation()); + } + + /** + * Tests setting and getting the type of a role. + */ + public void testRole() { + Association assoc = _tm.createAssociation(); + AssociationRole role = assoc.createAssociationRole(_tm.createTopic(), _tm.createTopic()); + _testSetGet((ITyped)role); + } + + /** + * Tests setting and getting the type of an occurrence. + */ + public void testOccurrence() { + Topic topic = _tm.createTopic(); + Occurrence occ = topic.createOccurrence("tinyTiM", null, null); + _testSetGet((ITyped)occ); + } + + /** + * Tests setting and getting the type of a name. + */ + public void testName() { + Topic topic = _tm.createTopic(); + TopicName name = topic.createTopicName("tinyTiM", null, null); + _testSetGet((ITyped)name); + } + + /** + * Tests setting and getting the type of a typed Topic Maps construct. + * + * @param typed The Topic Maps construct to test. + */ + private void _testSetGet(ITyped typed) { + Topic type = _tm.createTopic(); + Topic type2 = _tm.createTopic(); + assertFalse(type.equals(typed.getType())); + assertFalse(type2.equals(typed.getType())); + typed.setType(type); + assertTrue(type.equals(typed.getType())); + assertFalse(type2.equals(typed.getType())); + typed.setType(type2); + assertFalse(type.equals(typed.getType())); + assertTrue(type2.equals(typed.getType())); + typed.setType(null); + assertNull(typed.getType()); + } +} Property changes on: tinytim/trunk/test/java/org/tinytim/TestTyped.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/test/java/org/tinytim/TinyTimTestCase.java =================================================================== --- tinytim/trunk/test/java/org/tinytim/TinyTimTestCase.java (rev 0) +++ tinytim/trunk/test/java/org/tinytim/TinyTimTestCase.java 2008-04-20 12:06:28 UTC (rev 11) @@ -0,0 +1,71 @@ +/* + * This is tinyTiM, a tiny Topic Maps engine. + * + * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +package org.tinytim; + +import org.tinytim.TopicMapImpl; +import org.tinytim.TopicMapSystemFactoryImpl; +import org.tinytim.TopicMapSystemImpl; +import org.tmapi.core.Locator; + +import junit.framework.TestCase; + +/** + * Base class of all tinyTiM-specific test cases. + * + * This class sets up a default {@link org.tinytim.TopicMapSystemFactoryImpl}, + * a {@link org.tinytim.TopicMapSystemImpl}, and a + * {@link org.tinytim.TopicMapImpl}. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class TinyTimTestCase extends TestCase { + + protected static final String _IRI = "http://www.semagia.com/tinyTiM/testTopicMap/"; + protected Locator _base; + protected TopicMapImpl _tm; + protected TopicMapSystemImpl _sys; + protected TopicMapSystemFactoryImpl _sysFactory; + + /* (non-Javadoc) + * @see junit.framework.TestCase#setUp() + */ + @Override + protected void setUp() throws Exception { + super.setUp(); + _sysFactory = new TopicMapSystemFactoryImpl(); + _sys = (TopicMapSystemImpl) _sysFactory.newTopicMapSystem(); + _tm = (TopicMapImpl) _sys.createTopicMap(_IRI); + _base = _tm.getBaseLocator(); + } + + /* (non-Javadoc) + * @see junit.framework.TestCase#tearDown() + */ + @Override + protected void tearDown() throws Exception { + super.tearDown(); + _sysFactory = null; + _sys = null; + _tm = null; + } + +} Property changes on: tinytim/trunk/test/java/org/tinytim/TinyTimTestCase.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-20 11:59:50
|
Revision: 10 http://tinytim.svn.sourceforge.net/tinytim/?rev=10&view=rev Author: lheuer Date: 2008-04-20 04:59:51 -0700 (Sun, 20 Apr 2008) Log Message: ----------- JUnit import Added Paths: ----------- tinytim/trunk/lib/LICENSE.junit.html tinytim/trunk/lib/junit-4.4.jar Added: tinytim/trunk/lib/LICENSE.junit.html =================================================================== --- tinytim/trunk/lib/LICENSE.junit.html (rev 0) +++ tinytim/trunk/lib/LICENSE.junit.html 2008-04-20 11:59:51 UTC (rev 10) @@ -0,0 +1,125 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> +<HTML> +<HEAD> +<TITLE>Common Public License - v 1.0</TITLE> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +</HEAD> + +<BODY BGCOLOR="#FFFFFF" VLINK="#800000"> + + +<P ALIGN="CENTER"><B>Common Public License - v 1.0</B> +<P><B></B><FONT SIZE="3"></FONT> +<P><FONT SIZE="3"></FONT><FONT SIZE="2">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.</FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"><B>1. DEFINITIONS</B></FONT> +<P><FONT SIZE="2">"Contribution" means:</FONT> + +<UL><FONT SIZE="2">a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and<BR CLEAR="LEFT"> +b) in the case of each subsequent Contributor:</FONT></UL> + + +<UL><FONT SIZE="2">i) changes to the Program, and</FONT></UL> + + +<UL><FONT SIZE="2">ii) additions to the Program;</FONT></UL> + + +<UL><FONT SIZE="2">where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. </FONT><FONT SIZE="2">A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. </FONT><FONT SIZE="2">Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. </FONT></UL> + +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">"Contributor" means any person or entity that distributes the Program.</FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. </FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2">"Program" means the Contributions distributed in accordance with this Agreement.</FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.</FONT> +<P><FONT SIZE="2"><B></B></FONT> +<P><FONT SIZE="2"><B>2. GRANT OF RIGHTS</B></FONT> + +<UL><FONT SIZE="2"></FONT><FONT SIZE="2">a) </FONT><FONT SIZE="2">Subject to the terms of this Agreement, each Contributor hereby grants</FONT><FONT SIZE="2"> Recipient a non-exclusive, worldwide, royalty-free copyright license to</FONT><FONT SIZE="2" COLOR="#FF0000"> </FONT><FONT SIZE="2">reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.</FONT></UL> + + +<UL><FONT SIZE="2"></FONT></UL> + + +<UL><FONT SIZE="2"></FONT><FONT SIZE="2">b) Subject to the terms of this Agreement, each Contributor hereby grants </FONT><FONT SIZE="2">Recipient a non-exclusive, worldwide,</FONT><FONT SIZE="2" COLOR="#008000"> </FONT><FONT SIZE="2">royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. </FONT></UL> + + +<UL><FONT SIZE="2"></FONT></UL> + + +<UL><FONT SIZE="2">c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.</FONT></UL> + + +<UL><FONT SIZE="2"></FONT></UL> + + +<UL><FONT SIZE="2">d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. </FONT></UL> + + +<UL><FONT SIZE="2"></FONT></UL> + +<P><FONT SIZE="2"><B>3. REQUIREMENTS</B></FONT> +<P><FONT SIZE="2"><B></B>A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:</FONT> + +<UL><FONT SIZE="2">a) it complies with the terms and conditions of this Agreement; and</FONT></UL> + + +<UL><FONT SIZE="2">b) its license agreement:</FONT></UL> + + +<UL><FONT SIZE="2">i) effectively disclaims</FONT><FONT SIZE="2"> on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; </FONT></UL> + + +<UL><FONT SIZE="2">ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; </FONT></UL> + + +<UL><FONT SIZE="2">iii)</FONT><FONT SIZE="2"> states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and</FONT></UL> + + +<UL><FONT SIZE="2">iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.</FONT><FONT SIZE="2" COLOR="#0000FF"> </FONT><FONT SIZE="2" COLOR="#FF0000"></FONT></UL> + + +<UL><FONT SIZE="2" COLOR="#FF0000"></FONT><FONT SIZE="2"></FONT></UL> + +<P><FONT SIZE="2">When the Program is made available in source code form:</FONT> + +<UL><FONT SIZE="2">a) it must be made available under this Agreement; and </FONT></UL> + + +<UL><FONT SIZE="2">b) a copy of this Agreement must be included with each copy of the Program. </FONT></UL> + +<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT> +<P><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT><FONT SIZE="2">Contributors may not remove or alter any copyright notices contained within the Program. </FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. </FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"><B>4. COMMERCIAL DISTRIBUTION</B></FONT> +<P><FONT SIZE="2">Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.</FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.</FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"></FONT> +<P><FONT SIZE="2" COLOR="#0000FF"></FONT><FONT SIZE="2"><B>5. NO WARRANTY</B></FONT> +<P><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is</FONT><FONT SIZE="2"> solely responsible for determining the appropriateness of using and distributing </FONT><FONT SIZE="2">the Program</FONT><FONT SIZE="2"> and assumes all risks associated with its exercise of rights under this Agreement</FONT><FONT SIZE="2">, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, </FONT><FONT SIZE="2">programs or equipment, and unavailability or interruption of operations</FONT><FONT SIZE="2">. </FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2"><B>6. DISCLAIMER OF LIABILITY</B></FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES </FONT><FONT SIZE="2">(INCLUDING WITHOUT LIMITATION LOST PROFITS),</FONT><FONT SIZE="2"> HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"><B>7. GENERAL</B></FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2">If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.</FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. </FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. </FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2">Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to </FONT><FONT SIZE="2">publish new versions (including revisions) of this Agreement from time to </FONT><FONT SIZE="2">time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. </FONT><FONT SIZE="2">Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new </FONT><FONT SIZE="2">version. </FONT><FONT SIZE="2">Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, </FONT><FONT SIZE="2">by implication, estoppel or otherwise</FONT><FONT SIZE="2">.</FONT><FONT SIZE="2"> All rights in the Program not expressly granted under this Agreement are reserved.</FONT> +<P><FONT SIZE="2"></FONT> +<P><FONT SIZE="2">This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.</FONT> +<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT> +<P><FONT SIZE="2"></FONT> + +</BODY> + +</HTML> \ No newline at end of file Added: tinytim/trunk/lib/junit-4.4.jar =================================================================== (Binary files differ) Property changes on: tinytim/trunk/lib/junit-4.4.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-20 11:44:16
|
Revision: 9 http://tinytim.svn.sourceforge.net/tinytim/?rev=9&view=rev Author: lheuer Date: 2008-04-20 04:44:19 -0700 (Sun, 20 Apr 2008) Log Message: ----------- Initial import of the libs Added Paths: ----------- tinytim/trunk/lib/ tinytim/trunk/lib/LICENSE.tmapi-test.txt tinytim/trunk/lib/LICENSE.tmapi.txt tinytim/trunk/lib/LICENSE.trove.txt tinytim/trunk/lib/tmapi-1_0SP1.jar tinytim/trunk/lib/tmapi-test-1_0SP1.jar tinytim/trunk/lib/trove-2.0.3.jar Added: tinytim/trunk/lib/LICENSE.tmapi-test.txt =================================================================== --- tinytim/trunk/lib/LICENSE.tmapi-test.txt (rev 0) +++ tinytim/trunk/lib/LICENSE.tmapi-test.txt 2008-04-20 11:44:19 UTC (rev 9) @@ -0,0 +1,21 @@ +TMAPI 1.0 + + Version 1.0 of the Topic Maps API (TMAPI), created collectively by + the membership of the tmapi-discuss mailing list + (http://lists.sourceforge.net/mailman/listinfo/tmapi-discuss), + is hereby released into the public domain. + + No one owns TMAPI: you may use it freely in both commercial and + non-commercial applications, bundle it with your software + distribution, include it on a CD-ROM, list the source code in a + book, mirror the documentation at your own web site, or use it in + any other way you see fit. + + Kal Ahmed (kal at techquila.com) + Lars Marius Garshol (larsga at users.sourceforge.net) + Geir Ove Gr\xF8nmo (grove at users.sourceforge.net) + Lars Heuer (lheuer at users.sourceforge.net) + Stefan Lischke (lischke2 at users.sourceforge.net) + Graham Moore (gra_moore at users.sourceforge.net) + + 08 April 2004 Added: tinytim/trunk/lib/LICENSE.tmapi.txt =================================================================== --- tinytim/trunk/lib/LICENSE.tmapi.txt (rev 0) +++ tinytim/trunk/lib/LICENSE.tmapi.txt 2008-04-20 11:44:19 UTC (rev 9) @@ -0,0 +1,21 @@ +TMAPI 1.0 + + Version 1.0 of the Topic Maps API (TMAPI), created collectively by + the membership of the tmapi-discuss mailing list + (http://lists.sourceforge.net/mailman/listinfo/tmapi-discuss), + is hereby released into the public domain. + + No one owns TMAPI: you may use it freely in both commercial and + non-commercial applications, bundle it with your software + distribution, include it on a CD-ROM, list the source code in a + book, mirror the documentation at your own web site, or use it in + any other way you see fit. + + Kal Ahmed (kal at techquila.com) + Lars Marius Garshol (larsga at users.sourceforge.net) + Geir Ove Gr\xF8nmo (grove at users.sourceforge.net) + Lars Heuer (lheuer at users.sourceforge.net) + Stefan Lischke (lischke2 at users.sourceforge.net) + Graham Moore (gra_moore at users.sourceforge.net) + + 08 April 2004 Added: tinytim/trunk/lib/LICENSE.trove.txt =================================================================== --- tinytim/trunk/lib/LICENSE.trove.txt (rev 0) +++ tinytim/trunk/lib/LICENSE.trove.txt 2008-04-20 11:44:19 UTC (rev 9) @@ -0,0 +1,528 @@ +The Trove library is licensed under the Lesser GNU Public License, +which is included with the distribution in a file called LICENSE.txt. + +Other license arrangements are possible, for a fee: contact +e...@us... for terms/pricing. + +The PrimeFinder and HashFunctions classes in Trove are subject to the +following license restrictions: + +Copyright (c) 1999 CERN - European Organization for Nuclear Research. + +Permission to use, copy, modify, distribute and sell this software and +its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation. CERN makes no representations about the +suitability of this software for any purpose. It is provided "as is" +without expressed or implied warranty. + + + +Content of Trove's LICENSE.txt: + + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + Added: tinytim/trunk/lib/tmapi-1_0SP1.jar =================================================================== (Binary files differ) Property changes on: tinytim/trunk/lib/tmapi-1_0SP1.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: tinytim/trunk/lib/tmapi-test-1_0SP1.jar =================================================================== (Binary files differ) Property changes on: tinytim/trunk/lib/tmapi-test-1_0SP1.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: tinytim/trunk/lib/trove-2.0.3.jar =================================================================== (Binary files differ) Property changes on: tinytim/trunk/lib/trove-2.0.3.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-19 13:22:47
|
Revision: 8 http://tinytim.svn.sourceforge.net/tinytim/?rev=8&view=rev Author: lheuer Date: 2008-04-19 06:22:08 -0700 (Sat, 19 Apr 2008) Log Message: ----------- Created folder remotely Added Paths: ----------- tinytim/branches/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-19 13:21:13
|
Revision: 6 http://tinytim.svn.sourceforge.net/tinytim/?rev=6&view=rev Author: lheuer Date: 2008-04-19 06:20:29 -0700 (Sat, 19 Apr 2008) Log Message: ----------- Created folder remotely Added Paths: ----------- tinytim/trunk/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-19 13:21:09
|
Revision: 7 http://tinytim.svn.sourceforge.net/tinytim/?rev=7&view=rev Author: lheuer Date: 2008-04-19 06:20:51 -0700 (Sat, 19 Apr 2008) Log Message: ----------- Created folder remotely Added Paths: ----------- tinytim/tags/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-18 15:37:04
|
Revision: 5 http://tinytim.svn.sourceforge.net/tinytim/?rev=5&view=rev Author: lheuer Date: 2008-04-18 08:36:55 -0700 (Fri, 18 Apr 2008) Log Message: ----------- Removed test file Removed Paths: ------------- tinytim/test.txt Deleted: tinytim/test.txt =================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lh...@us...> - 2008-04-18 15:34:15
|
Revision: 4 http://tinytim.svn.sourceforge.net/tinytim/?rev=4&view=rev Author: lheuer Date: 2008-04-18 08:34:02 -0700 (Fri, 18 Apr 2008) Log Message: ----------- Test Added Paths: ----------- tinytim/test.txt Added: tinytim/test.txt =================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |