From: Antti Villberg Date: Fri, 16 Nov 2018 13:11:00 +0000 (+0200) Subject: Separate DB and non-DB code to different structural sync bundles X-Git-Tag: v1.43.0~136^2~263 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=e4007b17057ff4acc2e900c5c811743b74f71f41;p=simantics%2Fplatform.git Separate DB and non-DB code to different structural sync bundles Previously, code in org.simantics.structural.synchronization.client was in packages that were dangerously named org.simantics.structural.synchronization, which could easily escalate into split packages between bundles with more of such sloppy naming. This moves the whole org.simantics.structural.synchronization.base package from .structural.synchronization.client to .structural.synchronization which changes nothing from the bundle user's point of view. Code that stays in .structural.synchronization.client is moved into the org.simantics.structural.synchronization.client package to keep things cleaners. gitlab #206 Change-Id: I2366b6e7395750cc9b6649abd3e77ef1661d2d1f --- diff --git a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetGraphUtils.java b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetGraphUtils.java index 297ac9dc9..032acfcfc 100644 --- a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetGraphUtils.java +++ b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetGraphUtils.java @@ -38,7 +38,7 @@ import org.simantics.spreadsheet.Range; import org.simantics.spreadsheet.graph.synchronization.SpreadsheetSynchronizationEventHandler; import org.simantics.spreadsheet.resource.SpreadsheetResource; import org.simantics.spreadsheet.util.SpreadsheetUtils; -import org.simantics.structural.synchronization.Synchronizer; +import org.simantics.structural.synchronization.client.Synchronizer; import gnu.trove.iterator.TObjectIntIterator; import gnu.trove.map.hash.TObjectIntHashMap; diff --git a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetSessionManager.java b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetSessionManager.java index f50463ef0..ec8935f28 100644 --- a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetSessionManager.java +++ b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetSessionManager.java @@ -23,7 +23,7 @@ import org.simantics.simulator.toolkit.db.StandardVariableSessionManager; import org.simantics.spreadsheet.graph.formula.SpreadsheetEvaluationEnvironment; import org.simantics.spreadsheet.graph.synchronization.SpreadsheetSynchronizationEventHandler; import org.simantics.spreadsheet.resource.SpreadsheetResource; -import org.simantics.structural.synchronization.Synchronizer; +import org.simantics.structural.synchronization.client.Synchronizer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/synchronization/LineUpdater.java b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/synchronization/LineUpdater.java index baa0851b2..18f0bfbc5 100644 --- a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/synchronization/LineUpdater.java +++ b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/synchronization/LineUpdater.java @@ -10,7 +10,6 @@ import org.simantics.structural.synchronization.base.CommandBuilder; import org.simantics.structural.synchronization.base.ModuleUpdateContext; import org.simantics.structural.synchronization.base.ModuleUpdaterBase; import org.simantics.structural.synchronization.base.PropertyUpdateRule; -import org.simantics.structural.synchronization.utils.Solver; public class LineUpdater extends ModuleUpdaterBase { diff --git a/bundles/org.simantics.structural.synchronization.client/META-INF/MANIFEST.MF b/bundles/org.simantics.structural.synchronization.client/META-INF/MANIFEST.MF index 6fe0a79e0..ba77d3e37 100644 --- a/bundles/org.simantics.structural.synchronization.client/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.structural.synchronization.client/META-INF/MANIFEST.MF @@ -13,6 +13,5 @@ Require-Bundle: org.simantics.databoard;bundle-version="0.6.5", org.simantics.datatypes.ontology;bundle-version="1.1.0", org.simantics.structural.synchronization;bundle-version="1.0.0";visibility:=reexport, org.slf4j.api -Export-Package: org.simantics.structural.synchronization, - org.simantics.structural.synchronization.base +Export-Package: org.simantics.structural.synchronization.client Automatic-Module-Name: org.simantics.structural.synchronization.client diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/ContinuousSynchronizationJob.java b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/ContinuousSynchronizationJob.java similarity index 97% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/ContinuousSynchronizationJob.java rename to bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/ContinuousSynchronizationJob.java index 4b4edd7c4..47e9fa004 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/ContinuousSynchronizationJob.java +++ b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/ContinuousSynchronizationJob.java @@ -1,4 +1,4 @@ -package org.simantics.structural.synchronization; +package org.simantics.structural.synchronization.client; import java.util.concurrent.ConcurrentMap; diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/StructuralChangeFlattener.java b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/StructuralChangeFlattener.java similarity index 99% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/StructuralChangeFlattener.java rename to bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/StructuralChangeFlattener.java index 2809c5836..4503a82ea 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/StructuralChangeFlattener.java +++ b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/StructuralChangeFlattener.java @@ -1,4 +1,4 @@ -package org.simantics.structural.synchronization; +package org.simantics.structural.synchronization.client; import gnu.trove.map.hash.THashMap; import gnu.trove.map.hash.TObjectIntHashMap; diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/Synchronizer.java b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/Synchronizer.java similarity index 99% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/Synchronizer.java rename to bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/Synchronizer.java index 9c7428416..b2b4ea2ec 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/Synchronizer.java +++ b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/Synchronizer.java @@ -1,4 +1,4 @@ -package org.simantics.structural.synchronization; +package org.simantics.structural.synchronization.client; import gnu.trove.map.hash.TObjectIntHashMap; import gnu.trove.set.hash.THashSet; diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/UpdateComponentUids.java b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/UpdateComponentUids.java similarity index 98% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/UpdateComponentUids.java rename to bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/UpdateComponentUids.java index df63ada05..7209a19d6 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/UpdateComponentUids.java +++ b/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/client/UpdateComponentUids.java @@ -1,4 +1,4 @@ -package org.simantics.structural.synchronization.base; +package org.simantics.structural.synchronization.client; import org.eclipse.core.runtime.IProgressMonitor; import org.simantics.db.ReadGraph; diff --git a/bundles/org.simantics.structural.synchronization/META-INF/MANIFEST.MF b/bundles/org.simantics.structural.synchronization/META-INF/MANIFEST.MF index 63d4a6832..5cf82d1f1 100644 --- a/bundles/org.simantics.structural.synchronization/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.structural.synchronization/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: Synchronization Bundle-SymbolicName: org.simantics.structural.synchronization;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Export-Package: org.simantics.structural.synchronization.base2, +Export-Package: org.simantics.structural.synchronization.base, org.simantics.structural.synchronization.protocol, org.simantics.structural.synchronization.utils Require-Bundle: org.simantics.databoard;bundle-version="0.6.5", diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/CommandBuilder.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/CommandBuilder.java similarity index 100% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/CommandBuilder.java rename to bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/CommandBuilder.java diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ConnectionUpdateRule.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ConnectionUpdateRule.java similarity index 100% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ConnectionUpdateRule.java rename to bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ConnectionUpdateRule.java diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleCallback.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleCallback.java similarity index 100% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleCallback.java rename to bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleCallback.java diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdateContext.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleUpdateContext.java similarity index 100% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdateContext.java rename to bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleUpdateContext.java index 854a22d23..a4dea1ab2 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdateContext.java +++ b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleUpdateContext.java @@ -1,13 +1,13 @@ package org.simantics.structural.synchronization.base; -import gnu.trove.map.hash.THashMap; - import java.util.ArrayList; import org.simantics.databoard.binding.mutable.Variant; import org.simantics.structural.synchronization.utils.ComponentBase; import org.simantics.structural.synchronization.utils.Solver; +import gnu.trove.map.hash.THashMap; + public class ModuleUpdateContext> { private ModuleUpdaterBase updater; diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdaterBase.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleUpdaterBase.java similarity index 100% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdaterBase.java rename to bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleUpdaterBase.java index 45ea7400f..f7a20768f 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdaterBase.java +++ b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleUpdaterBase.java @@ -1,7 +1,5 @@ package org.simantics.structural.synchronization.base; -import gnu.trove.map.hash.THashMap; - import java.util.Collection; import java.util.Collections; import java.util.Map; @@ -11,6 +9,8 @@ import org.simantics.structural.synchronization.protocol.Connection; import org.simantics.structural.synchronization.protocol.SerializedVariable; import org.simantics.structural.synchronization.utils.ComponentBase; +import gnu.trove.map.hash.THashMap; + abstract public class ModuleUpdaterBase> { public String moduleType; diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdaterFactoryBase.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleUpdaterFactoryBase.java similarity index 78% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdaterFactoryBase.java rename to bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleUpdaterFactoryBase.java index f30527e3d..e384e1a2d 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ModuleUpdaterFactoryBase.java +++ b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ModuleUpdaterFactoryBase.java @@ -1,11 +1,9 @@ package org.simantics.structural.synchronization.base; -import org.simantics.db.exception.DatabaseException; import org.simantics.structural.synchronization.utils.ComponentBase; - public interface ModuleUpdaterFactoryBase> { - public ModuleUpdaterBase createUpdater(String id) throws DatabaseException; + public ModuleUpdaterBase createUpdater(String id) throws Exception; } diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/PropertyUpdateRule.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/PropertyUpdateRule.java similarity index 100% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/PropertyUpdateRule.java rename to bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/PropertyUpdateRule.java diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ReferenceResolverBase.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ReferenceResolverBase.java similarity index 100% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ReferenceResolverBase.java rename to bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ReferenceResolverBase.java index 33b5d9bdc..83ff7d72e 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/ReferenceResolverBase.java +++ b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/ReferenceResolverBase.java @@ -1,8 +1,5 @@ package org.simantics.structural.synchronization.base; -import gnu.trove.map.hash.THashMap; -import gnu.trove.procedure.TObjectObjectProcedure; - import java.util.ArrayList; import java.util.Collections; @@ -12,6 +9,9 @@ import org.simantics.structural.synchronization.utils.ComponentBase; import org.simantics.structural.synchronization.utils.Solver; import org.slf4j.Logger; +import gnu.trove.map.hash.THashMap; +import gnu.trove.procedure.TObjectObjectProcedure; + abstract public class ReferenceResolverBase> { protected SynchronizationEventHandler eventHandler; diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SolverNameUtil.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SolverNameUtil.java similarity index 100% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SolverNameUtil.java rename to bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SolverNameUtil.java diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java similarity index 99% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java rename to bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java index 7be353a02..a6efeefb2 100644 --- a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java +++ b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java @@ -8,7 +8,6 @@ import java.util.Queue; import org.simantics.databoard.Bindings; import org.simantics.databoard.adapter.AdaptException; -import org.simantics.db.exception.DatabaseException; import org.simantics.structural.synchronization.internal.Policy; import org.simantics.structural.synchronization.protocol.ChildInfo; import org.simantics.structural.synchronization.protocol.Connection; @@ -379,7 +378,7 @@ public abstract class SynchronizationEventHandlerBase ModuleUpdaterBase updater; try { updater = moduleUpdaterFactory.createUpdater(id); - } catch (DatabaseException e) { + } catch (Exception e) { throw new RuntimeException(e); } if(updater == null) diff --git a/bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/internal/Policy.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/internal/Policy.java similarity index 100% rename from bundles/org.simantics.structural.synchronization.client/src/org/simantics/structural/synchronization/internal/Policy.java rename to bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/internal/Policy.java diff --git a/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base2/AbstractSynchronizationEventHandler.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/protocol/AbstractSynchronizationEventHandler.java similarity index 96% rename from bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base2/AbstractSynchronizationEventHandler.java rename to bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/protocol/AbstractSynchronizationEventHandler.java index 8dc051a7a..58bbbf0b3 100644 --- a/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base2/AbstractSynchronizationEventHandler.java +++ b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/protocol/AbstractSynchronizationEventHandler.java @@ -1,4 +1,4 @@ -package org.simantics.structural.synchronization.base2; +package org.simantics.structural.synchronization.protocol; import gnu.trove.map.hash.THashMap; import gnu.trove.set.hash.THashSet; @@ -8,11 +8,6 @@ import java.util.Collection; import java.util.Map; import org.simantics.databoard.util.URIStringUtils; -import org.simantics.structural.synchronization.protocol.ChildInfo; -import org.simantics.structural.synchronization.protocol.Connection; -import org.simantics.structural.synchronization.protocol.SerializedVariable; -import org.simantics.structural.synchronization.protocol.SynchronizationEventHandler; -import org.simantics.structural.synchronization.protocol.SynchronizationException; /** *

A partial implementation of SynchronizationEventHandler that contains all generic