]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Remove deprecated/duplicate version of org.simantics.objmap2
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 18 Aug 2020 07:58:28 +0000 (10:58 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 18 Aug 2020 07:58:59 +0000 (10:58 +0300)
gitlab #139

150 files changed:
org.simantics.objmap2/.classpath [deleted file]
org.simantics.objmap2/.project [deleted file]
org.simantics.objmap2/.settings/org.eclipse.jdt.core.prefs [deleted file]
org.simantics.objmap2/META-INF/MANIFEST.MF [deleted file]
org.simantics.objmap2/build.properties [deleted file]
org.simantics.objmap2/pom.xml [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/backward/IBackwardLinkType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/backward/IBackwardMapping.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/backward/IBackwardMappingRule.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/backward/IBackwardMappingSchema.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/bidirectional/IBidirectionalLinkType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/bidirectional/IBidirectionalMapping.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/bidirectional/IBidirectionalMappingRule.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/bidirectional/IBidirectionalMappingSchema.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/exceptions/MappingException.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardLinkType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMapping.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMappingRule.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMappingSchema.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/IMapping.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/IMappingListener.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/Mappings.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/Composition.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/CompoundRelatedGetValue.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/CompoundRelatedSetValue.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/DynamicGraphType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/GetType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/GraphType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/HasCollectionAdder.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/HasCollectionRemover.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/HasSetter.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OptionalRelatedElements.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OrderedElementsAdd.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OrderedElementsGet.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OrderedElementsRem.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OrderedSetType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElement.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElements.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElementsAdd.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElementsGet.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElementsRem.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedGetObj.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedGetValue.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedOrderedSetElements.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedSetObj.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedSetValue.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedValue.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/SetType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/UpdateMethod.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/CompoundRelatedGetSetValueRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/DataTypeUtils.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/OptionalRelatedElementsRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/OrderedElementsRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedElementRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedElementsRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedElementsRuleFactory2.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedGetSetObjRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedGetSetValueRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedOrderedSetElementsRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedValueRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/UpdateMethodFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsClassRule.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsCollectionRule.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsFieldRule.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsGetSetRule.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsMethodRule.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/impl/Link.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/impl/Mapping.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/impl/RangeUpdateRequest.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementRule.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementsRule.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/ValueRule.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/adapters/IdentityAdapter.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/adapters/ValueAdapter.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/CompoundValueAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/IDomainAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/MappingUtils.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedObjectAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedObjectsAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedOrderedSetElementsAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedValueAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/IClassRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/ICollectionRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/IFieldRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/IGetSetRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/IMethodRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/AdaptedRangeAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/CollectionAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/CompoundGetSetValueAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/FieldAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/FieldAccessorWithDefault.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/GetSetObjectAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/GetSetValueAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/IRangeAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/ListAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/schema/AdaptedLinkType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/schema/DefaultSchema.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/schema/DynamicSimpleLinkType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/schema/ILinkType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/schema/IMappingSchema.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/schema/MappingSchemas.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/schema/OrderedSetSimpleLinkType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/schema/SimpleLinkType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/graph/schema/SimpleSchema.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/internal/BidirectionalLink.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/internal/BidirectionalMapping.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/internal/MonotoneBackwardMapping.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/internal/MonotoneForwardMapping.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/IStructuralObject.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/StructuralResource.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedElementsAdd.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedElementsGet.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedElementsRem.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedGetObj.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedSetObj.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedElementsAdd.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedElementsGet.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedElementsRem.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedGetObj.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedGetValue.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedSetObj.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedSetValue.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/DataTypeUtils.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/OptionalRelatedElementsRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedElementRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedElementsRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedElementsRuleFactory2.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedGetSetObjRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedGetSetValueRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedOrderedSetElementsRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedValueRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/StructuralRelatedElementsRuleFactory2.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/StructuralRelatedGetSetObjRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/TypeRelatedElementsRuleFactory2.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/TypeRelatedGetSetObjRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/TypeRelatedGetSetValueRuleFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/UpdateMethodFactory.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedObjectAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedObjectsAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedOrderedSetElementsAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedValueAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/StructuralRelatedObjectAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/StructuralRelatedObjectsAccessor.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/StructuralUtils.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/schema/AdaptedLinkType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/schema/DefaultSchema.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/schema/MappingSchemas.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/schema/OrderedSetSimpleLinkType.java [deleted file]
org.simantics.objmap2/src/org/simantics/objmap/structural/schema/SimpleLinkType.java [deleted file]
pom.xml

diff --git a/org.simantics.objmap2/.classpath b/org.simantics.objmap2/.classpath
deleted file mode 100644 (file)
index e801ebf..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.simantics.objmap2/.project b/org.simantics.objmap2/.project
deleted file mode 100644 (file)
index 25f8723..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
-       <name>org.simantics.objmap2</name>\r
-       <comment></comment>\r
-       <projects>\r
-       </projects>\r
-       <buildSpec>\r
-               <buildCommand>\r
-                       <name>org.eclipse.jdt.core.javabuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.ManifestBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.SchemaBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-       </buildSpec>\r
-       <natures>\r
-               <nature>org.eclipse.pde.PluginNature</nature>\r
-               <nature>org.eclipse.jdt.core.javanature</nature>\r
-       </natures>\r
-</projectDescription>\r
diff --git a/org.simantics.objmap2/.settings/org.eclipse.jdt.core.prefs b/org.simantics.objmap2/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644 (file)
index 7adc0fb..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
-org.eclipse.jdt.core.compiler.compliance=11
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
-org.eclipse.jdt.core.compiler.release=enabled
-org.eclipse.jdt.core.compiler.source=11
diff --git a/org.simantics.objmap2/META-INF/MANIFEST.MF b/org.simantics.objmap2/META-INF/MANIFEST.MF
deleted file mode 100644 (file)
index 2e5ead6..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Objmap2
-Bundle-SymbolicName: org.simantics.objmap2
-Bundle-Version: 1.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-11
-Require-Bundle: org.simantics.db;bundle-version="1.1.0",
- gnu.trove3;bundle-version="3.0.0",
- org.eclipse.core.runtime;bundle-version="3.7.0",
- org.simantics.layer0;bundle-version="1.0.0",
- org.apache.log4j;bundle-version="1.2.15",
- org.simantics.db.common;bundle-version="1.1.0",
- org.simantics.structural.ontology;bundle-version="1.1.0"
-Export-Package: org.simantics.objmap.backward,
- org.simantics.objmap.bidirectional,
- org.simantics.objmap.exceptions,
- org.simantics.objmap.forward,
- org.simantics.objmap.graph,
- org.simantics.objmap.graph.annotations,
- org.simantics.objmap.graph.annotations.factories,
- org.simantics.objmap.graph.rules.factory,
- org.simantics.objmap.graph.schema,
- org.simantics.objmap.structural,
- org.simantics.objmap.structural.annotations,
- org.simantics.objmap.structural.schema
-Automatic-Module-Name: org.simantics.objmap2
diff --git a/org.simantics.objmap2/build.properties b/org.simantics.objmap2/build.properties
deleted file mode 100644 (file)
index eaa957c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################\r
-# Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
-# Industry THTH ry.\r
-# All rights reserved. This program and the accompanying materials\r
-# are made available under the terms of the Eclipse Public License v1.0\r
-# which accompanies this distribution, and is available at\r
-# http://www.eclipse.org/legal/epl-v10.html\r
-#\r
-# Contributors:\r
-#     VTT Technical Research Centre of Finland - initial API and implementation\r
-###############################################################################\r
-source.. = src/\r
-output.. = bin/\r
-bin.includes = META-INF/,\\r
-               .\r
diff --git a/org.simantics.objmap2/pom.xml b/org.simantics.objmap2/pom.xml
deleted file mode 100644 (file)
index e154945..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
-       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-       xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-       <modelVersion>4.0.0</modelVersion>
-
-       <parent>
-               <groupId>org.simantics.g3d</groupId>
-               <artifactId>org.simantics.g3d.root</artifactId>
-               <version>1.0.0-SNAPSHOT</version>
-       </parent>
-
-       <artifactId>org.simantics.objmap2</artifactId>
-       <packaging>eclipse-plugin</packaging>
-       <version>1.0.0-SNAPSHOT</version>
-
-</project>
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/backward/IBackwardLinkType.java b/org.simantics.objmap2/src/org/simantics/objmap/backward/IBackwardLinkType.java
deleted file mode 100644 (file)
index 847e996..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.backward;\r
-\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-/**\r
- * Contains rules for creating and updating domain elements for given\r
- * range elements.\r
- * @author Hannu Niemist&ouml;\r
- */\r
-public interface IBackwardLinkType<Domain, Range> extends IBackwardMappingRule<Domain, Range> {\r
-    /**\r
-     * Creates a domain element based on a known range element.\r
-     */\r
-    Domain createDomainElement(WriteGraph graph, Range rangeElement) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/backward/IBackwardMapping.java b/org.simantics.objmap2/src/org/simantics/objmap/backward/IBackwardMapping.java
deleted file mode 100644 (file)
index c48e98b..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.backward;\r
-\r
-import java.util.Set;\r
-\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-/**\r
- * A backward mapping is a one-to-one correspondence between domain and range\r
- * elements. It supports adding new range elements and creating corresponding\r
- * domain elements.\r
- * \r
- * @author Hannu Niemist&ouml;\r
- */\r
-public interface IBackwardMapping<Domain, Range> {\r
-    Set<Range> getRange();\r
-    Domain inverseGet(Range rangeElement);\r
-    Domain inverseMap(WriteGraph graph, Range rangeElement) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/backward/IBackwardMappingRule.java b/org.simantics.objmap2/src/org/simantics/objmap/backward/IBackwardMappingRule.java
deleted file mode 100644 (file)
index 7d3123d..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.backward;\r
-\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-public interface IBackwardMappingRule<Domain, Range> {\r
-    /**\r
-     * Modifies the domain element so that it corresponds to the range element.\r
-     * @param g write transaction\r
-     * @param map unidirectional view of the current mapping\r
-     * @param domainElement the domain element that is updated\r
-     * @param rangeElement the range element that corresponds to the domain element\r
-     * @return true if the rule made some modifications\r
-     * @throws MappingException \r
-     */    \r
-       boolean updateDomain(WriteGraph graph, IBackwardMapping<Domain, Range> mapping, Domain domainElement, Range rangeElement) throws MappingException;\r
-       void createDomain(WriteGraph graph, IBackwardMapping<Domain, Range> mapping, Domain domainElement, Range rangeElement) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/backward/IBackwardMappingSchema.java b/org.simantics.objmap2/src/org/simantics/objmap/backward/IBackwardMappingSchema.java
deleted file mode 100644 (file)
index ebf75f1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.backward;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-public interface IBackwardMappingSchema<Domain, Range> {   \r
-    /**\r
-     * @return Link type that should be used for the element.\r
-     */\r
-    IBackwardLinkType<Domain, Range> linkTypeOfRangeElement(ReadGraph graph, Range element) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/bidirectional/IBidirectionalLinkType.java b/org.simantics.objmap2/src/org/simantics/objmap/bidirectional/IBidirectionalLinkType.java
deleted file mode 100644 (file)
index f866241..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.bidirectional;\r
-\r
-import org.simantics.objmap.backward.IBackwardLinkType;\r
-import org.simantics.objmap.forward.IForwardLinkType;\r
-\r
-\r
-public interface IBidirectionalLinkType<Domain, Range> \r
-extends IForwardLinkType<Domain, Range>, IBackwardLinkType<Domain, Range>,\r
-IBidirectionalMappingRule<Domain, Range> {\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/bidirectional/IBidirectionalMapping.java b/org.simantics.objmap2/src/org/simantics/objmap/bidirectional/IBidirectionalMapping.java
deleted file mode 100644 (file)
index dc4c5d1..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.bidirectional;\r
-\r
-import org.simantics.objmap.backward.IBackwardMapping;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-\r
-\r
-public interface IBidirectionalMapping<Domain, Range> \r
-extends IForwardMapping<Domain, Range>, IBackwardMapping<Domain, Range> {\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/bidirectional/IBidirectionalMappingRule.java b/org.simantics.objmap2/src/org/simantics/objmap/bidirectional/IBidirectionalMappingRule.java
deleted file mode 100644 (file)
index ea6e931..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.bidirectional;\r
-\r
-import org.simantics.objmap.backward.IBackwardMappingRule;\r
-import org.simantics.objmap.forward.IForwardMappingRule;\r
-\r
-\r
-public interface IBidirectionalMappingRule<Domain, Range> \r
-extends IForwardMappingRule<Domain, Range>, IBackwardMappingRule<Domain, Range> {\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/bidirectional/IBidirectionalMappingSchema.java b/org.simantics.objmap2/src/org/simantics/objmap/bidirectional/IBidirectionalMappingSchema.java
deleted file mode 100644 (file)
index b494234..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.bidirectional;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.objmap.backward.IBackwardMappingSchema;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardMappingSchema;\r
-\r
-\r
-public interface IBidirectionalMappingSchema<Domain, Range> \r
-extends IForwardMappingSchema<Domain, Range>, IBackwardMappingSchema<Domain, Range> {\r
-    IBidirectionalLinkType<Domain, Range> linkTypeOfDomainElement(ReadGraph graph, Domain element) throws MappingException;\r
-    IBidirectionalLinkType<Domain, Range> linkTypeOfRangeElement(ReadGraph graph, Range element) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/exceptions/MappingException.java b/org.simantics.objmap2/src/org/simantics/objmap/exceptions/MappingException.java
deleted file mode 100644 (file)
index 85b19be..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.exceptions;\r
-\r
-import org.simantics.db.exception.DatabaseException;\r
-\r
-public class MappingException extends DatabaseException {\r
-    private static final long serialVersionUID = 5381307568357191426L;\r
-    \r
-    \r
-    public MappingException() {\r
-               super();\r
-       }\r
-    \r
-    public MappingException(String message) {\r
-       super(message);\r
-    }\r
-    \r
-    public MappingException(Throwable cause) {\r
-       super(cause);\r
-    }\r
-    \r
-    public MappingException(String message, Throwable cause) {\r
-       super(message, cause);\r
-    }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardLinkType.java b/org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardLinkType.java
deleted file mode 100644 (file)
index 00e2b36..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.forward;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-/**\r
- * Contains rules for creating and updating range elements for given\r
- * domain elements.\r
- * @author Hannu Niemist&ouml;\r
- */\r
-public interface IForwardLinkType<Domain, Range> extends IForwardMappingRule<Domain, Range> {\r
-    /**\r
-     * Creates a range element based on a known domain element.\r
-     */\r
-    Range createRangeElement(ReadGraph graph, Domain domainElement) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMapping.java b/org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMapping.java
deleted file mode 100644 (file)
index 1994b62..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.forward;\r
-\r
-import java.util.Set;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-public interface IForwardMapping<Domain, Range> {\r
-    Set<Domain> getDomain();\r
-    Range get(Domain domainElement);\r
-    Range map(ReadGraph graph, Domain domainElement) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMappingRule.java b/org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMappingRule.java
deleted file mode 100644 (file)
index b64acc9..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.forward;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-public interface IForwardMappingRule<Domain, Range> {\r
-       /**\r
-        * Modifies the range element so that it corresponds to the domain element.\r
-        * @param g read transaction\r
-        * @param map unidirectional view of the current mapping\r
-        * @param domainElement the domain element that corresponds to the range element\r
-        * @param rangeElement the range element that is updated\r
-        * @return true if the rule made some modifications\r
-        * @throws MappingException\r
-        */\r
-       boolean updateRange(ReadGraph graph, IForwardMapping<Domain, Range> mapping, Domain domainElement, Range rangeElement) throws MappingException; \r
-       void createRange(ReadGraph graph, IForwardMapping<Domain, Range> mapping, Domain domainElement, Range rangeElement) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMappingSchema.java b/org.simantics.objmap2/src/org/simantics/objmap/forward/IForwardMappingSchema.java
deleted file mode 100644 (file)
index 5470c8e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.forward;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-public interface IForwardMappingSchema<Domain, Range> {\r
-    /**\r
-     * @return Link type that should be used for the element.\r
-     */\r
-    IForwardLinkType<Domain, Range> linkTypeOfDomainElement(ReadGraph graph, Domain element) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/IMapping.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/IMapping.java
deleted file mode 100644 (file)
index 655c716..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph;\r
-\r
-import java.util.Collection;\r
-import java.util.Set;\r
-\r
-import org.simantics.db.Disposable;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMapping;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-/**\r
- * A mapping consists of domain (a set of resources), range (a set of Java objects) and\r
- * a set of links relating them. The mapping is used to propagate modifications of\r
- * domain elements to range and vice versa. \r
- * \r
- * @see <a href="http://www.simantics.org/wiki/index.php/org.simantics.objmap_Manual#Concepts">Manual</a>\r
- * \r
- * @author Hannu Niemistö\r
- */\r
-public interface IMapping<Domain,Range> extends Disposable, IBidirectionalMapping<Domain, Range> {\r
-\r
-    /**\r
-     * Returns the domain of the mapping. All set operations are supported.\r
-     * Adding a new domain element does not automatically create a link to it.\r
-     * Removal of a domain element removes also a link and the target element,\r
-     * but does not remove the element from the database.\r
-     */\r
-    Set<Domain> getDomain();\r
-\r
-    /**\r
-     * Returns the range of the mapping. All set operations are supported.\r
-     * Adding a new range element does not automatically create a link to it.\r
-     * Removal of a range element removes also a link and the domain element,\r
-     * but does not remove the domain element from the database.\r
-     */\r
-    Set<Range> getRange();\r
-\r
-    /**\r
-     * Updates all domain elements whose counterpart is modified and creates new\r
-     * domain elements for previously added range elements. Returns the\r
-     * collection of domain elements that were modified or created in the update\r
-     * process.\r
-     */\r
-    Collection<Domain> updateDomain(WriteGraph g) throws MappingException;\r
-\r
-    /**\r
-     * Updates all range elements whose counterpart is modified and creates new\r
-     * range elements for previously added domain elements. Returns the\r
-     * collection of range elements that were modified or created in the update\r
-     * process.\r
-     */\r
-    Collection<Range> updateRange(ReadGraph g) throws MappingException;\r
-\r
-    /**\r
-     * Returns the counterpart of a domain element or null if the element does\r
-     * not belong to the domain or does not have a link.\r
-     */\r
-    Range get(Domain domainElement);\r
-\r
-    /**\r
-     * Returns the counterpart of a range element or null if the element does\r
-     * not belong to the range or does not have a link.\r
-     */\r
-    Domain inverseGet(Range rangeElement);\r
-\r
-    /**\r
-     * A convenience method that adds a domain element to the mapping and\r
-     * immediately updates the mapping and returns the corresponding range\r
-     * element.\r
-     */\r
-    Range map(ReadGraph g, Domain domainElement) throws MappingException;\r
-\r
-    /**\r
-     * A convenience method that adds a range element to the mapping and\r
-     * immediately updates the mapping and returns the corresponding domain\r
-     * element.\r
-     */\r
-    Domain inverseMap(WriteGraph g, Range rangeElement)\r
-            throws MappingException;\r
-\r
-    /**\r
-     * Tells the mapping that the domain element has been modified.\r
-     */\r
-    void domainModified(Domain domainElement);\r
-\r
-    /**\r
-     * Tells the mapping that the range element has been modified.\r
-     */\r
-    void rangeModified(Range rangeElement);\r
-\r
-    /**\r
-     * Tells if some domain elements have been modified or added.\r
-     */\r
-    boolean isDomainModified();\r
-\r
-    /**\r
-     * Tells if some range elements have been modified or added.\r
-     */\r
-    boolean isRangeModified();\r
-    \r
-    Collection<Domain> getDomainModified();\r
-    Collection<Range> getRangeModified();\r
-\r
-    /**\r
-     * Returns a collection of domain elements which have been modified and also\r
-     * their counterparts in the mapping are modified. These elements are in\r
-     * conflict in the sense that the updating domain and range in different\r
-     * orders may produce different results.\r
-     */\r
-    Collection<Domain> getConflictingDomainElements();\r
-\r
-    /**\r
-     * Returns a collection of range elements which have been modified and also\r
-     * their counterparts in the mapping are modified. These elements are in\r
-     * conflict in the sense that the updating domain and range in different\r
-     * orders may produce different results.\r
-     */\r
-    Collection<Range> getConflictingRangeElements();\r
-\r
-    /**\r
-     * Adds a listener for domain and range modifications.\r
-     */\r
-    void addMappingListener(IMappingListener listener);\r
-\r
-    /**\r
-     * Removes a previously added listener.\r
-     */\r
-    void removeMappingListener(IMappingListener listener);\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/IMappingListener.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/IMappingListener.java
deleted file mode 100644 (file)
index 9f9888d..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph;\r
-\r
-/**\r
- * Listens modifications in a mapping.\r
- * @author Hannu Niemistö\r
- */\r
-public interface IMappingListener {\r
-    /**\r
-     * Called when some domain element is modified or created\r
-     * and the mapping was previously up to date.\r
-     */\r
-       void domainModified();\r
-       \r
-       /**\r
-     * Called when some range element is modified or created\r
-     * and the mapping was previously up to date.\r
-     */\r
-       void rangeModified();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/Mappings.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/Mappings.java
deleted file mode 100644 (file)
index ef609bc..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph;\r
-\r
-import org.simantics.objmap.graph.impl.Mapping;\r
-import org.simantics.objmap.graph.schema.IMappingSchema;\r
-/**\r
- * Static utility methods for mappings. \r
- * @author Hannu Niemistö\r
- */\r
-public class Mappings {\r
-       private Mappings() {}\r
-       \r
-       /**\r
-        * Creates a new mapping based on the given mapping schema. \r
-        * The created mapping is not thread-safe and will not\r
-        * listen database changes automatically.\r
-        */\r
-       public static <Domain,Range> IMapping<Domain,Range> createWithoutListening(IMappingSchema<Domain,Range> schema) {\r
-               return new Mapping<Domain,Range>(schema, false);\r
-       }\r
-       \r
-       /**\r
-     * Creates a new mapping based on the given mapping schema. \r
-     * The created mapping is not thread-safe. It listens database\r
-     * changes automatically.\r
-     */\r
-       public static <Domain,Range> IMapping<Domain,Range> createWithListening(IMappingSchema<Domain,Range> schema) {\r
-        return new Mapping<Domain,Range>(schema, true);\r
-    }\r
-       \r
-       \r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/Composition.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/Composition.java
deleted file mode 100644 (file)
index 85aa938..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target({ElementType.FIELD,ElementType.METHOD})\r
-public @interface Composition {\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/CompoundRelatedGetValue.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/CompoundRelatedGetValue.java
deleted file mode 100644 (file)
index f20199e..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.meta.IsGetSetRule;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-@IsGetSetRule\r
-@HasSetter(CompoundRelatedSetValue.class)\r
-public @interface CompoundRelatedGetValue {\r
-       String objRelation();\r
-       String objType();\r
-       String valRelation();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/CompoundRelatedSetValue.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/CompoundRelatedSetValue.java
deleted file mode 100644 (file)
index 4a08904..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface CompoundRelatedSetValue {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/DynamicGraphType.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/DynamicGraphType.java
deleted file mode 100644 (file)
index fe83d2d..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.TYPE) \r
-public @interface DynamicGraphType {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/GetType.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/GetType.java
deleted file mode 100644 (file)
index 97542a3..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface GetType {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/GraphType.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/GraphType.java
deleted file mode 100644 (file)
index 6b886a1..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.TYPE) \r
-public @interface GraphType {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/HasCollectionAdder.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/HasCollectionAdder.java
deleted file mode 100644 (file)
index a4301d6..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.ANNOTATION_TYPE)\r
-public @interface HasCollectionAdder {\r
-        Class<? extends Annotation> value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/HasCollectionRemover.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/HasCollectionRemover.java
deleted file mode 100644 (file)
index c7fe7cd..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.ANNOTATION_TYPE)\r
-public @interface HasCollectionRemover {\r
-        Class<? extends Annotation> value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/HasSetter.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/HasSetter.java
deleted file mode 100644 (file)
index 9b32640..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.ANNOTATION_TYPE)\r
-public @interface HasSetter {\r
-        Class<? extends Annotation> value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OptionalRelatedElements.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OptionalRelatedElements.java
deleted file mode 100644 (file)
index 297adaa..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.meta.IsFieldRule;\r
-\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.FIELD)\r
-@IsFieldRule\r
-public @interface OptionalRelatedElements {\r
-       String value();\r
-       boolean composition() default false;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OrderedElementsAdd.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OrderedElementsAdd.java
deleted file mode 100644 (file)
index 08aa7fb..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface OrderedElementsAdd {\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OrderedElementsGet.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OrderedElementsGet.java
deleted file mode 100644 (file)
index 88d3d8e..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.meta.IsCollectionRule;\r
-\r
-\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-@IsCollectionRule\r
-@HasCollectionAdder(OrderedElementsAdd.class)\r
-@HasCollectionRemover(OrderedElementsRem.class)\r
-public @interface OrderedElementsGet {\r
-       boolean composition() default false;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OrderedElementsRem.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OrderedElementsRem.java
deleted file mode 100644 (file)
index c922f79..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface OrderedElementsRem {\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OrderedSetType.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/OrderedSetType.java
deleted file mode 100644 (file)
index 0ae08af..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.TYPE) \r
-public @interface OrderedSetType {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElement.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElement.java
deleted file mode 100644 (file)
index 36c74aa..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.meta.IsFieldRule;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.FIELD)\r
-@IsFieldRule\r
-public @interface RelatedElement {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElements.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElements.java
deleted file mode 100644 (file)
index 6cbf6e1..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.meta.IsFieldRule;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.FIELD)\r
-@IsFieldRule\r
-public @interface RelatedElements {\r
-       String value();\r
-       boolean composition() default false;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElementsAdd.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElementsAdd.java
deleted file mode 100644 (file)
index 7f005d9..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface RelatedElementsAdd {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElementsGet.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElementsGet.java
deleted file mode 100644 (file)
index 46b1f03..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.meta.IsCollectionRule;\r
-\r
-\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-@IsCollectionRule\r
-@HasCollectionAdder(RelatedElementsAdd.class)\r
-@HasCollectionRemover(RelatedElementsRem.class)\r
-public @interface RelatedElementsGet {\r
-       String value();\r
-       boolean composition() default false;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElementsRem.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedElementsRem.java
deleted file mode 100644 (file)
index c25aa5d..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface RelatedElementsRem {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedGetObj.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedGetObj.java
deleted file mode 100644 (file)
index 30bcc8d..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.meta.IsGetSetRule;\r
-\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-//@HasGetSetRuleFactory(RelatedGetSetObjRuleFactory.class)\r
-@IsGetSetRule\r
-@HasSetter(RelatedSetObj.class)\r
-public @interface RelatedGetObj {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedGetValue.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedGetValue.java
deleted file mode 100644 (file)
index 163cf30..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.meta.IsGetSetRule;\r
-import org.simantics.objmap.graph.rules.adapters.IdentityAdapter;\r
-import org.simantics.objmap.graph.rules.adapters.ValueAdapter;\r
-\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-//@HasGetSetRuleFactory(RelatedGetSetValueRuleFactory.class)\r
-@IsGetSetRule\r
-@HasSetter(RelatedSetValue.class)\r
-public @interface RelatedGetValue {\r
-       String value();\r
-        Class<? extends ValueAdapter> adapter() default IdentityAdapter.class;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedOrderedSetElements.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedOrderedSetElements.java
deleted file mode 100644 (file)
index d437288..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.meta.IsFieldRule;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.FIELD)\r
-@IsFieldRule\r
-public @interface RelatedOrderedSetElements {\r
-       boolean composition() default false;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedSetObj.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedSetObj.java
deleted file mode 100644 (file)
index f57651c..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface RelatedSetObj {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedSetValue.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedSetValue.java
deleted file mode 100644 (file)
index 09c8c52..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface RelatedSetValue {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedValue.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/RelatedValue.java
deleted file mode 100644 (file)
index 8f61c2f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.meta.IsFieldRule;\r
-import org.simantics.objmap.graph.rules.adapters.IdentityAdapter;\r
-import org.simantics.objmap.graph.rules.adapters.ValueAdapter;\r
-\r
-\r
-\r
-/**\r
- * Specifies a correspondence between a field and \r
- * functional property.\r
- * @author Hannu Niemistö\r
- */\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.FIELD)\r
-@IsFieldRule\r
-public @interface RelatedValue {\r
-    String value();\r
-    Class<? extends ValueAdapter> adapter() default IdentityAdapter.class;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/SetType.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/SetType.java
deleted file mode 100644 (file)
index c3f8b4d..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface SetType {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/UpdateMethod.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/UpdateMethod.java
deleted file mode 100644 (file)
index 841340a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.meta.IsFieldRule;\r
-\r
-\r
-\r
-/**\r
- * Specifies that the annotated method should be called\r
- * to update range object.\r
- * @author Hannu Niemistö\r
- */\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-@IsFieldRule\r
-public @interface UpdateMethod {\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/CompoundRelatedGetSetValueRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/CompoundRelatedGetSetValueRuleFactory.java
deleted file mode 100644 (file)
index 2120b50..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.CompoundRelatedGetValue;\r
-import org.simantics.objmap.graph.annotations.CompoundRelatedSetValue;\r
-import org.simantics.objmap.graph.rules.ValueRule;\r
-import org.simantics.objmap.graph.rules.domain.CompoundValueAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IGetSetRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.CompoundGetSetValueAccessor;\r
-import org.simantics.objmap.graph.rules.range.IRangeAccessor;\r
-\r
-/**\r
- * Rule factory for mapped value using Getter/Setter-methods.\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class CompoundRelatedGetSetValueRuleFactory<Range> implements IGetSetRuleFactory<Resource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<Resource, Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method setter)\r
-                       throws DatabaseException {\r
-               CompoundRelatedGetValue getterAnn = (CompoundRelatedGetValue)annotation;\r
-               \r
-//             Class<? extends ValueAdapter> adapterClass = getterAnn.adapter();\r
-               IRangeAccessor<Range,Object> rangeAccessor = new CompoundGetSetValueAccessor<Range,Object>(getter, setter);\r
-//        Resource valueType;\r
-//        if (adapterClass == IdentityAdapter.class) {\r
-//            valueType = dataTypeOfClass(g, getter.getReturnType());\r
-//        } else {\r
-//             try{\r
-//                      ValueAdapter adapter = adapterClass.newInstance();\r
-//                 rangeAccessor = new AdaptedRangeAccessor<Range>(rangeAccessor, adapter);\r
-//                 valueType = adapter.rangeTypeToDomainType(g, getter.getReturnType());\r
-//             } catch (InstantiationException e) {\r
-//                 throw new RuntimeException(e);\r
-//             } catch (IllegalAccessException e) {\r
-//                 throw new RuntimeException(e);\r
-//             }\r
-//        }\r
-               return new ValueRule<Resource,Range>(new CompoundValueAccessor(g.getResource(getterAnn.objRelation()),\r
-                                                                                                                                          g.getResource(getterAnn.objType()),\r
-                                                                                                                                          g.getResource(getterAnn.valRelation())),\r
-                                       rangeAccessor);\r
-       }\r
-       \r
-       @Override\r
-       public boolean isSetter(Annotation getterAnnotation, Annotation annotation) {\r
-               CompoundRelatedGetValue getterAnn = (CompoundRelatedGetValue)getterAnnotation;\r
-               CompoundRelatedSetValue setterAnn = (CompoundRelatedSetValue)annotation;\r
-               return getterAnn.objRelation().equals(setterAnn.value());\r
-       }\r
-       \r
-       public static Resource dataTypeOfClass(ReadGraph g, Class<?> clazz) {\r
-        Layer0 b = Layer0.getInstance(g);\r
-        if(clazz.equals(Double.class) || clazz.equals(double.class))\r
-            return b.Double;\r
-        else if(clazz.equals(String.class))\r
-            return b.String;\r
-        else if(clazz.equals(Integer.class) || clazz.equals(int.class))\r
-            return b.Integer;\r
-        else if(clazz.equals(Float.class) || clazz.equals(float.class))\r
-            return b.Float;\r
-        else if(clazz.equals(Boolean.class) || clazz.equals(boolean.class))\r
-            return b.Boolean;\r
-        else if(clazz.equals(Long.class) || clazz.equals(long.class))\r
-            return b.Long;\r
-        else if(clazz.equals(Byte.class) || clazz.equals(byte.class))\r
-            return b.Byte;\r
-        \r
-        else if(clazz.equals(double[].class))\r
-            return b.DoubleArray;\r
-        else if(clazz.equals(int[].class))\r
-            return b.IntegerArray;\r
-        else if(clazz.equals(byte[].class))\r
-            return b.ByteArray;\r
-        else if(clazz.equals(float[].class))\r
-            return b.FloatArray;\r
-        else if(clazz.equals(boolean[].class))\r
-            return b.BooleanArray;\r
-        else if(clazz.equals(String[].class))\r
-            return b.StringArray;\r
-        else if(clazz.equals(long[].class))\r
-            return b.LongArray;\r
-        else {\r
-               System.out.println("Couldn't find a data type for " + clazz);\r
-            return null;\r
-        }\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/DataTypeUtils.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/DataTypeUtils.java
deleted file mode 100644 (file)
index 6fe7f93..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.factories;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.Layer0;\r
-\r
-public class DataTypeUtils {\r
-    \r
-    public static Resource dataTypeOfClass(ReadGraph g, Class<?> clazz) {\r
-        Layer0 b = Layer0.getInstance(g);\r
-        if(clazz.equals(Double.class) || clazz.equals(double.class))\r
-            return b.Double;\r
-        else if(clazz.equals(String.class))\r
-            return b.String;\r
-        else if(clazz.equals(Integer.class) || clazz.equals(int.class))\r
-            return b.Integer;\r
-        else if(clazz.equals(Float.class) || clazz.equals(float.class))\r
-            return b.Float;\r
-        else if(clazz.equals(Boolean.class) || clazz.equals(boolean.class))\r
-            return b.Boolean;\r
-        else if(clazz.equals(Long.class) || clazz.equals(long.class))\r
-            return b.Long;\r
-        else if(clazz.equals(Byte.class) || clazz.equals(byte.class))\r
-            return b.Byte;\r
-        \r
-        else if(clazz.equals(double[].class))\r
-            return b.DoubleArray;\r
-        else if(clazz.equals(int[].class))\r
-            return b.IntegerArray;\r
-        else if(clazz.equals(byte[].class))\r
-            return b.ByteArray;\r
-        else if(clazz.equals(float[].class))\r
-            return b.FloatArray;\r
-        else if(clazz.equals(boolean[].class))\r
-            return b.BooleanArray;\r
-        else if(clazz.equals(String[].class))\r
-            return b.StringArray;\r
-        else if(clazz.equals(long[].class))\r
-            return b.LongArray;\r
-        else {\r
-               System.out.println("Couldn't find a data type for " + clazz);\r
-            return null;\r
-        }\r
-    }\r
-    \r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/OptionalRelatedElementsRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/OptionalRelatedElementsRuleFactory.java
deleted file mode 100644 (file)
index 84b1134..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.ResourceNotFoundException;\r
-import org.simantics.db.exception.ServiceException;\r
-import org.simantics.db.exception.ValidationException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.OptionalRelatedElements;\r
-import org.simantics.objmap.graph.rules.MappedElementsRule;\r
-import org.simantics.objmap.graph.rules.domain.RelatedObjectsAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IFieldRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.FieldAccessorWithDefault;\r
-\r
-\r
-public class OptionalRelatedElementsRuleFactory<Range> implements IFieldRuleFactory<Resource, Range> {\r
-\r
-    @Override\r
-    public IBidirectionalMappingRule<Resource, Range> create(ReadGraph g, Annotation _annotation, Field field) throws ResourceNotFoundException, ValidationException, ServiceException {\r
-        OptionalRelatedElements annotation = (OptionalRelatedElements)_annotation;\r
-        return new MappedElementsRule<Resource, Range>(\r
-                new RelatedObjectsAccessor(g.getResource(annotation.value()),\r
-                        annotation.composition()),\r
-                new FieldAccessorWithDefault<Range,Collection<Range>>(field, Collections.<Range>emptyList())\r
-                );\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/OrderedElementsRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/OrderedElementsRuleFactory.java
deleted file mode 100644 (file)
index aeaea5f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.OrderedElementsAdd;\r
-import org.simantics.objmap.graph.annotations.OrderedElementsGet;\r
-import org.simantics.objmap.graph.annotations.OrderedElementsRem;\r
-import org.simantics.objmap.graph.rules.MappedElementsRule;\r
-import org.simantics.objmap.graph.rules.domain.RelatedOrderedSetElementsAccessor;\r
-import org.simantics.objmap.graph.rules.factory.ICollectionRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.ListAccessor;\r
-\r
-\r
-public class OrderedElementsRuleFactory<Range> implements ICollectionRuleFactory<Resource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<Resource, Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method adder, Method remover)\r
-                       throws DatabaseException {\r
-               OrderedElementsGet getterAnn = (OrderedElementsGet)annotation;\r
-               return new MappedElementsRule<Resource,Range>(new RelatedOrderedSetElementsAccessor(getterAnn.composition()),\r
-                                       new ListAccessor<Range,Range>(getter, adder, remover));\r
-       }\r
-       \r
-       @Override\r
-       public boolean isAdder(Annotation getterAnnotation, Annotation annotation) {\r
-               OrderedElementsGet getterAnn = (OrderedElementsGet)getterAnnotation;\r
-               OrderedElementsAdd adderAnn = (OrderedElementsAdd)annotation;\r
-               return true;\r
-       }\r
-       \r
-       @Override\r
-       public boolean isRemover(Annotation getterAnnotation, Annotation annotation) {\r
-               OrderedElementsGet getterAnn = (OrderedElementsGet)getterAnnotation;\r
-               OrderedElementsRem adderAnn = (OrderedElementsRem)annotation;\r
-               return true;\r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedElementRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedElementRuleFactory.java
deleted file mode 100644 (file)
index 30281ee..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.ResourceNotFoundException;\r
-import org.simantics.db.exception.ServiceException;\r
-import org.simantics.db.exception.ValidationException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedElement;\r
-import org.simantics.objmap.graph.rules.MappedElementRule;\r
-import org.simantics.objmap.graph.rules.domain.RelatedObjectAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IFieldRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.FieldAccessor;\r
-\r
-\r
-public class RelatedElementRuleFactory<Range> implements IFieldRuleFactory<Resource,Range> {\r
-\r
-    @Override\r
-    public IBidirectionalMappingRule<Resource, Range> create(ReadGraph g, Annotation _annotation, Field field) throws ResourceNotFoundException, ValidationException, ServiceException {\r
-        RelatedElement annotation = (RelatedElement)_annotation;\r
-        return new MappedElementRule<Resource,Range>(\r
-                new RelatedObjectAccessor(g.getResource(annotation.value())),\r
-                new FieldAccessor<Range,Range>(field)\r
-                );\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedElementsRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedElementsRuleFactory.java
deleted file mode 100644 (file)
index d5cce13..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.ResourceNotFoundException;\r
-import org.simantics.db.exception.ServiceException;\r
-import org.simantics.db.exception.ValidationException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedElements;\r
-import org.simantics.objmap.graph.rules.MappedElementsRule;\r
-import org.simantics.objmap.graph.rules.domain.RelatedObjectsAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IFieldRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.FieldAccessor;\r
-\r
-\r
-public class RelatedElementsRuleFactory<Range> implements IFieldRuleFactory<Resource, Range> {\r
-\r
-    @Override\r
-    public IBidirectionalMappingRule<Resource, Range> create(ReadGraph g, Annotation _annotation, Field field) throws ResourceNotFoundException, ValidationException, ServiceException {\r
-        RelatedElements annotation = (RelatedElements)_annotation;\r
-        return new MappedElementsRule<Resource,Range>(\r
-                new RelatedObjectsAccessor(g.getResource(annotation.value()),\r
-                        annotation.composition()),\r
-                new FieldAccessor<Range,Collection<Range>>(field)\r
-                );\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedElementsRuleFactory2.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedElementsRuleFactory2.java
deleted file mode 100644 (file)
index ae0649d..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedElementsAdd;\r
-import org.simantics.objmap.graph.annotations.RelatedElementsGet;\r
-import org.simantics.objmap.graph.annotations.RelatedElementsRem;\r
-import org.simantics.objmap.graph.rules.MappedElementsRule;\r
-import org.simantics.objmap.graph.rules.domain.RelatedObjectsAccessor;\r
-import org.simantics.objmap.graph.rules.factory.ICollectionRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.CollectionAccessor;\r
-\r
-\r
-public class RelatedElementsRuleFactory2<Range> implements ICollectionRuleFactory<Resource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<Resource, Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method adder, Method remover)\r
-                       throws DatabaseException {\r
-               RelatedElementsGet getterAnn = (RelatedElementsGet)annotation;\r
-               return new MappedElementsRule<Resource,Range>(new RelatedObjectsAccessor(g.getResource(getterAnn.value()),getterAnn.composition()),\r
-                                       new CollectionAccessor<Range,Range>(getter, adder, remover));\r
-       }\r
-       \r
-       @Override\r
-       public boolean isAdder(Annotation getterAnnotation, Annotation annotation) {\r
-               RelatedElementsGet getterAnn = (RelatedElementsGet)getterAnnotation;\r
-               RelatedElementsAdd adderAnn = (RelatedElementsAdd)annotation;\r
-               return getterAnn.value().equals(adderAnn.value());\r
-       }\r
-       \r
-       @Override\r
-       public boolean isRemover(Annotation getterAnnotation, Annotation annotation) {\r
-               RelatedElementsGet getterAnn = (RelatedElementsGet)getterAnnotation;\r
-               RelatedElementsRem adderAnn = (RelatedElementsRem)annotation;\r
-               return getterAnn.value().equals(adderAnn.value());\r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedGetSetObjRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedGetSetObjRuleFactory.java
deleted file mode 100644 (file)
index ffd46bb..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedGetObj;\r
-import org.simantics.objmap.graph.annotations.RelatedSetObj;\r
-import org.simantics.objmap.graph.rules.MappedElementRule;\r
-import org.simantics.objmap.graph.rules.domain.RelatedObjectAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IGetSetRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.GetSetObjectAccessor;\r
-\r
-\r
-/**\r
- * Rule factory for mapped object using Getter/Setter-methods.\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class RelatedGetSetObjRuleFactory<Range> implements IGetSetRuleFactory<Resource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<Resource,Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method setter)\r
-                       throws DatabaseException {\r
-               RelatedGetObj getterAnn = (RelatedGetObj)annotation;\r
-               return new MappedElementRule<Resource,Range>(new RelatedObjectAccessor(g.getResource(getterAnn.value())),\r
-                                       new GetSetObjectAccessor<Range,Range>(getter, setter));\r
-       }\r
-       \r
-       @Override\r
-       public boolean isSetter(Annotation getterAnnotation, Annotation annotation) {\r
-               RelatedGetObj getterAnn = (RelatedGetObj)getterAnnotation;\r
-               RelatedSetObj setterAnn = (RelatedSetObj)annotation;\r
-               return getterAnn.value().equals(setterAnn.value());\r
-       }\r
-       \r
-       \r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedGetSetValueRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedGetSetValueRuleFactory.java
deleted file mode 100644 (file)
index 8e08c49..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedGetValue;\r
-import org.simantics.objmap.graph.annotations.RelatedSetValue;\r
-import org.simantics.objmap.graph.rules.ValueRule;\r
-import org.simantics.objmap.graph.rules.adapters.IdentityAdapter;\r
-import org.simantics.objmap.graph.rules.adapters.ValueAdapter;\r
-import org.simantics.objmap.graph.rules.domain.RelatedValueAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IGetSetRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.AdaptedRangeAccessor;\r
-import org.simantics.objmap.graph.rules.range.GetSetValueAccessor;\r
-import org.simantics.objmap.graph.rules.range.IRangeAccessor;\r
-\r
-/**\r
- * Rule factory for mapped value using Getter/Setter-methods.\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class RelatedGetSetValueRuleFactory<Range> implements IGetSetRuleFactory<Resource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<Resource, Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method setter)\r
-                       throws DatabaseException {\r
-               RelatedGetValue getterAnn = (RelatedGetValue)annotation;\r
-               \r
-               Class<? extends ValueAdapter> adapterClass = getterAnn.adapter();\r
-                IRangeAccessor<Range,Object> rangeAccessor = new GetSetValueAccessor<Range,Object>(getter, setter);\r
-        Resource valueType;\r
-        if (adapterClass == IdentityAdapter.class) {\r
-            valueType = dataTypeOfClass(g, getter.getReturnType());\r
-        } else {\r
-               try{\r
-                        ValueAdapter adapter = adapterClass.newInstance();\r
-                 rangeAccessor = new AdaptedRangeAccessor<Range>(rangeAccessor, adapter);\r
-                 valueType = adapter.rangeTypeToDomainType(g, getter.getReturnType());\r
-             } catch (InstantiationException e) {\r
-                 throw new RuntimeException(e);\r
-             } catch (IllegalAccessException e) {\r
-                 throw new RuntimeException(e);\r
-             }\r
-        }\r
-               return new ValueRule<Resource,Range>(new RelatedValueAccessor(g.getResource(getterAnn.value()), valueType),\r
-                                       rangeAccessor);\r
-       }\r
-       \r
-       @Override\r
-       public boolean isSetter(Annotation getterAnnotation, Annotation annotation) {\r
-               RelatedGetValue getterAnn = (RelatedGetValue)getterAnnotation;\r
-               RelatedSetValue setterAnn = (RelatedSetValue)annotation;\r
-               return getterAnn.value().equals(setterAnn.value());\r
-       }\r
-       \r
-       public static Resource dataTypeOfClass(ReadGraph g, Class<?> clazz) {\r
-        Layer0 b = Layer0.getInstance(g);\r
-        if(clazz.equals(Double.class) || clazz.equals(double.class))\r
-            return b.Double;\r
-        else if(clazz.equals(String.class))\r
-            return b.String;\r
-        else if(clazz.equals(Integer.class) || clazz.equals(int.class))\r
-            return b.Integer;\r
-        else if(clazz.equals(Float.class) || clazz.equals(float.class))\r
-            return b.Float;\r
-        else if(clazz.equals(Boolean.class) || clazz.equals(boolean.class))\r
-            return b.Boolean;\r
-        else if(clazz.equals(Long.class) || clazz.equals(long.class))\r
-            return b.Long;\r
-        else if(clazz.equals(Byte.class) || clazz.equals(byte.class))\r
-            return b.Byte;\r
-        \r
-        else if(clazz.equals(double[].class))\r
-            return b.DoubleArray;\r
-        else if(clazz.equals(int[].class))\r
-            return b.IntegerArray;\r
-        else if(clazz.equals(byte[].class))\r
-            return b.ByteArray;\r
-        else if(clazz.equals(float[].class))\r
-            return b.FloatArray;\r
-        else if(clazz.equals(boolean[].class))\r
-            return b.BooleanArray;\r
-        else if(clazz.equals(String[].class))\r
-            return b.StringArray;\r
-        else if(clazz.equals(long[].class))\r
-            return b.LongArray;\r
-        else {\r
-               System.out.println("Couldn't find a data type for " + clazz);\r
-            return null;\r
-        }\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedOrderedSetElementsRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedOrderedSetElementsRuleFactory.java
deleted file mode 100644 (file)
index 5cded54..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.ResourceNotFoundException;\r
-import org.simantics.db.exception.ServiceException;\r
-import org.simantics.db.exception.ValidationException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedOrderedSetElements;\r
-import org.simantics.objmap.graph.rules.MappedElementsRule;\r
-import org.simantics.objmap.graph.rules.domain.RelatedOrderedSetElementsAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IFieldRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.FieldAccessor;\r
-\r
-\r
-public class RelatedOrderedSetElementsRuleFactory<Range> implements IFieldRuleFactory<Resource, Range> {\r
-\r
-    @Override\r
-    public IBidirectionalMappingRule<Resource, Range> create(ReadGraph g, Annotation _annotation, Field field) throws ResourceNotFoundException, ValidationException, ServiceException {\r
-        RelatedOrderedSetElements annotation = (RelatedOrderedSetElements)_annotation;\r
-        return new MappedElementsRule<Resource,Range>(\r
-                new RelatedOrderedSetElementsAccessor(annotation.composition()),\r
-                new FieldAccessor<Range,Collection<Range>>(field)\r
-                );\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedValueRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/RelatedValueRuleFactory.java
deleted file mode 100644 (file)
index 52d6caa..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.ResourceNotFoundException;\r
-import org.simantics.db.exception.ServiceException;\r
-import org.simantics.db.exception.ValidationException;\r
-\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedValue;\r
-import org.simantics.objmap.graph.rules.ValueRule;\r
-import org.simantics.objmap.graph.rules.adapters.IdentityAdapter;\r
-import org.simantics.objmap.graph.rules.adapters.ValueAdapter;\r
-import org.simantics.objmap.graph.rules.domain.RelatedValueAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IFieldRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.AdaptedRangeAccessor;\r
-import org.simantics.objmap.graph.rules.range.FieldAccessor;\r
-import org.simantics.objmap.graph.rules.range.IRangeAccessor;\r
-\r
-\r
-public class RelatedValueRuleFactory<Range> implements IFieldRuleFactory<Resource, Range> {\r
-\r
-    @Override\r
-    public IBidirectionalMappingRule<Resource, Range> create(ReadGraph g, Annotation _annotation, Field field) throws ResourceNotFoundException,\r
-            ValidationException, ServiceException {\r
-        RelatedValue annotation = (RelatedValue) _annotation;\r
-        Class<? extends ValueAdapter> adapterClass = annotation.adapter();\r
-        IRangeAccessor<Range,Object> rangeAccessor = new FieldAccessor<Range,Object>(field);\r
-        Resource valueType;\r
-        if (adapterClass == IdentityAdapter.class) {\r
-            valueType = DataTypeUtils.dataTypeOfClass(g, field.getType());\r
-        } else {\r
-            try {\r
-                ValueAdapter adapter = adapterClass.newInstance();\r
-                rangeAccessor = new AdaptedRangeAccessor<Range>(rangeAccessor, adapter);\r
-                valueType = adapter.rangeTypeToDomainType(g, field.getType());\r
-            } catch (InstantiationException e) {\r
-                throw new RuntimeException(e);\r
-            } catch (IllegalAccessException e) {\r
-                throw new RuntimeException(e);\r
-            }\r
-        }\r
-        return new ValueRule<Resource,Range>(new RelatedValueAccessor(g.getResource(annotation.value()), valueType), rangeAccessor);\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/UpdateMethodFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/factories/UpdateMethodFactory.java
deleted file mode 100644 (file)
index 5cb22fd..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.backward.IBackwardMapping;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-import org.simantics.objmap.graph.rules.factory.IMethodRuleFactory;\r
-\r
-public class UpdateMethodFactory<Domain, Range> implements IMethodRuleFactory<Domain, Range> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-    @Override\r
-    public IBidirectionalMappingRule<Domain, Range> create(ReadGraph g, \r
-            Annotation annotation, \r
-            final Method method)\r
-            throws DatabaseException {\r
-        method.setAccessible(true);\r
-        return new IBidirectionalMappingRule<Domain,Range>() {\r
-            \r
-            @Override\r
-            public boolean updateRange(ReadGraph g, IForwardMapping<Domain, Range> map,\r
-                    Domain domainElement, Range rangeElement)\r
-                    throws MappingException {\r
-                LOGGER.info("    UpdateMethodFactory.updateRange");      \r
-                try {\r
-                    return (Boolean)method.invoke(rangeElement, g, domainElement);\r
-                } catch (Exception e) {\r
-                    // TODO Auto-generated catch block\r
-                    e.printStackTrace();\r
-                }\r
-                return false;\r
-            }\r
-            \r
-            @Override\r
-            public boolean updateDomain(WriteGraph g, IBackwardMapping<Domain,Range> map,\r
-                    Domain domainElement, Range rangeElement)\r
-                    throws MappingException {\r
-                return false;\r
-            }\r
-            \r
-            public void createDomain(WriteGraph g, IBackwardMapping<Domain,Range> map, Domain domainElement, Range rangeElement) throws MappingException {\r
-               updateDomain(g, map, domainElement, rangeElement);\r
-            };\r
-            \r
-            public void createRange(ReadGraph g, IForwardMapping<Domain,Range> map, Domain domainElement, Range rangeElement) throws MappingException {\r
-               updateRange(g, map, domainElement, rangeElement);\r
-            };\r
-        };\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsClassRule.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsClassRule.java
deleted file mode 100644 (file)
index 6373bf6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.meta;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.ANNOTATION_TYPE) \r
-public @interface IsClassRule {\r
-    \r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsCollectionRule.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsCollectionRule.java
deleted file mode 100644 (file)
index e96821f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.meta;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.ANNOTATION_TYPE) \r
-public @interface IsCollectionRule {\r
-       \r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsFieldRule.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsFieldRule.java
deleted file mode 100644 (file)
index 2367030..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.meta;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.ANNOTATION_TYPE) \r
-public @interface IsFieldRule {\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsGetSetRule.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsGetSetRule.java
deleted file mode 100644 (file)
index dd67932..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.meta;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.ANNOTATION_TYPE) \r
-public @interface IsGetSetRule {\r
-       \r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsMethodRule.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/annotations/meta/IsMethodRule.java
deleted file mode 100644 (file)
index 797ecc5..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.annotations.meta;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.ANNOTATION_TYPE) \r
-public @interface IsMethodRule {\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/Link.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/Link.java
deleted file mode 100644 (file)
index 2b2212e..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-/**\r
- * \r
- */\r
-package org.simantics.objmap.graph.impl;\r
-\r
-import org.simantics.objmap.graph.schema.ILinkType;\r
-\r
-\r
-/**\r
- * An indication that the domain element corresponds to the range element\r
- * in the mapping. The link type describes how source and target objects\r
- * are updated. There are additionally flags for dirtiness of the link.\r
- * @author Hannu Niemistö\r
- */\r
-public class Link<Domain,Range> {\r
-       public ILinkType<Domain,Range> type;\r
-       public Domain domainElement;\r
-       public Range rangeElement;\r
-       \r
-       public boolean domainModified = false;\r
-       public boolean rangeModified = false;\r
-       public boolean removed = false;\r
-       \r
-       public Link(ILinkType<Domain,Range> type, Domain domainElement, Range rangeElement) {\r
-               this.type = type;\r
-               this.domainElement = domainElement;\r
-               this.rangeElement = rangeElement;               \r
-       }               \r
-}
\ No newline at end of file
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/Mapping.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/Mapping.java
deleted file mode 100644 (file)
index ee1eb2e..0000000
+++ /dev/null
@@ -1,476 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.impl;\r
-\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-\r
-import java.util.AbstractSet;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Set;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-\r
-import org.simantics.objmap.backward.IBackwardMapping;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-import org.simantics.objmap.graph.IMapping;\r
-import org.simantics.objmap.graph.IMappingListener;\r
-import org.simantics.objmap.graph.schema.ILinkType;\r
-import org.simantics.objmap.graph.schema.IMappingSchema;\r
-\r
-/**\r
- * An implementation of IMapping. The class should not be created\r
- * directly but using methods in Mappings.\r
- * @see org.simantics.objmap.graph.Mappings\r
- * @author Hannu Niemistö\r
- */\r
-public class Mapping<Domain, Range> implements IMapping<Domain, Range> {\r
-\r
-       static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-       \r
-       \r
-       IMappingSchema<Domain, Range> schema;\r
-       \r
-       THashMap<Domain, Link<Domain,Range>> domain = new THashMap<Domain, Link<Domain,Range>>();\r
-       THashMap<Range, Link<Domain,Range>> range = new THashMap<Range, Link<Domain,Range>>();\r
-       ArrayList<IMappingListener> listeners = new ArrayList<IMappingListener>();\r
-\r
-       ArrayList<Link<Domain,Range>> modifiedDomainLinks = new ArrayList<Link<Domain,Range>>();\r
-       ArrayList<Link<Domain,Range>> modifiedRangeLinks = new ArrayList<Link<Domain,Range>>();\r
-\r
-       boolean disposed = false;\r
-       \r
-       boolean listensDomain; \r
-       \r
-       public Mapping(IMappingSchema<Domain, Range> schema, boolean listensDomain) {\r
-               this.schema = schema;\r
-               this.listensDomain = listensDomain;\r
-       }\r
-       \r
-       private void removeLink(Link<Domain,Range> link) {\r
-               if(link.domainModified)\r
-                       modifiedDomainLinks.remove(link);\r
-               if(link.rangeModified)\r
-                       modifiedRangeLinks.remove(link);\r
-               link.removed = true;\r
-       }\r
-       \r
-       private void createDomain(WriteGraph g, Link<Domain,Range> link) throws MappingException {\r
-           LOGGER.info("        createDomain for " + link.rangeElement);\r
-               ILinkType<Domain,Range> type = schema.linkTypeOfRangeElement(link.rangeElement);\r
-               Domain domainElement = type.createDomainElement(g, link.rangeElement);\r
-               link.type = type;\r
-               link.domainElement = domainElement;\r
-               domain.put(domainElement, link);\r
-               type.createDomain(g, new RangeToDomain(g), domainElement, link.rangeElement);\r
-               \r
-        // TODO Should we do this only if the mapping is listening?\r
-        domainModified(link);\r
-       }\r
-       \r
-       private void createRange(ReadGraph g, Link<Domain,Range> link) throws MappingException {\r
-               ILinkType<Domain,Range> type = schema.linkTypeOfDomainElement(g, link.domainElement);           \r
-               Range rangeElement = type.createRangeElement(g, link.domainElement);\r
-               \r
-               link.type = type;\r
-               link.rangeElement = rangeElement;\r
-               range.put(rangeElement, link);\r
-               type.createRange(g, new DomainToRange(g), link.domainElement, rangeElement);\r
-       }\r
-       \r
-       Set<Domain> domainSet = new AbstractSet<Domain>() {\r
-\r
-               public boolean add(Domain e) {\r
-                       if(domain.containsKey(e))\r
-                               return false;\r
-                       Link<Domain,Range> link = new Link<Domain,Range>(null, e, null);\r
-                       domain.put(e, link);\r
-                       modifiedDomainLinks.add(link);\r
-                       return true;\r
-               }\r
-               \r
-               public boolean contains(Object o) {\r
-                       return domain.contains(o);\r
-               }\r
-               \r
-               public boolean remove(Object o) {\r
-                       Link<Domain,Range> link = domain.remove(o);                     \r
-                       if(link == null)\r
-                               return false;\r
-                       removeLink(link);\r
-                       if(link.rangeElement != null)\r
-                               range.remove(link.rangeElement);\r
-                       return true;    \r
-               }\r
-               \r
-               @Override\r
-               public Iterator<Domain> iterator() {\r
-                   // FIXME does not implement Iterator.remove correctly\r
-                       return domain.keySet().iterator();\r
-               }\r
-\r
-               @Override\r
-               public int size() {\r
-                       return domain.size();\r
-               }\r
-               \r
-       };\r
-       \r
-       Set<Range> rangeSet = new AbstractSet<Range>() {\r
-\r
-               public boolean add(Range e) {\r
-                       if(range.containsKey(e))\r
-                               return false;\r
-                       Link<Domain,Range> link = new Link<Domain,Range>(null, null, e);\r
-                       range.put(e, link);\r
-                       modifiedRangeLinks.add(link);\r
-                       return true;\r
-               }\r
-               \r
-               public boolean contains(Object o) {\r
-                       return range.contains(o);\r
-               }\r
-               \r
-               public boolean remove(Object o) {\r
-                       Link<Domain,Range> link = range.remove(o);                      \r
-                       if(link == null)\r
-                               return false;\r
-                       removeLink(link);\r
-                       if(link.domainElement != null)\r
-                               domain.remove(link.domainElement);\r
-                       return true;\r
-               }\r
-               \r
-               @Override\r
-               public Iterator<Range> iterator() {\r
-                   // FIXME does not implement Iterator.remove correctly\r
-                       return range.keySet().iterator();\r
-               }\r
-\r
-               @Override\r
-               public int size() {\r
-                       return range.size();\r
-               }\r
-               \r
-       };\r
-       \r
-       class DomainToRange implements IForwardMapping<Domain, Range> {\r
-\r
-               ReadGraph g;\r
-               \r
-               public DomainToRange(ReadGraph g) {\r
-                       this.g = g;\r
-               }\r
-\r
-               @Override\r
-               public Range get(Domain element)  {\r
-                       Link<Domain,Range> link = domain.get(element);\r
-                       if (link != null)\r
-                               return link.rangeElement;\r
-                       return null;\r
-                       \r
-               }\r
-               \r
-               @Override\r
-               public Range map(ReadGraph graph, Domain element)\r
-                               throws MappingException {\r
-                       Link<Domain,Range> link = domain.get(element);\r
-                       if(link == null) {\r
-                           link = new Link<Domain,Range>(null, element, null);\r
-                   link.domainModified = true;\r
-                   modifiedDomainLinks.add(link);\r
-                           domain.put(element, link);           \r
-                           createRange(g, link);       \r
-                       }\r
-                       else if(link.type == null) \r
-                               createRange(g, link);\r
-            return link.rangeElement;\r
-               }\r
-               \r
-               @Override\r
-               public Set<Domain> getDomain() {\r
-                       return domain.keySet();\r
-               }\r
-               \r
-       };\r
-       \r
-       class RangeToDomain extends DomainToRange implements IBackwardMapping<Domain, Range> {\r
-\r
-               WriteGraph g;\r
-               \r
-               public RangeToDomain(WriteGraph g) {\r
-                       super(g);\r
-                       this.g = g;\r
-               }\r
-               @Override\r
-               public Domain inverseGet(Range element) {\r
-                       \r
-                       Link<Domain,Range> link = range.get(element);\r
-                       if(link != null)\r
-                               return link.domainElement;\r
-                       return null;\r
-               }\r
-               \r
-               @Override\r
-               public Domain inverseMap(WriteGraph graph, Range element)\r
-                               throws MappingException {\r
-                       Link<Domain,Range> link = range.get(element);\r
-                       if(link == null) {\r
-                           link = new Link<Domain,Range>(null, null, element);\r
-                           link.rangeModified = true;\r
-                modifiedRangeLinks.add(link);\r
-                           range.put(element, link);\r
-                           createDomain(g, link);                              \r
-                       }\r
-                       else if(link.type == null)\r
-                               createDomain(g, link);\r
-                       return link.domainElement;\r
-               }\r
-               \r
-               \r
-               @Override\r
-               public Set<Range> getRange() {\r
-                       return range.keySet();\r
-               }\r
-       };\r
-       \r
-       @Override\r
-       public Set<Domain> getDomain() {\r
-               return domainSet;\r
-       }\r
-       \r
-       @Override\r
-       public Set<Range> getRange() {\r
-               return rangeSet;\r
-       }\r
-       \r
-       \r
-       @Override\r
-       public synchronized Collection<Domain> updateDomain(WriteGraph g) throws MappingException {\r
-           LOGGER.info("Mapping.updateDomain");\r
-               RangeToDomain map = new RangeToDomain(g);\r
-               ArrayList<Domain> updated = new ArrayList<Domain>();\r
-               while(!modifiedRangeLinks.isEmpty()) {\r
-                   LOGGER.info("    modifiedRangeLinks.size() = " + modifiedRangeLinks.size());\r
-                   \r
-                       Link<Domain,Range> link = modifiedRangeLinks.remove(modifiedRangeLinks.size()-1);\r
-                       link.rangeModified = false;\r
-                       /*if(link.domainModified) {\r
-                               link.domainModified = false;\r
-                               modifiedDomainLinks.remove(link);\r
-                       }*/\r
-                       \r
-                       if(link.type == null) {\r
-                               createDomain(g, link);\r
-                       }\r
-                       \r
-                       if(link.type.updateDomain(g, map, link.domainElement, link.rangeElement))\r
-                               updated.add(link.domainElement);\r
-               }       \r
-               if (listensDomain)\r
-                       updateRange(g); //FIXME: without this listening would stop. \r
-               return updated;\r
-       }\r
-       \r
-       @Override\r
-       public synchronized Collection<Range> updateRange(ReadGraph g) throws MappingException {\r
-           LOGGER.info("Mapping.updateRange");\r
-               DomainToRange map = new DomainToRange(g);\r
-               ArrayList<Range> updated = new ArrayList<Range>();\r
-               while(!modifiedDomainLinks.isEmpty()) {             \r
-                   LOGGER.info("    modifiedDomainLinks.size() = " + modifiedDomainLinks.size());\r
-                   \r
-                       Link<Domain,Range> link = modifiedDomainLinks.remove(modifiedDomainLinks.size()-1);\r
-                       link.domainModified = false;\r
-                       /*if(link.rangeModified) {\r
-                               link.rangeModified = false;\r
-                               modifiedRangeLinks.remove(link);\r
-                       }*/\r
-                       \r
-                       if(link.type == null) {\r
-                               createRange(g, link);\r
-                       }\r
-                       \r
-                       if(listensDomain) {\r
-                           RangeUpdateRequest<Domain,Range> request = new RangeUpdateRequest<Domain,Range>(link, map, this);\r
-                           try {\r
-                    g.syncRequest(request, request);\r
-                } catch (DatabaseException e) {\r
-                    throw new MappingException(e);\r
-                }\r
-                           // TODO check if really modified\r
-                           updated.add(link.rangeElement);\r
-                       }\r
-                       else\r
-                           if(link.type.updateRange(g, map, link.domainElement, link.rangeElement))\r
-                               updated.add(link.rangeElement);\r
-               }       \r
-               return updated;\r
-       }\r
-\r
-       @Override\r
-       public Range get(Domain domainElement) {\r
-               Link<Domain,Range> link = domain.get(domainElement);\r
-               if(link == null)\r
-                       return null;\r
-               return link.rangeElement;\r
-       }\r
-\r
-       @Override\r
-       public Domain inverseGet(Range rangeElement) {\r
-               Link<Domain,Range> link = range.get(rangeElement);\r
-               if(link == null)\r
-                       return null;\r
-               return link.domainElement;\r
-       }\r
-\r
-       @Override\r
-       public Domain inverseMap(WriteGraph g, Range rangeElement) throws MappingException {\r
-               getRange().add(rangeElement);\r
-               updateDomain(g);\r
-               return inverseGet(rangeElement);\r
-       }\r
-\r
-       @Override\r
-       public Range map(ReadGraph g, Domain domainElement) throws MappingException {\r
-               getDomain().add(domainElement);\r
-               updateRange(g);\r
-               return get(domainElement);\r
-       }\r
-\r
-       void domainModified(Link<Domain,Range> link) {\r
-           if(!link.domainModified) {          \r
-               synchronized(modifiedDomainLinks) {\r
-                   LOGGER.info("        domainModified for " + link.rangeElement);\r
-                link.domainModified = true;\r
-                modifiedDomainLinks.add(link);\r
-                if(modifiedDomainLinks.size() == 1) {\r
-                    for(IMappingListener listener : listeners)\r
-                        listener.domainModified();\r
-                }\r
-               }\r
-        }\r
-       }\r
-       \r
-       @Override\r
-       public void domainModified(Domain domainElement) {\r
-               Link<Domain,Range> link = domain.get(domainElement);\r
-               if(link != null)\r
-                   domainModified(link);\r
-       }\r
-\r
-       void rangeModified(Link<Domain,Range> link) {\r
-           if(!link.rangeModified) {\r
-               synchronized(modifiedRangeLinks) {\r
-                link.rangeModified = true;\r
-                modifiedRangeLinks.add(link);\r
-                if(modifiedRangeLinks.size() == 1) {\r
-                    for(IMappingListener listener : listeners)\r
-                        listener.rangeModified();\r
-                }\r
-               }\r
-        }\r
-       }\r
-       \r
-       @Override\r
-       public void rangeModified(Range rangeElement) {\r
-               Link<Domain,Range> link = range.get(rangeElement);\r
-               if(link != null)\r
-                   rangeModified(link);\r
-       }\r
-\r
-       @Override\r
-       public boolean isDomainModified() {\r
-               return !modifiedDomainLinks.isEmpty();\r
-       }\r
-\r
-       @Override\r
-       public boolean isRangeModified() {\r
-               return !modifiedRangeLinks.isEmpty();\r
-       }\r
-       \r
-       @Override\r
-       public Collection<Domain> getDomainModified() {\r
-               List<Domain> list = new ArrayList<Domain>(modifiedDomainLinks.size());\r
-               for (Link<Domain, Range> link : modifiedDomainLinks)\r
-                       list.add(link.domainElement);\r
-               return list;\r
-                               \r
-       }\r
-       \r
-       @Override\r
-       public Collection<Range> getRangeModified() {\r
-               List<Range> list = new ArrayList<Range>(modifiedRangeLinks.size());\r
-               for (Link<Domain, Range> link : modifiedRangeLinks)\r
-                       list.add(link.rangeElement);\r
-               return list;\r
-       }\r
-\r
-       @Override\r
-       public void addMappingListener(IMappingListener listener) {\r
-               listeners.add(listener);\r
-       }\r
-\r
-       @Override\r
-       public void removeMappingListener(IMappingListener listener) {\r
-               listeners.remove(listener);             \r
-       }\r
-\r
-       @Override\r
-       public Collection<Domain> getConflictingDomainElements() {\r
-               ArrayList<Domain> result = new ArrayList<Domain>();\r
-               if(modifiedDomainLinks.size() < modifiedRangeLinks.size()) {\r
-                       for(Link<Domain,Range> link : modifiedDomainLinks)\r
-                               if(link.rangeModified)\r
-                                       result.add(link.domainElement);\r
-               }\r
-               else {\r
-                       for(Link<Domain,Range> link : modifiedRangeLinks)\r
-                               if(link.domainModified)\r
-                                       result.add(link.domainElement);\r
-               }\r
-               return result;\r
-       }\r
-\r
-       @Override\r
-       public Collection<Range> getConflictingRangeElements() {\r
-               ArrayList<Range> result = new ArrayList<Range>();\r
-               if(modifiedDomainLinks.size() < modifiedRangeLinks.size()) {\r
-                       for(Link<Domain,Range> link : modifiedDomainLinks)\r
-                               if(link.rangeModified)\r
-                                       result.add(link.rangeElement);\r
-               }\r
-               else {\r
-                       for(Link<Domain,Range> link : modifiedRangeLinks)\r
-                               if(link.domainModified)\r
-                                       result.add(link.rangeElement);\r
-               }\r
-               return result;\r
-       }\r
-\r
-    @Override\r
-    public void dispose() {\r
-        disposed = true;\r
-    }\r
-    \r
-    public boolean isDisposed() {\r
-        return disposed;\r
-    }\r
-       \r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/RangeUpdateRequest.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/impl/RangeUpdateRequest.java
deleted file mode 100644 (file)
index fed1918..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.impl;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.procedure.SyncListener;\r
-import org.simantics.db.request.Read;\r
-\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-import org.simantics.objmap.graph.impl.Link;\r
-\r
-\r
-public class RangeUpdateRequest<Domain,Range> implements Read<Boolean>, SyncListener<Boolean> {\r
-\r
-    Link<Domain,Range> link;\r
-    /*\r
-     * Note that this map uses a read request that it has got from caller and \r
-     * not the one that is used in updateRange. This is intentional.\r
-     */\r
-    IForwardMapping<Domain, Range> map; // map==null is used to flag that request is performed once\r
-    Mapping<Domain, Range> mapping; // mapping==null is used as a flag the request disposed\r
-    \r
-    public RangeUpdateRequest(Link<Domain,Range> link, IForwardMapping<Domain,Range> map, Mapping<Domain,Range> mapping) {\r
-        this.link = link;\r
-        this.map = map;\r
-        this.mapping = mapping;\r
-    }\r
-\r
-    @Override\r
-    public Boolean perform(ReadGraph g) throws DatabaseException {\r
-        if(map != null) {\r
-            link.type.updateRange(g, map, link.domainElement, link.rangeElement);\r
-            map = null;\r
-            return Boolean.TRUE;\r
-        }\r
-        else if(mapping != null) {\r
-            mapping.domainModified(link);\r
-            mapping = null;\r
-            return Boolean.FALSE;\r
-        }\r
-        else\r
-            return null;\r
-    }\r
-    \r
-    @Override\r
-    public void exception(ReadGraph graph, Throwable throwable)\r
-            throws DatabaseException {\r
-        if(throwable instanceof DatabaseException)\r
-            throw (DatabaseException)throwable;\r
-        else\r
-            throw new MappingException(throwable);\r
-    }\r
-\r
-    @Override\r
-    public void execute(ReadGraph graph, Boolean result)\r
-            throws DatabaseException {       \r
-    }\r
-\r
-    @Override\r
-    public boolean isDisposed() {\r
-        return mapping == null || link.removed || mapping.isDisposed();\r
-    }\r
-    \r
-    \r
-    \r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementRule.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementRule.java
deleted file mode 100644 (file)
index 7454d73..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.objmap.backward.IBackwardMapping;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-import org.simantics.objmap.graph.rules.domain.IDomainAccessor;\r
-import org.simantics.objmap.graph.rules.range.IRangeAccessor;\r
-\r
-\r
-\r
-\r
-/**\r
- * A rule that synchronizes collection of elements between\r
- * domain and range accessors. Elements are mapped from\r
- * between domain and range during the synchronization.\r
- * @author Hannu Niemistö\r
- */\r
-public class MappedElementRule<Domain, Range> implements IBidirectionalMappingRule<Domain, Range> {\r
-    \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       IDomainAccessor<Domain,Domain> domainAccessor;\r
-       IRangeAccessor<Range,Range> rangeAccessor;\r
-       \r
-       public MappedElementRule(IDomainAccessor<Domain,Domain> domainAccessor,\r
-            IRangeAccessor<Range,Range> rangeAccessor) {\r
-        this.domainAccessor = domainAccessor;\r
-        this.rangeAccessor = rangeAccessor;\r
-    }\r
-\r
-    @Override\r
-       public boolean updateDomain(WriteGraph g, IBackwardMapping<Domain, Range> map,\r
-                       Domain domainElement, Range rangeElement)\r
-                       throws MappingException {\r
-        LOGGER.info("    MappedElementRule.updateDomain");\r
-           Range value = rangeAccessor.get(rangeElement);\r
-           Domain mappedValue = value == null ? null : map.inverseMap(g, value);//map.inverseGet(value);\r
-               return domainAccessor.set(g, domainElement, mappedValue);\r
-       }\r
-\r
-       @Override\r
-       public boolean updateRange(ReadGraph g, IForwardMapping<Domain, Range> map,\r
-                       Domain domainElement, Range rangeElement)\r
-                       throws MappingException {\r
-        LOGGER.info("    MappedElementRule.updateRange");   \r
-           Domain value = domainAccessor.get(g, domainElement);\r
-        Range mappedValue = value == null ? null : map.map(g, value);////map.get(value);\r
-        return rangeAccessor.set(rangeElement, mappedValue);\r
-       }       \r
-       \r
-       public void createDomain(WriteGraph g, IBackwardMapping<Domain,Range> map, Domain domainElement, Range rangeElement) throws MappingException {\r
-               updateDomain(g, map, domainElement, rangeElement);\r
-       };\r
-       \r
-       public void createRange(ReadGraph g, IForwardMapping<Domain,Range> map, Domain domainElement, Range rangeElement) throws MappingException {\r
-               updateRange(g, map, domainElement, rangeElement);\r
-       };\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementsRule.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/MappedElementsRule.java
deleted file mode 100644 (file)
index 202c9ab..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.objmap.backward.IBackwardMapping;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-import org.simantics.objmap.graph.rules.domain.IDomainAccessor;\r
-import org.simantics.objmap.graph.rules.range.IRangeAccessor;\r
-\r
-\r
-/**\r
- * A rule that synchronizes collection of elements between\r
- * domain and range accessors. Elements are mapped from\r
- * between domain and range during the synchronization.\r
- * @author Hannu Niemistö\r
- */\r
-public class MappedElementsRule<Domain, Range> implements IBidirectionalMappingRule<Domain, Range> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-\r
-    IDomainAccessor<Domain,Collection<Domain>> domainAccessor;\r
-    IRangeAccessor<Range,Collection<Range>> rangeAccessor;\r
-\r
-    public MappedElementsRule(IDomainAccessor<Domain,Collection<Domain>> domainAccessor,\r
-            IRangeAccessor<Range,Collection<Range>> rangeAccessor) {\r
-        this.domainAccessor = domainAccessor;\r
-        this.rangeAccessor = rangeAccessor;\r
-    }\r
-\r
-    @Override\r
-    public boolean updateDomain(WriteGraph g, IBackwardMapping<Domain, Range> map,\r
-            Domain domainElement, Range rangeElement)\r
-    throws MappingException {\r
-        LOGGER.info("    MappedElementsRule.updateDomain");\r
-        // Snapshot the accessed range value for concurrency safety.\r
-        // NOTE: still assumes that the accessed collection is concurrent or\r
-        // synchronized for toArray to be atomic.\r
-        Collection<Range> value = rangeAccessor.get(rangeElement);\r
-        Object[] rangeSnapshot = value.toArray();\r
-        ArrayList<Domain> mappedValue = new ArrayList<Domain>(rangeSnapshot.length);\r
-        for (Object obj : rangeSnapshot)\r
-            mappedValue.add(map.inverseMap(g, (Range)obj));//map.inverseGet((Range)obj));\r
-        return domainAccessor.set(g, domainElement, mappedValue);\r
-    }\r
-\r
-    @Override\r
-    public boolean updateRange(ReadGraph g, IForwardMapping<Domain, Range> map,\r
-            Domain domainElement, Range rangeElement)\r
-    throws MappingException {\r
-        LOGGER.info("    MappedElementsRule.updateRange");\r
-        Collection<Domain> value = domainAccessor.get(g, domainElement);\r
-        ArrayList<Range> mappedValue = new ArrayList<Range>(value.size());\r
-        for(Domain r : value)\r
-            mappedValue.add(map.map(g, r));//map.get(r));\r
-        return rangeAccessor.set(rangeElement, mappedValue);\r
-    }\r
-    \r
-    public void createDomain(WriteGraph g, IBackwardMapping<Domain,Range> map, Domain domainElement, Range rangeElement) throws MappingException {\r
-       updateDomain(g, map, domainElement, rangeElement);\r
-    };\r
-    \r
-    public void createRange(ReadGraph g, IForwardMapping<Domain,Range> map, Domain domainElement, Range rangeElement) throws MappingException {\r
-       updateRange(g, map, domainElement, rangeElement);\r
-    };\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/ValueRule.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/ValueRule.java
deleted file mode 100644 (file)
index 231e14a..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.objmap.backward.IBackwardMapping;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-import org.simantics.objmap.graph.rules.domain.IDomainAccessor;\r
-import org.simantics.objmap.graph.rules.range.IRangeAccessor;\r
-\r
-\r
-/**\r
- * A rule that synchronizes values between domain and\r
- * range accessors.\r
- * @author Hannu Niemistö\r
- */\r
-public class ValueRule<Domain, Range> implements IBidirectionalMappingRule<Domain, Range> {\r
-    \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       IDomainAccessor<Domain,Object> domainAccessor;\r
-       IRangeAccessor<Range,Object> rangeAccessor;\r
-       \r
-       public ValueRule(IDomainAccessor<Domain,Object> domainAccessor,\r
-                       IRangeAccessor<Range,Object> rangeAccessor) {\r
-               this.domainAccessor = domainAccessor;\r
-               this.rangeAccessor = rangeAccessor;\r
-       }\r
-\r
-       @Override\r
-       public boolean updateDomain(WriteGraph g, IBackwardMapping<Domain, Range> map,\r
-                       Domain domainElement, Range rangeElement)\r
-                       throws MappingException {\r
-        LOGGER.info("    ValueRule.updateDomain");         \r
-               Object value = rangeAccessor.get(rangeElement);\r
-               return domainAccessor.set(g, domainElement, value);\r
-       }\r
-\r
-       @Override\r
-       public boolean updateRange(ReadGraph g, IForwardMapping<Domain, Range> map,\r
-                       Domain domainElement, Range rangeElement)\r
-                       throws MappingException {\r
-        LOGGER.info("    ValueRule.updateRange");\r
-               Object value = domainAccessor.get(g, domainElement);\r
-               return rangeAccessor.set(rangeElement, value);\r
-       }       \r
-       \r
-       public void createDomain(WriteGraph g, IBackwardMapping<Domain,Range> map, Domain domainElement, Range rangeElement) throws MappingException {\r
-               updateDomain(g, map, domainElement, rangeElement);\r
-       };\r
-       public void createRange(ReadGraph g, IForwardMapping<Domain,Range> map, Domain domainElement, Range rangeElement) throws MappingException {\r
-               updateRange(g, map, domainElement, rangeElement);\r
-       };\r
-}\r
-\r
-\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/adapters/IdentityAdapter.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/adapters/IdentityAdapter.java
deleted file mode 100644 (file)
index 77d1256..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.adapters;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-\r
-public enum IdentityAdapter implements ValueAdapter {\r
-    INSTANCE;\r
-\r
-    @Override\r
-    public Object domainToRange(Object domainValue) {\r
-        return domainValue;\r
-    }\r
-\r
-    @Override\r
-    public Object rangeToDomain(Object rangeValue) {\r
-        return rangeValue;\r
-    }\r
-\r
-    @Override\r
-    public Resource rangeTypeToDomainType(ReadGraph graph, Class<?> rangeType) {\r
-        return null;\r
-    }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/adapters/ValueAdapter.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/adapters/ValueAdapter.java
deleted file mode 100644 (file)
index 51a0f56..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.adapters;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-\r
-public interface ValueAdapter {\r
-    Resource rangeTypeToDomainType(ReadGraph graph, Class<?> rangeType);\r
-    Object domainToRange(Object domainValue);\r
-    Object rangeToDomain(Object rangeValue);\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/CompoundValueAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/CompoundValueAccessor.java
deleted file mode 100644 (file)
index 4d29ac0..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.domain;\r
-\r
-import java.util.Arrays;\r
-import java.util.Collection;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.graph.annotations.factories.CompoundRelatedGetSetValueRuleFactory;\r
-\r
-/**\r
- * \r
- * @author Marko Luukkainen\r
- */\r
-public class CompoundValueAccessor implements IDomainAccessor<Resource,Object> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       Resource objRelation;\r
-       Resource objType;\r
-       Resource valRelation;\r
-\r
-       public CompoundValueAccessor(Resource objRelation, Resource objType, Resource valRelation) {\r
-               this.objRelation = objRelation;\r
-               this.objType = objType;\r
-               this.valRelation = valRelation;\r
-       }\r
-\r
-       @Override\r
-       public Object get(ReadGraph g, Resource element) throws MappingException {\r
-               try {\r
-                       Layer0 l0 = Layer0.getInstance(g);\r
-                   LOGGER.info("        CompoundValueAccessor.get");\r
-                   Collection<Statement> coll = g.getStatements(element, objRelation);\r
-                   Map<String,Object> map = new HashMap<String, Object>();\r
-                   for (Statement c : coll) {\r
-                       String name = g.getRelatedValue(c.getObject(), l0.HasName);\r
-                       if (!map.containsKey(name) || !c.isAsserted(element))\r
-                               map.put(name, g.getRelatedValue(c.getObject(), valRelation));\r
-                   }\r
-                       return map;\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public boolean set(WriteGraph g, Resource element, Object v)\r
-                       throws MappingException {\r
-               try {\r
-                       Layer0 l0 = Layer0.getInstance(g);\r
-                   LOGGER.info("        CompoundValueAccessor.set");\r
-                   @SuppressWarnings("unchecked")\r
-                   Map<String,Object> values = (Map<String, Object>)v;\r
-                   \r
-                   Collection<Statement> coll = g.getStatements(element, objRelation);\r
-                   Map<String,Statement> stmMap = new HashMap<String, Statement>();\r
-                   Map<String,Object> valueMap = new HashMap<String, Object>();\r
-                   for (Statement c : coll) {\r
-                       String name = g.getRelatedValue(c.getObject(), l0.HasName);\r
-                       if (!stmMap.containsKey(name) || !c.isAsserted(element)) {\r
-                               stmMap.put(name, c);\r
-                               valueMap.put(name, g.getRelatedValue(c.getObject(), valRelation));\r
-                       }\r
-                   }\r
-                   boolean changed = false;\r
-                   for (String key : values.keySet()) {\r
-                       Object value = values.get(key);\r
-                       if (value.equals(valueMap.get(key)))\r
-                               continue;\r
-                       changed = true;\r
-                       Statement stm = stmMap.get(key);\r
-                       if (stm == null || stm.isAsserted(element)) {\r
-                               Resource obj = g.newResource();\r
-                               g.claim(obj, l0.InstanceOf, objType);\r
-                               g.claimLiteral(obj, l0.HasName, key);\r
-                               g.claim(element, objRelation, obj);\r
-                               stm = getStatement(g, element, objRelation, obj);\r
-                       }\r
-                       \r
-                       Statement valueStatement = g.getPossibleStatement(stm.getObject(), valRelation);\r
-                       Resource valueType = CompoundRelatedGetSetValueRuleFactory.dataTypeOfClass(g, value.getClass());\r
-                               if(valueStatement == null) {\r
-                                       \r
-                                       Resource valueResource = g.newResource();\r
-                                       g.claim(valueResource, Layer0.getInstance(g).InstanceOf, null,  valueType);\r
-                                       g.claim(stm.getObject(), valRelation, valueResource);\r
-                                       g.claimValue(valueResource, value);                             \r
-                               } else {\r
-                                                                       \r
-                                       \r
-                                       if (!valueStatement.isAsserted(stm.getObject()))\r
-                                               g.claimValue(valueStatement.getObject(), value);\r
-                                       else {\r
-                                               Resource valueResource = g.newResource();\r
-                                               g.claim(valueResource, Layer0.getInstance(g).InstanceOf, null,\r
-                                                               valueType);\r
-                                               g.claim(stm.getObject(), valRelation, valueResource);\r
-                                               g.claimValue(valueResource, value);\r
-                                       }\r
-                               }\r
-                   }\r
-                   return changed;\r
-                   \r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-               \r
-       }\r
-       \r
-       private Statement getStatement(ReadGraph g, Resource s, Resource p, Resource o) throws DatabaseException{\r
-               for (Statement stm : g.getStatements(s, p)) {\r
-                       if (stm.getObject().equals(o))\r
-                               return stm;\r
-               }\r
-               return null;\r
-       }\r
-       \r
-       private boolean equals(Object o1, Object o2) {\r
-               if (o1 instanceof boolean[])\r
-                       Arrays.equals((boolean[])o1,(boolean[])o2);\r
-               if (o1 instanceof int[])\r
-                       Arrays.equals((int[])o1,(int[])o2);\r
-               if (o1 instanceof float[])\r
-                       Arrays.equals((float[])o1,(float[])o2);\r
-               if (o1 instanceof double[])\r
-                       Arrays.equals((double[])o1,(double[])o2);\r
-               if (o1 instanceof byte[])\r
-                       Arrays.equals((byte[])o1,(byte[])o2);\r
-               return o1.equals(o2);\r
-               \r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/IDomainAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/IDomainAccessor.java
deleted file mode 100644 (file)
index d1a12e6..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.domain;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-\r
-/**\r
- * Provides access to some property of domain elements.\r
- * @author Hannu Niemistö\r
- */\r
-public interface IDomainAccessor<Domain,T> {\r
-       T get(ReadGraph g, Domain element) throws MappingException;\r
-       boolean set(WriteGraph g, Domain element, T value) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/MappingUtils.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/MappingUtils.java
deleted file mode 100644 (file)
index 5e97f85..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.domain;\r
-\r
-import java.util.Arrays;\r
-import java.util.Collection;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-\r
-/**\r
- * Static utility methods for rule implementations.\r
- * @author Hannu Niemistö\r
- */\r
-public class MappingUtils {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-    /**\r
-     * Adds and removes statements to/from the database so that <code>objects</code>\r
-     * will be exactly the objects connected to <code>subject</code> by <code>predicate</code>.\r
-     * Returns true if the method made modifications to the database.\r
-     */\r
-       public static boolean synchronizeStatements(WriteGraph g, Resource subject, Resource predicate, Resource[] objects,\r
-               boolean deleteExtraObjects) \r
-               throws DatabaseException {\r
-               Collection<Resource> currentObjects0 = g.getObjects(subject, predicate);\r
-               Resource[] currentObjects = currentObjects0.toArray(new Resource[currentObjects0.size()]);\r
-               \r
-               Arrays.sort(objects);\r
-               Arrays.sort(currentObjects);\r
-               \r
-               boolean modified = false;\r
-               int i=0, j=0;   \r
-               if(currentObjects.length > 0 && objects.length > 0)\r
-               while(true) {\r
-                       int cmp = currentObjects[i].compareTo(objects[j]);\r
-                       if(cmp < 0) {\r
-                           LOGGER.info("            remove statement");\r
-                           if(deleteExtraObjects)\r
-                               g.deny(currentObjects[i]);\r
-                           else\r
-                               g.denyStatement(subject, predicate, currentObjects[i]);                                 \r
-                               modified = true;\r
-                               ++i;\r
-                               if(i >= currentObjects.length)\r
-                                       break;\r
-                       }\r
-                       else if(cmp > 0) {\r
-                           LOGGER.info("            add statement");\r
-                               g.claim(subject, predicate, objects[j]);\r
-                               modified = true;\r
-                               ++j;\r
-                               if(j >= objects.length)\r
-                                       break;\r
-                       }\r
-                       else {\r
-                               ++i; ++j;\r
-                               if(i >= currentObjects.length)\r
-                                       break;\r
-                               if(j >= objects.length)\r
-                                       break;\r
-                       }\r
-               }\r
-               while(i < currentObjects.length) {\r
-                   if(deleteExtraObjects)\r
-                g.deny(currentObjects[i]);\r
-            else\r
-                g.denyStatement(subject, predicate, currentObjects[i]);\r
-                       modified = true;\r
-                       ++i;\r
-               }\r
-               while(j < objects.length) {\r
-                       g.claim(subject, predicate, objects[j]);\r
-                       modified = true;\r
-                       ++j;\r
-               }\r
-               return modified;\r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedObjectAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedObjectAccessor.java
deleted file mode 100644 (file)
index 91a1647..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.domain;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-/**\r
- * Accesses a resource attached to the element by given functional relation.\r
- * @author Hannu Niemistö\r
- */\r
-public class RelatedObjectAccessor implements IDomainAccessor<Resource,Resource> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       Resource relation;\r
-       \r
-       public RelatedObjectAccessor(Resource relation) {\r
-               this.relation = relation;\r
-       }\r
-\r
-       @Override\r
-       public Resource get(ReadGraph g, Resource element) throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedObjectAccessor.get");\r
-                       return g.getPossibleObject(element, relation);\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public boolean set(WriteGraph g, Resource element, Resource value)\r
-                       throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedObjectAccessor.set");\r
-                   Resource resource = g.getPossibleObject(element, relation);\r
-                       if(resource == null) {\r
-                           if(value == null)\r
-                               return false;\r
-                           g.claim(element, relation, value);\r
-                           return true;\r
-                       }\r
-                       else if(resource.equals(value))\r
-                           return false;\r
-                       else {\r
-                           g.deny(element, relation);\r
-                           if(value != null)\r
-                               g.claim(element, relation, value);\r
-                           return true;\r
-                       }\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-               \r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedObjectsAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedObjectsAccessor.java
deleted file mode 100644 (file)
index 5a9b186..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.domain;\r
-\r
-import java.util.Collection;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-/**\r
- * Accesses the set of objects attached to the element by the given relation.\r
- * @author Hannu Niemistö\r
- */\r
-public class RelatedObjectsAccessor implements IDomainAccessor<Resource,Collection<Resource>> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       Resource relation;\r
-       boolean deleteExtraObjects;\r
-\r
-       public RelatedObjectsAccessor(Resource relation, boolean deleteExtraObjects) {\r
-        super();\r
-        this.relation = relation;\r
-        this.deleteExtraObjects = deleteExtraObjects;\r
-    }\r
-\r
-    @Override\r
-       public Collection<Resource> get(ReadGraph g, Resource element) throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedObjectsAccessor.get");\r
-                       return g.getObjects(element, relation);\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public boolean set(WriteGraph g, Resource element, Collection<Resource> value)\r
-                       throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedObjectsAccessor.set");\r
-                       return MappingUtils.synchronizeStatements(g, element, relation, \r
-                               value.toArray(new Resource[value.size()]), deleteExtraObjects);\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-               \r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedOrderedSetElementsAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedOrderedSetElementsAccessor.java
deleted file mode 100644 (file)
index 2190fef..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.domain;\r
-\r
-import java.util.Collection;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.utils.OrderedSetUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-/**\r
- * Accesses the set of objects attached to the element by the given relation.\r
- * @author Hannu Niemistö\r
- */\r
-public class RelatedOrderedSetElementsAccessor implements IDomainAccessor<Resource, Collection<Resource>> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       boolean deleteExtraObjects;\r
-\r
-       public RelatedOrderedSetElementsAccessor(boolean deleteExtraObjects) {\r
-        super();\r
-        this.deleteExtraObjects = deleteExtraObjects;\r
-    }\r
-\r
-    @Override\r
-       public Collection<Resource> get(ReadGraph g, Resource element) throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedOrderedSetElementsAccessor.get");\r
-                       return OrderedSetUtils.toList(g, element);\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public boolean set(WriteGraph g, Resource element, Collection<Resource> value)\r
-                       throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedOrderedSetElementsAccessor.set");\r
-                   return OrderedSetUtils.set(g, element, value);\r
-                   // FIXME Implement deleteExtraObjects\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-               \r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedValueAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/domain/RelatedValueAccessor.java
deleted file mode 100644 (file)
index 719011f..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.domain;\r
-\r
-import java.util.Arrays;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-/**\r
- * Accesses a value attached to the element by given functional relation.\r
- * @author Hannu Niemist�\r
- */\r
-public class RelatedValueAccessor implements IDomainAccessor<Resource,Object> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       Resource relation;\r
-       Resource valueType;\r
-\r
-       public RelatedValueAccessor(Resource relation, Resource valueType) {\r
-               this.relation = relation;\r
-               this.valueType = valueType;\r
-       }\r
-\r
-       @Override\r
-       public Object get(ReadGraph g, Resource element) throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedValueAccessor.get");\r
-                       Resource valueResource = g.getPossibleObject(element, relation);\r
-                       if(valueResource == null)\r
-                               return null;\r
-                       return g.getValue(valueResource);\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public boolean set(WriteGraph g, Resource element, Object value)\r
-                       throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedValueAccessor.set");\r
-                   Statement valueStatement = g.getPossibleStatement(element, relation);\r
-                       if(valueStatement == null) {\r
-                               if(value == null)\r
-                                       return false;\r
-                               Resource valueResource = g.newResource();\r
-                               g.claim(valueResource, Layer0.getInstance(g).InstanceOf, null,\r
-                                               valueType);\r
-                               g.claim(element, relation, valueResource);\r
-                               g.claimValue(valueResource, value);                             \r
-                               return true;\r
-                       }\r
-                       else {\r
-                               if(value == null) {\r
-                                       if (!valueStatement.isAsserted(element)) {\r
-                                               g.deny(valueStatement.getObject());\r
-                                               return true;\r
-                                       } else {\r
-                                               return false;\r
-                                       }\r
-                               }                               \r
-                               Object currentValue = g.getValue(valueStatement.getObject());\r
-                               if(equals(currentValue,value))\r
-                                       return false;\r
-                               if (!valueStatement.isAsserted(element))\r
-                                       g.claimValue(valueStatement.getObject(), value);\r
-                               else {\r
-                                       Resource valueResource = g.newResource();\r
-                                       g.claim(valueResource, Layer0.getInstance(g).InstanceOf, null,\r
-                                                       valueType);\r
-                                       g.claim(element, relation, valueResource);\r
-                                       g.claimValue(valueResource, value);\r
-                               }\r
-                               return true;\r
-                       }\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-               \r
-       }\r
-       \r
-       private boolean equals(Object o1, Object o2) {\r
-               if (o1 instanceof boolean[])\r
-                       Arrays.equals((boolean[])o1,(boolean[])o2);\r
-               if (o1 instanceof int[])\r
-                       Arrays.equals((int[])o1,(int[])o2);\r
-               if (o1 instanceof float[])\r
-                       Arrays.equals((float[])o1,(float[])o2);\r
-               if (o1 instanceof double[])\r
-                       Arrays.equals((double[])o1,(double[])o2);\r
-               if (o1 instanceof byte[])\r
-                       Arrays.equals((byte[])o1,(byte[])o2);\r
-               return o1.equals(o2);\r
-               \r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/IClassRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/IClassRuleFactory.java
deleted file mode 100644 (file)
index ad9ca7b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.factory;\r
-\r
-import java.lang.annotation.Annotation;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-\r
-public interface IClassRuleFactory<Domain, Range> {\r
-    IBidirectionalMappingRule<Domain, Range> create(ReadGraph g, Annotation annotation, Class<?> clazz) throws DatabaseException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/ICollectionRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/ICollectionRuleFactory.java
deleted file mode 100644 (file)
index 5018e03..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.factory;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-\r
-public interface ICollectionRuleFactory<Domain,Range> {\r
-       IBidirectionalMappingRule<Domain, Range> create(ReadGraph g, Annotation annotation, Method getter, Method adder, Method remover) throws DatabaseException;\r
-       boolean isAdder(Annotation getterAnnotation, Annotation annotation);\r
-       boolean isRemover(Annotation getterAnnotation, Annotation annotation);\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/IFieldRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/IFieldRuleFactory.java
deleted file mode 100644 (file)
index 267273d..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.factory;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-\r
-public interface IFieldRuleFactory<Domain, Range> {\r
-    IBidirectionalMappingRule<Domain, Range> create(ReadGraph g, Annotation annotation, Field field) throws DatabaseException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/IGetSetRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/IGetSetRuleFactory.java
deleted file mode 100644 (file)
index 5ed52de..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.factory;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-\r
-public interface IGetSetRuleFactory<Domain,Range> {\r
-       IBidirectionalMappingRule<Domain, Range> create(ReadGraph g, Annotation annotation, Method getter, Method setter) throws DatabaseException;\r
-       boolean isSetter(Annotation getterAnnotation, Annotation annotation);\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/IMethodRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/factory/IMethodRuleFactory.java
deleted file mode 100644 (file)
index 86acc7c..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.factory;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-\r
-public interface IMethodRuleFactory<Domain, Range> {\r
-    IBidirectionalMappingRule<Domain, Range> create(ReadGraph g, Annotation annotation, Method method) throws DatabaseException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/AdaptedRangeAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/AdaptedRangeAccessor.java
deleted file mode 100644 (file)
index 3b6e010..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.range;\r
-\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.graph.rules.adapters.ValueAdapter;\r
-\r
-\r
-\r
-public class AdaptedRangeAccessor<Range> implements IRangeAccessor<Range,Object> {\r
-    IRangeAccessor<Range,Object> baseAccessor;\r
-    ValueAdapter adapter;\r
-    \r
-    public AdaptedRangeAccessor(IRangeAccessor<Range,Object> baseAccessror,\r
-            ValueAdapter adapter) {\r
-        this.baseAccessor = baseAccessror;\r
-        this.adapter = adapter;\r
-    }\r
-\r
-    @Override\r
-    public Object get(Range element) throws MappingException {\r
-        return adapter.rangeToDomain(baseAccessor.get(element));    \r
-    }\r
-    \r
-    @Override\r
-    public boolean set(Range element, Object value) throws MappingException {\r
-        return baseAccessor.set(element, adapter.domainToRange(value));\r
-    }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/CollectionAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/CollectionAccessor.java
deleted file mode 100644 (file)
index d2b9f83..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.range;\r
-\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-\r
-/**\r
- * Accessor for mapped collections. \r
- * Uses three methods:\r
- * - Getter: returns the collection.\r
- * - Adder: adds one item into the collection.\r
- * - Remover: removes one item from the collection. \r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- * @param <T>\r
- */\r
-public class CollectionAccessor<Range,T>  implements IRangeAccessor<Range,Collection<T>> {\r
-       \r
-       private Method getter;\r
-       private Method adder;\r
-       private Method remover;\r
-       \r
-       public CollectionAccessor(Method getter, Method adder, Method remover) {\r
-               this.getter = getter;\r
-               this.adder = adder;\r
-               this.remover = remover;\r
-       }\r
-       \r
-       @SuppressWarnings("unchecked")\r
-       public java.util.Collection<T> get(Object element) throws MappingException {\r
-               try {\r
-                       return (Collection<T>) getter.invoke(element);\r
-               } catch (IllegalArgumentException e) {\r
-                       throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                       throw new MappingException(e);\r
-               } catch (InvocationTargetException e) {\r
-                       throw new MappingException(e.getCause());\r
-               }\r
-       };\r
-\r
-       @Override\r
-       public boolean set(Range element, Collection<T> value)\r
-                       throws MappingException {\r
-               java.util.Collection<T> current = get(element);\r
-               Collection<T> adding = new ArrayList<T>();\r
-               Collection<T> removing = new ArrayList<T>();\r
-               for (T e : current) {\r
-                       if (!value.contains(e))\r
-                               removing.add(e);\r
-               }\r
-               for (T e : value) {\r
-                       if (!current.contains(e))\r
-                               adding.add(e);\r
-               }\r
-               \r
-               try {\r
-                       for (T e : removing) {\r
-                               remover.invoke(element, e);\r
-                       }\r
-                       \r
-                       for (T e : adding) {\r
-                               adder.invoke(element, e);\r
-                       }\r
-               } catch (IllegalArgumentException e) {\r
-                       throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                       throw new MappingException(e);\r
-               } catch (InvocationTargetException e) {\r
-                       throw new MappingException(e.getCause());\r
-               }\r
-               return removing.size() > 0 || adding.size() > 0;\r
-               \r
-       }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/CompoundGetSetValueAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/CompoundGetSetValueAccessor.java
deleted file mode 100644 (file)
index 7dac5f7..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.range;\r
-\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-\r
-/**\r
- * Accessor for mapped value. Uses two methods:\r
- * - Getter: returns the current value.\r
- * - Setter: sets the current value. The value may be null. (if setter parameter is primitive, null value is not mapped).\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- * @param <T>\r
- */\r
-public class CompoundGetSetValueAccessor<Range,T>  implements IRangeAccessor<Range,T> {\r
-       \r
-       private Method getter;\r
-       private Method setter;\r
-       private boolean primitive;\r
-       \r
-       public CompoundGetSetValueAccessor(Method getter, Method setter) {\r
-               this.getter = getter;\r
-               this.setter = setter;\r
-               this.primitive = setter.getParameterTypes()[0].isPrimitive();\r
-       }\r
-       \r
-       @SuppressWarnings("unchecked")\r
-       public T get(Range element) throws MappingException {\r
-               try {\r
-                       return (T) getter.invoke(element);\r
-               } catch (IllegalArgumentException e) {\r
-                       throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                       throw new MappingException(e);\r
-               } catch (InvocationTargetException e) {\r
-                       throw new MappingException(e.getCause());\r
-               }\r
-       };\r
-\r
-       @Override\r
-       public boolean set(Range element, T value)\r
-                       throws MappingException {\r
-               if (value == null && primitive)\r
-                       return false;\r
-               if (equal(get(element),value))\r
-                       return false;\r
-               try {\r
-                       setter.invoke(element, value);\r
-               } catch (IllegalArgumentException e) {\r
-                       throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                       throw new MappingException(e);\r
-               } catch (InvocationTargetException e) {\r
-                       throw new MappingException(e.getCause());\r
-               }\r
-               return true;\r
-               \r
-       }\r
-       \r
-       private boolean equal(Object v1, Object v2) {\r
-               if (v1 == null) {\r
-                       if (v2 == null)\r
-                               return true;\r
-                       return false;\r
-               } else if (v2 == null) {\r
-                       return false;\r
-               }\r
-               return v1.equals(v2);\r
-       }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/FieldAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/FieldAccessor.java
deleted file mode 100644 (file)
index 4cd0f2e..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.range;\r
-\r
-import java.lang.reflect.Field;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-\r
-/**\r
- * Accesses the given field of the element.\r
- * @author Hannu Niemistö\r
- */\r
-public class FieldAccessor<Range,T> implements IRangeAccessor<Range,T> {\r
-    \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       Field field;\r
-\r
-       public FieldAccessor(Field field) {\r
-               this.field = field;\r
-       }\r
-\r
-       @Override\r
-       public T get(Range element) throws MappingException {\r
-               try {\r
-                   @SuppressWarnings("unchecked")\r
-                       T result = (T)field.get(element);\r
-                   \r
-               if(LOGGER.isInfoEnabled())\r
-                   LOGGER.info("        FieldAccessor.get " +\r
-                           field.getName() + " -> " + result\r
-                   );\r
-               \r
-                       return result;\r
-               } catch (IllegalArgumentException e) {\r
-                       throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }\r
-\r
-       @Override\r
-       public boolean set(Range element, T value) throws MappingException {\r
-               try {\r
-                       Object currentValue = field.get(element);\r
-                       \r
-            if(LOGGER.isInfoEnabled())\r
-                LOGGER.info("        FieldAccessor.set " +\r
-                        field.getName() + " " + currentValue +  \r
-                        " -> " + value\r
-                );\r
-                       \r
-                       if(value == null \r
-                               ? (currentValue == null || field.getType().isPrimitive()) \r
-                               : value.equals(currentValue))\r
-                               return false;                   \r
-                       field.set(element, value);\r
-                       return true;\r
-               } catch (IllegalArgumentException e) {\r
-                       throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }       \r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/FieldAccessorWithDefault.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/FieldAccessorWithDefault.java
deleted file mode 100644 (file)
index dea8cf3..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.range;\r
-\r
-import java.lang.reflect.Field;\r
-\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-\r
-/**\r
- * Accesses the given field of the element.\r
- * @author Hannu Niemist�\r
- */\r
-public class FieldAccessorWithDefault<Range,T> extends FieldAccessor<Range,T> {\r
-    \r
-       T defaultValue;\r
-\r
-       public FieldAccessorWithDefault(Field field, T defaultValue) {\r
-        super(field);\r
-        this.defaultValue = defaultValue;\r
-    }\r
-\r
-    @Override\r
-       public T get(Range element) throws MappingException {\r
-               T value = super.get(element);\r
-               if(value == null)\r
-                   return defaultValue;\r
-               else\r
-                   return value;\r
-       }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/GetSetObjectAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/GetSetObjectAccessor.java
deleted file mode 100644 (file)
index befd2fd..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.range;\r
-\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-\r
-/**\r
- * Accessor for mapped objects. Uses two methods:\r
- * - Getter: returns the current object.\r
- * - Setter: sets the current object. The object may be null.\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- * @param <T>\r
- */\r
-public class GetSetObjectAccessor<Range,T>  implements IRangeAccessor<Range,T> {\r
-       \r
-       private Method getter;\r
-       private Method setter;\r
-       \r
-       \r
-       public GetSetObjectAccessor(Method getter, Method setter) {\r
-               this.getter = getter;\r
-               this.setter = setter;\r
-               \r
-       }\r
-       \r
-       @SuppressWarnings("unchecked")\r
-       public T get(Range element) throws MappingException {\r
-               try {\r
-                       return (T) getter.invoke(element);\r
-               } catch (IllegalArgumentException e) {\r
-                       throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                       throw new MappingException(e);\r
-               } catch (InvocationTargetException e) {\r
-                       throw new MappingException(e.getCause());\r
-               }\r
-       };\r
-\r
-       @Override\r
-       public boolean set(Range element, T value)\r
-                       throws MappingException {       \r
-               try {\r
-                       setter.invoke(element, value);\r
-               } catch (IllegalArgumentException e) {\r
-                       throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                       throw new MappingException(e);\r
-               } catch (InvocationTargetException e) {\r
-                       throw new MappingException(e.getCause());\r
-               }\r
-               return true;\r
-               \r
-       }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/GetSetValueAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/GetSetValueAccessor.java
deleted file mode 100644 (file)
index 9f17e78..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.range;\r
-\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-\r
-/**\r
- * Accessor for mapped value. Uses two methods:\r
- * - Getter: returns the current value.\r
- * - Setter: sets the current value. The value may be null. (if setter parameter is primitive, null value is not mapped).\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- * @param <T>\r
- */\r
-public class GetSetValueAccessor<Range,T>  implements IRangeAccessor<Range,T> {\r
-       \r
-       private Method getter;\r
-       private Method setter;\r
-       private boolean primitive;\r
-       \r
-       public GetSetValueAccessor(Method getter, Method setter) {\r
-               this.getter = getter;\r
-               this.setter = setter;\r
-               this.primitive = setter.getParameterTypes()[0].isPrimitive();\r
-       }\r
-       \r
-       @SuppressWarnings("unchecked")\r
-       public T get(Range element) throws MappingException {\r
-               try {\r
-                       return (T) getter.invoke(element);\r
-               } catch (IllegalArgumentException e) {\r
-                       throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                       throw new MappingException(e);\r
-               } catch (InvocationTargetException e) {\r
-                       throw new MappingException(e.getCause());\r
-               }\r
-       };\r
-\r
-       @Override\r
-       public boolean set(Range element, T value)\r
-                       throws MappingException {\r
-               if (value == null && primitive)\r
-                       return false;\r
-               if (equal(get(element),value))\r
-                       return false;\r
-               try {\r
-                       setter.invoke(element, value);\r
-               } catch (IllegalArgumentException e) {\r
-                       throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                       throw new MappingException(e);\r
-               } catch (InvocationTargetException e) {\r
-                       throw new MappingException(e.getCause());\r
-               }\r
-               return true;\r
-               \r
-       }\r
-       \r
-       private boolean equal(Object v1, Object v2) {\r
-               if (v1 == null) {\r
-                       if (v2 == null)\r
-                               return true;\r
-                       return false;\r
-               } else if (v2 == null) {\r
-                       return false;\r
-               }\r
-               return v1.equals(v2);\r
-       }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/IRangeAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/IRangeAccessor.java
deleted file mode 100644 (file)
index 94e7fca..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.range;\r
-\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-\r
-\r
-/**\r
- * Provides access to some property of range elements.\r
- * @author Hannu Niemistö\r
- */\r
-public interface IRangeAccessor<Range,T> {\r
-       T get(Range element) throws MappingException;\r
-       boolean set(Range element, T value) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/ListAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/rules/range/ListAccessor.java
deleted file mode 100644 (file)
index a384235..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.rules.range;\r
-\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.utils.datastructures.Pair;\r
-\r
-\r
-/**\r
- * Accessor for mapped collections. \r
- * Uses three methods:\r
- * - Getter: returns the collection.\r
- * - Adder: adds one item into the collection.\r
- * - Remover: removes one item from the collection. \r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- * @param <T>\r
- */\r
-public class ListAccessor<Range,T>  implements IRangeAccessor<Range,Collection<T>> {\r
-       \r
-       private Method getter;\r
-       private Method adder;\r
-       private Method remover;\r
-       \r
-       public ListAccessor(Method getter, Method adder, Method remover) {\r
-               this.getter = getter;\r
-               this.adder = adder;\r
-               this.remover = remover;\r
-       }\r
-       \r
-       @SuppressWarnings("unchecked")\r
-       public java.util.Collection<T> get(Object element) throws MappingException {\r
-               try {\r
-                       return (Collection<T>) getter.invoke(element);\r
-               } catch (IllegalArgumentException e) {\r
-                       throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                       throw new MappingException(e);\r
-               } catch (InvocationTargetException e) {\r
-                       throw new MappingException(e.getCause());\r
-               }\r
-       };\r
-\r
-       @Override\r
-       public boolean set(Range element, Collection<T> value)\r
-                       throws MappingException {\r
-               java.util.Collection<T> current = get(element);\r
-               Collection<Pair<Integer, T>> adding = new ArrayList<Pair<Integer, T>>();\r
-               Collection<T> removing = new ArrayList<T>();\r
-               for (T e : current) {\r
-                       if (!value.contains(e))\r
-                               removing.add(e);\r
-               }\r
-               int i = 0;\r
-               for (T e : value) {\r
-                       if (!current.contains(e))\r
-                               adding.add(new Pair<Integer, T>(i, e));\r
-                       i++;\r
-               }\r
-               \r
-               try {\r
-                       for (T e : removing) {\r
-                               remover.invoke(element, e);\r
-                       }\r
-                       \r
-                       for (Pair<Integer,T> e : adding) {\r
-                               adder.invoke(element, e.first,e.second);\r
-                       }\r
-               } catch (IllegalArgumentException e) {\r
-                       throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                       throw new MappingException(e);\r
-               } catch (InvocationTargetException e) {\r
-                       throw new MappingException(e.getCause());\r
-               }\r
-               return removing.size() > 0 || adding.size() > 0;\r
-               \r
-       }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/AdaptedLinkType.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/AdaptedLinkType.java
deleted file mode 100644 (file)
index d66e4f1..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.schema;\r
-\r
-//import org.apache.log4j.Logger;\r
-import org.eclipse.core.runtime.IAdaptable;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-\r
-import org.simantics.objmap.backward.IBackwardMapping;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-\r
-/**\r
- * A link type that is associated with adaptable resource (ReadGraph.getAdapter(Resource,Class)). \r
- * The adapted object must implement IAdaptable interface for returning the original Resource. \r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class AdaptedLinkType<Range> implements ILinkType<Resource,Range> {\r
-\r
-       \r
-       //static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-    Resource domainType;\r
-    Class<?> rangeType;\r
-    \r
-    \r
-    public AdaptedLinkType(Resource domainType, Class<?> rangeType) {\r
-        this.domainType = domainType;\r
-        this.rangeType = rangeType;\r
-    }\r
-    \r
-    @Override\r
-    public Resource createDomainElement(WriteGraph g, Range rangeElement)\r
-               throws MappingException {\r
-       try {\r
-               IAdaptable adaptable = (IAdaptable)rangeElement;\r
-               Resource res = (Resource)adaptable.getAdapter(Resource.class);\r
-               if (res == null)\r
-                       throw new NullPointerException();\r
-               return res;\r
-       } catch (Exception e) {\r
-               throw new MappingException("Adapted object must implement IAdaptable interface to return the source Resource.", e);\r
-       }\r
-       \r
-    }\r
-    \r
-    @SuppressWarnings("unchecked")\r
-       @Override\r
-    public Range createRangeElement(ReadGraph g, Resource domainElement)\r
-               throws MappingException {\r
-       try {\r
-               return (Range)g.adapt(domainElement, rangeType);\r
-       } catch (DatabaseException e) {\r
-               throw new MappingException(e);\r
-       }\r
-    }\r
-    \r
-    public void createDomain(WriteGraph graph, IBackwardMapping<Resource,Range> mapping, Resource domainElement, Range rangeElement) throws MappingException {\r
-       \r
-    };\r
-    \r
-    public void createRange(ReadGraph graph, org.simantics.objmap.forward.IForwardMapping<Resource,Range> mapping, Resource domainElement, Range rangeElement) throws MappingException {\r
-       \r
-    };\r
-    \r
-    public boolean updateDomain(WriteGraph g, IBackwardMapping<Resource,Range> map, Resource domainElement, Range rangeElement) throws MappingException {\r
-       return false;\r
-    }\r
-    \r
-    public boolean updateRange(ReadGraph g, IForwardMapping<Resource,Range> map, Resource domainElement, Range rangeElement) throws MappingException {\r
-       return false;\r
-    }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/DefaultSchema.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/DefaultSchema.java
deleted file mode 100644 (file)
index e5adac8..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.schema;\r
-\r
-\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.utils.NameUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-\r
-/**\r
- * \r
- */\r
-public class DefaultSchema implements IMappingSchema<Resource,Object> {\r
-\r
-    THashMap<Resource, ILinkType<Resource,Object>> domainLinkTypes = \r
-        new THashMap<Resource, ILinkType<Resource,Object>>();\r
-    THashMap<Class<?>, ILinkType<Resource,Object>> rangeLinkTypes = \r
-        new THashMap<Class<?>, ILinkType<Resource,Object>>();\r
-    \r
-    public void addLinkType(SimpleLinkType<Object> linkType) {\r
-        domainLinkTypes.put(linkType.domainType, linkType);\r
-        rangeLinkTypes.put(linkType.rangeType, linkType);\r
-    }\r
-    \r
-    public void addLinkType(AdaptedLinkType<Object> linkType) {\r
-        domainLinkTypes.put(linkType.domainType, linkType);\r
-        rangeLinkTypes.put(linkType.rangeType, linkType);\r
-    }\r
-    \r
-    @Override\r
-    public ILinkType<Resource,Object> linkTypeOfDomainElement(ReadGraph g, Resource element) throws MappingException {        \r
-        try {\r
-               \r
-               for(Resource type : g.getTypes(element)) {\r
-\r
-                       ILinkType<Resource,Object> linkType = domainLinkTypes.get(type);\r
-                       if(linkType != null) return linkType;\r
-                       \r
-               }\r
-               \r
-               throw new MappingException("Didn't find a link type for " +\r
-                               NameUtils.getSafeName(g, element) + ".");\r
-                               \r
-        } catch (DatabaseException e) {\r
-            throw new MappingException(e);\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public ILinkType<Resource,Object> linkTypeOfRangeElement(Object element) throws MappingException {\r
-       ILinkType<Resource,Object> type = rangeLinkTypes.get(element.getClass());\r
-               if(type == null)  {\r
-                       for (Class<?> clazz : element.getClass().getInterfaces()) {\r
-                               type = rangeLinkTypes.get(clazz);\r
-                               if (type != null)\r
-                                       return type;\r
-                               \r
-                       }\r
-                       throw new MappingException("Didn't find a link type for " +     element + ".");\r
-               }\r
-               return type;\r
-    }\r
-\r
-    \r
-    public ILinkType<Resource,Object> linkTypeOfDomainType(ReadGraph g, Resource type)  {        \r
-       return domainLinkTypes.get(type);\r
-    }\r
-    \r
-    public ILinkType<Resource,Object> linkTypeOfRangeType(Class<?> clazz) {\r
-       ILinkType<Resource,Object> type = rangeLinkTypes.get(clazz);\r
-       if(type == null)  {\r
-               // FIXME: c is not referenced at all, should it be?\r
-               // TODO: should this method take inheritance into account ?\r
-                       for (Class<?> c : clazz.getInterfaces()) {\r
-                               type = rangeLinkTypes.get(clazz);\r
-                               if (type != null)\r
-                                       return type;\r
-                               \r
-                       }\r
-               }\r
-       return null;\r
-    }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/DynamicSimpleLinkType.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/DynamicSimpleLinkType.java
deleted file mode 100644 (file)
index 0abd423..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.schema;\r
-\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.lang.reflect.Method;\r
-import java.util.ArrayList;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.utils.NameUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.graph.annotations.GetType;\r
-import org.simantics.objmap.graph.annotations.SetType;\r
-\r
-public class DynamicSimpleLinkType<Range> extends SimpleLinkType<Range>{\r
-\r
-       protected Method typeGetter;\r
-       protected Method typeSetter;\r
-       \r
-       public DynamicSimpleLinkType(Resource domainType, Class<?> rangeType, ArrayList<IBidirectionalMappingRule<Resource, Range>> rules) {\r
-               super(domainType, rangeType, rules);\r
-               findTypeGetter(rangeType);\r
-       }\r
-\r
-       public DynamicSimpleLinkType(Resource domainType, Class<?> rangeType) {\r
-               super(domainType, rangeType);\r
-               findTypeGetter(rangeType);\r
-       }\r
-       \r
-       private void findTypeGetter(Class<?> clazz) {\r
-               for (Method m : clazz.getDeclaredMethods()) {\r
-                        m.setAccessible(true);\r
-                        GetType t = m.getAnnotation(GetType.class);\r
-                        if (t != null) {\r
-                                typeGetter = m;\r
-                        }\r
-                        SetType t2 = m.getAnnotation(SetType.class);\r
-                        if (t2 != null) {\r
-                                typeSetter = m;\r
-                        }\r
-               }\r
-               if (typeGetter == null || typeSetter == null) {\r
-                       Class<?> superClazz = clazz.getSuperclass();\r
-                       if (superClazz != Object.class)\r
-                               findTypeGetter(superClazz);\r
-                       if (typeGetter == null || typeSetter == null) {\r
-                               throw new RuntimeException("Cannot find dynamic type methods for class " + clazz.getSimpleName());      \r
-                       }\r
-               }\r
-               \r
-                       \r
-       }\r
-       \r
-       @Override\r
-    public Resource createDomainElement(WriteGraph g, Range rangeElement)\r
-            throws MappingException {\r
-        try {\r
-               String typeUri = (String)typeGetter.invoke(rangeElement, (Object[]) null);\r
-            if(LOGGER.isInfoEnabled())\r
-                LOGGER.info("SimpleLinkType.createDomainElement " +\r
-                        rangeElement.toString()\r
-                );\r
-            Resource actualDomainType = g.getResource(typeUri);\r
-            Resource result = g.newResource();\r
-            //g.claim(result, Layer0.getInstance(g).InstanceOf, null, domainType);\r
-            g.claim(result, Layer0.getInstance(g).InstanceOf, null, actualDomainType);\r
-            return result;\r
-        } catch(DatabaseException e) {\r
-            throw new MappingException(e);\r
-        } catch (IllegalArgumentException e) {\r
-                throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                        throw new MappingException(e);\r
-               } catch (InvocationTargetException e) {\r
-                        throw new MappingException(e.getCause());\r
-               }\r
-    }\r
-       \r
-        @SuppressWarnings("unchecked")\r
-       @Override\r
-           public Range createRangeElement(ReadGraph g, Resource domainElement)\r
-                   throws MappingException {\r
-               try {\r
-                   if(LOGGER.isInfoEnabled())\r
-                       try { \r
-                           LOGGER.info("SimpleLinkType.createRangeElement " +\r
-                                       NameUtils.getSafeName(g, domainElement)\r
-                                   );\r
-                       } catch(DatabaseException e) {\r
-                           throw new MappingException(e);\r
-                       }\r
-                  Range r =  (Range)rangeType.newInstance();\r
-                  Resource type = g.getSingleType(domainElement, domainType);\r
-                  String uri = g.getURI(type);\r
-                  typeSetter.invoke(r, uri);\r
-                  return r;\r
-               } catch (InstantiationException e) {\r
-                   throw new MappingException(e);\r
-               } catch (IllegalAccessException e) {\r
-                   throw new MappingException(e);\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-                       } catch (IllegalArgumentException e) {\r
-                               throw new MappingException(e);\r
-                       } catch (InvocationTargetException e) {\r
-                               throw new MappingException(e.getCause());\r
-                       } \r
-           }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/ILinkType.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/ILinkType.java
deleted file mode 100644 (file)
index ca5036d..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.schema;\r
-\r
-import org.simantics.objmap.backward.IBackwardLinkType;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.forward.IForwardLinkType;\r
-\r
-/**\r
- * Contains rules for how a link should be created and maintained.\r
- * @author Hannu Niemistö\r
- */\r
-public interface ILinkType<Domain,Range> extends IBidirectionalMappingRule<Domain, Range>, IBackwardLinkType<Domain,Range>, IForwardLinkType<Domain,Range> {\r
-    /**\r
-     * Creates a domain element based on known range element.\r
-     */\r
-       //Resource createDomainElement(WriteGraph g, Object rangeElement) throws MappingException;\r
-       \r
-       /**\r
-     * Creates a range element based on known domain element.\r
-     */\r
-       //Object createRangeElement(ReadGraph g, Resource domainElement) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/IMappingSchema.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/IMappingSchema.java
deleted file mode 100644 (file)
index 884f006..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.schema;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-/**\r
- * Specifies the link types of new elements added to a mapping.\r
- * @author Hannu Niemistö\r
- */\r
-public interface IMappingSchema<Domain,Range> {\r
-    /**\r
-     * @return Link type that should be used for the element.\r
-     */\r
-       ILinkType<Domain,Range> linkTypeOfDomainElement(ReadGraph g, Domain element) throws MappingException;\r
-       \r
-       /**\r
-     * @return Link type that should be used for the element.\r
-     */\r
-       ILinkType<Domain,Range> linkTypeOfRangeElement(Range element) throws MappingException;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/MappingSchemas.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/MappingSchemas.java
deleted file mode 100644 (file)
index b863fba..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.schema;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-import java.lang.reflect.Method;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.CompoundRelatedGetValue;\r
-import org.simantics.objmap.graph.annotations.DynamicGraphType;\r
-import org.simantics.objmap.graph.annotations.GraphType;\r
-import org.simantics.objmap.graph.annotations.HasCollectionAdder;\r
-import org.simantics.objmap.graph.annotations.HasCollectionRemover;\r
-import org.simantics.objmap.graph.annotations.HasSetter;\r
-import org.simantics.objmap.graph.annotations.OptionalRelatedElements;\r
-import org.simantics.objmap.graph.annotations.OrderedElementsGet;\r
-import org.simantics.objmap.graph.annotations.OrderedSetType;\r
-import org.simantics.objmap.graph.annotations.RelatedElements;\r
-import org.simantics.objmap.graph.annotations.RelatedElementsGet;\r
-import org.simantics.objmap.graph.annotations.RelatedGetObj;\r
-import org.simantics.objmap.graph.annotations.RelatedGetValue;\r
-import org.simantics.objmap.graph.annotations.RelatedOrderedSetElements;\r
-import org.simantics.objmap.graph.annotations.RelatedValue;\r
-import org.simantics.objmap.graph.annotations.UpdateMethod;\r
-import org.simantics.objmap.graph.annotations.factories.CompoundRelatedGetSetValueRuleFactory;\r
-import org.simantics.objmap.graph.annotations.factories.OptionalRelatedElementsRuleFactory;\r
-import org.simantics.objmap.graph.annotations.factories.OrderedElementsRuleFactory;\r
-import org.simantics.objmap.graph.annotations.factories.RelatedElementsRuleFactory;\r
-import org.simantics.objmap.graph.annotations.factories.RelatedElementsRuleFactory2;\r
-import org.simantics.objmap.graph.annotations.factories.RelatedGetSetObjRuleFactory;\r
-import org.simantics.objmap.graph.annotations.factories.RelatedGetSetValueRuleFactory;\r
-import org.simantics.objmap.graph.annotations.factories.RelatedOrderedSetElementsRuleFactory;\r
-import org.simantics.objmap.graph.annotations.factories.RelatedValueRuleFactory;\r
-import org.simantics.objmap.graph.annotations.factories.UpdateMethodFactory;\r
-import org.simantics.objmap.graph.annotations.meta.IsClassRule;\r
-import org.simantics.objmap.graph.annotations.meta.IsCollectionRule;\r
-import org.simantics.objmap.graph.annotations.meta.IsFieldRule;\r
-import org.simantics.objmap.graph.annotations.meta.IsGetSetRule;\r
-import org.simantics.objmap.graph.annotations.meta.IsMethodRule;\r
-import org.simantics.objmap.graph.rules.factory.IClassRuleFactory;\r
-import org.simantics.objmap.graph.rules.factory.ICollectionRuleFactory;\r
-import org.simantics.objmap.graph.rules.factory.IFieldRuleFactory;\r
-import org.simantics.objmap.graph.rules.factory.IGetSetRuleFactory;\r
-import org.simantics.objmap.graph.rules.factory.IMethodRuleFactory;\r
-\r
-\r
-public class MappingSchemas {\r
-       /**\r
-     * Creates a new SimpleLinkType based on the annotations in the given class.\r
-     * @throws IllegalAccessException \r
-     * @throws InstantiationException \r
-     * @see GraphType\r
-     * @see RelatedValue\r
-     */\r
-       public static SimpleLinkType<Object> fromAnnotations(ReadGraph g, Class<?> clazz) throws DatabaseException, InstantiationException, IllegalAccessException {\r
-           GraphType graphType = clazz.getAnnotation(GraphType.class);\r
-           \r
-           if (graphType != null) {\r
-                   ArrayList<IBidirectionalMappingRule<Resource, Object>> rules = new ArrayList<IBidirectionalMappingRule<Resource, Object>>();\r
-                   collectRulesFromAnnotations(g, clazz, rules);\r
-                   \r
-                   return new SimpleLinkType<Object>(g.getResource(graphType.value()), clazz, rules);  \r
-           }\r
-           DynamicGraphType dynamicType = clazz.getAnnotation(DynamicGraphType.class);\r
-           if (dynamicType != null) {\r
-               ArrayList<IBidirectionalMappingRule<Resource, Object>> rules = new ArrayList<IBidirectionalMappingRule<Resource, Object>>();\r
-                   collectRulesFromAnnotations(g, clazz, rules);\r
-                   \r
-                   return new DynamicSimpleLinkType<Object>(g.getResource(dynamicType.value()), clazz, rules);\r
-           }\r
-           OrderedSetType orderedSetType = clazz.getAnnotation(OrderedSetType.class);\r
-           if (orderedSetType != null) {\r
-               ArrayList<IBidirectionalMappingRule<Resource, Object>> rules = new ArrayList<IBidirectionalMappingRule<Resource, Object>>();\r
-                   collectRulesFromAnnotations(g, clazz, rules);\r
-                   \r
-                   return new OrderedSetSimpleLinkType<Object>(g.getResource(orderedSetType.value()), clazz, rules);\r
-           }\r
-           throw new IllegalArgumentException("Class " + clazz.toString() + " does not contain annotations.");\r
-       }\r
-       \r
-       public static void collectRulesFromAnnotations(ReadGraph g, Class<?> clazz, Collection<IBidirectionalMappingRule<Resource, Object>> rules) throws DatabaseException, InstantiationException, IllegalAccessException {\r
-           Class<?> superclass = clazz.getSuperclass();\r
-           if(superclass != null)\r
-               collectRulesFromAnnotations(g, superclass, rules);\r
-               \r
-        for(Annotation annotation : clazz.getAnnotations()) {\r
-\r
-               IsClassRule tag = annotation.annotationType().getAnnotation(IsClassRule.class);\r
-            if(tag!= null) {\r
-               rules.add(createClassRule(g, annotation, clazz).create(g, annotation, clazz));\r
-            }\r
-        }\r
-\r
-        for(Field f : clazz.getDeclaredFields()) {\r
-            f.setAccessible(true);\r
-\r
-            for(Annotation annotation : f.getAnnotations()) {\r
-\r
-               IsFieldRule tag = annotation.annotationType().getAnnotation(IsFieldRule.class);\r
-                if(tag != null) {\r
-                    rules.add(createFieldRule(g, annotation, f).create(g, annotation, f));\r
-                }\r
-            }\r
-        }\r
-\r
-        for(Method m : clazz.getDeclaredMethods()) {\r
-            m.setAccessible(true);\r
-\r
-            for(Annotation annotation : m.getAnnotations()) {\r
-               IsMethodRule tag = \r
-                        annotation.annotationType().getAnnotation(IsMethodRule.class);\r
-                if(tag != null) {\r
-                       rules.add(createMethodRule(g, annotation, m).create(g, annotation, m));\r
-                }\r
-            }\r
-        }\r
-        \r
-        for (Method m : clazz.getDeclaredMethods()) {\r
-               m.setAccessible(true);\r
-               for (Annotation annotation : m.getAnnotations()) {\r
-                       Class<? extends Annotation> annotationType = annotation.annotationType();\r
-\r
-                        IsGetSetRule tag = \r
-                         annotationType.getAnnotation(IsGetSetRule.class);\r
-                        if (tag != null) {\r
-                                \r
-                                HasSetter setterAnnType = annotationType.getAnnotation(HasSetter.class);\r
-                                \r
-                                Class<? extends Annotation> setterAnn = setterAnnType.value();\r
-                                \r
-                                Method getter = m;\r
-                                \r
-                                IGetSetRuleFactory<Resource,Object> ruleFactory = createGetSetRuleFactory(g, annotation, getter);\r
-                                \r
-                                \r
-                                Method setter = null;\r
-                                \r
-                                for (Method m2 : clazz.getDeclaredMethods()) {\r
-                                        Annotation set = m2.getAnnotation(setterAnn);\r
-                                        if (set != null && ruleFactory.isSetter(annotation, set))\r
-                                                setter = m2;\r
-                                }\r
-\r
-                                rules.add(ruleFactory.create(g, annotation, getter, setter));\r
-                        }\r
-                \r
-               }\r
-        }\r
-        \r
-        for (Method m : clazz.getDeclaredMethods()) {\r
-               m.setAccessible(true);\r
-               for (Annotation annotation : m.getAnnotations()) {\r
-                       Class<? extends Annotation> annotationType = annotation.annotationType();\r
-\r
-                        IsCollectionRule tag = \r
-                         annotationType.getAnnotation(IsCollectionRule.class);\r
-                        if (tag != null) {\r
-                                \r
-                                HasCollectionAdder adderAnnType = annotationType.getAnnotation(HasCollectionAdder.class);\r
-                                HasCollectionRemover removerAnnType = annotationType.getAnnotation(HasCollectionRemover.class);\r
-                \r
-                                Class<? extends Annotation> adderAnn = adderAnnType.value();\r
-                                Class<? extends Annotation> removerAnn = removerAnnType.value();\r
-                                \r
-                                Method getter = m;\r
-                                \r
-                                ICollectionRuleFactory<Resource,Object> ruleFactory = createCollectionRuleFactory(g, annotation, getter);\r
-                                \r
-                                \r
-                                Method adder = null;\r
-                                Method remover = null;\r
-                                \r
-                                for (Method m2 : clazz.getDeclaredMethods()) {\r
-                                        Annotation add = m2.getAnnotation(adderAnn);\r
-                                        Annotation rem = m2.getAnnotation(removerAnn);\r
-                                        if (add != null && ruleFactory.isAdder(annotation, add))\r
-                                                adder = m2;\r
-                                        if (rem != null && ruleFactory.isRemover(annotation, rem))\r
-                                                remover = m2;\r
-                                }\r
-                                \r
-                                \r
-                                \r
-                                rules.add(ruleFactory.create(g, annotation, getter,adder,remover));\r
-                        }\r
-                \r
-               }\r
-        }\r
-    }\r
-       \r
-       public static IClassRuleFactory<Resource, Object> createClassRule(ReadGraph g, Annotation annotation, Class<?> clazz) {\r
-               return null;\r
-       }\r
-       \r
-       public static IFieldRuleFactory<Resource,Object> createFieldRule(ReadGraph g, Annotation annotation, Field field) {\r
-               if (annotation.annotationType().equals(RelatedElements.class))\r
-                       return new RelatedElementsRuleFactory<Object>();\r
-               if (annotation.annotationType().equals(RelatedValue.class))\r
-                       return new RelatedValueRuleFactory<Object>();\r
-               if (annotation.annotationType().equals(OptionalRelatedElements.class))\r
-                       return new OptionalRelatedElementsRuleFactory<Object>();\r
-               if (annotation.annotationType().equals(RelatedOrderedSetElements.class))\r
-                       return new RelatedOrderedSetElementsRuleFactory<Object>();\r
-               return null;\r
-       }\r
-       \r
-       public static IMethodRuleFactory<Resource, Object> createMethodRule(ReadGraph g, Annotation annotation, Method m) {\r
-               if (annotation.annotationType().equals(UpdateMethod.class))\r
-                       return new UpdateMethodFactory<Resource,Object>();\r
-               return null;\r
-       }\r
-       \r
-       public static IGetSetRuleFactory<Resource,Object> createGetSetRuleFactory(ReadGraph g, Annotation annotation, Method getter) {\r
-               if (annotation.annotationType().equals(RelatedGetValue.class))\r
-                       return new RelatedGetSetValueRuleFactory<Object>();\r
-               if (annotation.annotationType().equals(RelatedGetObj.class))\r
-                       return new RelatedGetSetObjRuleFactory<Object>();\r
-               if (annotation.annotationType().equals(CompoundRelatedGetValue.class))\r
-                       return new CompoundRelatedGetSetValueRuleFactory<Object>();\r
-               return null;\r
-       }\r
-       \r
-       public static ICollectionRuleFactory<Resource,Object> createCollectionRuleFactory(ReadGraph g, Annotation annotation, Method getter) {\r
-               if (annotation.annotationType().equals(RelatedElementsGet.class))\r
-                       return new RelatedElementsRuleFactory2<Object>();\r
-               if (annotation.annotationType().equals(OrderedElementsGet.class))\r
-                       return new OrderedElementsRuleFactory<Object>();\r
-               return null;\r
-       }\r
-       \r
-       /**\r
-     * Creates a new SimpleLinkType based on the annotations in the given class.\r
-     * @throws IllegalAccessException \r
-     * @throws InstantiationException \r
-     * @see GraphType\r
-     * @see RelatedValue\r
-     */\r
-       \r
-       public static AdaptedLinkType<Object> fromAdaptable(ReadGraph g, String type, Class<?> clazz) throws DatabaseException, InstantiationException, IllegalAccessException {\r
-           \r
-           \r
-           return new AdaptedLinkType<Object>(g.getResource(type), clazz);    \r
-       }\r
-       \r
-       \r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/OrderedSetSimpleLinkType.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/OrderedSetSimpleLinkType.java
deleted file mode 100644 (file)
index b912745..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.simantics.objmap.graph.schema;\r
-\r
-import java.util.ArrayList;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.utils.OrderedSetUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-public class OrderedSetSimpleLinkType<Range> extends SimpleLinkType<Range> {\r
-\r
-       public OrderedSetSimpleLinkType(Resource domainType, Class<?> rangeType, ArrayList<IBidirectionalMappingRule<Resource, Range>> rules) {\r
-               super(domainType, rangeType, rules);\r
-       }\r
-\r
-       public OrderedSetSimpleLinkType(Resource domainType, Class<?> rangeType) {\r
-               super(domainType, rangeType);\r
-       }\r
-       \r
-       public Resource createDomainElement(org.simantics.db.WriteGraph g, Range rangeElement) throws org.simantics.objmap.exceptions.MappingException {\r
-                try {\r
-            if(LOGGER.isInfoEnabled())\r
-                LOGGER.info("SimpleLinkType.createDomainElement " +\r
-                        rangeElement.toString()\r
-                );\r
-            Resource result = OrderedSetUtils.create(g, domainType);\r
-            return result;\r
-        } catch(DatabaseException e) {\r
-            throw new MappingException(e);\r
-        }\r
-       };\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/SimpleLinkType.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/SimpleLinkType.java
deleted file mode 100644 (file)
index 880d117..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.schema;\r
-\r
-import java.util.ArrayList;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.utils.NameUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.objmap.backward.IBackwardMapping;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-\r
-\r
-/**\r
- * A link type that is associated with single domain and range type (class).\r
- * SimpleLinkType is composed of simpler rules whose combination determines\r
- * its update policy.\r
- * @author Hannu Niemist�\r
- */\r
-public class SimpleLinkType<Range> implements ILinkType<Resource,Range> {\r
-    \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-    public Resource domainType;\r
-    public Class<?> rangeType;\r
-    ArrayList<IBidirectionalMappingRule<Resource, Range>> rules;\r
-    \r
-    public SimpleLinkType(Resource domainType, Class<?> rangeType,\r
-            ArrayList<IBidirectionalMappingRule<Resource, Range>> rules) {\r
-        this.domainType = domainType;\r
-        this.rangeType = rangeType;\r
-        this.rules = rules;\r
-    }\r
-\r
-    public SimpleLinkType(Resource domainType, Class<?> rangeType) {\r
-        this(domainType, rangeType, new ArrayList<IBidirectionalMappingRule<Resource, Range>>());\r
-    }\r
-\r
-    /**\r
-     * Adds a new rule to this link type that is enforced\r
-     * during updates.\r
-     */\r
-    public void addRule(IBidirectionalMappingRule<Resource, Range> rule) {\r
-        rules.add(rule);\r
-    }\r
-    \r
-    @Override\r
-    public Resource createDomainElement(WriteGraph g, Range rangeElement)\r
-            throws MappingException {\r
-        try {\r
-            if(LOGGER.isInfoEnabled())\r
-                LOGGER.info("SimpleLinkType.createDomainElement " +\r
-                        rangeElement.toString()\r
-                );\r
-            Resource result = g.newResource();\r
-            g.claim(result, Layer0.getInstance(g).InstanceOf, null, domainType);\r
-            return result;\r
-        } catch(DatabaseException e) {\r
-            throw new MappingException(e);\r
-        }\r
-    }\r
-    @SuppressWarnings("unchecked")\r
-       @Override\r
-    public Range createRangeElement(ReadGraph g, Resource domainElement)\r
-            throws MappingException {\r
-        try {\r
-            if(LOGGER.isInfoEnabled())\r
-                try { \r
-                    LOGGER.info("SimpleLinkType.createRangeElement " +\r
-                               NameUtils.getSafeName(g, domainElement)\r
-                            );\r
-                } catch(DatabaseException e) {\r
-                    throw new MappingException(e);\r
-                }\r
-            return (Range)rangeType.newInstance();\r
-        } catch (InstantiationException e) {\r
-            throw new MappingException(e);\r
-        } catch (IllegalAccessException e) {\r
-            throw new MappingException(e);\r
-        }\r
-    }\r
-    \r
-    public void createDomain(WriteGraph graph, IBackwardMapping<Resource,Range> mapping, Resource domainElement, Range rangeElement) throws MappingException {\r
-       updateDomain(graph, mapping, domainElement, rangeElement);\r
-    };\r
-    \r
-    public void createRange(ReadGraph graph, org.simantics.objmap.forward.IForwardMapping<Resource,Range> mapping, Resource domainElement, Range rangeElement) throws MappingException {\r
-       updateRange(graph, mapping, domainElement, rangeElement);\r
-    };\r
-    \r
-    public boolean updateDomain(WriteGraph g, IBackwardMapping<Resource,Range> map, Resource domainElement, Range rangeElement) throws MappingException {\r
-        if(LOGGER.isInfoEnabled())\r
-            try { \r
-                LOGGER.info("SimpleLinkType.updateDomain " +\r
-                        NameUtils.getSafeName(g, domainElement) + " " +\r
-                        rangeElement.toString()\r
-                        );\r
-            } catch(DatabaseException e) {\r
-                throw new MappingException(e);\r
-            }\r
-        \r
-        boolean updated = false;\r
-        for(IBidirectionalMappingRule<Resource, Range> rule : rules)\r
-               updated |= rule.updateDomain(g, map, domainElement, rangeElement);\r
-        return updated;\r
-    }\r
-    \r
-    public boolean updateRange(ReadGraph g, IForwardMapping<Resource,Range> map, Resource domainElement, Range rangeElement) throws MappingException {\r
-    \r
-        if(LOGGER.isInfoEnabled())\r
-            try { \r
-                LOGGER.info("SimpleLinkType.updateRange " +\r
-                               NameUtils.getSafeName(g, domainElement) + " " +\r
-                        rangeElement.toString()\r
-                        );\r
-            } catch(DatabaseException e) {\r
-                throw new MappingException(e);\r
-            }\r
-        \r
-        boolean updated = false;\r
-        for(IBidirectionalMappingRule<Resource, Range> rule : rules)\r
-            updated |= rule.updateRange(g, map, domainElement, rangeElement);\r
-        return updated;\r
-    }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/SimpleSchema.java b/org.simantics.objmap2/src/org/simantics/objmap/graph/schema/SimpleSchema.java
deleted file mode 100644 (file)
index 734f101..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.graph.schema;\r
-\r
-\r
-import java.util.Stack;\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.utils.NameUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-\r
-/**\r
- * An implementation of IMappingSchema that contains\r
- * only SimpleLinkTypes. The link type of any domain\r
- * element is based solely on its type in database and\r
- * the link type of any range element is based on its class.\r
- * @author Hannu Niemistö\r
- */\r
-public class SimpleSchema implements IMappingSchema<Resource,Object> {\r
-\r
-    THashMap<Resource, ILinkType<Resource,Object>> domainLinkTypes = \r
-        new THashMap<Resource, ILinkType<Resource,Object>>();\r
-    THashMap<Class<?>, ILinkType<Resource,Object>> rangeLinkTypes = \r
-        new THashMap<Class<?>, ILinkType<Resource,Object>>();\r
-    \r
-    public void addLinkType(SimpleLinkType<Object> linkType) {\r
-        domainLinkTypes.put(linkType.domainType, linkType);\r
-        rangeLinkTypes.put(linkType.rangeType, linkType);\r
-    }\r
-    \r
-    public void addLinkType(AdaptedLinkType<Object> linkType) {\r
-        domainLinkTypes.put(linkType.domainType, linkType);\r
-        rangeLinkTypes.put(linkType.rangeType, linkType);\r
-    }\r
-    \r
-    @Override\r
-    public ILinkType<Resource,Object> linkTypeOfDomainElement(ReadGraph g, Resource element) throws MappingException {        \r
-        try {\r
-               \r
-               for(Resource type : g.getTypes(element)) {\r
-\r
-                       ILinkType<Resource,Object> linkType = domainLinkTypes.get(type);\r
-                       if(linkType != null) return linkType;\r
-                       \r
-               }\r
-               \r
-               throw new MappingException("Didn't find a link type for " +     NameUtils.getSafeName(g, element) + ".");\r
-                               \r
-        } catch (DatabaseException e) {\r
-            throw new MappingException(e);\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public ILinkType<Resource,Object> linkTypeOfRangeElement(Object element) throws MappingException {\r
-       ILinkType<Resource,Object> type = rangeLinkTypes.get(element.getClass());\r
-       if(type == null)  {\r
-               Stack<Class<?>> clazzes = new Stack<Class<?>>();\r
-               for (Class<?> clazz : element.getClass().getInterfaces()) {\r
-                       clazzes.add(clazz);\r
-               }\r
-               clazzes.add(element.getClass().getSuperclass());\r
-               \r
-               \r
-                       while (!clazzes.isEmpty()) {\r
-                               Class<?> clazz = clazzes.pop();\r
-                       \r
-                               type = rangeLinkTypes.get(clazz);\r
-                               if (type != null)\r
-                                       return type;\r
-                               for (Class<?> c : clazz.getInterfaces())\r
-                                       clazzes.add(c);\r
-                               \r
-                       }\r
-                       throw new MappingException("Didn't find a link type for " +     element.getClass() + ".");\r
-               }\r
-               return type;\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/internal/BidirectionalLink.java b/org.simantics.objmap2/src/org/simantics/objmap/internal/BidirectionalLink.java
deleted file mode 100644 (file)
index 604de11..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.internal;\r
-\r
-import org.simantics.objmap.bidirectional.IBidirectionalLinkType;\r
-\r
-public class BidirectionalLink<Domain, Range> {\r
-    IBidirectionalLinkType<Domain, Range> linkType;\r
-    Domain domainElement;\r
-    Range rangeElement;\r
-    \r
-    boolean domainModified;\r
-    boolean rangeModified;\r
-    \r
-    public BidirectionalLink(IBidirectionalLinkType<Domain, Range> linkType,\r
-            Domain domainElement, Range rangeElement) {\r
-        this.linkType = linkType;\r
-        this.domainElement = domainElement;\r
-        this.rangeElement = rangeElement;\r
-    }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/internal/BidirectionalMapping.java b/org.simantics.objmap2/src/org/simantics/objmap/internal/BidirectionalMapping.java
deleted file mode 100644 (file)
index 7861503..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.internal;\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.Set;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.objmap.bidirectional.IBidirectionalLinkType;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMapping;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingSchema;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-public class BidirectionalMapping<Domain, Range> implements IBidirectionalMapping<Domain, Range> {\r
-\r
-    IBidirectionalMappingSchema<Domain, Range> schema;\r
-    THashMap<Domain, BidirectionalLink<Domain, Range>> forwardMap =\r
-            new THashMap<Domain, BidirectionalLink<Domain, Range>>();\r
-    THashMap<Range, BidirectionalLink<Domain, Range>> backwardMap =\r
-            new THashMap<Range, BidirectionalLink<Domain, Range>>();\r
-    \r
-    ArrayList<BidirectionalLink<Domain, Range>> modifiedDomain = new ArrayList<BidirectionalLink<Domain, Range>>();\r
-    ArrayList<BidirectionalLink<Domain, Range>> modifiedRange = new ArrayList<BidirectionalLink<Domain, Range>>();\r
-    \r
-    private void markDomainModified(BidirectionalLink<Domain, Range> link) {\r
-        if(!link.domainModified) {\r
-            link.domainModified = true;\r
-            modifiedDomain.add(link);\r
-        }\r
-    }\r
-    \r
-    private void markRangeModified(BidirectionalLink<Domain, Range> link) {\r
-        if(!link.rangeModified) {\r
-            link.rangeModified = true;\r
-            modifiedRange.add(link);\r
-        }\r
-    }\r
-    \r
-    public BidirectionalMapping(IBidirectionalMappingSchema<Domain, Range> schema) {\r
-        this.schema = schema;\r
-    }\r
-\r
-    private BidirectionalLink<Domain, Range> addLink(IBidirectionalLinkType<Domain, Range> linkType, Domain domainElement, Range rangeElement) {\r
-        BidirectionalLink<Domain, Range> link = \r
-                new BidirectionalLink<Domain, Range>(linkType, domainElement, rangeElement);\r
-        forwardMap.put(domainElement, link);\r
-        backwardMap.put(rangeElement, link);\r
-        return link;\r
-    }\r
-    \r
-    @Override\r
-    public Set<Domain> getDomain() {\r
-        return Collections.unmodifiableSet(forwardMap.keySet());\r
-    }\r
-\r
-    @Override\r
-    public Range get(Domain domainElement) {\r
-        BidirectionalLink<Domain, Range> link = forwardMap.get(domainElement);\r
-        if(link == null)\r
-            return null;\r
-        return link.rangeElement;\r
-    }\r
-\r
-    @Override\r
-    public Range map(ReadGraph graph, Domain domainElement) throws MappingException {\r
-        Range result = get(domainElement);\r
-        if(result == null) {\r
-            IBidirectionalLinkType<Domain, Range> linkType = \r
-                    schema.linkTypeOfDomainElement(graph, domainElement);\r
-            Range rangeElement = linkType.createRangeElement(graph, domainElement);\r
-            addLink(linkType, domainElement, rangeElement);\r
-            linkType.createRange(graph, this, domainElement, rangeElement);\r
-        }\r
-        return result;\r
-    }\r
-    \r
-    public Collection<Range> updateRange(ReadGraph graph) throws MappingException {\r
-        ArrayList<Range> updated = new ArrayList<Range>(Math.max(10, modifiedDomain.size())); \r
-        for(BidirectionalLink<Domain, Range> link : modifiedDomain) {\r
-            link.domainModified = false;\r
-            if(link.linkType.updateRange(graph, this, link.domainElement, link.rangeElement))\r
-                updated.add(link.rangeElement);\r
-        }\r
-        modifiedDomain.clear();\r
-        return updated;        \r
-    }\r
-\r
-    @Override\r
-    public Set<Range> getRange() {\r
-        return Collections.unmodifiableSet(backwardMap.keySet());\r
-    }\r
-\r
-    @Override\r
-    public Domain inverseGet(Range rangeElement) {\r
-        BidirectionalLink<Domain, Range> link = backwardMap.get(rangeElement);\r
-        if(link == null)\r
-            return null;\r
-        return link.domainElement;\r
-    }\r
-\r
-    @Override\r
-    public Domain inverseMap(WriteGraph graph, Range rangeElement)\r
-            throws MappingException {\r
-        Domain result = inverseGet(rangeElement);\r
-        if(result == null) {\r
-            IBidirectionalLinkType<Domain, Range> linkType = \r
-                    schema.linkTypeOfRangeElement(graph, rangeElement);\r
-            Domain domainElement = linkType.createDomainElement(graph, rangeElement);\r
-            addLink(linkType, domainElement, rangeElement);\r
-            linkType.createDomain(graph, this, domainElement, rangeElement);\r
-        }\r
-        return result;\r
-    }\r
-    \r
-    public Collection<Domain> updateDomain(WriteGraph graph) throws MappingException {\r
-        ArrayList<Domain> updated = new ArrayList<Domain>(Math.max(10, modifiedRange.size())); \r
-        for(BidirectionalLink<Domain, Range> link : modifiedRange) {\r
-            link.rangeModified = false;\r
-            if(link.linkType.updateDomain(graph, this, link.domainElement, link.rangeElement))\r
-                updated.add(link.domainElement);\r
-        }\r
-        modifiedDomain.clear();\r
-        return updated;        \r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/internal/MonotoneBackwardMapping.java b/org.simantics.objmap2/src/org/simantics/objmap/internal/MonotoneBackwardMapping.java
deleted file mode 100644 (file)
index 8205d1f..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.internal;\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-\r
-import java.util.Collections;\r
-import java.util.Set;\r
-\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.objmap.backward.IBackwardLinkType;\r
-import org.simantics.objmap.backward.IBackwardMapping;\r
-import org.simantics.objmap.backward.IBackwardMappingSchema;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-\r
-/**\r
- * An unidirectional (from range to domain) mapping that does not support removals.\r
- * \r
- * @author Hannu Niemist&ouml;\r
- */\r
-public class MonotoneBackwardMapping<Domain, Range> implements IBackwardMapping<Domain, Range> {\r
-\r
-    IBackwardMappingSchema<Domain, Range> schema;\r
-    THashMap<Range, Domain> map = new THashMap<Range, Domain>();\r
-    \r
-    public MonotoneBackwardMapping(IBackwardMappingSchema<Domain, Range> schema) {\r
-        this.schema = schema;\r
-    }\r
-\r
-    @Override\r
-    public Set<Range> getRange() {\r
-        return Collections.unmodifiableSet(map.keySet());\r
-    }\r
-\r
-    @Override\r
-    public Domain inverseGet(Range rangeElement) {\r
-        return map.get(rangeElement);\r
-    }\r
-\r
-    @Override\r
-    public Domain inverseMap(WriteGraph graph, Range rangeElement) throws MappingException {\r
-        Domain result = inverseGet(rangeElement);\r
-        if(result == null) {\r
-            IBackwardLinkType<Domain, Range> linkType = \r
-                    schema.linkTypeOfRangeElement(graph, rangeElement);\r
-            // Two phase creation makes cyclic references possible\r
-            Domain domainElement = linkType.createDomainElement(graph, rangeElement);\r
-            map.put(rangeElement, domainElement);\r
-            linkType.createDomain(graph, this, domainElement, rangeElement);\r
-        }\r
-        return result;\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/internal/MonotoneForwardMapping.java b/org.simantics.objmap2/src/org/simantics/objmap/internal/MonotoneForwardMapping.java
deleted file mode 100644 (file)
index 2f4f7a5..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.internal;\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-\r
-import java.util.Collections;\r
-import java.util.Set;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardLinkType;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-import org.simantics.objmap.forward.IForwardMappingSchema;\r
-\r
-public class MonotoneForwardMapping<Domain, Range> implements IForwardMapping<Domain, Range> {\r
-\r
-    IForwardMappingSchema<Domain, Range> schema;\r
-    THashMap<Domain, Range> map = new THashMap<Domain, Range>();\r
-    \r
-    public MonotoneForwardMapping(IForwardMappingSchema<Domain, Range> schema) {\r
-        this.schema = schema;\r
-    }\r
-\r
-    @Override\r
-    public Set<Domain> getDomain() {\r
-        return Collections.unmodifiableSet(map.keySet());\r
-    }\r
-\r
-    @Override\r
-    public Range get(Domain domainElement) {\r
-        return map.get(domainElement);\r
-    }\r
-\r
-    @Override\r
-    public Range map(ReadGraph graph, Domain domainElement) throws MappingException {\r
-        Range result = get(domainElement);\r
-        if(result == null) {\r
-            IForwardLinkType<Domain, Range> linkType = \r
-                    schema.linkTypeOfDomainElement(graph, domainElement);\r
-            // Two phase creation makes cyclic references possible\r
-            Range rangeElement = linkType.createRangeElement(graph, domainElement);\r
-            map.put(domainElement, rangeElement);\r
-            linkType.createRange(graph, this, domainElement, rangeElement);\r
-        }\r
-        return result;\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/IStructuralObject.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/IStructuralObject.java
deleted file mode 100644 (file)
index 44340bf..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural;\r
-\r
-import java.util.List;\r
-\r
-import org.simantics.db.Resource;\r
-\r
-/**\r
- * Interface for structurally mapped Java objects.\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public interface IStructuralObject {\r
-       \r
-       /**\r
-        * Context of an object. \r
-        * @return\r
-        */\r
-       public List<IStructuralObject> getContext();\r
-\r
-       /**\r
-        * Sets object's context. Used by ObjMap, don't touch. \r
-        * @param object\r
-        */\r
-       public void setContext(List<IStructuralObject> object);\r
-       \r
-       /**\r
-        * Return type resource for Structural instances. For other objects returns null.\r
-        * @return\r
-        */\r
-       public Resource getType();\r
-       \r
-       /**\r
-        * Sets object's type. Used by ObjMap, don't touch.\r
-        * @param object\r
-        */\r
-       public void setType(Resource type);\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/StructuralResource.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/StructuralResource.java
deleted file mode 100644 (file)
index 857d0e4..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-\r
-/**\r
- * An object representing structural Resource.\r
- * \r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class StructuralResource  {\r
-\r
-       private Resource resource;\r
-       private List<Resource> context = new ArrayList<Resource>(1);\r
-       \r
-       private Resource typeResource = null;\r
-       \r
-       public StructuralResource(Resource resource) {\r
-               assert(resource != null);\r
-               this.resource = resource;\r
-       }\r
-       public StructuralResource(ReadGraph g, Resource resource, Resource context) throws DatabaseException {\r
-               assert(resource != null);\r
-               this.resource = resource;\r
-               this.context.add(context);\r
-               resolveType(g);\r
-       }\r
-       \r
-       public StructuralResource(ReadGraph g, Resource resource, Resource... context) throws DatabaseException {\r
-               assert(resource != null);\r
-               this.resource = resource;\r
-               for (Resource r : context)\r
-                       this.context.add(r);\r
-               resolveType(g);\r
-       }\r
-       \r
-       public StructuralResource(ReadGraph g, Resource resource, List<Resource> context) throws DatabaseException {\r
-               assert(resource != null);\r
-               this.resource = resource;\r
-               for (Resource r : context)\r
-                       this.context.add(r);\r
-               resolveType(g); \r
-       }\r
-       public StructuralResource(ReadGraph g, Resource resource, List<Resource> context, Resource context2) throws DatabaseException {\r
-               assert(resource != null);\r
-               this.resource = resource;\r
-               for (Resource r : context)\r
-                       this.context.add(r);\r
-               this.context.add(context2);\r
-               resolveType(g);\r
-       }\r
-       \r
-       private void resolveType(ReadGraph g) throws DatabaseException {\r
-               if (this.context.contains(resource)) {\r
-                       Layer0 l0 = Layer0.getInstance(g);\r
-                       typeResource = g.getSingleObject(resource, l0.InstanceOf);\r
-               } \r
-       }\r
-       \r
-       \r
-       /**\r
-        * The Resource in the DB.\r
-        * @return\r
-        */\r
-       public Resource getResource() {\r
-               return resource;\r
-       }\r
-       \r
-       /**\r
-        * Context in which this resource is accessed. Each context resource represents a structural model instance. \r
-        * @return\r
-        */\r
-       public List<Resource> getContext() {\r
-               return context;\r
-       }\r
-       \r
-       /**\r
-        * If the resource is structural model instance, this returns the type Resource. Otherwise returns null.\r
-        * @return\r
-        */\r
-       public Resource getTypeResource() {\r
-               return typeResource;\r
-       }\r
-       \r
-       /**\r
-        * Returns true, if the resource is structural, \r
-        * @return\r
-        */\r
-       public boolean isStructural() {\r
-               return context.size() > 0;\r
-       }\r
-       \r
-       /**\r
-        * Returns true is the Resource is root of Structural Model instance.\r
-        * In this case the resource instance is editable.\r
-        * \r
-        * @return\r
-        */\r
-       public boolean isStructuralRoot() {\r
-               return (context.size() == 1 && context.get(0).equals(resource));\r
-       }\r
-       \r
-       /**\r
-        * Returns true,  the resource is structural model instance.\r
-        * @return\r
-        */\r
-       public boolean isStructuralInstance() {\r
-               return typeResource != null;\r
-       }\r
-       \r
-       @Override\r
-       public int hashCode() {\r
-               int hashCode = resource.hashCode();\r
-               for (Resource ctx : context)\r
-                       hashCode += ctx.hashCode();\r
-               return hashCode;\r
-       }\r
-       \r
-       @Override\r
-       public boolean equals(Object obj) {\r
-               if (obj == this)\r
-                       return true;\r
-               if (obj == null)\r
-                       return false;\r
-               if (obj.getClass() != getClass())\r
-                       return false;\r
-               StructuralResource other = (StructuralResource)obj;\r
-               if (!resource.equals(other.resource))\r
-                       return false;\r
-               if (context.size() != other.context.size())\r
-                       return false;\r
-               for (int i = 0; i < context.size(); i++) {\r
-                       if (!context.get(i).equals(other.context.get(i)))\r
-                               return false;\r
-               }\r
-               return true;\r
-       }\r
-       \r
-       @Override\r
-       public String toString() {\r
-               String s = "Res: " + resource + " Context:";\r
-               for (Resource ctx : context) \r
-                       s+= " "+ ctx;\r
-               if (typeResource != null)\r
-                       s+= " Type: " + typeResource;\r
-               return s;\r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedElementsAdd.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedElementsAdd.java
deleted file mode 100644 (file)
index ce4e62d..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface StructuralRelatedElementsAdd {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedElementsGet.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedElementsGet.java
deleted file mode 100644 (file)
index ba0c7c1..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.HasCollectionAdder;\r
-import org.simantics.objmap.graph.annotations.HasCollectionRemover;\r
-import org.simantics.objmap.graph.annotations.meta.IsCollectionRule;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-@IsCollectionRule\r
-@HasCollectionAdder(StructuralRelatedElementsAdd.class)\r
-@HasCollectionRemover(StructuralRelatedElementsRem.class)\r
-public @interface StructuralRelatedElementsGet {\r
-       String value();\r
-       boolean composition() default false;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedElementsRem.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedElementsRem.java
deleted file mode 100644 (file)
index 5823672..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface StructuralRelatedElementsRem {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedGetObj.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedGetObj.java
deleted file mode 100644 (file)
index 56e7a6b..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.HasSetter;\r
-import org.simantics.objmap.graph.annotations.meta.IsGetSetRule;\r
-\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-@IsGetSetRule\r
-@HasSetter(StructuralRelatedSetObj.class)\r
-public @interface StructuralRelatedGetObj {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedSetObj.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/StructuralRelatedSetObj.java
deleted file mode 100644 (file)
index bae77b7..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface StructuralRelatedSetObj {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedElementsAdd.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedElementsAdd.java
deleted file mode 100644 (file)
index ffc5bbb..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface TypeRelatedElementsAdd {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedElementsGet.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedElementsGet.java
deleted file mode 100644 (file)
index 7c06d61..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.HasCollectionAdder;\r
-import org.simantics.objmap.graph.annotations.HasCollectionRemover;\r
-import org.simantics.objmap.graph.annotations.meta.IsCollectionRule;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-@IsCollectionRule\r
-@HasCollectionAdder(TypeRelatedElementsAdd.class)\r
-@HasCollectionRemover(TypeRelatedElementsRem.class)\r
-public @interface TypeRelatedElementsGet {\r
-       String value();\r
-       boolean composition() default false;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedElementsRem.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedElementsRem.java
deleted file mode 100644 (file)
index c540bf5..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface TypeRelatedElementsRem {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedGetObj.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedGetObj.java
deleted file mode 100644 (file)
index 6386730..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.HasSetter;\r
-import org.simantics.objmap.graph.annotations.meta.IsGetSetRule;\r
-\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-//@HasGetSetRuleFactory(RelatedGetSetObjRuleFactory.class)\r
-@IsGetSetRule\r
-@HasSetter(TypeRelatedSetObj.class)\r
-public @interface TypeRelatedGetObj {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedGetValue.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedGetValue.java
deleted file mode 100644 (file)
index 1b0f147..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.simantics.objmap.graph.annotations.HasSetter;\r
-import org.simantics.objmap.graph.annotations.meta.IsGetSetRule;\r
-import org.simantics.objmap.graph.rules.adapters.IdentityAdapter;\r
-import org.simantics.objmap.graph.rules.adapters.ValueAdapter;\r
-\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-//@HasGetSetRuleFactory(RelatedGetSetValueRuleFactory.class)\r
-@IsGetSetRule\r
-@HasSetter(TypeRelatedSetValue.class)\r
-public @interface TypeRelatedGetValue {\r
-       String value();\r
-        Class<? extends ValueAdapter> adapter() default IdentityAdapter.class;\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedSetObj.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedSetObj.java
deleted file mode 100644 (file)
index 6045fb0..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface TypeRelatedSetObj {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedSetValue.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/TypeRelatedSetValue.java
deleted file mode 100644 (file)
index 61b061d..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations;\r
-\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-\r
-@Retention(RetentionPolicy.RUNTIME)\r
-@Target(ElementType.METHOD)\r
-public @interface TypeRelatedSetValue {\r
-       String value();\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/DataTypeUtils.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/DataTypeUtils.java
deleted file mode 100644 (file)
index 8218f36..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.layer0.Layer0;\r
-\r
-public class DataTypeUtils {\r
-    \r
-    public static Resource dataTypeOfClass(ReadGraph g, Class<?> clazz) {\r
-        Layer0 b = Layer0.getInstance(g);\r
-        if(clazz.equals(Double.class) || clazz.equals(double.class))\r
-            return b.Double;\r
-        else if(clazz.equals(String.class))\r
-            return b.String;\r
-        else if(clazz.equals(Integer.class) || clazz.equals(int.class))\r
-            return b.Integer;\r
-        else if(clazz.equals(Float.class) || clazz.equals(float.class))\r
-            return b.Float;\r
-        else if(clazz.equals(Boolean.class) || clazz.equals(boolean.class))\r
-            return b.Boolean;\r
-        else if(clazz.equals(Long.class) || clazz.equals(long.class))\r
-            return b.Long;\r
-        else if(clazz.equals(Byte.class) || clazz.equals(byte.class))\r
-            return b.Byte;\r
-        \r
-        else if(clazz.equals(double[].class))\r
-            return b.DoubleArray;\r
-        else if(clazz.equals(int[].class))\r
-            return b.IntegerArray;\r
-        else if(clazz.equals(byte[].class))\r
-            return b.ByteArray;\r
-        else if(clazz.equals(float[].class))\r
-            return b.FloatArray;\r
-        else if(clazz.equals(boolean[].class))\r
-            return b.BooleanArray;\r
-        else if(clazz.equals(String[].class))\r
-            return b.StringArray;\r
-        else if(clazz.equals(long[].class))\r
-            return b.LongArray;\r
-        else {\r
-               System.out.println("Couldn't find a data type for " + clazz);\r
-            return null;\r
-        }\r
-    }\r
-    \r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/OptionalRelatedElementsRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/OptionalRelatedElementsRuleFactory.java
deleted file mode 100644 (file)
index 734b3cd..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.ResourceNotFoundException;\r
-import org.simantics.db.exception.ServiceException;\r
-import org.simantics.db.exception.ValidationException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.OptionalRelatedElements;\r
-import org.simantics.objmap.graph.rules.MappedElementsRule;\r
-import org.simantics.objmap.structural.rules.domain.RelatedObjectsAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IFieldRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.FieldAccessorWithDefault;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-\r
-public class OptionalRelatedElementsRuleFactory<Range> implements IFieldRuleFactory<StructuralResource, Range> {\r
-\r
-    @Override\r
-    public IBidirectionalMappingRule<StructuralResource, Range> create(ReadGraph g, Annotation _annotation, Field field) throws ResourceNotFoundException, ValidationException, ServiceException {\r
-        OptionalRelatedElements annotation = (OptionalRelatedElements)_annotation;\r
-        return new MappedElementsRule<StructuralResource, Range>(\r
-                new RelatedObjectsAccessor(g.getResource(annotation.value()),\r
-                        annotation.composition(),false),\r
-                new FieldAccessorWithDefault<Range,Collection<Range>>(field, Collections.<Range>emptyList())\r
-                );\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedElementRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedElementRuleFactory.java
deleted file mode 100644 (file)
index 3576bc5..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.ResourceNotFoundException;\r
-import org.simantics.db.exception.ServiceException;\r
-import org.simantics.db.exception.ValidationException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedElement;\r
-import org.simantics.objmap.graph.rules.MappedElementRule;\r
-import org.simantics.objmap.graph.rules.domain.RelatedObjectAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IFieldRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.FieldAccessor;\r
-\r
-\r
-public class RelatedElementRuleFactory<Range> implements IFieldRuleFactory<Resource,Range> {\r
-\r
-    @Override\r
-    public IBidirectionalMappingRule<Resource, Range> create(ReadGraph g, Annotation _annotation, Field field) throws ResourceNotFoundException, ValidationException, ServiceException {\r
-        RelatedElement annotation = (RelatedElement)_annotation;\r
-        return new MappedElementRule<Resource,Range>(\r
-                new RelatedObjectAccessor(g.getResource(annotation.value())),\r
-                new FieldAccessor<Range,Range>(field)\r
-                );\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedElementsRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedElementsRuleFactory.java
deleted file mode 100644 (file)
index a2d0a4c..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.ResourceNotFoundException;\r
-import org.simantics.db.exception.ServiceException;\r
-import org.simantics.db.exception.ValidationException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedElements;\r
-import org.simantics.objmap.graph.rules.MappedElementsRule;\r
-import org.simantics.objmap.structural.rules.domain.RelatedObjectsAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IFieldRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.FieldAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-\r
-public class RelatedElementsRuleFactory<Range> implements IFieldRuleFactory<StructuralResource, Range> {\r
-\r
-    @Override\r
-    public IBidirectionalMappingRule<StructuralResource, Range> create(ReadGraph g, Annotation _annotation, Field field) throws ResourceNotFoundException, ValidationException, ServiceException {\r
-        RelatedElements annotation = (RelatedElements)_annotation;\r
-        return new MappedElementsRule<StructuralResource,Range>(\r
-                new RelatedObjectsAccessor(g.getResource(annotation.value()),\r
-                        annotation.composition(),false),\r
-                new FieldAccessor<Range,Collection<Range>>(field)\r
-                );\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedElementsRuleFactory2.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedElementsRuleFactory2.java
deleted file mode 100644 (file)
index e100c7a..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedElementsAdd;\r
-import org.simantics.objmap.graph.annotations.RelatedElementsGet;\r
-import org.simantics.objmap.graph.annotations.RelatedElementsRem;\r
-import org.simantics.objmap.graph.rules.MappedElementsRule;\r
-import org.simantics.objmap.graph.rules.factory.ICollectionRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.CollectionAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-import org.simantics.objmap.structural.rules.domain.RelatedObjectsAccessor;\r
-\r
-\r
-public class RelatedElementsRuleFactory2<Range> implements ICollectionRuleFactory<StructuralResource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<StructuralResource, Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method adder, Method remover)\r
-                       throws DatabaseException {\r
-               RelatedElementsGet getterAnn = (RelatedElementsGet)annotation;\r
-               return new MappedElementsRule<StructuralResource,Range>(new RelatedObjectsAccessor(g.getResource(getterAnn.value()),getterAnn.composition(),false,true,false),\r
-                                       new CollectionAccessor<Range,Range>(getter, adder, remover));\r
-       }\r
-       \r
-       @Override\r
-       public boolean isAdder(Annotation getterAnnotation, Annotation annotation) {\r
-               RelatedElementsGet getterAnn = (RelatedElementsGet)getterAnnotation;\r
-               RelatedElementsAdd adderAnn = (RelatedElementsAdd)annotation;\r
-               return getterAnn.value().equals(adderAnn.value());\r
-       }\r
-       \r
-       @Override\r
-       public boolean isRemover(Annotation getterAnnotation, Annotation annotation) {\r
-               RelatedElementsGet getterAnn = (RelatedElementsGet)getterAnnotation;\r
-               RelatedElementsRem adderAnn = (RelatedElementsRem)annotation;\r
-               return getterAnn.value().equals(adderAnn.value());\r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedGetSetObjRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedGetSetObjRuleFactory.java
deleted file mode 100644 (file)
index f1b3f35..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedGetObj;\r
-import org.simantics.objmap.graph.annotations.RelatedSetObj;\r
-import org.simantics.objmap.graph.rules.MappedElementRule;\r
-import org.simantics.objmap.structural.rules.domain.RelatedObjectAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IGetSetRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.GetSetObjectAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-\r
-/**\r
- * Rule factory for mapped object using Getter/Setter-methods.\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class RelatedGetSetObjRuleFactory<Range> implements IGetSetRuleFactory<StructuralResource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<StructuralResource,Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method setter)\r
-                       throws DatabaseException {\r
-               RelatedGetObj getterAnn = (RelatedGetObj)annotation;\r
-               return new MappedElementRule<StructuralResource,Range>(new RelatedObjectAccessor(g.getResource(getterAnn.value()),false,true,false),\r
-                                       new GetSetObjectAccessor<Range,Range>(getter, setter));\r
-       }\r
-       \r
-       @Override\r
-       public boolean isSetter(Annotation getterAnnotation, Annotation annotation) {\r
-               RelatedGetObj getterAnn = (RelatedGetObj)getterAnnotation;\r
-               RelatedSetObj setterAnn = (RelatedSetObj)annotation;\r
-               return getterAnn.value().equals(setterAnn.value());\r
-       }\r
-       \r
-       \r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedGetSetValueRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedGetSetValueRuleFactory.java
deleted file mode 100644 (file)
index e1b8d2d..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedGetValue;\r
-import org.simantics.objmap.graph.annotations.RelatedSetValue;\r
-import org.simantics.objmap.graph.rules.ValueRule;\r
-import org.simantics.objmap.graph.rules.adapters.IdentityAdapter;\r
-import org.simantics.objmap.graph.rules.adapters.ValueAdapter;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-import org.simantics.objmap.structural.rules.domain.RelatedValueAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IGetSetRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.AdaptedRangeAccessor;\r
-import org.simantics.objmap.graph.rules.range.GetSetValueAccessor;\r
-import org.simantics.objmap.graph.rules.range.IRangeAccessor;\r
-\r
-/**\r
- * Rule factory for mapped value using Getter/Setter-methods.\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class RelatedGetSetValueRuleFactory<Range> implements IGetSetRuleFactory<StructuralResource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<StructuralResource, Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method setter)\r
-                       throws DatabaseException {\r
-               RelatedGetValue getterAnn = (RelatedGetValue)annotation;\r
-               \r
-               Class<? extends ValueAdapter> adapterClass = getterAnn.adapter();\r
-                IRangeAccessor<Range,Object> rangeAccessor = new GetSetValueAccessor<Range,Object>(getter, setter);\r
-        Resource valueType;\r
-        if (adapterClass == IdentityAdapter.class) {\r
-            valueType = dataTypeOfClass(g, getter.getReturnType());\r
-        } else {\r
-               try{\r
-                        ValueAdapter adapter = adapterClass.newInstance();\r
-                 rangeAccessor = new AdaptedRangeAccessor<Range>(rangeAccessor, adapter);\r
-                 valueType = adapter.rangeTypeToDomainType(g, getter.getReturnType());\r
-             } catch (InstantiationException e) {\r
-                 throw new RuntimeException(e);\r
-             } catch (IllegalAccessException e) {\r
-                 throw new RuntimeException(e);\r
-             }\r
-        }\r
-               return new ValueRule<StructuralResource,Range>(new RelatedValueAccessor(g.getResource(getterAnn.value()), valueType,false,true,false),\r
-                                       rangeAccessor);\r
-       }\r
-       \r
-       @Override\r
-       public boolean isSetter(Annotation getterAnnotation, Annotation annotation) {\r
-               RelatedGetValue getterAnn = (RelatedGetValue)getterAnnotation;\r
-               RelatedSetValue setterAnn = (RelatedSetValue)annotation;\r
-               return getterAnn.value().equals(setterAnn.value());\r
-       }\r
-       \r
-       public static Resource dataTypeOfClass(ReadGraph g, Class<?> clazz) {\r
-        Layer0 b = Layer0.getInstance(g);\r
-        if(clazz.equals(Double.class) || clazz.equals(double.class))\r
-            return b.Double;\r
-        else if(clazz.equals(String.class))\r
-            return b.String;\r
-        else if(clazz.equals(Integer.class) || clazz.equals(int.class))\r
-            return b.Integer;\r
-        else if(clazz.equals(Float.class) || clazz.equals(float.class))\r
-            return b.Float;\r
-        else if(clazz.equals(Boolean.class) || clazz.equals(boolean.class))\r
-            return b.Boolean;\r
-        else if(clazz.equals(Long.class) || clazz.equals(long.class))\r
-            return b.Long;\r
-        else if(clazz.equals(Byte.class) || clazz.equals(byte.class))\r
-            return b.Byte;\r
-        \r
-        else if(clazz.equals(double[].class))\r
-            return b.DoubleArray;\r
-        else if(clazz.equals(int[].class))\r
-            return b.IntegerArray;\r
-        else if(clazz.equals(byte[].class))\r
-            return b.ByteArray;\r
-        else if(clazz.equals(float[].class))\r
-            return b.FloatArray;\r
-        else if(clazz.equals(boolean[].class))\r
-            return b.BooleanArray;\r
-        else if(clazz.equals(String[].class))\r
-            return b.StringArray;\r
-        else if(clazz.equals(long[].class))\r
-            return b.LongArray;\r
-        else {\r
-               System.out.println("Couldn't find a data type for " + clazz);\r
-            return null;\r
-        }\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedOrderedSetElementsRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedOrderedSetElementsRuleFactory.java
deleted file mode 100644 (file)
index b2e6564..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.ResourceNotFoundException;\r
-import org.simantics.db.exception.ServiceException;\r
-import org.simantics.db.exception.ValidationException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedOrderedSetElements;\r
-import org.simantics.objmap.graph.rules.MappedElementsRule;\r
-import org.simantics.objmap.graph.rules.factory.IFieldRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.FieldAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-import org.simantics.objmap.structural.rules.domain.RelatedOrderedSetElementsAccessor;\r
-\r
-\r
-public class RelatedOrderedSetElementsRuleFactory<Range> implements IFieldRuleFactory<StructuralResource, Range> {\r
-\r
-    @Override\r
-    public IBidirectionalMappingRule<StructuralResource, Range> create(ReadGraph g, Annotation _annotation, Field field) throws ResourceNotFoundException, ValidationException, ServiceException {\r
-        RelatedOrderedSetElements annotation = (RelatedOrderedSetElements)_annotation;\r
-        return new MappedElementsRule<StructuralResource,Range>(\r
-                new RelatedOrderedSetElementsAccessor(annotation.composition(),false),\r
-                new FieldAccessor<Range,Collection<Range>>(field)\r
-                );\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedValueRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/RelatedValueRuleFactory.java
deleted file mode 100644 (file)
index 0b4b34d..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.ResourceNotFoundException;\r
-import org.simantics.db.exception.ServiceException;\r
-import org.simantics.db.exception.ValidationException;\r
-\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.RelatedValue;\r
-import org.simantics.objmap.graph.rules.ValueRule;\r
-import org.simantics.objmap.graph.rules.adapters.IdentityAdapter;\r
-import org.simantics.objmap.graph.rules.adapters.ValueAdapter;\r
-import org.simantics.objmap.structural.rules.domain.RelatedValueAccessor;\r
-import org.simantics.objmap.graph.rules.factory.IFieldRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.AdaptedRangeAccessor;\r
-import org.simantics.objmap.graph.rules.range.FieldAccessor;\r
-import org.simantics.objmap.graph.rules.range.IRangeAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-\r
-public class RelatedValueRuleFactory<Range> implements IFieldRuleFactory<StructuralResource, Range> {\r
-\r
-    @Override\r
-    public IBidirectionalMappingRule<StructuralResource, Range> create(ReadGraph g, Annotation _annotation, Field field) throws ResourceNotFoundException,\r
-            ValidationException, ServiceException {\r
-        RelatedValue annotation = (RelatedValue) _annotation;\r
-        Class<? extends ValueAdapter> adapterClass = annotation.adapter();\r
-        IRangeAccessor<Range,Object> rangeAccessor = new FieldAccessor<Range,Object>(field);\r
-        Resource valueType;\r
-        if (adapterClass == IdentityAdapter.class) {\r
-            valueType = DataTypeUtils.dataTypeOfClass(g, field.getType());\r
-        } else {\r
-            try {\r
-                ValueAdapter adapter = adapterClass.newInstance();\r
-                rangeAccessor = new AdaptedRangeAccessor<Range>(rangeAccessor, adapter);\r
-                valueType = adapter.rangeTypeToDomainType(g, field.getType());\r
-            } catch (InstantiationException e) {\r
-                throw new RuntimeException(e);\r
-            } catch (IllegalAccessException e) {\r
-                throw new RuntimeException(e);\r
-            }\r
-        }\r
-        return new ValueRule<StructuralResource,Range>(new RelatedValueAccessor(g.getResource(annotation.value()), valueType,false,true,false), rangeAccessor);\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/StructuralRelatedElementsRuleFactory2.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/StructuralRelatedElementsRuleFactory2.java
deleted file mode 100644 (file)
index b54c735..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.rules.MappedElementsRule;\r
-import org.simantics.objmap.graph.rules.factory.ICollectionRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.CollectionAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-import org.simantics.objmap.structural.annotations.StructuralRelatedElementsAdd;\r
-import org.simantics.objmap.structural.annotations.StructuralRelatedElementsGet;\r
-import org.simantics.objmap.structural.annotations.StructuralRelatedElementsRem;\r
-import org.simantics.objmap.structural.rules.domain.StructuralRelatedObjectsAccessor;\r
-\r
-\r
-public class StructuralRelatedElementsRuleFactory2<Range> implements ICollectionRuleFactory<StructuralResource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<StructuralResource, Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method adder, Method remover)\r
-                       throws DatabaseException {\r
-               StructuralRelatedElementsGet getterAnn = (StructuralRelatedElementsGet)annotation;\r
-               return new MappedElementsRule<StructuralResource,Range>(new StructuralRelatedObjectsAccessor(g.getResource(getterAnn.value()),getterAnn.composition()),\r
-                                       new CollectionAccessor<Range,Range>(getter, adder, remover));\r
-       }\r
-       \r
-       @Override\r
-       public boolean isAdder(Annotation getterAnnotation, Annotation annotation) {\r
-               StructuralRelatedElementsGet getterAnn = (StructuralRelatedElementsGet)getterAnnotation;\r
-               StructuralRelatedElementsAdd adderAnn = (StructuralRelatedElementsAdd)annotation;\r
-               return getterAnn.value().equals(adderAnn.value());\r
-       }\r
-       \r
-       @Override\r
-       public boolean isRemover(Annotation getterAnnotation, Annotation annotation) {\r
-               StructuralRelatedElementsGet getterAnn = (StructuralRelatedElementsGet)getterAnnotation;\r
-               StructuralRelatedElementsRem adderAnn = (StructuralRelatedElementsRem)annotation;\r
-               return getterAnn.value().equals(adderAnn.value());\r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/StructuralRelatedGetSetObjRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/StructuralRelatedGetSetObjRuleFactory.java
deleted file mode 100644 (file)
index 22b8b08..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.rules.MappedElementRule;\r
-import org.simantics.objmap.graph.rules.factory.IGetSetRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.GetSetObjectAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-import org.simantics.objmap.structural.annotations.StructuralRelatedGetObj;\r
-import org.simantics.objmap.structural.annotations.StructuralRelatedSetObj;\r
-import org.simantics.objmap.structural.rules.domain.StructuralRelatedObjectAccessor;\r
-\r
-\r
-/**\r
- * Rule factory for mapped object using Getter/Setter-methods.\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class StructuralRelatedGetSetObjRuleFactory<Range> implements IGetSetRuleFactory<StructuralResource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<StructuralResource,Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method setter)\r
-                       throws DatabaseException {\r
-               StructuralRelatedGetObj getterAnn = (StructuralRelatedGetObj)annotation;\r
-               return new MappedElementRule<StructuralResource,Range>(new StructuralRelatedObjectAccessor(g.getResource(getterAnn.value()),false,true,false),\r
-                                       new GetSetObjectAccessor<Range,Range>(getter, setter));\r
-       }\r
-       \r
-       @Override\r
-       public boolean isSetter(Annotation getterAnnotation, Annotation annotation) {\r
-               StructuralRelatedGetObj getterAnn = (StructuralRelatedGetObj)getterAnnotation;\r
-               StructuralRelatedSetObj setterAnn = (StructuralRelatedSetObj)annotation;\r
-               return getterAnn.value().equals(setterAnn.value());\r
-       }\r
-       \r
-       \r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/TypeRelatedElementsRuleFactory2.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/TypeRelatedElementsRuleFactory2.java
deleted file mode 100644 (file)
index 0bbc2b9..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.rules.MappedElementsRule;\r
-import org.simantics.objmap.graph.rules.factory.ICollectionRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.CollectionAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-import org.simantics.objmap.structural.annotations.TypeRelatedElementsAdd;\r
-import org.simantics.objmap.structural.annotations.TypeRelatedElementsGet;\r
-import org.simantics.objmap.structural.annotations.TypeRelatedElementsRem;\r
-import org.simantics.objmap.structural.rules.domain.RelatedObjectsAccessor;\r
-\r
-\r
-public class TypeRelatedElementsRuleFactory2<Range> implements ICollectionRuleFactory<StructuralResource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<StructuralResource, Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method adder, Method remover)\r
-                       throws DatabaseException {\r
-               TypeRelatedElementsGet getterAnn = (TypeRelatedElementsGet)annotation;\r
-               return new MappedElementsRule<StructuralResource,Range>(new RelatedObjectsAccessor(g.getResource(getterAnn.value()),getterAnn.composition(),true,true,true),\r
-                                       new CollectionAccessor<Range,Range>(getter, adder, remover));\r
-       }\r
-       \r
-       @Override\r
-       public boolean isAdder(Annotation getterAnnotation, Annotation annotation) {\r
-               TypeRelatedElementsGet getterAnn = (TypeRelatedElementsGet)getterAnnotation;\r
-               TypeRelatedElementsAdd adderAnn = (TypeRelatedElementsAdd)annotation;\r
-               return getterAnn.value().equals(adderAnn.value());\r
-       }\r
-       \r
-       @Override\r
-       public boolean isRemover(Annotation getterAnnotation, Annotation annotation) {\r
-               TypeRelatedElementsGet getterAnn = (TypeRelatedElementsGet)getterAnnotation;\r
-               TypeRelatedElementsRem adderAnn = (TypeRelatedElementsRem)annotation;\r
-               return getterAnn.value().equals(adderAnn.value());\r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/TypeRelatedGetSetObjRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/TypeRelatedGetSetObjRuleFactory.java
deleted file mode 100644 (file)
index 5784718..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.rules.MappedElementRule;\r
-import org.simantics.objmap.graph.rules.factory.IGetSetRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.GetSetObjectAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-import org.simantics.objmap.structural.annotations.TypeRelatedGetObj;\r
-import org.simantics.objmap.structural.annotations.TypeRelatedSetObj;\r
-import org.simantics.objmap.structural.rules.domain.RelatedObjectAccessor;\r
-\r
-\r
-/**\r
- * Rule factory for mapped object using Getter/Setter-methods.\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class TypeRelatedGetSetObjRuleFactory<Range> implements IGetSetRuleFactory<StructuralResource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<StructuralResource,Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method setter)\r
-                       throws DatabaseException {\r
-               TypeRelatedGetObj getterAnn = (TypeRelatedGetObj)annotation;\r
-               return new MappedElementRule<StructuralResource,Range>(new RelatedObjectAccessor(g.getResource(getterAnn.value()),true,true,true),\r
-                                       new GetSetObjectAccessor<Range,Range>(getter, setter));\r
-       }\r
-       \r
-       @Override\r
-       public boolean isSetter(Annotation getterAnnotation, Annotation annotation) {\r
-               TypeRelatedGetObj getterAnn = (TypeRelatedGetObj)getterAnnotation;\r
-               TypeRelatedSetObj setterAnn = (TypeRelatedSetObj)annotation;\r
-               return getterAnn.value().equals(setterAnn.value());\r
-       }\r
-       \r
-       \r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/TypeRelatedGetSetValueRuleFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/TypeRelatedGetSetValueRuleFactory.java
deleted file mode 100644 (file)
index 60fb6ac..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.rules.ValueRule;\r
-import org.simantics.objmap.graph.rules.adapters.IdentityAdapter;\r
-import org.simantics.objmap.graph.rules.adapters.ValueAdapter;\r
-import org.simantics.objmap.graph.rules.factory.IGetSetRuleFactory;\r
-import org.simantics.objmap.graph.rules.range.AdaptedRangeAccessor;\r
-import org.simantics.objmap.graph.rules.range.GetSetValueAccessor;\r
-import org.simantics.objmap.graph.rules.range.IRangeAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-import org.simantics.objmap.structural.annotations.TypeRelatedGetValue;\r
-import org.simantics.objmap.structural.annotations.TypeRelatedSetValue;\r
-import org.simantics.objmap.structural.rules.domain.RelatedValueAccessor;\r
-\r
-/**\r
- * Rule factory for mapped value using Getter/Setter-methods.\r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class TypeRelatedGetSetValueRuleFactory<Range> implements IGetSetRuleFactory<StructuralResource,Range> {\r
-       \r
-       @Override\r
-       public IBidirectionalMappingRule<StructuralResource, Range> create(ReadGraph g, Annotation annotation,\r
-                       Method getter, Method setter)\r
-                       throws DatabaseException {\r
-               TypeRelatedGetValue getterAnn = (TypeRelatedGetValue)annotation;\r
-               \r
-               Class<? extends ValueAdapter> adapterClass = getterAnn.adapter();\r
-                IRangeAccessor<Range,Object> rangeAccessor = new GetSetValueAccessor<Range,Object>(getter, setter);\r
-        Resource valueType;\r
-        if (adapterClass == IdentityAdapter.class) {\r
-            valueType = dataTypeOfClass(g, getter.getReturnType());\r
-        } else {\r
-               try{\r
-                        ValueAdapter adapter = adapterClass.newInstance();\r
-                 rangeAccessor = new AdaptedRangeAccessor<Range>(rangeAccessor, adapter);\r
-                 valueType = adapter.rangeTypeToDomainType(g, getter.getReturnType());\r
-             } catch (InstantiationException e) {\r
-                 throw new RuntimeException(e);\r
-             } catch (IllegalAccessException e) {\r
-                 throw new RuntimeException(e);\r
-             }\r
-        }\r
-               return new ValueRule<StructuralResource,Range>(new RelatedValueAccessor(g.getResource(getterAnn.value()), valueType,true,true,true),\r
-                                       rangeAccessor);\r
-       }\r
-       \r
-       @Override\r
-       public boolean isSetter(Annotation getterAnnotation, Annotation annotation) {\r
-               TypeRelatedGetValue getterAnn = (TypeRelatedGetValue)getterAnnotation;\r
-               TypeRelatedSetValue setterAnn = (TypeRelatedSetValue)annotation;\r
-               return getterAnn.value().equals(setterAnn.value());\r
-       }\r
-       \r
-       public static Resource dataTypeOfClass(ReadGraph g, Class<?> clazz) {\r
-        Layer0 b = Layer0.getInstance(g);\r
-        if(clazz.equals(Double.class) || clazz.equals(double.class))\r
-            return b.Double;\r
-        else if(clazz.equals(String.class))\r
-            return b.String;\r
-        else if(clazz.equals(Integer.class) || clazz.equals(int.class))\r
-            return b.Integer;\r
-        else if(clazz.equals(Float.class) || clazz.equals(float.class))\r
-            return b.Float;\r
-        else if(clazz.equals(Boolean.class) || clazz.equals(boolean.class))\r
-            return b.Boolean;\r
-        else if(clazz.equals(Long.class) || clazz.equals(long.class))\r
-            return b.Long;\r
-        else if(clazz.equals(Byte.class) || clazz.equals(byte.class))\r
-            return b.Byte;\r
-        \r
-        else if(clazz.equals(double[].class))\r
-            return b.DoubleArray;\r
-        else if(clazz.equals(int[].class))\r
-            return b.IntegerArray;\r
-        else if(clazz.equals(byte[].class))\r
-            return b.ByteArray;\r
-        else if(clazz.equals(float[].class))\r
-            return b.FloatArray;\r
-        else if(clazz.equals(boolean[].class))\r
-            return b.BooleanArray;\r
-        else if(clazz.equals(String[].class))\r
-            return b.StringArray;\r
-        else if(clazz.equals(long[].class))\r
-            return b.LongArray;\r
-        else {\r
-               System.out.println("Couldn't find a data type for " + clazz);\r
-            return null;\r
-        }\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/UpdateMethodFactory.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/annotations/factories/UpdateMethodFactory.java
deleted file mode 100644 (file)
index b7f1fc2..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.annotations.factories;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Method;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.backward.IBackwardMapping;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-import org.simantics.objmap.graph.rules.factory.IMethodRuleFactory;\r
-\r
-public class UpdateMethodFactory<Domain, Range> implements IMethodRuleFactory<Domain, Range> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-    @Override\r
-    public IBidirectionalMappingRule<Domain, Range> create(ReadGraph g, \r
-            Annotation annotation, \r
-            final Method method)\r
-            throws DatabaseException {\r
-        method.setAccessible(true);\r
-        return new IBidirectionalMappingRule<Domain,Range>() {\r
-            \r
-            @Override\r
-            public boolean updateRange(ReadGraph g, IForwardMapping<Domain, Range> map,\r
-                    Domain domainElement, Range rangeElement)\r
-                    throws MappingException {\r
-                LOGGER.info("    UpdateMethodFactory.updateRange");      \r
-                try {\r
-                    return (Boolean)method.invoke(rangeElement, g, domainElement);\r
-                } catch (Exception e) {\r
-                    // TODO Auto-generated catch block\r
-                    e.printStackTrace();\r
-                }\r
-                return false;\r
-            }\r
-            \r
-            @Override\r
-            public boolean updateDomain(WriteGraph g, IBackwardMapping<Domain,Range> map,\r
-                    Domain domainElement, Range rangeElement)\r
-                    throws MappingException {\r
-                return false;\r
-            }\r
-            \r
-            public void createDomain(WriteGraph g, IBackwardMapping<Domain,Range> map, Domain domainElement, Range rangeElement) throws MappingException {\r
-               updateDomain(g, map, domainElement, rangeElement);\r
-            };\r
-            \r
-            public void createRange(ReadGraph g, IForwardMapping<Domain,Range> map, Domain domainElement, Range rangeElement) throws MappingException {\r
-               updateRange(g, map, domainElement, rangeElement);\r
-            };\r
-        };\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedObjectAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedObjectAccessor.java
deleted file mode 100644 (file)
index 6fa4af7..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.rules.domain;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.graph.rules.domain.IDomainAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-\r
-public class RelatedObjectAccessor implements IDomainAccessor<StructuralResource,StructuralResource> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       Resource relation;\r
-       boolean useTypeResource;\r
-       \r
-       private boolean preventStructuralChanges = true;\r
-       private boolean preventStructuralRootChanges = true;\r
-       \r
-       public RelatedObjectAccessor(Resource relation, boolean useTypeResource) {\r
-               this.relation = relation;\r
-               this.useTypeResource = useTypeResource;\r
-       }\r
-       \r
-       public RelatedObjectAccessor(Resource relation, boolean useTypeResource, boolean preventStructuralChanges, boolean preventStructuralRootChanges) {\r
-               this.relation = relation;\r
-               this.useTypeResource = useTypeResource;\r
-               this.preventStructuralChanges = preventStructuralChanges;\r
-               this.preventStructuralRootChanges = preventStructuralRootChanges;\r
-       }\r
-       \r
- private boolean preventChange(StructuralResource element) {\r
-       return preventStructuralChanges && element.isStructural() && (!element.isStructuralRoot()||preventStructuralRootChanges);       \r
-    }\r
-\r
-       @Override\r
-       public StructuralResource get(ReadGraph g, StructuralResource element) throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedObjectAccessor.get");\r
-                   Resource res = getServiceResource(g, element);\r
-                   if (res == null)\r
-                       return null;\r
-                       Resource r =  g.getPossibleObject(res, relation);\r
-                       if (r == null)\r
-                               return null;\r
-                       if (StructuralUtils.isStructuralInstance(g, r)) {\r
-                               return new StructuralResource(g, r, element.getContext(),r);\r
-                       } else {\r
-                               return new StructuralResource(g, r, element.getContext());\r
-                       }\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public boolean set(WriteGraph g, StructuralResource selement, StructuralResource value)\r
-                       throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedObjectAccessor.set");\r
-                   Resource element = getServiceResource(g, selement);\r
-                   if (element == null)\r
-                       return false;\r
-                   Resource resource = g.getPossibleObject(element, relation);\r
-                       if(resource == null) {\r
-                           if(value == null)\r
-                               return false;\r
-                           if (preventChange(selement))\r
-                                       return false;\r
-                           g.claim(element, relation, value.getResource());\r
-                           return true;\r
-                       }\r
-                       else if(resource.equals(value))\r
-                           return false;\r
-                       else {\r
-                               if (preventChange(selement))\r
-                                       return false;\r
-                           g.deny(element, relation);\r
-                           if(value != null)\r
-                               g.claim(element, relation, value.getResource());\r
-                           return true;\r
-                       }\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-               \r
-       }\r
-       \r
-               \r
-       \r
-       private Resource getServiceResource(ReadGraph g, StructuralResource element) {\r
-               if(!useTypeResource)\r
-                       return element.getResource();\r
-               return element.getTypeResource();\r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedObjectsAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedObjectsAccessor.java
deleted file mode 100644 (file)
index c56ffb6..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.rules.domain;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.List;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.graph.rules.domain.IDomainAccessor;\r
-import org.simantics.objmap.graph.rules.domain.MappingUtils;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-\r
-public class RelatedObjectsAccessor implements IDomainAccessor<StructuralResource,Collection<StructuralResource>> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       Resource relation;\r
-       boolean deleteExtraObjects;\r
-       boolean useTypeResource;\r
-       \r
-       private boolean preventStructuralChanges = true;\r
-       private boolean preventStructuralRootChanges = true;\r
-\r
-       public RelatedObjectsAccessor(Resource relation, boolean deleteExtraObjects, boolean useTypeResource) {\r
-        super();\r
-        this.relation = relation;\r
-        this.deleteExtraObjects = deleteExtraObjects;\r
-        this.useTypeResource = useTypeResource;\r
-    }\r
-       \r
-       public RelatedObjectsAccessor(Resource relation, boolean deleteExtraObjects, boolean useTypeResource, boolean preventStructuralChanges, boolean preventStructuralRootChanges) {\r
-        super();\r
-        this.relation = relation;\r
-        this.deleteExtraObjects = deleteExtraObjects;\r
-        this.useTypeResource = useTypeResource;\r
-               this.preventStructuralChanges = preventStructuralChanges;\r
-               this.preventStructuralRootChanges = preventStructuralRootChanges;\r
-    }\r
-\r
-    @Override\r
-       public Collection<StructuralResource> get(ReadGraph g, StructuralResource element) throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedObjectsAccessor.get");\r
-                       \r
-                  \r
-                   Resource res = getServiceResource(g, element);\r
-                   if (res == null)\r
-                       return Collections.emptyList();\r
-                   Collection<Resource> coll = g.getObjects(res, relation);\r
-                       List<StructuralResource> result = new ArrayList<StructuralResource>(coll.size());\r
-                       for (Resource r : coll) {\r
-                               if (StructuralUtils.isStructuralInstance(g, r)) {\r
-                                       result.add(new StructuralResource(g, r, element.getContext(),r));\r
-                               } else {\r
-                                       result.add(new StructuralResource(g, r, element.getContext()));\r
-                               }\r
-                       }\r
-                       return result;\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }\r
-    \r
-    private boolean preventChange(StructuralResource element) {\r
-       return preventStructuralChanges && element.isStructural() && (!element.isStructuralRoot()||preventStructuralRootChanges);       \r
-    }\r
-       \r
-       @Override\r
-       public boolean set(WriteGraph g, StructuralResource element, Collection<StructuralResource> value)\r
-                       throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedObjectsAccessor.set");\r
-                   Resource res = getServiceResource(g, element);\r
-                   if (res == null)\r
-                       return false;\r
-                   if (preventChange(element))\r
-                               return false;\r
-                   Resource[] arr = new Resource[value.size()];\r
-                   int i = 0; \r
-                   for (StructuralResource sr : value) {\r
-                       arr[i++] = sr.getResource();\r
-                   }\r
-                       return MappingUtils.synchronizeStatements(g, res, relation, \r
-                               arr, deleteExtraObjects);\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-               \r
-       }\r
-\r
-       private Resource getServiceResource(ReadGraph g, StructuralResource element) {\r
-               if (!useTypeResource)\r
-                       return element.getResource();\r
-               return element.getTypeResource();\r
-       }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedOrderedSetElementsAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedOrderedSetElementsAccessor.java
deleted file mode 100644 (file)
index c9b63e4..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.rules.domain;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.List;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.utils.OrderedSetUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.graph.rules.domain.IDomainAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-public class RelatedOrderedSetElementsAccessor implements IDomainAccessor<StructuralResource, Collection<StructuralResource>> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       boolean deleteExtraObjects;\r
-       boolean useTypeResource;\r
-\r
-       public RelatedOrderedSetElementsAccessor(boolean deleteExtraObjects, boolean useTypeResource) {\r
-        super();\r
-        this.deleteExtraObjects = deleteExtraObjects;\r
-        this.useTypeResource = useTypeResource;\r
-    }\r
-\r
-    @Override\r
-       public Collection<StructuralResource> get(ReadGraph g, StructuralResource element) throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedOrderedSetElementsAccessor.get");\r
-                   Resource res = getServiceResource(g, element);\r
-                   if (res == null)\r
-                       return Collections.emptyList();\r
-                       List<Resource> list =  OrderedSetUtils.toList(g, res);\r
-                       List<StructuralResource> result = new ArrayList<StructuralResource>(list.size());\r
-                       for (Resource r : list) {\r
-                               result.add(new StructuralResource(g,r,element.getContext()));\r
-                       }\r
-                       return result;\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public boolean set(WriteGraph g, StructuralResource element, Collection<StructuralResource> value)\r
-                       throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedOrderedSetElementsAccessor.set");\r
-                   Resource res = getServiceResource(g, element);\r
-                   if (res == null)\r
-                       return false;\r
-                   List<Resource> list = new ArrayList<Resource>(value.size());\r
-                   for (StructuralResource r : value) {\r
-                       list.add(r.getResource());\r
-                   }\r
-                   return OrderedSetUtils.set(g, res, list);\r
-                   // FIXME Implement deleteExtraObjects\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-               \r
-       }\r
-       \r
-       private Resource getServiceResource(ReadGraph g, StructuralResource element) {\r
-               if (!useTypeResource)\r
-                       return element.getResource();\r
-               return element.getTypeResource();\r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedValueAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/RelatedValueAccessor.java
deleted file mode 100644 (file)
index 84516fc..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.rules.domain;\r
-\r
-import java.util.Arrays;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.Statement;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.graph.rules.domain.IDomainAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-\r
-public class RelatedValueAccessor implements IDomainAccessor<StructuralResource,Object> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       Resource relation;\r
-       Resource valueType;\r
-       boolean useTypeResource;\r
-       \r
-       private boolean preventStructuralChanges = true;\r
-       private boolean preventStructuralRootChanges = true;\r
-       \r
-       public RelatedValueAccessor(Resource relation, Resource valueType, boolean useTypeResource) {\r
-               this.relation = relation;\r
-               this.valueType = valueType;\r
-               this.useTypeResource = useTypeResource;\r
-       }\r
-       \r
-       public RelatedValueAccessor(Resource relation, Resource valueType, boolean useTypeResource, boolean preventStructuralChanges, boolean preventStructuralRootChanges) {\r
-               this.relation = relation;\r
-               this.valueType = valueType;\r
-               this.useTypeResource = useTypeResource;\r
-               this.preventStructuralChanges = preventStructuralChanges;\r
-               this.preventStructuralRootChanges = preventStructuralRootChanges;\r
-       }\r
-       \r
-       private boolean preventChange(StructuralResource element) {\r
-       return preventStructuralChanges && element.isStructural() && (!element.isStructuralRoot()||preventStructuralRootChanges);       \r
-    }\r
-\r
-       @Override\r
-       public Object get(ReadGraph g, StructuralResource element) throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedValueAccessor.get");\r
-                   Resource res = getServiceResource(g, element);\r
-                   if (res == null)\r
-                       return null;\r
-                       Resource valueResource = g.getPossibleObject(res, relation);\r
-                       if(valueResource == null)\r
-                               return null;\r
-                       return g.getValue(valueResource);\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public boolean set(WriteGraph g, StructuralResource relement, Object value)\r
-                       throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedValueAccessor.set");\r
-                   \r
-                   Resource element = getServiceResource(g, relement);\r
-                   if (element == null)\r
-                       return false;\r
-                   Statement valueStatement = g.getPossibleStatement(element, relation);\r
-                       if(valueStatement == null) {\r
-                               if(value == null)\r
-                                       return false;\r
-                               if (preventChange(relement))\r
-                                       return false;\r
-                               Resource valueResource = g.newResource();\r
-                               g.claim(valueResource, Layer0.getInstance(g).InstanceOf, null,\r
-                                               valueType);\r
-                               g.claim(element, relation, valueResource);\r
-                               g.claimValue(valueResource, value);                             \r
-                               return true;\r
-                       }\r
-                       else {\r
-                               if(value == null) {\r
-                                       if (preventChange(relement))\r
-                                               return false;\r
-                                       if (!valueStatement.isAsserted(element)) {\r
-                                               g.deny(valueStatement.getObject());\r
-                                               return true;\r
-                                       } else {\r
-                                               return false;\r
-                                       }\r
-                                       \r
-                               }                               \r
-                               Object currentValue = g.getValue(valueStatement.getObject());\r
-                               if(equals(currentValue,value))\r
-                                       return false;\r
-                               if (preventChange(relement))\r
-                                       return false;\r
-                               if (!valueStatement.isAsserted(element))\r
-                                       g.claimValue(valueStatement.getObject(), value);\r
-                               else {\r
-                                       Resource valueResource = g.newResource();\r
-                                       g.claim(valueResource, Layer0.getInstance(g).InstanceOf, null,\r
-                                                       valueType);\r
-                                       g.claim(element, relation, valueResource);\r
-                                       g.claimValue(valueResource, value);\r
-                               }\r
-                               return true;\r
-                       }\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-               \r
-       }\r
-       \r
-       private Resource getServiceResource(ReadGraph g, StructuralResource element) {\r
-               if (!useTypeResource)\r
-                       return element.getResource();\r
-               return element.getTypeResource();\r
-       }\r
-       \r
-       private boolean equals(Object o1, Object o2) {\r
-               if (o1 instanceof boolean[])\r
-                       Arrays.equals((boolean[])o1,(boolean[])o2);\r
-               if (o1 instanceof int[])\r
-                       Arrays.equals((int[])o1,(int[])o2);\r
-               if (o1 instanceof float[])\r
-                       Arrays.equals((float[])o1,(float[])o2);\r
-               if (o1 instanceof double[])\r
-                       Arrays.equals((double[])o1,(double[])o2);\r
-               if (o1 instanceof byte[])\r
-                       Arrays.equals((byte[])o1,(byte[])o2);\r
-               return o1.equals(o2);\r
-               \r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/StructuralRelatedObjectAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/StructuralRelatedObjectAccessor.java
deleted file mode 100644 (file)
index 66e6ea9..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.rules.domain;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.graph.rules.domain.IDomainAccessor;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-\r
-public class StructuralRelatedObjectAccessor implements IDomainAccessor<StructuralResource,StructuralResource> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       Resource relation;\r
-       boolean useTypeResource;\r
-       \r
-       private boolean preventStructuralChanges = true;\r
-       private boolean preventStructuralRootChanges = true;\r
-       \r
-       public StructuralRelatedObjectAccessor(Resource relation, boolean useTypeResource) {\r
-               this.relation = relation;\r
-               this.useTypeResource = useTypeResource;\r
-       }\r
-       \r
-       public StructuralRelatedObjectAccessor(Resource relation, boolean useTypeResource, boolean preventStructuralChanges, boolean preventStructuralRootChanges) {\r
-               this.relation = relation;\r
-               this.useTypeResource = useTypeResource;\r
-               this.preventStructuralChanges = preventStructuralChanges;\r
-               this.preventStructuralRootChanges = preventStructuralRootChanges;\r
-       }\r
-       \r
- private boolean preventChange(StructuralResource element) {\r
-       return preventStructuralChanges && element.isStructural() && (!element.isStructuralRoot()||preventStructuralRootChanges);       \r
-    }\r
-\r
-       @Override\r
-       public StructuralResource get(ReadGraph g, StructuralResource element) throws MappingException {\r
-               try {\r
-                       \r
-                       LOGGER.info("        RelatedObjectAccessor.get");\r
-                       \r
-                       if (!element.isStructural())\r
-                               return null;\r
-                       Resource instance = StructuralUtils.getContainingInstance(element);\r
-                           \r
-                       Resource publicRelation = StructuralUtils.getPublishedRelation(g, element, relation);\r
-\r
-                    if (publicRelation == null)\r
-                       return null;\r
-                       Resource r =  g.getPossibleObject(instance, publicRelation);\r
-                       if (r == null)\r
-                               return null;\r
-                       List<Resource> context = new ArrayList<Resource>();\r
-                       for (int i = 0; i < element.getContext().size()-1; i++)\r
-                               context.add(element.getContext().get(i));\r
-                       if (StructuralUtils.isStructuralInstance(g, r)) {\r
-                               return new StructuralResource(g, r, context,r);\r
-                       } else {\r
-                               return new StructuralResource(g, r, context);\r
-                       }\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public boolean set(WriteGraph g, StructuralResource element, StructuralResource value)\r
-                       throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedObjectAccessor.set");\r
-                   Resource instance = StructuralUtils.getContainingInstance(element);\r
-                   Resource publicRelation = null;\r
-                   if (instance == null)\r
-                       return false;\r
-                   publicRelation = StructuralUtils.getPublishedRelation(g, element, relation);\r
-                   if (value == null) {\r
-                       if (publicRelation == null)\r
-                               return false;\r
-                       if (preventChange(element))\r
-                               return false;\r
-                       g.deny(instance, publicRelation);\r
-                       return true;\r
-                   } else {\r
-                       if (publicRelation == null) {\r
-                               if (preventChange(element))\r
-                                       return false;\r
-                               publicRelation = StructuralUtils.getOrCreatePublishedRelation(g, element, relation);\r
-                               g.claim(instance, publicRelation, value.getResource());\r
-                               return true;\r
-                       } else {\r
-                               Resource r = g.getPossibleObject(instance, publicRelation);\r
-                               if (r == null) {\r
-                                       if (preventChange(element))\r
-                                               return false;\r
-                                       g.claim(instance, publicRelation, value.getResource());\r
-                                       return true;\r
-                               } else {\r
-                                       if (r.equals(value.getResource()))\r
-                                               return false;\r
-                                       if (preventChange(element))\r
-                                               return false;\r
-                                       g.deny(instance, publicRelation);\r
-                                       g.claim(instance, publicRelation, value.getResource());\r
-                                       return true;\r
-                               }\r
-                       }\r
-                   }\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-               \r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/StructuralRelatedObjectsAccessor.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/StructuralRelatedObjectsAccessor.java
deleted file mode 100644 (file)
index c2bc6f9..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.rules.domain;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.List;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.graph.rules.domain.IDomainAccessor;\r
-import org.simantics.objmap.graph.rules.domain.MappingUtils;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-\r
-public class StructuralRelatedObjectsAccessor implements IDomainAccessor<StructuralResource,Collection<StructuralResource>> {\r
-\r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-       Resource relation;\r
-       boolean deleteExtraObjects;\r
-\r
-       public StructuralRelatedObjectsAccessor(Resource relation, boolean deleteExtraObjects) {\r
-        super();\r
-        this.relation = relation;\r
-        this.deleteExtraObjects = deleteExtraObjects;\r
-    }\r
-\r
-    @Override\r
-       public Collection<StructuralResource> get(ReadGraph g, StructuralResource element) throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedObjectsAccessor.get");\r
-                       \r
-                   if (!element.isStructural())\r
-                       return Collections.emptyList();\r
-                   \r
-                   // Structural instance\r
-                   Resource instance = StructuralUtils.getContainingInstance(element);\r
-                   \r
-                   Resource publicRelation = StructuralUtils.getPublishedRelation(g, element, relation);\r
-                   \r
-                   if (publicRelation == null)\r
-                     return Collections.emptyList();\r
-                   \r
-                   Collection<Resource> coll = g.getObjects(instance, publicRelation);\r
-                       List<StructuralResource> result = new ArrayList<StructuralResource>(coll.size());\r
-                       List<Resource> context = new ArrayList<Resource>();\r
-                       for (int i = 0; i < element.getContext().size()-1; i++)\r
-                               context.add(element.getContext().get(i));\r
-                       for (Resource r : coll) {\r
-                               if (StructuralUtils.isStructuralInstance(g, r)) {\r
-                                       result.add(new StructuralResource(g, r, context,r));\r
-                               } else {\r
-                                       result.add(new StructuralResource(g, r, context));\r
-                               }\r
-                       }\r
-                       return result;\r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-       }\r
-       \r
-       @Override\r
-       public boolean set(WriteGraph g, StructuralResource element, Collection<StructuralResource> value)\r
-                       throws MappingException {\r
-               try {\r
-                   LOGGER.info("        RelatedObjectsAccessor.set");\r
-                   \r
-                   if (!element.isStructural())\r
-                       return false;\r
-                   \r
-                   Resource instance = StructuralUtils.getContainingInstance(element);\r
-                   Resource publicRelation = null;\r
-                   if (value.size() == 0) {\r
-                       publicRelation = StructuralUtils.getPublishedRelation(g, element, relation);\r
-                       if (publicRelation == null)\r
-                               return false;\r
-                       else {\r
-                               return MappingUtils.synchronizeStatements(g, instance, publicRelation, new Resource[0], deleteExtraObjects);\r
-                       }\r
-                   } else {\r
-                       publicRelation = StructuralUtils.getOrCreatePublishedRelation(g, element, relation);\r
-                       if (publicRelation == null)\r
-                               throw new MappingException("Structural Resource " + element + " cannot contain structural elements, the Resource is not published.");\r
-                           Resource[] arr = new Resource[value.size()];\r
-                           int i = 0; \r
-                           for (StructuralResource sr : value) {\r
-                               arr[i++] = sr.getResource();\r
-                           }\r
-                           return MappingUtils.synchronizeStatements(g, instance, publicRelation, arr, deleteExtraObjects);\r
-                   }\r
-                   \r
-                   \r
-                       \r
-               } catch (DatabaseException e) {\r
-                       throw new MappingException(e);\r
-               }\r
-               \r
-       }\r
-\r
-       \r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/StructuralUtils.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/rules/domain/StructuralUtils.java
deleted file mode 100644 (file)
index 0f0d1e7..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.rules.domain;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.exception.NoSingleResultException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-import org.simantics.structural.stubs.StructuralResource2;\r
-\r
-public class StructuralUtils {\r
-\r
-       \r
-       public static boolean isStructuralInstance(ReadGraph g, Resource r) throws DatabaseException {\r
-               StructuralResource2 sr = StructuralResource2.getInstance(g);\r
-                if (g.isInstanceOf(r, sr.Component)) {\r
-                        Resource type = g.getSingleType(r);\r
-                        return g.isInstanceOf(type, sr.Component);\r
-                }\r
-                return false;\r
-               \r
-       }\r
-       \r
-       public static Resource getContainingInstance(StructuralResource element) {\r
-               if (!element.isStructural())\r
-                       return null;\r
-               Resource instance = element.getContext().get(element.getContext().size()-1);\r
-               return instance;\r
-       }\r
-       \r
-       public static Resource getPublishedRelation(ReadGraph g, StructuralResource element, Resource relation) throws DatabaseException{\r
-               Resource instance = getContainingInstance(element);\r
-               if (instance == null)\r
-                       return null;\r
-               \r
-               Layer0 l0 = Layer0.getInstance(g);\r
-               StructuralResource2 sr = StructuralResource2.getInstance(g);\r
-               \r
-           Resource type = null;\r
-           try {\r
-               type = g.getSingleType(instance);\r
-           } catch (NoSingleResultException e) {\r
-               \r
-           }\r
-           if (type == null)\r
-               return null;\r
-           \r
-           boolean elementPublished = false;\r
-           Resource publicRelation = null;\r
-           for (Resource r : g.getObjects(type, l0.DomainOf)) {\r
-               if (r.equals(element.getResource()))\r
-                       elementPublished = true;\r
-               if (g.isInstanceOf(r, relation)) {\r
-                       if (element.getResource().equals(g.getPossibleObject(r, sr.IsBoundBy)))\r
-                               publicRelation = r;\r
-               }\r
-           }\r
-           if (!elementPublished)\r
-               return null;\r
-           return publicRelation;\r
-       }\r
-       \r
-       public static Resource getOrCreatePublishedRelation(WriteGraph g, StructuralResource element, Resource relation) throws DatabaseException{\r
-               Resource instance = getContainingInstance(element);\r
-               if (instance == null)\r
-                       return null;\r
-               \r
-               Layer0 l0 = Layer0.getInstance(g);\r
-               StructuralResource2 sr = StructuralResource2.getInstance(g);\r
-               \r
-           Resource type = g.getSingleType(instance);\r
-           \r
-           boolean elementPublished = false;\r
-           Resource publicRelation = null;\r
-           for (Resource r : g.getObjects(type, l0.DomainOf)) {\r
-               if (r.equals(element.getResource()))\r
-                       elementPublished = true;\r
-               if (g.isInstanceOf(r, relation)) {\r
-                       if (element.getResource().equals(g.getPossibleObject(r, sr.IsBoundBy)))\r
-                               publicRelation = r;\r
-               }\r
-           }\r
-           if (!elementPublished)\r
-               return null;\r
-           if (publicRelation != null)\r
-               return publicRelation;\r
-           \r
-           publicRelation = g.newResource();\r
-           // TODO: type ConsistsOf publicRelation, publicRelation ConsistsOf publicInverse ?\r
-           g.claim(publicRelation, l0.SubrelationOf, l0.IsRelatedTo);\r
-           g.claim(publicRelation, l0.InstanceOf, relation);\r
-           g.claim(publicRelation, sr.IsBoundBy, element.getResource());\r
-           g.claim(type, l0.DomainOf, publicRelation);\r
-           g.claimLiteral(publicRelation, l0.HasName, g.getRelatedValue(element.getResource(), l0.HasName) +"_" + g.getRelatedValue(relation, l0.HasName)); \r
-           Resource inverse = g.getPossibleInverse(relation);\r
-           if (inverse != null) {\r
-               Resource publicInverse = g.newResource();\r
-               g.claim(publicInverse, l0.SubrelationOf, inverse);\r
-               g.claim(publicRelation, l0.InverseOf, publicInverse);\r
-           }\r
-           return publicRelation;\r
-           \r
-       }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/AdaptedLinkType.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/AdaptedLinkType.java
deleted file mode 100644 (file)
index adb60d1..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.schema;\r
-\r
-//import org.apache.log4j.Logger;\r
-import org.eclipse.core.runtime.IAdaptable;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.backward.IBackwardMapping;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-import org.simantics.objmap.graph.schema.ILinkType;\r
-import org.simantics.objmap.structural.IStructuralObject;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-/**\r
- * A link type that is associated with adaptable resource (ReadGraph.getAdapter(Resource,Class)). \r
- * The adapted object must implement IAdaptable interface for returning the original Resource. \r
- * \r
- * @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
- *\r
- */\r
-public class AdaptedLinkType implements ILinkType<StructuralResource,IStructuralObject> {\r
-\r
-       \r
-       //static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-    Resource domainType;\r
-    Class<?> rangeType;\r
-    \r
-    \r
-    public AdaptedLinkType(Resource domainType, Class<?> rangeType) {\r
-        this.domainType = domainType;\r
-        this.rangeType = rangeType;\r
-    }\r
-    \r
-    @Override\r
-    public StructuralResource createDomainElement(WriteGraph g, IStructuralObject rangeElement)\r
-               throws MappingException {\r
-       try {\r
-               IAdaptable adaptable = (IAdaptable)rangeElement;\r
-               Resource res = (Resource)adaptable.getAdapter(Resource.class);\r
-               if (res == null)\r
-                       throw new NullPointerException();\r
-               return new StructuralResource(g,res);\r
-       } catch (Exception e) {\r
-               throw new MappingException("Adapted object must implement IAdaptable interface to return the source Resource.", e);\r
-       }\r
-       \r
-    }\r
-\r
-    \r
-    @Override\r
-    public IStructuralObject createRangeElement(ReadGraph g, StructuralResource domainElement)\r
-               throws MappingException {\r
-       try {\r
-               // FIXME : this will not work, we cannot assume that adapted objects would implement IStructuralObject interface.\r
-               return (IStructuralObject)g.adapt(domainElement.getResource(), rangeType);\r
-       } catch (DatabaseException e) {\r
-               throw new MappingException(e);\r
-       }\r
-    }\r
-    \r
-    public void createDomain(WriteGraph graph, IBackwardMapping<StructuralResource, IStructuralObject> mapping, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException {\r
-       \r
-    };\r
-    \r
-    public void createRange(ReadGraph graph, org.simantics.objmap.forward.IForwardMapping<StructuralResource, IStructuralObject> mapping, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException {\r
-       \r
-    };\r
-    \r
-    public boolean updateDomain(WriteGraph g, IBackwardMapping<StructuralResource, IStructuralObject> map, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException {\r
-       return false;\r
-    }\r
-    \r
-    public boolean updateRange(ReadGraph g, IForwardMapping<StructuralResource, IStructuralObject> map, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException {\r
-       return false;\r
-    }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/DefaultSchema.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/DefaultSchema.java
deleted file mode 100644 (file)
index 0c8b6ca..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.schema;\r
-\r
-\r
-\r
-import java.util.Stack;\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.utils.NameUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.graph.schema.ILinkType;\r
-import org.simantics.objmap.graph.schema.IMappingSchema;\r
-import org.simantics.objmap.structural.IStructuralObject;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-\r
-/**\r
- * \r
- */\r
-public class DefaultSchema implements IMappingSchema<StructuralResource, IStructuralObject> {\r
-\r
-    THashMap<Resource, ILinkType<StructuralResource, IStructuralObject>> domainLinkTypes = \r
-        new THashMap<Resource, ILinkType<StructuralResource, IStructuralObject>>();\r
-    THashMap<Class<?>, ILinkType<StructuralResource, IStructuralObject>> rangeLinkTypes = \r
-        new THashMap<Class<?>, ILinkType<StructuralResource, IStructuralObject>>();\r
-    \r
-    public void addLinkType(SimpleLinkType linkType) {\r
-        domainLinkTypes.put(linkType.domainType, linkType);\r
-        rangeLinkTypes.put(linkType.rangeType, linkType);\r
-    }\r
-    \r
-    public void addLinkType(AdaptedLinkType linkType) {\r
-        domainLinkTypes.put(linkType.domainType, linkType);\r
-        rangeLinkTypes.put(linkType.rangeType, linkType);\r
-    }\r
-    \r
-    @Override\r
-    public ILinkType<StructuralResource, IStructuralObject> linkTypeOfDomainElement(ReadGraph g, StructuralResource element) throws MappingException {        \r
-        try {\r
-               \r
-               for(Resource type : g.getTypes(element.getResource())) {\r
-\r
-                       ILinkType<StructuralResource, IStructuralObject> linkType = domainLinkTypes.get(type);\r
-                       if(linkType != null) return linkType;\r
-                       \r
-               }\r
-               \r
-               throw new MappingException("Didn't find a link type for " +\r
-                               NameUtils.getSafeName(g, element.getResource()) + ".");\r
-                               \r
-        } catch (DatabaseException e) {\r
-            throw new MappingException(e);\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public ILinkType<StructuralResource, IStructuralObject> linkTypeOfRangeElement(IStructuralObject element) throws MappingException {\r
-       ILinkType<StructuralResource, IStructuralObject> type = rangeLinkTypes.get(element.getClass());\r
-               if(type == null)  {\r
-                       Stack<Class<?>> clazzes = new Stack<Class<?>>();\r
-               for (Class<?> clazz : element.getClass().getInterfaces()) {\r
-                       clazzes.add(clazz);\r
-               }\r
-               clazzes.add(element.getClass().getSuperclass());\r
-               \r
-                       while (!clazzes.isEmpty()) {\r
-                               Class<?> clazz = clazzes.pop();\r
-                       \r
-                               type = rangeLinkTypes.get(clazz);\r
-                               if (type != null)\r
-                                       return type;\r
-                               for (Class<?> c : clazz.getInterfaces())\r
-                                       clazzes.add(c);\r
-                               \r
-                       }\r
-                       throw new MappingException("Didn't find a link type for " +     element + ".");\r
-               }\r
-               return type;\r
-    }\r
-\r
-    \r
-    public ILinkType<StructuralResource, IStructuralObject> linkTypeOfDomainType(ReadGraph g, Resource type)  {        \r
-       return domainLinkTypes.get(type);\r
-    }\r
-    \r
-    public ILinkType<StructuralResource, IStructuralObject> linkTypeOfRangeType(Class<?> clazz) {\r
-       ILinkType<StructuralResource, IStructuralObject> type = rangeLinkTypes.get(clazz);\r
-       if(type == null)  {\r
-               Stack<Class<?>> clazzes = new Stack<Class<?>>();\r
-               for (Class<?> c : clazz.getInterfaces()) {\r
-                       clazzes.add(c);\r
-               }\r
-               clazzes.add(clazz.getSuperclass());\r
-               \r
-               while (!clazzes.isEmpty()) {\r
-                               Class<?> c = clazzes.pop();\r
-                       \r
-                               type = rangeLinkTypes.get(c);\r
-                               if (type != null)\r
-                                       return type;\r
-                               for (Class<?> c2 : c.getInterfaces())\r
-                                       clazzes.add(c2);\r
-                               \r
-                       }\r
-               \r
-               }\r
-       return null;\r
-    }\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/MappingSchemas.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/MappingSchemas.java
deleted file mode 100644 (file)
index 3f9169e..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2012, 2013 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.schema;\r
-\r
-import java.lang.annotation.Annotation;\r
-import java.lang.reflect.Field;\r
-import java.lang.reflect.Method;\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.graph.annotations.GraphType;\r
-import org.simantics.objmap.graph.annotations.HasCollectionAdder;\r
-import org.simantics.objmap.graph.annotations.HasCollectionRemover;\r
-import org.simantics.objmap.graph.annotations.HasSetter;\r
-import org.simantics.objmap.graph.annotations.OptionalRelatedElements;\r
-import org.simantics.objmap.graph.annotations.OrderedSetType;\r
-import org.simantics.objmap.graph.annotations.RelatedElements;\r
-import org.simantics.objmap.graph.annotations.RelatedElementsGet;\r
-import org.simantics.objmap.graph.annotations.RelatedGetObj;\r
-import org.simantics.objmap.graph.annotations.RelatedGetValue;\r
-import org.simantics.objmap.graph.annotations.RelatedOrderedSetElements;\r
-import org.simantics.objmap.graph.annotations.RelatedValue;\r
-import org.simantics.objmap.graph.annotations.UpdateMethod;\r
-import org.simantics.objmap.graph.annotations.meta.IsClassRule;\r
-import org.simantics.objmap.graph.annotations.meta.IsCollectionRule;\r
-import org.simantics.objmap.graph.annotations.meta.IsFieldRule;\r
-import org.simantics.objmap.graph.annotations.meta.IsGetSetRule;\r
-import org.simantics.objmap.graph.annotations.meta.IsMethodRule;\r
-import org.simantics.objmap.graph.rules.factory.IClassRuleFactory;\r
-import org.simantics.objmap.graph.rules.factory.ICollectionRuleFactory;\r
-import org.simantics.objmap.graph.rules.factory.IFieldRuleFactory;\r
-import org.simantics.objmap.graph.rules.factory.IGetSetRuleFactory;\r
-import org.simantics.objmap.graph.rules.factory.IMethodRuleFactory;\r
-import org.simantics.objmap.structural.IStructuralObject;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-import org.simantics.objmap.structural.annotations.StructuralRelatedElementsGet;\r
-import org.simantics.objmap.structural.annotations.StructuralRelatedGetObj;\r
-import org.simantics.objmap.structural.annotations.TypeRelatedElementsGet;\r
-import org.simantics.objmap.structural.annotations.TypeRelatedGetObj;\r
-import org.simantics.objmap.structural.annotations.TypeRelatedGetValue;\r
-import org.simantics.objmap.structural.annotations.factories.OptionalRelatedElementsRuleFactory;\r
-import org.simantics.objmap.structural.annotations.factories.RelatedElementsRuleFactory;\r
-import org.simantics.objmap.structural.annotations.factories.RelatedElementsRuleFactory2;\r
-import org.simantics.objmap.structural.annotations.factories.RelatedGetSetObjRuleFactory;\r
-import org.simantics.objmap.structural.annotations.factories.RelatedGetSetValueRuleFactory;\r
-import org.simantics.objmap.structural.annotations.factories.RelatedOrderedSetElementsRuleFactory;\r
-import org.simantics.objmap.structural.annotations.factories.RelatedValueRuleFactory;\r
-import org.simantics.objmap.structural.annotations.factories.StructuralRelatedElementsRuleFactory2;\r
-import org.simantics.objmap.structural.annotations.factories.StructuralRelatedGetSetObjRuleFactory;\r
-import org.simantics.objmap.structural.annotations.factories.TypeRelatedElementsRuleFactory2;\r
-import org.simantics.objmap.structural.annotations.factories.TypeRelatedGetSetObjRuleFactory;\r
-import org.simantics.objmap.structural.annotations.factories.TypeRelatedGetSetValueRuleFactory;\r
-import org.simantics.objmap.structural.annotations.factories.UpdateMethodFactory;\r
-\r
-\r
-public class MappingSchemas {\r
-       /**\r
-     * Creates a new SimpleLinkType based on the annotations in the given class.\r
-     * @throws IllegalAccessException \r
-     * @throws InstantiationException \r
-     * @see GraphType\r
-     * @see RelatedValue\r
-     */\r
-       public static SimpleLinkType fromAnnotations(ReadGraph g, Class<?> clazz) throws DatabaseException, InstantiationException, IllegalAccessException {\r
-           GraphType graphType = clazz.getAnnotation(GraphType.class);\r
-           \r
-           if (graphType != null) {\r
-                   ArrayList<IBidirectionalMappingRule<StructuralResource, IStructuralObject>> rules = new ArrayList<IBidirectionalMappingRule<StructuralResource, IStructuralObject>>();\r
-                   collectRulesFromAnnotations(g, clazz, rules);\r
-                   \r
-                   return new SimpleLinkType(g.getResource(graphType.value()), clazz, rules);    \r
-           }\r
-           OrderedSetType orderedSetType = clazz.getAnnotation(OrderedSetType.class);\r
-           if (orderedSetType != null) {\r
-               ArrayList<IBidirectionalMappingRule<StructuralResource, IStructuralObject>> rules = new ArrayList<IBidirectionalMappingRule<StructuralResource, IStructuralObject>>();\r
-                   collectRulesFromAnnotations(g, clazz, rules);\r
-                   \r
-                   return new OrderedSetSimpleLinkType(g.getResource(orderedSetType.value()), clazz, rules);\r
-           }\r
-           throw new IllegalArgumentException("Class " + clazz.toString() + " does not contain annotations.");\r
-       }\r
-       \r
-       public static void collectRulesFromAnnotations(ReadGraph g, Class<?> clazz, Collection<IBidirectionalMappingRule<StructuralResource, IStructuralObject>> rules) throws DatabaseException, InstantiationException, IllegalAccessException {\r
-                 Class<?> superclass = clazz.getSuperclass();\r
-                   if(superclass != null)\r
-                       collectRulesFromAnnotations(g, superclass, rules);\r
-                       \r
-               for(Annotation annotation : clazz.getAnnotations()) {\r
-\r
-                       IsClassRule tag = annotation.annotationType().getAnnotation(IsClassRule.class);\r
-                   if(tag!= null) {\r
-                       rules.add(createClassRule(g, annotation, clazz).create(g, annotation, clazz));\r
-                   }\r
-               }\r
-\r
-               for(Field f : clazz.getDeclaredFields()) {\r
-                   f.setAccessible(true);\r
-\r
-                   for(Annotation annotation : f.getAnnotations()) {\r
-\r
-                       IsFieldRule tag = annotation.annotationType().getAnnotation(IsFieldRule.class);\r
-                       if(tag != null) {\r
-                           rules.add(createFieldRule(g, annotation, f).create(g, annotation, f));\r
-                       }\r
-                   }\r
-               }\r
-\r
-               for(Method m : clazz.getDeclaredMethods()) {\r
-                   m.setAccessible(true);\r
-\r
-                   for(Annotation annotation : m.getAnnotations()) {\r
-                       IsMethodRule tag = \r
-                               annotation.annotationType().getAnnotation(IsMethodRule.class);\r
-                       if(tag != null) {\r
-                               rules.add(createMethodRule(g, annotation, m).create(g, annotation, m));\r
-                       }\r
-                   }\r
-               }\r
-               \r
-               for (Method m : clazz.getDeclaredMethods()) {\r
-                       m.setAccessible(true);\r
-                       for (Annotation annotation : m.getAnnotations()) {\r
-                               Class<? extends Annotation> annotationType = annotation.annotationType();\r
-\r
-                                IsGetSetRule tag = \r
-                                annotationType.getAnnotation(IsGetSetRule.class);\r
-                                if (tag != null) {\r
-                                        \r
-                                        HasSetter setterAnnType = annotationType.getAnnotation(HasSetter.class);\r
-                                        \r
-                                        Class<? extends Annotation> setterAnn = setterAnnType.value();\r
-                                        \r
-                                        Method getter = m;\r
-                                        \r
-                                        IGetSetRuleFactory<StructuralResource, IStructuralObject> ruleFactory = createGetSetRuleFactory(g, annotation, getter);\r
-                                        \r
-                                        \r
-                                        Method setter = null;\r
-                                        \r
-                                        for (Method m2 : clazz.getDeclaredMethods()) {\r
-                                                Annotation set = m2.getAnnotation(setterAnn);\r
-                                                if (set != null && ruleFactory.isSetter(annotation, set))\r
-                                                        setter = m2;\r
-                                        }\r
-\r
-                                        rules.add(ruleFactory.create(g, annotation, getter, setter));\r
-                                }\r
-                       \r
-                       }\r
-               }\r
-               \r
-               for (Method m : clazz.getDeclaredMethods()) {\r
-                       m.setAccessible(true);\r
-                       for (Annotation annotation : m.getAnnotations()) {\r
-                               Class<? extends Annotation> annotationType = annotation.annotationType();\r
-\r
-                                IsCollectionRule tag = \r
-                                annotationType.getAnnotation(IsCollectionRule.class);\r
-                                if (tag != null) {\r
-                                        \r
-                                        HasCollectionAdder adderAnnType = annotationType.getAnnotation(HasCollectionAdder.class);\r
-                                        HasCollectionRemover removerAnnType = annotationType.getAnnotation(HasCollectionRemover.class);\r
-                       \r
-                                        Class<? extends Annotation> adderAnn = adderAnnType.value();\r
-                                        Class<? extends Annotation> removerAnn = removerAnnType.value();\r
-                                        \r
-                                        Method getter = m;\r
-                                        \r
-                                        ICollectionRuleFactory<StructuralResource, IStructuralObject> ruleFactory = createCollectionRuleFactory(g, annotation, getter);\r
-                                        \r
-                                        \r
-                                        Method adder = null;\r
-                                        Method remover = null;\r
-                                        \r
-                                        for (Method m2 : clazz.getDeclaredMethods()) {\r
-                                                Annotation add = m2.getAnnotation(adderAnn);\r
-                                                Annotation rem = m2.getAnnotation(removerAnn);\r
-                                                if (add != null && ruleFactory.isAdder(annotation, add))\r
-                                                        adder = m2;\r
-                                                if (rem != null && ruleFactory.isRemover(annotation, rem))\r
-                                                        remover = m2;\r
-                                        }\r
-                                        \r
-                                        \r
-                                        \r
-                                        rules.add(ruleFactory.create(g, annotation, getter,adder,remover));\r
-                                }\r
-                       \r
-                       }\r
-               }\r
-           }\r
-               \r
-               public static IClassRuleFactory<StructuralResource, IStructuralObject> createClassRule(ReadGraph g, Annotation annotation, Class<?> clazz) {\r
-                       return null;\r
-               }\r
-               \r
-               public static IFieldRuleFactory<StructuralResource, IStructuralObject> createFieldRule(ReadGraph g, Annotation annotation, Field field) {\r
-                       if (annotation.annotationType().equals(RelatedElements.class))\r
-                               return new RelatedElementsRuleFactory<IStructuralObject>();\r
-                       if (annotation.annotationType().equals(RelatedValue.class))\r
-                               return new RelatedValueRuleFactory<IStructuralObject>();\r
-                       if (annotation.annotationType().equals(OptionalRelatedElements.class))\r
-                               return new OptionalRelatedElementsRuleFactory<IStructuralObject>();\r
-                       if (annotation.annotationType().equals(RelatedOrderedSetElements.class))\r
-                               return new RelatedOrderedSetElementsRuleFactory<IStructuralObject>();\r
-                       return null;\r
-               }\r
-               \r
-               public static IMethodRuleFactory<StructuralResource, IStructuralObject> createMethodRule(ReadGraph g, Annotation annotation, Method m) {\r
-                       if (annotation.annotationType().equals(UpdateMethod.class))\r
-                               return new UpdateMethodFactory<StructuralResource,IStructuralObject>();\r
-                       return null;\r
-               }\r
-               \r
-               public static IGetSetRuleFactory<StructuralResource, IStructuralObject> createGetSetRuleFactory(ReadGraph g, Annotation annotation, Method getter) {\r
-                       if (annotation.annotationType().equals(RelatedGetValue.class))\r
-                               return new RelatedGetSetValueRuleFactory<IStructuralObject>();\r
-                       if (annotation.annotationType().equals(RelatedGetObj.class))\r
-                               return new RelatedGetSetObjRuleFactory<IStructuralObject>();\r
-                       if (annotation.annotationType().equals(TypeRelatedGetValue.class))\r
-                               return new TypeRelatedGetSetValueRuleFactory<IStructuralObject>();\r
-                       if (annotation.annotationType().equals(TypeRelatedGetObj.class))\r
-                               return new TypeRelatedGetSetObjRuleFactory<IStructuralObject>();\r
-                       if (annotation.annotationType().equals(StructuralRelatedGetObj.class))\r
-                               return new StructuralRelatedGetSetObjRuleFactory<IStructuralObject>();\r
-                       return null;\r
-               }\r
-               \r
-               public static ICollectionRuleFactory<StructuralResource, IStructuralObject> createCollectionRuleFactory(ReadGraph g, Annotation annotation, Method getter) {\r
-                       if (annotation.annotationType().equals(RelatedElementsGet.class))\r
-                               return new RelatedElementsRuleFactory2<IStructuralObject>();\r
-                       if (annotation.annotationType().equals(TypeRelatedElementsGet.class))\r
-                               return new TypeRelatedElementsRuleFactory2<IStructuralObject>();\r
-                       if (annotation.annotationType().equals(StructuralRelatedElementsGet.class))\r
-                               return new StructuralRelatedElementsRuleFactory2<IStructuralObject>();\r
-                       return null;\r
-               }\r
-       \r
-       \r
-       /**\r
-     * Creates a new SimpleLinkType based on the annotations in the given class.\r
-     * @throws IllegalAccessException \r
-     * @throws InstantiationException \r
-     * @see GraphType\r
-     * @see RelatedValue\r
-     */\r
-       public static AdaptedLinkType fromAdaptable(ReadGraph g, String type, Class<?> clazz) throws DatabaseException, InstantiationException, IllegalAccessException {\r
-           \r
-           \r
-           return new AdaptedLinkType(g.getResource(type), clazz);    \r
-       }\r
-       \r
-       \r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/OrderedSetSimpleLinkType.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/OrderedSetSimpleLinkType.java
deleted file mode 100644 (file)
index 6fd6a01..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.simantics.objmap.structural.schema;\r
-\r
-import java.util.ArrayList;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.utils.OrderedSetUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.structural.IStructuralObject;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-public class OrderedSetSimpleLinkType extends SimpleLinkType {\r
-\r
-       public OrderedSetSimpleLinkType(Resource domainType, Class<?> rangeType, ArrayList<IBidirectionalMappingRule<StructuralResource, IStructuralObject>> rules) {\r
-               super(domainType, rangeType, rules);\r
-       }\r
-\r
-       public OrderedSetSimpleLinkType(Resource domainType, Class<?> rangeType) {\r
-               super(domainType, rangeType);\r
-       }\r
-       \r
-       @Override\r
-       protected Resource newResource(WriteGraph g, Resource type) throws DatabaseException {\r
-               return OrderedSetUtils.create(g, type);\r
-       }\r
-\r
-}\r
diff --git a/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/SimpleLinkType.java b/org.simantics.objmap2/src/org/simantics/objmap/structural/schema/SimpleLinkType.java
deleted file mode 100644 (file)
index 7ad6b6d..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.objmap.structural.schema;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.List;\r
-\r
-import org.apache.log4j.Logger;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.utils.NameUtils;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.objmap.backward.IBackwardMapping;\r
-import org.simantics.objmap.bidirectional.IBidirectionalMappingRule;\r
-import org.simantics.objmap.exceptions.MappingException;\r
-import org.simantics.objmap.forward.IForwardMapping;\r
-import org.simantics.objmap.graph.schema.ILinkType;\r
-import org.simantics.objmap.structural.IStructuralObject;\r
-import org.simantics.objmap.structural.StructuralResource;\r
-\r
-\r
-\r
-public class SimpleLinkType implements ILinkType<StructuralResource,IStructuralObject> {\r
-    \r
-    static Logger LOGGER = Logger.getLogger("org.simantics.objmap");\r
-    \r
-    public Resource domainType;\r
-    public Class<?> rangeType;\r
-    ArrayList<IBidirectionalMappingRule<StructuralResource,IStructuralObject>> rules;\r
-    \r
-    public SimpleLinkType(Resource domainType, Class<?> rangeType,\r
-            ArrayList<IBidirectionalMappingRule<StructuralResource,IStructuralObject>> rules) {\r
-        this.domainType = domainType;\r
-        this.rangeType = rangeType;\r
-        this.rules = rules;\r
-    }\r
-\r
-    public SimpleLinkType(Resource domainType, Class<?> rangeType) {\r
-        this(domainType, rangeType, new ArrayList<IBidirectionalMappingRule<StructuralResource,IStructuralObject>>());\r
-    }\r
-\r
-    /**\r
-     * Adds a new rule to this link type that is enforced\r
-     * during updates.\r
-     */\r
-    public void addRule(IBidirectionalMappingRule<StructuralResource,IStructuralObject> rule) {\r
-        rules.add(rule);\r
-    }\r
-    \r
-    @Override\r
-    public StructuralResource createDomainElement(WriteGraph g, IStructuralObject rangeElement)\r
-            throws MappingException {\r
-        try {\r
-            if(LOGGER.isInfoEnabled())\r
-                LOGGER.info("SimpleLinkType.createDomainElement " +\r
-                        rangeElement.toString()\r
-                );\r
-            if (rangeElement.getContext().size() == 0) {\r
-               // there is no context, this not a structural resource / object.\r
-               Resource result = newResource(g, domainType);\r
-               return new StructuralResource(g,result);\r
-            } else {\r
-               if (rangeElement.getContext().size() == 1 && rangeElement.getContext().get(0).equals(rangeElement)) {\r
-                       // Structural object's context is itself, we are instantiating a new structural model.\r
-                       Resource type = rangeElement.getType();\r
-                       Resource result = newResource(g, type);\r
-                       return new StructuralResource(g,result,result);\r
-               } else {\r
-                       // Structural object's context is not itself, which means that the object is inside of a structural model.\r
-                       // At the moment we do not support modifying instantiated structural models.\r
-                       throw new MappingException("Cannot create a new StucturalObject " + rangeElement + " " + rangeElement.getClass());\r
-               }\r
-            }\r
-        } catch(DatabaseException e) {\r
-            throw new MappingException(e);\r
-        }\r
-    }\r
-    \r
-    protected Resource newResource(WriteGraph g, Resource type) throws DatabaseException {\r
-       Resource result = g.newResource();\r
-       g.claim(result, Layer0.getInstance(g).InstanceOf, null, type);\r
-       return result;\r
-    }\r
-    @Override\r
-    public IStructuralObject createRangeElement(ReadGraph g, StructuralResource domainElement)\r
-            throws MappingException {\r
-        try {\r
-            if(LOGGER.isInfoEnabled())\r
-                try { \r
-                    LOGGER.info("SimpleLinkType.createRangeElement " + NameUtils.getSafeName(g, domainElement.getResource()));\r
-                } catch(DatabaseException e) {\r
-                    throw new MappingException(e);\r
-                }\r
-            IStructuralObject result = (IStructuralObject)rangeType.newInstance();\r
-            if (domainElement.getContext().size() == 1) {\r
-               if (domainElement.getContext().get(0).equals(domainElement.getResource()))\r
-                       result.setContext(Collections.singletonList(result));\r
-               else {\r
-                       //result.setContext(result); \r
-               }\r
-            }\r
-            return result;\r
-        } catch (InstantiationException e) {\r
-            throw new MappingException(e);\r
-        } catch (IllegalAccessException e) {\r
-            throw new MappingException(e);\r
-        }\r
-    }\r
-    \r
-    @SuppressWarnings("unchecked")\r
-       public void createDomain(WriteGraph graph, IBackwardMapping<StructuralResource,IStructuralObject> mapping, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException {\r
-       if (domainElement.isStructuralRoot())\r
-               // FIXME: this is nasty, but when a structural model is instantiated by creating new IStructuralObject, its related objects must be read from the graph first, or otherwise the objects would be deleted from the graph.\r
-               //        as a side effect, if the new IStructuralObject has any properties set, those properties are set to null (because the graph does not contain those values).\r
-               // \r
-               updateRange(graph, (IForwardMapping<StructuralResource, IStructuralObject>)mapping, domainElement, rangeElement);\r
-       updateDomain(graph, mapping, domainElement, rangeElement);\r
-    };\r
-    \r
-    \r
-    @Override\r
-    public void createRange(ReadGraph graph, IForwardMapping<StructuralResource, IStructuralObject> mapping, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException {\r
-       if (rangeElement.getContext().size() == 0 && domainElement.getContext().size() > 0) {\r
-               List<IStructuralObject> ctx = new ArrayList<IStructuralObject>(domainElement.getContext().size());\r
-                       try {\r
-                               List<Resource> context = new ArrayList<Resource>();\r
-                               for (int i = 0; i <domainElement.getContext().size(); i++) {\r
-                                       context.add(domainElement.getContext().get(i));\r
-                                       IStructuralObject ctxObj = mapping.get(new StructuralResource(graph,context.get(context.size()-1),context));\r
-                                       if (ctxObj == null) throw new MappingException("Cannot resolve range context for domain element " + domainElement);\r
-                                       ctx.add(ctxObj);\r
-                               }\r
-                               //ctx = mapping.get(new StructuralResource(graph,context.get(context.size()-1),context));\r
-                       } catch (DatabaseException e) {\r
-                               throw new MappingException(e);\r
-                       }\r
-               if (ctx.size() == 0)\r
-                       throw new MappingException("Cannot find context for structural object, " + domainElement);\r
-               rangeElement.setContext(ctx);\r
-       }\r
-       updateRange(graph, mapping, domainElement, rangeElement);\r
-    }\r
-    \r
-    public boolean updateDomain(WriteGraph g, IBackwardMapping<StructuralResource,IStructuralObject> map, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException {\r
-        if(LOGGER.isInfoEnabled())\r
-            try { \r
-                LOGGER.info("SimpleLinkType.updateDomain " +\r
-                        NameUtils.getSafeName(g, domainElement.getResource()) + " " +\r
-                        rangeElement.toString()\r
-                        );\r
-            } catch(DatabaseException e) {\r
-                throw new MappingException(e);\r
-            }\r
-        \r
-        boolean updated = false;\r
-        for(IBidirectionalMappingRule<StructuralResource, IStructuralObject> rule : rules)\r
-               updated |= rule.updateDomain(g, map, domainElement, rangeElement);\r
-        return updated;\r
-    }\r
-    \r
-    public boolean updateRange(ReadGraph g, IForwardMapping<StructuralResource, IStructuralObject> map, StructuralResource domainElement, IStructuralObject rangeElement) throws MappingException {\r
-    \r
-        if(LOGGER.isInfoEnabled())\r
-            try { \r
-                LOGGER.info("SimpleLinkType.updateRange " +\r
-                               NameUtils.getSafeName(g, domainElement.getResource()) + " " +\r
-                        rangeElement.toString()\r
-                        );\r
-            } catch(DatabaseException e) {\r
-                throw new MappingException(e);\r
-            }\r
-        \r
-        boolean updated = false;\r
-        for(IBidirectionalMappingRule<StructuralResource, IStructuralObject> rule : rules)\r
-            updated |= rule.updateRange(g, map, domainElement, rangeElement);\r
-        return updated;\r
-    }\r
-}\r
diff --git a/pom.xml b/pom.xml
index 7ed7b5b13546128f503deae0e58ffdfbb19e2d30..f1693bae72b7c1fda500659c24c47ce9cbcd0270 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                <module>org.simantics.g3d.csg.ontology</module>
                <module>org.simantics.g3d.ontology</module>
                <module>org.simantics.g3d.vtk</module>
-               <module>org.simantics.objmap2</module>
                <module>org.simantics.opencascade</module>
                <module>org.simantics.opencascade.vtk</module>
                <!--<module>org.simantics.g3d.jme</module>-->