summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2006-10-27 17:55:15 (EDT)
committerEike Stepper2006-10-27 17:55:15 (EDT)
commitd58e62c0c8163cc0f578afdb3554ec00899c2e82 (patch)
tree7eb156695f289eb877b50527c2f9350a9c7df882
parent1b1109017d317774d076718344291828938034cc (diff)
downloadcdo-d58e62c0c8163cc0f578afdb3554ec00899c2e82.zip
cdo-d58e62c0c8163cc0f578afdb3554ec00899c2e82.tar.gz
cdo-d58e62c0c8163cc0f578afdb3554ec00899c2e82.tar.bz2
Initial provisioning for v0.8.0
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.server/.options1
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.server/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.server/build.properties3
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/CDOServerBackendInitializer.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/CDOServerPlugin.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/.options4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF10
-rw-r--r--plugins/org.eclipse.emf.cdo.server/build.properties3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/AttributeInfo.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ClassInfo.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ColumnConverter.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/DatabaseInconsistencyException.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Mapper.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageInfo.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageListener.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageManager.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceInfo.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceManager.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceNotFoundException.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOProtocol.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOResProtocol.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/AttributeInfoImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ClassInfoImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ColumnConverterImpl.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/MapperImpl.java656
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageInfoImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageManagerImpl.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceInfoImpl.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceManagerImpl.java30
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/SQLConstants.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/internal/Activator.java (renamed from plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/internal/ServerPlugin.java)40
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/internal/CDOServer.java42
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/AnnouncePackageIndication.java67
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CommitTransactionIndication.java434
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DeleteResourcesIndication.java69
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DescribePackageIndication.java117
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidationNotificationRequest.java46
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadObjectIndication.java47
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadResourceIndication.java50
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryAllResourcesIndication.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryExtentIndication.java51
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryXRefsIndication.java49
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/RemovalNotificationRequest.java44
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcePathIndication.java62
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourceRIDIndication.java62
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcesChangedRequest.java40
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOProtocolImpl.java162
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOResProtocolImpl.java130
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/launches/CDO All Tests.launch13
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllSuites.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EMFDetachTest.java131
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/IOHelper.java119
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/internal/CDOTestPlugin.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AllTests.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BidiReferencesTest.java283
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla154389Test.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla162017Test.java63
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/NotificationTest.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/SerializationTest.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/AbstractTopology.java92
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/AbstractTopologyTest.java116
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientSeparatedServerTopology.java103
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientServerTopology.java186
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientTopology.java31
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/EmbeddedTopology.java44
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ITopology.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ITopologyConstants.java18
69 files changed, 2634 insertions, 1081 deletions
diff --git a/plugins/org.eclipse.emf.cdo.examples.server/.options b/plugins/org.eclipse.emf.cdo.examples.server/.options
new file mode 100644
index 0000000..e433ad3
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.examples.server/.options
@@ -0,0 +1 @@
+org.eclipse.emf.cdo.examples.server/debug = true
diff --git a/plugins/org.eclipse.emf.cdo.examples.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.examples.server/META-INF/MANIFEST.MF
index a32e761..b210992 100644
--- a/plugins/org.eclipse.emf.cdo.examples.server/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.examples.server/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo.examples.server;singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.8.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Eclipse-LazyStart: true
diff --git a/plugins/org.eclipse.emf.cdo.examples.server/build.properties b/plugins/org.eclipse.emf.cdo.examples.server/build.properties
index 269a7b1..45c6e46 100644
--- a/plugins/org.eclipse.emf.cdo.examples.server/build.properties
+++ b/plugins/org.eclipse.emf.cdo.examples.server/build.properties
@@ -7,7 +7,8 @@ bin.includes = plugin.xml,\
initMysql.bat,\
about.html,\
.,\
- license.html
+ license.html,\
+ .options
jars.compile.order = .
source.. = src/
output.. = bin/
diff --git a/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/CDOServerBackendInitializer.java b/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/CDOServerBackendInitializer.java
index 1d60ed0..56323fa 100644
--- a/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/CDOServerBackendInitializer.java
+++ b/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/CDOServerBackendInitializer.java
@@ -11,10 +11,6 @@
package org.eclipse.emf.cdo.examples.server.internal;
-import org.eclipse.net4j.examples.server.internal.AbstractBackendInitializer;
-import org.eclipse.net4j.spring.Container;
-
-
public class CDOServerBackendInitializer extends AbstractBackendInitializer
{
public CDOServerBackendInitializer()
diff --git a/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/CDOServerPlugin.java b/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/CDOServerPlugin.java
index d11f3ac..79da928 100644
--- a/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/CDOServerPlugin.java
+++ b/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/CDOServerPlugin.java
@@ -11,12 +11,6 @@
package org.eclipse.emf.cdo.examples.server.internal;
-import org.eclipse.net4j.examples.server.internal.ExampleServerPlugin;
-import org.eclipse.net4j.spring.Container;
-import org.eclipse.net4j.spring.ContainerCreationException;
-import org.eclipse.net4j.spring.impl.ContainerImpl;
-import org.eclipse.net4j.util.eclipse.AbstractPlugin;
-
import java.io.IOException;
diff --git a/plugins/org.eclipse.emf.cdo.server/.options b/plugins/org.eclipse.emf.cdo.server/.options
new file mode 100644
index 0000000..55f755f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/.options
@@ -0,0 +1,4 @@
+org.eclipse.emf.cdo.server/debug = true
+org.eclipse.emf.cdo.server/debug.mapper = true
+org.eclipse.emf.cdo.server/debug.resource = true
+org.eclipse.emf.cdo.server/debug.protocol = true
diff --git a/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
index c3aa1e9..f4ad29b 100644
--- a/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
@@ -2,13 +2,13 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo.server
-Bundle-Version: 0.7.0.qualifier
-Bundle-Activator: org.eclipse.emf.cdo.server.internal.ServerPlugin
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.emf.cdo.server.internal.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
-Require-Bundle: org.eclipse.emf.cdo.core;visibility:=reexport,
- org.eclipse.emf.cdo.dbgen;visibility:=reexport,
- org.eclipse.emf.cdo.jdbc;visibility:=reexport
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.cdo.core;visibility:=reexport,
+ org.eclipse.emf.cdo.dbgen;visibility:=reexport
Eclipse-LazyStart: true
Export-Package: org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.server.impl,
diff --git a/plugins/org.eclipse.emf.cdo.server/build.properties b/plugins/org.eclipse.emf.cdo.server/build.properties
index 4d66ad7..101d260 100644
--- a/plugins/org.eclipse.emf.cdo.server/build.properties
+++ b/plugins/org.eclipse.emf.cdo.server/build.properties
@@ -6,7 +6,8 @@ bin.includes = plugin.xml,\
copyright.txt,\
about.html,\
.,\
- license.html
+ license.html,\
+ .options
jars.compile.order = .
source.. = src/
output.. = bin/
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/AttributeInfo.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/AttributeInfo.java
index ad31900..fcd9c17 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/AttributeInfo.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/AttributeInfo.java
@@ -11,6 +11,9 @@
package org.eclipse.emf.cdo.server;
+/**
+ * @author Eike Stepper
+ */
public interface AttributeInfo
{
public String getName();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ClassInfo.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ClassInfo.java
index 98fea4c..d190a7e 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ClassInfo.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ClassInfo.java
@@ -14,6 +14,9 @@ package org.eclipse.emf.cdo.server;
import java.util.List;
+/**
+ * @author Eike Stepper
+ */
public interface ClassInfo
{
public int getCID();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ColumnConverter.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ColumnConverter.java
index 4804802..ab8eb1f 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ColumnConverter.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ColumnConverter.java
@@ -11,22 +11,18 @@
package org.eclipse.emf.cdo.server;
-import org.eclipse.net4j.core.Channel;
-import org.eclipse.net4j.spring.Service;
+import org.eclipse.net4j.util.stream.ExtendedDataInput;
+import org.eclipse.net4j.util.stream.ExtendedDataOutput;
+import java.io.IOException;
-public interface ColumnConverter extends Service
+
+/**
+ * @author Eike Stepper
+ */
+public interface ColumnConverter
{
- /**
- * @param channel
- * @return
- */
- public Object fromChannel(Channel channel, int dataType);
+ public Object fromChannel(ExtendedDataInput channel, int dataType) throws IOException;
- /**
- *
- * @param channel
- * @param value
- */
- public void toChannel(Channel channel, int dataType, Object value);
+ public void toChannel(ExtendedDataOutput channel, int dataType, Object value) throws IOException;
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/DatabaseInconsistencyException.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/DatabaseInconsistencyException.java
index 026f10b..b21f582 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/DatabaseInconsistencyException.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/DatabaseInconsistencyException.java
@@ -15,8 +15,6 @@ import org.eclipse.emf.cdo.core.CDOException;
/**
- * The <code>DatabaseInconsistencyException</code> class.<p>
- *
* @author Eike Stepper
*/
public class DatabaseInconsistencyException extends CDOException
@@ -26,40 +24,20 @@ public class DatabaseInconsistencyException extends CDOException
*/
private static final long serialVersionUID = 1L;
- /**
- * Creates an instance of this class.<p>
- */
public DatabaseInconsistencyException()
{
- super();
}
- /**
- * Creates an instance of this class.<p>
- *
- * @param message
- */
public DatabaseInconsistencyException(String message)
{
super(message);
}
- /**
- * Creates an instance of this class.<p>
- *
- * @param cause
- */
public DatabaseInconsistencyException(Throwable cause)
{
super(cause);
}
- /**
- * Creates an instance of this class.<p>
- *
- * @param message
- * @param cause
- */
public DatabaseInconsistencyException(String message, Throwable cause)
{
super(message, cause);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Mapper.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Mapper.java
index f37c990..e8d4eec 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Mapper.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Mapper.java
@@ -11,8 +11,7 @@
package org.eclipse.emf.cdo.server;
-import org.eclipse.net4j.core.Channel;
-import org.eclipse.net4j.spring.Service;
+import org.eclipse.net4j.util.stream.ExtendedDataOutput;
import org.eclipse.emf.cdo.core.OID;
import org.eclipse.emf.cdo.core.OIDEncoder;
@@ -20,8 +19,13 @@ import org.eclipse.emf.cdo.core.RID;
import java.util.Set;
+import java.io.IOException;
-public interface Mapper extends Service
+
+/**
+ * @author Eike Stepper
+ */
+public interface Mapper
{
public int getNextPid();
@@ -69,19 +73,21 @@ public interface Mapper extends Service
public void removeContent(long oid);
- public void transmitContent(Channel channel, ResourceInfo resourceInfo);
+ public void transmitContent(ExtendedDataOutput out, ResourceInfo resourceInfo) throws IOException;
- public void transmitObject(Channel channel, long oid);
+ public void transmitObject(ExtendedDataOutput out, long oid) throws IOException;
- public void transmitAttributes(Channel channel, long oid, ClassInfo classInfo);
+ public void transmitAttributes(ExtendedDataOutput out, long oid, ClassInfo classInfo)
+ throws IOException;
- public void transmitReferences(Channel channel, long oid);
+ public void transmitReferences(ExtendedDataOutput out, long oid) throws IOException;
- public void transmitAllResources(Channel channel);
+ public void transmitAllResources(ExtendedDataOutput out) throws IOException;
- public void transmitExtent(Channel channel, int cid, boolean exactMatch, int rid);
+ public void transmitExtent(ExtendedDataOutput out, int cid, boolean exactMatch, int rid)
+ throws IOException;
- public void transmitXRefs(Channel channel, long oid, int rid);
+ public void transmitXRefs(ExtendedDataOutput out, long oid, int rid) throws IOException;
/**
* Deletes the given resource within a transaction.<p>
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageInfo.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageInfo.java
index e585774..8d1f354 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageInfo.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageInfo.java
@@ -11,6 +11,9 @@
package org.eclipse.emf.cdo.server;
+/**
+ * @author Eike Stepper
+ */
public interface PackageInfo
{
public int getPid();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageListener.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageListener.java
index 99d4ac1..f3e348f 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageListener.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageListener.java
@@ -11,6 +11,9 @@
package org.eclipse.emf.cdo.server;
+/**
+ * @author Eike Stepper
+ */
public interface PackageListener
{
public void notifyAddedPackage();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageManager.java
index 58d74e1..ce7fee1 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/PackageManager.java
@@ -11,12 +11,13 @@
package org.eclipse.emf.cdo.server;
-import org.eclipse.net4j.spring.Service;
-
import java.util.List;
-public interface PackageManager extends Service
+/**
+ * @author Eike Stepper
+ */
+public interface PackageManager
{
public void addPackageListener(PackageListener listener);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceInfo.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceInfo.java
index 6f78b64..2a6a751 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceInfo.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceInfo.java
@@ -11,6 +11,9 @@
package org.eclipse.emf.cdo.server;
+/**
+ * @author Eike Stepper
+ */
public interface ResourceInfo
{
public long getNextOIDFragment();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceManager.java
index c5c41dc..e6f840f 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceManager.java
@@ -11,10 +11,10 @@
package org.eclipse.emf.cdo.server;
-import org.eclipse.net4j.spring.Service;
-
-
-public interface ResourceManager extends Service
+/**
+ * @author Eike Stepper
+ */
+public interface ResourceManager
{
public void registerResourceInfo(ResourceInfo resourceInfo);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceNotFoundException.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceNotFoundException.java
index 7347044..1d66de7 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceNotFoundException.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceNotFoundException.java
@@ -15,8 +15,6 @@ import org.eclipse.emf.cdo.core.CDOException;
/**
- * The <code>ResourceNotFoundException</code> class.<p>
- *
* @author Eike Stepper
*/
public class ResourceNotFoundException extends CDOException
@@ -26,40 +24,20 @@ public class ResourceNotFoundException extends CDOException
*/
private static final long serialVersionUID = 1L;
- /**
- * Creates an instance of this class.<p>
- */
public ResourceNotFoundException()
{
- super();
}
- /**
- * Creates an instance of this class.<p>
- *
- * @param message
- */
public ResourceNotFoundException(String message)
{
super(message);
}
- /**
- * Creates an instance of this class.<p>
- *
- * @param cause
- */
public ResourceNotFoundException(Throwable cause)
{
super(cause);
}
- /**
- * Creates an instance of this class.<p>
- *
- * @param message
- * @param cause
- */
public ResourceNotFoundException(String message, Throwable cause)
{
super(message, cause);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOProtocol.java
index fcf6a84..6e25365 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOProtocol.java
@@ -11,21 +11,18 @@
package org.eclipse.emf.cdo.server;
-import org.eclipse.net4j.core.Channel;
+import org.eclipse.net4j.transport.Channel;
import org.eclipse.emf.cdo.core.CDOProtocol;
-import org.springframework.transaction.support.TransactionTemplate;
-
import java.util.Collection;
+/**
+ * @author Eike Stepper
+ */
public interface ServerCDOProtocol extends CDOProtocol
{
- public Mapper getMapper();
-
- public TransactionTemplate getTransactionTemplate();
-
public ServerCDOResProtocol getServerCDOResProtocol();
public void fireRemovalNotification(Collection<Integer> rids);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOResProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOResProtocol.java
index 91847ea..b142124 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOResProtocol.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ServerCDOResProtocol.java
@@ -16,18 +16,15 @@ import org.eclipse.emf.cdo.core.OID;
import org.eclipse.emf.cdo.core.RID;
import org.eclipse.emf.cdo.core.protocol.ResourceChangeInfo;
-import org.springframework.transaction.support.TransactionTemplate;
-
import java.util.Collection;
import java.util.List;
+/**
+ * @author Eike Stepper
+ */
public interface ServerCDOResProtocol extends CDOResProtocol
{
- public Mapper getMapper();
-
- public TransactionTemplate getTransactionTemplate();
-
public void fireResourcesChangedNotification(List<ResourceChangeInfo> resourceChanges);
public void fireInvalidationNotification(Collection<Long> modifiedOIDs);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/AttributeInfoImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/AttributeInfoImpl.java
index f11f859..db04ef9 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/AttributeInfoImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/AttributeInfoImpl.java
@@ -14,6 +14,9 @@ package org.eclipse.emf.cdo.server.impl;
import org.eclipse.emf.cdo.server.AttributeInfo;
+/**
+ * @author Eike Stepper
+ */
public class AttributeInfoImpl implements AttributeInfo
{
protected String name;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ClassInfoImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ClassInfoImpl.java
index 5d299cb..76279a0 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ClassInfoImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ClassInfoImpl.java
@@ -20,6 +20,9 @@ import java.util.Iterator;
import java.util.List;
+/**
+ * @author Eike Stepper
+ */
public class ClassInfoImpl implements ClassInfo
{
protected int cid;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ColumnConverterImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ColumnConverterImpl.java
index d55e348..30caa83 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ColumnConverterImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ColumnConverterImpl.java
@@ -11,19 +11,25 @@
package org.eclipse.emf.cdo.server.impl;
-import org.eclipse.net4j.core.Channel;
+import org.eclipse.net4j.util.stream.ExtendedDataInput;
+import org.eclipse.net4j.util.stream.ExtendedDataOutput;
import org.eclipse.emf.cdo.core.impl.AbstractConverter;
import org.eclipse.emf.cdo.server.ColumnConverter;
+import java.io.IOException;
+
+/**
+ * @author Eike Stepper
+ */
public class ColumnConverterImpl extends AbstractConverter implements ColumnConverter
{
- public Object fromChannel(Channel channel, int dataType)
+ public Object fromChannel(ExtendedDataInput channel, int dataType) throws IOException
{
if (dataType > MIN_PRIMITIVE)
{
- boolean isNull = channel.receiveBoolean();
+ boolean isNull = channel.readBoolean();
if (isNull)
{
@@ -39,12 +45,12 @@ public class ColumnConverterImpl extends AbstractConverter implements ColumnConv
return dispatchFromChannel(channel, dataType);
}
- public void toChannel(Channel channel, int dataType, Object value)
+ public void toChannel(ExtendedDataOutput channel, int dataType, Object value) throws IOException
{
if (dataType > MIN_PRIMITIVE)
{
boolean isNull = value == null;
- channel.transmitBoolean(isNull);
+ channel.writeBoolean(isNull);
if (isNull)
{
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/MapperImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/MapperImpl.java
index bc8ef82..e48e9f7 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/MapperImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/MapperImpl.java
@@ -11,22 +11,22 @@
package org.eclipse.emf.cdo.server.impl;
-import org.eclipse.net4j.core.Channel;
-import org.eclipse.net4j.spring.ValidationException;
-import org.eclipse.net4j.spring.impl.ServiceImpl;
-import org.eclipse.net4j.util.ImplementationError;
-import org.eclipse.net4j.util.StringHelper;
+import org.eclipse.net4j.util.lifecycle.AbstractLifecycle;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataOutput;
import org.eclipse.emf.cdo.core.CDOProtocol;
import org.eclipse.emf.cdo.core.CDOResProtocol;
+import org.eclipse.emf.cdo.core.ImplementationError;
import org.eclipse.emf.cdo.core.OIDEncoder;
+import org.eclipse.emf.cdo.core.WrappedIOException;
+import org.eclipse.emf.cdo.core.util.StringHelper;
import org.eclipse.emf.cdo.dbgen.ColumnType;
import org.eclipse.emf.cdo.dbgen.DBGenFactory;
import org.eclipse.emf.cdo.dbgen.Database;
import org.eclipse.emf.cdo.dbgen.IndexType;
import org.eclipse.emf.cdo.dbgen.SQLDialect;
import org.eclipse.emf.cdo.dbgen.Table;
-import org.eclipse.emf.cdo.dbgen.internal.DBGenActivator;
import org.eclipse.emf.cdo.server.AttributeInfo;
import org.eclipse.emf.cdo.server.ClassInfo;
import org.eclipse.emf.cdo.server.ColumnConverter;
@@ -37,6 +37,7 @@ import org.eclipse.emf.cdo.server.PackageManager;
import org.eclipse.emf.cdo.server.ResourceInfo;
import org.eclipse.emf.cdo.server.ResourceManager;
import org.eclipse.emf.cdo.server.ResourceNotFoundException;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -48,18 +49,26 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Set;
+import java.io.IOException;
+
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.sql.DataSource;
-public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
+/**
+ * @author Eike Stepper
+ */
+public class MapperImpl extends AbstractLifecycle implements Mapper, SQLConstants
{
protected static final int OBJECT_NOT_FOUND_IN_DB = 0;
protected static final long OBJECT_NOT_REFERENCED_IN_DB = 0;
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_MAPPER,
+ MapperImpl.class);
+
protected ColumnConverter columnConverter;
protected PackageManager packageManager;
@@ -95,7 +104,7 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
*/
public void setPackageManager(PackageManager packageManager)
{
- doSet("packageManager", packageManager);
+ this.packageManager = packageManager;
}
/**
@@ -111,7 +120,7 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
*/
public void setColumnConverter(ColumnConverter columnConverter)
{
- doSet("columnConverter", columnConverter);
+ this.columnConverter = columnConverter;
}
public ResourceManager getResourceManager()
@@ -121,7 +130,7 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
public void setResourceManager(ResourceManager resourceManager)
{
- doSet("resourceManager", resourceManager);
+ this.resourceManager = resourceManager;
}
/**
@@ -137,7 +146,7 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
*/
public void setDataSource(DataSource dataSource)
{
- doSet("dataSource", dataSource);
+ this.dataSource = dataSource;
}
/**
@@ -147,8 +156,9 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
{
if (cachedSqlDialect == null)
{
- cachedSqlDialect = DBGenActivator.INSTANCE.createDialect(sqlDialectName);
+ cachedSqlDialect = DBGenFactory.eINSTANCE.createDialect(sqlDialectName);
}
+
return cachedSqlDialect;
}
@@ -162,7 +172,7 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
*/
public void setSqlDialectName(String sqlDialectName)
{
- doSet("sqlDialectName", sqlDialectName);
+ this.sqlDialectName = sqlDialectName;
}
/**
@@ -178,7 +188,7 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
*/
public void setOidEncoder(OIDEncoder oidEncoder) // Don't change case! Spring will be irritated
{
- doSet("oidEncoder", oidEncoder);
+ this.oidEncoder = oidEncoder;
}
/**
@@ -194,7 +204,7 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
*/
public void setJdbcTemplate(JdbcTemplate jdbcTemplate)
{
- doSet("jdbcTemplate", jdbcTemplate);
+ this.jdbcTemplate = jdbcTemplate;
}
public int getNextPid()
@@ -215,21 +225,48 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
public long getNextOID(int rid)
{
ResourceInfo resourceInfo = resourceManager.getResourceInfo(rid, this);
- if (resourceInfo == null) throw new ResourceNotFoundException("Unknown RID: " + rid);
+ if (resourceInfo == null)
+ {
+ throw new ResourceNotFoundException("Unknown RID: " + rid);
+ }
long nextOIDFragment = resourceInfo.getNextOIDFragment();
return oidEncoder.getOID(rid, nextOIDFragment);
}
- protected void validate() throws ValidationException
+ @Override
+ protected void onAboutToActivate() throws Exception
{
- super.validate();
- assertNotNull("columnConverter");
- assertNotNull("packageManager");
- assertNotNull("resourceManager");
- assertNotNull("dataSource");
- assertNotNull("oidEncoder");
- assertNotNull("jdbcTemplate");
+ super.onAboutToActivate();
+ if (columnConverter == null)
+ {
+ throw new IllegalStateException("columnConverter == null");
+ }
+
+ if (packageManager == null)
+ {
+ throw new IllegalStateException("packageManager == null");
+ }
+
+ if (resourceManager == null)
+ {
+ throw new IllegalStateException("resourceManager == null");
+ }
+
+ if (dataSource == null)
+ {
+ throw new IllegalStateException("dataSource == null");
+ }
+
+ if (oidEncoder == null)
+ {
+ throw new IllegalStateException("oidEncoder == null");
+ }
+
+ if (jdbcTemplate == null)
+ {
+ throw new IllegalStateException("jdbcTemplate == null");
+ }
initTables();
initPackages();
@@ -239,6 +276,20 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
nextRID = selectMaxRID() + 1;
}
+ @Override
+ protected void onDeactivate() throws Exception
+ {
+ columnConverter = null;
+ dataSource = null;
+ jdbcTemplate = null;
+ oidEncoder = null;
+ packageManager = null;
+ resourceManager = null;
+ sqlDialectName = null;
+ cachedSqlDialect = null;
+ super.onDeactivate();
+ }
+
protected void initTables()
{
Database database = DBGenFactory.eINSTANCE.createDatabase();
@@ -295,12 +346,12 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
referenceTable.addColumn(REFERENCE_FEATUREID_COLUMN, ColumnType.INTEGER_LITERAL);
referenceTable.addColumn(REFERENCE_ORDINAL_COLUMN, ColumnType.BIGINT_LITERAL);
referenceTable.addColumn(REFERENCE_TARGET_COLUMN, ColumnType.BIGINT_LITERAL, 0, "NOT NULL");
- referenceTable.addColumn(REFERENCE_CONTENT_COLUMN, ColumnType.BOOLEAN_LITERAL);
+ referenceTable.addColumn(REFERENCE_CONTAINMENT_COLUMN, ColumnType.BOOLEAN_LITERAL);
referenceTable.addSimpleIndex(REFERENCE_TARGET_COLUMN, IndexType.NON_UNIQUE_LITERAL);
// TODO Check if this compound index generally makes preceding simple index superfluous
referenceTable.addCompoundIndex(new String[] { REFERENCE_TARGET_COLUMN,
- REFERENCE_CONTENT_COLUMN,}, IndexType.NON_UNIQUE_LITERAL);
+ REFERENCE_CONTAINMENT_COLUMN,}, IndexType.NON_UNIQUE_LITERAL);
// This index can not be a real PK (UNIQUE), since during movement of allReferences
// it temporarily holds duplicate entries!!!
@@ -312,7 +363,11 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
protected void initPackages()
{
- if (isDebugEnabled()) debug(SELECT_PACKAGES);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(SELECT_PACKAGES);
+ }
+
jdbcTemplate.query(SELECT_PACKAGES, new RowCallbackHandler()
{
public void processRow(ResultSet resultSet) throws SQLException
@@ -320,7 +375,10 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
int pid = resultSet.getInt(1);
String name = resultSet.getString(2);
- if (isDebugEnabled()) debug("Initializing package: pid=" + pid + ", name=" + name);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Initializing package: pid=" + pid + ", name=" + name);
+ }
PackageInfo packageInfo = packageManager.addPackage(pid, name);
initClasses(packageInfo);
}
@@ -334,7 +392,10 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
JdbcTemplate nestedTemplate = new JdbcTemplate(dataSource);
Object[] args = { new Integer(packageInfo.getPid())};
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_CLASSES, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(SELECT_CLASSES, "?", args));
+ }
nestedTemplate.query(SELECT_CLASSES, args, new RowCallbackHandler()
{
@@ -350,9 +411,11 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
parentName = null;
}
- if (isDebugEnabled())
- debug("Initializing class: cid=" + cid + ", name=" + name + ", parentName=" + parentName
- + ", tableName=" + tableName);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Initializing class: cid=" + cid + ", name=" + name + ", parentName="
+ + parentName + ", tableName=" + tableName);
+ }
ClassInfo classInfo = packageInfo.addClass(cid, name, parentName, tableName);
initAttributes(classInfo);
@@ -372,7 +435,10 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
JdbcTemplate nestedTemplate = new JdbcTemplate(dataSource);
Object[] args = { new Integer(classInfo.getCID())};
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_ATTRIBUTES, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(SELECT_ATTRIBUTES, "?", args));
+ }
nestedTemplate.query(SELECT_ATTRIBUTES, args, new RowCallbackHandler()
{
@@ -384,9 +450,12 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
String columnName = resultSet.getString(4);
int columnType = resultSet.getInt(5);
- if (isDebugEnabled())
- debug("Initializing attribute: name=" + name + ", featureId=" + featureId + ", dataType="
- + dataType + ", columnName=" + columnName + ", columnType=" + columnType);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Initializing attribute: name=" + name + ", featureId=" + featureId
+ + ", dataType=" + dataType + ", columnName=" + columnName + ", columnType="
+ + columnType);
+ }
classInfo.addAttribute(name, featureId, dataType, columnName, columnType);
}
});
@@ -414,7 +483,10 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
public ResourceInfo selectResourceInfo(String path)
{
Object[] args = { path};
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_RID_OF_RESOURCE, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(SELECT_RID_OF_RESOURCE, "?", args));
+ }
final int[] rows = new int[1];
final ResourceInfoImpl result = new ResourceInfoImpl();
@@ -437,14 +509,20 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
long nextOIDFragment = selectMaxOIDFragment(result.getRID()) + 1;
result.setNextOIDFragment(nextOIDFragment);
- if (isDebugEnabled()) debug("Selected " + result);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Selected " + result);
+ }
return result;
}
public ResourceInfo selectResourceInfo(int rid)
{
Object[] args = { new Integer(rid)};
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_PATH_OF_RESOURCE, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(SELECT_PATH_OF_RESOURCE, "?", args));
+ }
final int[] rows = new int[1];
final ResourceInfoImpl result = new ResourceInfoImpl();
@@ -467,14 +545,20 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
long nextOIDFragment = selectMaxOIDFragment(result.getRID()) + 1;
result.setNextOIDFragment(nextOIDFragment);
- if (isDebugEnabled()) debug("Selected " + result);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Selected " + result);
+ }
return result;
}
protected long selectMaxOIDFragment(int rid)
{
Object[] args = ridBounds(rid);
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_MAX_OID_FRAGMENT, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(SELECT_MAX_OID_FRAGMENT, "?", args));
+ }
long oid = jdbcTemplate.queryForLong(SELECT_MAX_OID_FRAGMENT, args);
return oidEncoder.getOIDFragment(oid);
}
@@ -488,19 +572,28 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
private int selectMaxPid()
{
- if (isDebugEnabled()) debug(SELECT_MAX_PID);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(SELECT_MAX_PID);
+ }
return jdbcTemplate.queryForInt(SELECT_MAX_PID);
}
private int selectMaxCID()
{
- if (isDebugEnabled()) debug(SELECT_MAX_CID);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(SELECT_MAX_CID);
+ }
return jdbcTemplate.queryForInt(SELECT_MAX_CID);
}
private int selectMaxRID()
{
- if (isDebugEnabled()) debug(SELECT_MAX_RID);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(SELECT_MAX_RID);
+ }
return jdbcTemplate.queryForInt(SELECT_MAX_RID);
}
@@ -514,7 +607,10 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
public int getCollectionCount(long oid, int feature)
{
Object[] args = { new Long(oid), new Integer(feature)};
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_COLLECTION_COUNT, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(SELECT_COLLECTION_COUNT, "?", args));
+ }
return jdbcTemplate.queryForInt(SELECT_COLLECTION_COUNT, args);
}
@@ -522,7 +618,10 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
public boolean lock(long oid, int oca)
{
Object[] args = { new Long(oid), new Integer(oca)};
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(DO_OPTIMISTIC_CONTROL, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(DO_OPTIMISTIC_CONTROL, "?", args));
+ }
int changed = jdbcTemplate.update(DO_OPTIMISTIC_CONTROL, args);
return changed == 1;
@@ -533,9 +632,9 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
sql(INSERT_RESOURCE, new Object[] { rid, path});
}
- public void insertReference(long oid, int feature, int ordinal, long target, boolean content)
+ public void insertReference(long oid, int feature, int ordinal, long target, boolean containment)
{
- sql(INSERT_REFERENCE, new Object[] { oid, feature, ordinal, target, content});
+ sql(INSERT_REFERENCE, new Object[] { oid, feature, ordinal, target, containment});
}
public void removeReference(long oid, int feature, int ordinal)
@@ -552,8 +651,10 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
{
Object[] args = { new Integer(offset), new Long(oid), new Integer(feature),
new Integer(startIndex), new Integer(endIndex)};
- if (isDebugEnabled())
- debug(StringHelper.replaceWildcards(MOVE_REFERENCES_RELATIVE, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(MOVE_REFERENCES_RELATIVE, "?", args));
+ }
// ignore number of affected rows
jdbcTemplate.update(MOVE_REFERENCES_RELATIVE, args);
@@ -567,7 +668,10 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
protected void removeReferences(long oid)
{
Object[] args = { oid};
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(REMOVE_REFERENCES, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(REMOVE_REFERENCES, "?", args));
+ }
jdbcTemplate.update(REMOVE_REFERENCES, args);
}
@@ -594,7 +698,10 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
protected int selectCIDOfObject(long oid)
{
Object[] args = { new Long(oid)};
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_CID_OF_OBJECT, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(SELECT_CID_OF_OBJECT, "?", args));
+ }
try
{
@@ -642,7 +749,10 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
public void sql(String sql)
{
- if (isDebugEnabled()) debug(sql);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(sql);
+ }
int rows = jdbcTemplate.update(sql);
@@ -654,7 +764,10 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
public void sql(String sql, Object[] args)
{
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(sql, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(sql, "?", args));
+ }
int rows = jdbcTemplate.update(sql, args);
@@ -666,82 +779,131 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
public void sql(String sql, Object[] args, int[] types)
{
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(sql, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(sql, "?", args));
+ }
int rows = jdbcTemplate.update(sql, args, types);
-
if (rows != 1)
{
throw new DatabaseInconsistencyException(sql);
}
}
- public void transmitContent(final Channel channel, ResourceInfo resourceInfo)
+ public void transmitContent(final ExtendedDataOutput out, ResourceInfo resourceInfo)
+ throws IOException
{
if (resourceInfo != null)
{
Object[] args = ridBounds(resourceInfo.getRID());
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(TRANSMIT_CONTENT, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(TRANSMIT_CONTENT, "?", args));
+ }
- jdbcTemplate.query(TRANSMIT_CONTENT, args, new RowCallbackHandler()
+ try
{
- public void processRow(ResultSet resultSet) throws SQLException
+ jdbcTemplate.query(TRANSMIT_CONTENT, args, new RowCallbackHandler()
{
- long oid = resultSet.getLong(1);
- int oca = resultSet.getInt(2);
- int cid = resultSet.getInt(3);
-
- if (isDebugEnabled())
- debug("Object: oid=" + oidEncoder.toString(oid) + ", oca=" + oca + ", cid=" + cid);
-
- channel.transmitLong(oid);
- channel.transmitInt(oca);
- channel.transmitInt(cid);
-
- ClassInfo classInfo = packageManager.getClassInfo(cid);
- if (classInfo == null) throw new ImplementationError("Unknown cid " + cid);
-
- transmitAttributes(channel, oid, classInfo);
- transmitReferences(channel, oid);
- }
- });
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ try
+ {
+ long oid = resultSet.getLong(1);
+ int oca = resultSet.getInt(2);
+ int cid = resultSet.getInt(3);
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Object: oid=" + oidEncoder.toString(oid) + ", oca=" + oca + ", cid="
+ + cid);
+ }
+
+ out.writeLong(oid);
+ out.writeInt(oca);
+ out.writeInt(cid);
+
+ ClassInfo classInfo = packageManager.getClassInfo(cid);
+ if (classInfo == null)
+ {
+ throw new ImplementationError("Unknown cid " + cid);
+ }
+
+ transmitAttributes(out, oid, classInfo);
+ transmitReferences(out, oid);
+ }
+ catch (IOException ex)
+ {
+ throw new WrappedIOException(ex);
+ }
+ }
+ });
+ }
+ catch (WrappedIOException ex)
+ {
+ ex.reThrow();
+ }
}
- channel.transmitLong(0);
+ out.writeLong(0);
}
- public void transmitObject(final Channel channel, final long oid)
+ public void transmitObject(final ExtendedDataOutput out, final long oid) throws IOException
{
Object[] args = { new Long(oid)};
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(TRANSMIT_OBJECT, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(TRANSMIT_OBJECT, "?", args));
+ }
- jdbcTemplate.query(TRANSMIT_OBJECT, args, new RowCallbackHandler()
+ try
{
- public void processRow(ResultSet resultSet) throws SQLException
+ jdbcTemplate.query(TRANSMIT_OBJECT, args, new RowCallbackHandler()
{
- int oca = resultSet.getInt(1);
- int cid = resultSet.getInt(2);
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ try
+ {
+ int oca = resultSet.getInt(1);
+ int cid = resultSet.getInt(2);
- if (isDebugEnabled())
- debug("Object: oid=" + oidEncoder.toString(oid) + ", oca=" + oca + ", cid=" + cid);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Object: oid=" + oidEncoder.toString(oid) + ", oca=" + oca + ", cid="
+ + cid);
+ }
- channel.transmitLong(oid);
- channel.transmitInt(oca);
- channel.transmitInt(cid);
+ out.writeLong(oid);
+ out.writeInt(oca);
+ out.writeInt(cid);
- ClassInfo classInfo = packageManager.getClassInfo(cid);
- if (classInfo == null) throw new ImplementationError("Unknown cid " + cid);
+ ClassInfo classInfo = packageManager.getClassInfo(cid);
+ if (classInfo == null)
+ {
+ throw new ImplementationError("Unknown cid " + cid);
+ }
- transmitContainers(channel, oid);
- transmitAttributes(channel, oid, classInfo);
- transmitReferences(channel, oid);
- }
- });
+ transmitContainers(out, oid);
+ transmitAttributes(out, oid, classInfo);
+ transmitReferences(out, oid);
+ }
+ catch (IOException ex)
+ {
+ throw new WrappedIOException(ex);
+ }
+ }
+ });
+ }
+ catch (WrappedIOException ex)
+ {
+ ex.reThrow();
+ }
- channel.transmitLong(0);
+ out.writeLong(0);
}
- public void transmitContainers(final Channel channel, long oid)
+ public void transmitContainers(final ExtendedDataOutput out, long oid) throws IOException
{
class Container
{
@@ -755,16 +917,16 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
this.cid = cid;
}
}
- ;
final List containers = new LinkedList();
final long[] child = { oid};
-
while (child[0] != 0)
{
Object[] args = { new Long(child[0]), Boolean.TRUE};
- if (isDebugEnabled())
- debug(StringHelper.replaceWildcards(SELECT_CONTAINER_OF_OBJECT, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(SELECT_CONTAINER_OF_OBJECT, "?", args));
+ }
child[0] = 0;
jdbcTemplate.query(SELECT_CONTAINER_OF_OBJECT, args, new RowCallbackHandler()
@@ -773,56 +935,77 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
{
long oid = resultSet.getLong(1);
int cid = resultSet.getInt(2);
-
containers.add(0, new Container(oid, cid));
child[0] = oid;
}
});
}
- channel.transmitInt(containers.size());
+ out.writeInt(containers.size());
for (Iterator it = containers.iterator(); it.hasNext();)
{
Container container = (Container) it.next();
- if (isDebugEnabled())
- debug("Container: oid=" + oidEncoder.toString(container.oid) + ", cid=" + container.cid);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Container: oid=" + oidEncoder.toString(container.oid) + ", cid="
+ + container.cid);
+ }
- channel.transmitLong(container.oid);
- channel.transmitInt(container.cid);
+ out.writeLong(container.oid);
+ out.writeInt(container.cid);
}
}
- public void transmitReferences(final Channel channel, long oid)
+ public void transmitReferences(final ExtendedDataOutput out, long oid) throws IOException
{
Object[] args = { new Long(oid)};
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(TRANSMIT_REFERENCES, "?", args));
- jdbcTemplate.query(TRANSMIT_REFERENCES, args, new RowCallbackHandler()
+ if (TRACER.isEnabled())
{
- public void processRow(ResultSet resultSet) throws SQLException
- {
- int feature = resultSet.getInt(1);
- long target = resultSet.getLong(2);
- int cid = resultSet.getInt(3);
+ TRACER.trace(StringHelper.replaceWildcards(TRANSMIT_REFERENCES, "?", args));
+ }
- if (isDebugEnabled())
- debug("Reference: feature=" + feature + ", target=" + oidEncoder.toString(target)
- + ", cid=" + cid);
+ try
+ {
+ jdbcTemplate.query(TRANSMIT_REFERENCES, args, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ try
+ {
+ int feature = resultSet.getInt(1);
+ long target = resultSet.getLong(2);
+ int cid = resultSet.getInt(3);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Reference: feature=" + feature + ", target="
+ + oidEncoder.toString(target) + ", cid=" + cid);
+ }
- channel.transmitInt(feature);
- channel.transmitLong(target);
- channel.transmitInt(cid);
- }
- });
+ out.writeInt(feature);
+ out.writeLong(target);
+ out.writeInt(cid);
+ }
+ catch (IOException ex)
+ {
+ throw new WrappedIOException(ex);
+ }
+ }
+ });
+ }
+ catch (WrappedIOException ex)
+ {
+ ex.reThrow();
+ }
- channel.transmitInt(-1);
+ out.writeInt(-1);
}
- public void transmitAttributes(final Channel channel, long oid, ClassInfo classInfo)
+ public void transmitAttributes(final ExtendedDataOutput out, long oid, ClassInfo classInfo)
+ throws IOException
{
while (classInfo != null)
{
String columnNames = classInfo.getColumnNames();
-
if (columnNames != null && columnNames.length() > 0)
{
final ClassInfo finalClassInfo = classInfo;
@@ -830,63 +1013,95 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
+ USER_OID_COLUMN + "=?";
Object[] args = { new Long(oid)};
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(sql, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(sql, "?", args));
+ }
- jdbcTemplate.query(sql, args, new RowCallbackHandler()
+ try
{
- public void processRow(ResultSet resultSet) throws SQLException
+ jdbcTemplate.query(sql, args, new RowCallbackHandler()
{
- AttributeInfo[] attributeInfos = finalClassInfo.getAttributeInfos();
- for (int i = 0; i < attributeInfos.length; i++)
+ public void processRow(ResultSet resultSet) throws SQLException
{
- AttributeInfo attributeInfo = attributeInfos[i];
-
- Object value = resultSet.getObject(i + 1);
- columnConverter.toChannel(channel, attributeInfo.getDataType(), value);
+ try
+ {
+ AttributeInfo[] attributeInfos = finalClassInfo.getAttributeInfos();
+ for (int i = 0; i < attributeInfos.length; i++)
+ {
+ AttributeInfo attributeInfo = attributeInfos[i];
+
+ Object value = resultSet.getObject(i + 1);
+ columnConverter.toChannel(out, attributeInfo.getDataType(), value);
+ }
+ }
+ catch (IOException ex)
+ {
+ throw new WrappedIOException(ex);
+ }
}
- }
- });
+ });
+ }
+ catch (WrappedIOException ex)
+ {
+ ex.reThrow();
+ }
}
classInfo = classInfo.getParent();
}
}
- public void transmitAllResources(final Channel channel)
+ public void transmitAllResources(final ExtendedDataOutput out) throws IOException
{
- if (isDebugEnabled())
+ if (TRACER.isEnabled())
{
- debug("Querying all resources");
- debug(SELECT_ALL_RESOURCES);
+ TRACER.trace("Querying all resources");
+ TRACER.trace(SELECT_ALL_RESOURCES);
}
- jdbcTemplate.query(SELECT_ALL_RESOURCES, new RowCallbackHandler()
+ try
{
- public void processRow(ResultSet resultSet) throws SQLException
+ jdbcTemplate.query(SELECT_ALL_RESOURCES, new RowCallbackHandler()
{
- int rid = resultSet.getInt(1);
- String path = resultSet.getString(2);
-
- channel.transmitInt(rid);
- channel.transmitString(path);
- }
- });
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ try
+ {
+ int rid = resultSet.getInt(1);
+ String path = resultSet.getString(2);
+ out.writeInt(rid);
+ out.writeString(path);
+ }
+ catch (IOException ex)
+ {
+ throw new WrappedIOException(ex);
+ }
+ }
+ });
+ }
+ catch (WrappedIOException ex)
+ {
+ ex.reThrow();
+ }
- channel.transmitInt(CDOResProtocol.NO_MORE_RESOURCES);
+ out.writeInt(CDOResProtocol.NO_MORE_RESOURCES);
}
public void deleteResource(int rid)
{
- if (isDebugEnabled())
+ if (TRACER.isEnabled())
{
- debug("Deleting resource: rid=" + rid);
+ TRACER.trace("Deleting resource: rid=" + rid);
}
sql(DELETE_RESOURCE, new Object[] { rid});
Object[] args = ridBounds(rid);
- if (isDebugEnabled())
- debug(StringHelper.replaceWildcards(SELECT_ALL_OBJECTS_OF_RESOURCE, "?", args));
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(StringHelper.replaceWildcards(SELECT_ALL_OBJECTS_OF_RESOURCE, "?", args));
+ }
jdbcTemplate.query(SELECT_ALL_OBJECTS_OF_RESOURCE, args, new RowCallbackHandler()
{
@@ -895,9 +1110,9 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
long oid = resultSet.getLong(1);
int cid = resultSet.getInt(2);
- if (isDebugEnabled())
+ if (TRACER.isEnabled())
{
- debug("Deleting object: oid=" + oidEncoder.toString(oid) + ", cid=" + cid);
+ TRACER.trace("Deleting object: oid=" + oidEncoder.toString(oid) + ", cid=" + cid);
}
removeObject(oid, cid);
@@ -907,9 +1122,9 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
public Set<Long> removeStaleReferences()
{
- if (isDebugEnabled())
+ if (TRACER.isEnabled())
{
- debug("Removing stale references");
+ TRACER.trace("Removing stale references");
}
final Set<Long> modifiedOIDs = new HashSet<Long>();
@@ -921,9 +1136,9 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
int feature = resultSet.getInt(2);
int ordinal = resultSet.getInt(3);
- if (isDebugEnabled())
+ if (TRACER.isEnabled())
{
- debug("Reference: oid=" + oidEncoder.toString(oid) + ", feature=" + feature
+ TRACER.trace("Reference: oid=" + oidEncoder.toString(oid) + ", feature=" + feature
+ ", ordinal=" + ordinal);
}
@@ -935,8 +1150,8 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
return modifiedOIDs;
}
- public void transmitExtent(final Channel channel, final int context, final boolean exactMatch,
- int rid)
+ public void transmitExtent(final ExtendedDataOutput out, final int context,
+ final boolean exactMatch, int rid) throws IOException
{
StringBuffer buffer = new StringBuffer();
buffer.append("SELECT ");
@@ -948,7 +1163,6 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
buffer.append(OBJECT_CID_COLUMN);
buffer.append(" IN (");
buffer.append(context);
-
if (!exactMatch)
{
ClassInfo classInfo = packageManager.getClassInfo(context);
@@ -961,7 +1175,6 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
}
buffer.append(")");
-
if (rid != CDOProtocol.GLOBAL_EXTENT)
{
Object[] bounds = ridBounds(rid);
@@ -975,65 +1188,100 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
buffer.append(" ORDER BY ");
buffer.append(OBJECT_OID_COLUMN);
-
String sql = buffer.toString();
- if (isDebugEnabled())
+ if (TRACER.isEnabled())
{
- debug(sql);
-
+ TRACER.trace(sql);
}
- jdbcTemplate.query(sql, new RowCallbackHandler()
+ try
{
- public void processRow(ResultSet resultSet) throws SQLException
+ jdbcTemplate.query(sql, new RowCallbackHandler()
{
- long oid = resultSet.getLong(1);
- int cid = exactMatch ? context : resultSet.getInt(2);
-
- if (isDebugEnabled())
+ public void processRow(ResultSet resultSet) throws SQLException
{
- debug("Extent: oid=" + oidEncoder.toString(oid) + (exactMatch ? "" : ", cid=" + cid));
- }
+ try
+ {
+ long oid = resultSet.getLong(1);
+ int cid = exactMatch ? context : resultSet.getInt(2);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Extent: oid=" + oidEncoder.toString(oid)
+ + (exactMatch ? "" : ", cid=" + cid));
+ }
- channel.transmitLong(oid);
- if (!exactMatch)
- {
- channel.transmitInt(cid);
+ out.writeLong(oid);
+ if (!exactMatch)
+ {
+ out.writeInt(cid);
+ }
+ }
+ catch (IOException ex)
+ {
+ throw new WrappedIOException(ex);
+ }
}
- }
- });
+ });
+ }
+ catch (WrappedIOException ex)
+ {
+ ex.reThrow();
+ }
- channel.transmitLong(CDOProtocol.NO_MORE_OBJECTS);
+ out.writeLong(CDOProtocol.NO_MORE_OBJECTS);
}
- public void transmitXRefs(final Channel channel, final long oid, int rid)
+ public void transmitXRefs(final ExtendedDataOutput out, final long oid, int rid)
+ throws IOException
{
Object[] args = { new Long(oid)};
- if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_XREFS_OF_OBJECT, "?", args));
- jdbcTemplate.query(SELECT_XREFS_OF_OBJECT, args, new RowCallbackHandler()
+ if (TRACER.isEnabled())
{
- public void processRow(ResultSet resultSet) throws SQLException
- {
- long referer = resultSet.getLong(1);
- int feature = resultSet.getInt(2);
- int cid = resultSet.getInt(3);
+ TRACER.trace(StringHelper.replaceWildcards(SELECT_XREFS_OF_OBJECT, "?", args));
+ }
- if (isDebugEnabled())
- debug("XRef: referer=" + oidEncoder.toString(referer) + ", feature=" + feature + ", cid="
- + cid);
+ try
+ {
+ jdbcTemplate.query(SELECT_XREFS_OF_OBJECT, args, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ try
+ {
+ long referer = resultSet.getLong(1);
+ int feature = resultSet.getInt(2);
+ int cid = resultSet.getInt(3);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("XRef: referer=" + oidEncoder.toString(referer) + ", feature=" + feature
+ + ", cid=" + cid);
+ }
- channel.transmitLong(referer);
- channel.transmitInt(feature);
- channel.transmitInt(cid);
- }
- });
+ out.writeLong(referer);
+ out.writeInt(feature);
+ out.writeInt(cid);
+ }
+ catch (IOException ex)
+ {
+ throw new WrappedIOException(ex);
+ }
+ }
+ });
+ }
+ catch (WrappedIOException ex)
+ {
+ ex.reThrow();
+ }
- channel.transmitLong(CDOProtocol.NO_MORE_OBJECTS);
+ out.writeLong(CDOProtocol.NO_MORE_OBJECTS);
}
public void createAttributeTables(PackageInfo packageInfo)
{
- if (isDebugEnabled()) debug("Creating attribute tables");
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Creating attribute tables");
+ }
Database database = DBGenFactory.eINSTANCE.createDatabase();
ClassInfo[] classes = packageInfo.getClasses();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageInfoImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageInfoImpl.java
index 73f36da..e4036e3 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageInfoImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageInfoImpl.java
@@ -19,6 +19,9 @@ import java.util.ArrayList;
import java.util.List;
+/**
+ * @author Eike Stepper
+ */
public class PackageInfoImpl implements PackageInfo
{
protected int pid;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageManagerImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageManagerImpl.java
index 40ea2d5..0f6c175 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/PackageManagerImpl.java
@@ -11,7 +11,7 @@
package org.eclipse.emf.cdo.server.impl;
-import org.eclipse.net4j.spring.impl.ServiceImpl;
+import org.eclipse.net4j.util.lifecycle.AbstractLifecycle;
import org.eclipse.emf.cdo.server.ClassInfo;
import org.eclipse.emf.cdo.server.PackageInfo;
@@ -26,7 +26,10 @@ import java.util.List;
import java.util.Map;
-public class PackageManagerImpl extends ServiceImpl implements PackageManager
+/**
+ * @author Eike Stepper
+ */
+public class PackageManagerImpl extends AbstractLifecycle implements PackageManager
{
protected Map<Integer, ClassInfo> cidToClassInfoMap = new HashMap<Integer, ClassInfo>(2111);
@@ -113,4 +116,15 @@ public class PackageManagerImpl extends ServiceImpl implements PackageManager
listener.notifyAddedPackage();
}
}
+
+ @Override
+ protected void onDeactivate() throws Exception
+ {
+ cidToClassInfoMap = null;
+ listeners = null;
+ nameToClassInfoMap = null;
+ packages = null;
+ subClassInfoMap = null;
+ super.onDeactivate();
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceInfoImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceInfoImpl.java
index 31f9aa6..9245a92 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceInfoImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceInfoImpl.java
@@ -14,6 +14,9 @@ package org.eclipse.emf.cdo.server.impl;
import org.eclipse.emf.cdo.server.ResourceInfo;
+/**
+ * @author Eike Stepper
+ */
public class ResourceInfoImpl implements ResourceInfo
{
private String path;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceManagerImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceManagerImpl.java
index c069c44..70fe143 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/ResourceManagerImpl.java
@@ -11,25 +11,37 @@
package org.eclipse.emf.cdo.server.impl;
-import org.eclipse.net4j.spring.impl.ServiceImpl;
+import org.eclipse.net4j.util.lifecycle.AbstractLifecycle;
+import org.eclipse.net4j.util.om.ContextTracer;
import org.eclipse.emf.cdo.server.Mapper;
import org.eclipse.emf.cdo.server.ResourceInfo;
import org.eclipse.emf.cdo.server.ResourceManager;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
import java.util.HashMap;
import java.util.Map;
-public class ResourceManagerImpl extends ServiceImpl implements ResourceManager
+/**
+ * @author Eike Stepper
+ */
+public class ResourceManagerImpl extends AbstractLifecycle implements ResourceManager
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_RESOURCE,
+ ResourceManagerImpl.class);
+
private Map<Integer, ResourceInfo> ridToResourceMap = new HashMap<Integer, ResourceInfo>();
private Map<String, ResourceInfo> pathToResourceMap = new HashMap<String, ResourceInfo>();
public void registerResourceInfo(ResourceInfo resourceInfo)
{
- if (isDebugEnabled()) debug("Registering " + resourceInfo);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Registering " + resourceInfo);
+ }
+
ridToResourceMap.put(resourceInfo.getRID(), resourceInfo);
pathToResourceMap.put(resourceInfo.getPath(), resourceInfo);
}
@@ -44,11 +56,9 @@ public class ResourceManagerImpl extends ServiceImpl implements ResourceManager
public ResourceInfo getResourceInfo(String path, Mapper mapper)
{
ResourceInfo resourceInfo = pathToResourceMap.get(path);
-
if (resourceInfo == null)
{
resourceInfo = mapper.selectResourceInfo(path);
-
if (resourceInfo == null)
{
return null;
@@ -63,11 +73,9 @@ public class ResourceManagerImpl extends ServiceImpl implements ResourceManager
public ResourceInfo getResourceInfo(int rid, Mapper mapper)
{
ResourceInfo resourceInfo = ridToResourceMap.get(new Integer(rid));
-
if (resourceInfo == null)
{
resourceInfo = mapper.selectResourceInfo(rid);
-
if (resourceInfo == null)
{
return null;
@@ -78,4 +86,12 @@ public class ResourceManagerImpl extends ServiceImpl implements ResourceManager
return resourceInfo;
}
+
+ @Override
+ protected void onDeactivate() throws Exception
+ {
+ pathToResourceMap = null;
+ ridToResourceMap = null;
+ super.onDeactivate();
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/SQLConstants.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/SQLConstants.java
index a3e07f4..29aeb62 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/SQLConstants.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/SQLConstants.java
@@ -11,6 +11,9 @@
package org.eclipse.emf.cdo.server.impl;
+/**
+ * @author Eike Stepper
+ */
public interface SQLConstants
{
//--------------------------------------------------------------------
@@ -83,7 +86,7 @@ public interface SQLConstants
public static final String REFERENCE_FEATUREID_COLUMN = "FEATUREID";
- public static final String REFERENCE_CONTENT_COLUMN = "CONTENT";
+ public static final String REFERENCE_CONTAINMENT_COLUMN = "CONTENT";
public static final String REFERENCE_ORDINAL_COLUMN = "ORDINAL";
@@ -131,7 +134,7 @@ public interface SQLConstants
public static final String SELECT_CONTAINER_OF_OBJECT = "SELECT " + REFERENCE_TABLE + "."
+ REFERENCE_OID_COLUMN + ", " + OBJECT_TABLE + "." + OBJECT_CID_COLUMN + " FROM "
+ REFERENCE_TABLE + ", " + OBJECT_TABLE + " WHERE " + REFERENCE_TABLE + "."
- + REFERENCE_TARGET_COLUMN + "=? AND " + REFERENCE_TABLE + "." + REFERENCE_CONTENT_COLUMN
+ + REFERENCE_TARGET_COLUMN + "=? AND " + REFERENCE_TABLE + "." + REFERENCE_CONTAINMENT_COLUMN
+ "=? AND " + REFERENCE_TABLE + "." + REFERENCE_OID_COLUMN + "=" + OBJECT_TABLE + "."
+ OBJECT_OID_COLUMN;
@@ -139,7 +142,7 @@ public interface SQLConstants
+ REFERENCE_OID_COLUMN + ", " + REFERENCE_TABLE + "." + REFERENCE_FEATUREID_COLUMN + ", "
+ OBJECT_TABLE + "." + OBJECT_CID_COLUMN + " FROM " + REFERENCE_TABLE + ", " + OBJECT_TABLE
+ " WHERE " + REFERENCE_TABLE + "." + REFERENCE_TARGET_COLUMN + "=? AND " + REFERENCE_TABLE
- + "." + REFERENCE_CONTENT_COLUMN + "=FALSE AND " + REFERENCE_TABLE + "."
+ + "." + REFERENCE_CONTAINMENT_COLUMN + "=FALSE AND " + REFERENCE_TABLE + "."
+ REFERENCE_OID_COLUMN + "=" + OBJECT_TABLE + "." + OBJECT_OID_COLUMN;
public static final String SELECT_ALL_OBJECTS_OF_RESOURCE = "SELECT " + OBJECT_OID_COLUMN + ", "
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/internal/ServerPlugin.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/internal/Activator.java
index cdcb7ad..93af00b 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/internal/ServerPlugin.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/internal/Activator.java
@@ -11,47 +11,38 @@
package org.eclipse.emf.cdo.server.internal;
-import org.eclipse.net4j.util.eclipse.AbstractPlugin;
-import org.eclipse.net4j.util.eclipse.Element;
-import org.eclipse.net4j.util.eclipse.ListExtensionParser;
+import org.eclipse.emf.cdo.core.util.extensions.Element;
+import org.eclipse.emf.cdo.core.util.extensions.ListExtensionParser;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
import java.util.List;
/**
- * The main plugin class to be used in the desktop.
+ * @author Eike Stepper
*/
-public class ServerPlugin extends AbstractPlugin
+public class Activator implements BundleActivator
{
- //The shared instance.
- private static ServerPlugin plugin;
-
- /**
- * The constructor.
- */
- public ServerPlugin()
+ public Activator()
{
- if (plugin == null) plugin = this;
}
- protected void doStart() throws Exception
+ public void start(BundleContext context) throws Exception
{
+ CDOServer.BUNDLE.setBundleContext(context);
}
- protected void doStop() throws Exception
+ public void stop(BundleContext context) throws Exception
{
- plugin = null;
+ CDOServer.BUNDLE.setBundleContext(null);
}
+
/**
- * Returns the shared instance.
+ * @author Eike Stepper
*/
- public static ServerPlugin getDefault()
- {
- return plugin;
- }
-
-
public class MappingElement extends Element
{
protected String uri;
@@ -85,6 +76,9 @@ public class ServerPlugin extends AbstractPlugin
}
+ /**
+ * @author Eike Stepper
+ */
public class MappingExtensionParser extends ListExtensionParser
{
public MappingExtensionParser(List list)
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/internal/CDOServer.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/internal/CDOServer.java
new file mode 100644
index 0000000..a933b05
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/internal/CDOServer.java
@@ -0,0 +1,42 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.server.internal;
+
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMLogger;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OMTracer;
+
+
+/**
+ * @author Eike Stepper
+ */
+public final class CDOServer
+{
+ public static final String BUNDLE_ID = "org.eclipse.emf.cdo.server"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, CDOServer.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_MAPPER = DEBUG.tracer("mapper"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_RESOURCE = DEBUG.tracer("resource"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_PROTOCOL = DEBUG.tracer("protocol"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ private CDOServer()
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/AnnouncePackageIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/AnnouncePackageIndication.java
index f95dea3..6b897a8 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/AnnouncePackageIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/AnnouncePackageIndication.java
@@ -11,53 +11,80 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+import org.eclipse.net4j.signal.IndicationWithResponse;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
-import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.core.CDOSignals;
import org.eclipse.emf.cdo.server.ClassInfo;
import org.eclipse.emf.cdo.server.Mapper;
import org.eclipse.emf.cdo.server.PackageInfo;
-import org.eclipse.emf.cdo.server.ServerCDOProtocol;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
+import java.io.IOException;
-public class AnnouncePackageIndication extends AbstractIndicationWithResponse
+
+/**
+ * @author Eike Stepper
+ */
+public class AnnouncePackageIndication extends IndicationWithResponse
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ AnnouncePackageIndication.class);
+
+ private Mapper mapper;
+
private String packageName;
- public short getSignalId()
+ public AnnouncePackageIndication(Mapper mapper)
{
- return CDOProtocol.ANNOUNCE_PACKAGE;
+ this.mapper = mapper;
}
- public void indicate()
+ @Override
+ protected short getSignalID()
{
- packageName = receiveString();
- if (isDebugEnabled()) debug("Announced package " + packageName);
+ return CDOSignals.ANNOUNCE_PACKAGE;
}
- public void respond()
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws IOException
{
- Mapper mapper = ((ServerCDOProtocol) getProtocol()).getMapper();
- PackageInfo packageInfo = mapper.getPackageManager().getPackageInfo(packageName);
+ packageName = in.readString();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Announced package " + packageName);
+ }
+ }
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws IOException
+ {
+ PackageInfo packageInfo = mapper.getPackageManager().getPackageInfo(packageName);
if (packageInfo == null)
{
- if (isDebugEnabled()) debug("Unknown package " + packageName);
- transmitInt(-1);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Unknown package " + packageName);
+ }
+
+ out.writeInt(-1);
}
else
{
ClassInfo[] classInfos = packageInfo.getClasses();
- transmitInt(classInfos.length);
-
+ out.writeInt(classInfos.length);
for (int i = 0; i < classInfos.length; i++)
{
ClassInfo classInfo = classInfos[i];
- if (isDebugEnabled())
- debug("Responding class " + classInfo.getName() + " = " + classInfo.getCID());
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Responding class " + classInfo.getName() + " = " + classInfo.getCID());
+ }
- transmitInt(classInfo.getCID());
- transmitString(classInfo.getName());
+ out.writeInt(classInfo.getCID());
+ out.writeString(classInfo.getName());
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CommitTransactionIndication.java
index 229ae8d..2c8ef8c 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CommitTransactionIndication.java
@@ -11,13 +11,15 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.Channel;
-import org.eclipse.net4j.core.Protocol;
-import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
-import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.signal.IndicationWithResponse;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.core.ImplementationError;
import org.eclipse.emf.cdo.core.OIDEncoder;
+import org.eclipse.emf.cdo.core.WrappedIOException;
import org.eclipse.emf.cdo.core.protocol.ResourceChangeInfo;
import org.eclipse.emf.cdo.server.AttributeInfo;
import org.eclipse.emf.cdo.server.ClassInfo;
@@ -27,6 +29,7 @@ import org.eclipse.emf.cdo.server.ResourceInfo;
import org.eclipse.emf.cdo.server.ServerCDOProtocol;
import org.eclipse.emf.cdo.server.ServerCDOResProtocol;
import org.eclipse.emf.cdo.server.impl.SQLConstants;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
import org.springframework.transaction.TransactionException;
import org.springframework.transaction.TransactionStatus;
@@ -39,13 +42,25 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.io.IOException;
+
import java.sql.Types;
-public class CommitTransactionIndication extends AbstractIndicationWithResponse
+/**
+ * @author Eike Stepper
+ */
+public class CommitTransactionIndication extends IndicationWithResponse
{
public static final int CAPACITY_tempIdtoPersistentIdMap = 499;
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ CommitTransactionIndication.class);
+
+ private Mapper mapper;
+
+ private TransactionTemplate transactionTemplate;
+
private Map<Long, Long> tempOIDs = new HashMap<Long, Long>(CAPACITY_tempIdtoPersistentIdMap);
private List<Long> changedObjectIds = new ArrayList<Long>();
@@ -56,151 +71,168 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
private boolean optimisticControlException = false;
- private Mapper mapper;
-
private List<ResourceChangeInfo> newResources = new ArrayList<ResourceChangeInfo>();
- public short getSignalId()
+ public CommitTransactionIndication(Mapper mapper, TransactionTemplate transactionTemplate)
+ {
+ this.mapper = mapper;
+ this.transactionTemplate = transactionTemplate;
+ }
+
+ @Override
+ protected short getSignalID()
{
return CDOProtocol.COMMIT_TRANSACTION;
}
- public void indicate()
+ @Override
+ protected void indicating(final ExtendedDataInputStream in) throws IOException
{
try
{
- final TransactionTemplate transactionTemplate = ((ServerCDOProtocol) getProtocol())
- .getTransactionTemplate();
transactionTemplate.execute(new TransactionCallbackWithoutResult()
{
public void doInTransactionWithoutResult(TransactionStatus status)
{
- receiveObjectsToDetach();
- receiveObjectsToAttach();
- receiveObjectChanges();
- receiveNewResources();
-
- if (optimisticControlException)
+ try
{
- status.setRollbackOnly();
+ receiveObjectsToDetach(in);
+ receiveObjectsToAttach(in);
+ receiveObjectChanges(in);
+ receiveNewResources(in);
+ if (optimisticControlException)
+ {
+ status.setRollbackOnly();
+ }
+ }
+ catch (IOException ex)
+ {
+ throw new WrappedIOException(ex);
}
}
});
}
+ catch (WrappedIOException ex)
+ {
+ ex.reThrow();
+ }
catch (TransactionException ex)
{
- error("Error while committing transaction to database", ex);
+ CDOServer.LOG.error("Error while committing transaction to database", ex);
}
if (!optimisticControlException)
{
transmitInvalidations();
- transmitRescourceChanges();
+ transmitResourceChanges();
}
}
- public void respond()
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws IOException
{
if (optimisticControlException)
{
- transmitBoolean(false);
+ out.writeBoolean(false);
return;
}
else
{
- transmitBoolean(true);
+ out.writeBoolean(true);
}
- transmitInt(oidList.size());
-
+ out.writeInt(oidList.size());
for (Iterator<Long> iter = oidList.iterator(); iter.hasNext();)
{
Long id = iter.next();
- transmitLong(id.longValue());
+ out.writeLong(id.longValue());
}
- transmitInt(changedObjectIds.size());
-
+ out.writeInt(changedObjectIds.size());
for (Iterator<Long> iter = changedObjectIds.iterator(); iter.hasNext();)
{
Long id = iter.next();
- transmitLong(id.longValue());
-
Integer oca = changedObjectOIDOCA.get(id);
- transmitInt(oca.intValue());
+ out.writeLong(id.longValue());
+ out.writeInt(oca.intValue());
}
}
- private void receiveNewResources()
+ private void receiveNewResources(ExtendedDataInputStream in) throws IOException
{
int rid;
- while ((rid = receiveInt()) != 0)
+ while ((rid = in.readInt()) != 0)
{
- String path = receiveString();
- getMapper().insertResource(rid, path);
+ String path = in.readString();
+ mapper.insertResource(rid, path);
newResources.add(new ResourceChangeInfo(ResourceChangeInfo.ADDED, rid, path));
}
}
- private void receiveObjectsToDetach()
+ private void receiveObjectsToDetach(ExtendedDataInputStream in) throws IOException
{
- if (isDebugEnabled()) debug("receiveObjectsToDetach()");
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("receiveObjectsToDetach()");
+ }
for (;;)
{
- long oid = receiveLong();
-
+ long oid = in.readLong();
if (oid == CDOProtocol.NO_MORE_OBJECTS)
{
break;
}
- getMapper().removeObject(oid);
+ mapper.removeObject(oid);
}
}
- private void receiveObjectsToAttach()
+ private void receiveObjectsToAttach(ExtendedDataInputStream in) throws IOException
{
- if (isDebugEnabled()) debug("receiveObjectsToAttach()");
- int count = receiveInt();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("receiveObjectsToAttach()");
+ }
+ int count = in.readInt();
for (int i = 0; i < count; i++)
{
- long oid = receiveLong();
-
+ long oid = in.readLong();
if (oid < 0)
{
oid = registerTempOID(oid);
}
- ClassInfo info = receiveClassInfo();
- getMapper().insertObject(oid, info.getCID());
-
- boolean isContent = receiveBoolean();
+ ClassInfo info = receiveClassInfo(in);
+ mapper.insertObject(oid, info.getCID());
+ boolean isContent = in.readBoolean();
if (isContent)
{
- getMapper().insertContent(oid);
+ mapper.insertContent(oid);
}
- receiveObjectsToAttachAttributes(info, oid);
+ receiveObjectsToAttachAttributes(in, info, oid);
}
- receiveObjectsToAttachReferences();
+ receiveObjectsToAttachReferences(in);
}
- private void receiveObjectsToAttachReferences()
+ private void receiveObjectsToAttachReferences(ExtendedDataInputStream in) throws IOException
{
- if (isDebugEnabled()) debug("receiveObjectsToAttachReferences()");
- int count = receiveInt();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("receiveObjectsToAttachReferences()");
+ }
+ int count = in.readInt();
for (int i = 0; i < count; i++)
{
- long oid = receiveLong();
- int feature = receiveInt();
- int ordinal = receiveInt();
- long target = receiveLong();
- boolean content = receiveBoolean();
-
+ long oid = in.readLong();
+ int feature = in.readInt();
+ int ordinal = in.readInt();
+ long target = in.readLong();
+ boolean containment = in.readBoolean();
if (oid < 0)
{
oid = resolveTempOID(oid);
@@ -211,18 +243,23 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
target = resolveTempOID(target);
}
- getMapper().insertReference(oid, feature, ordinal, target, content);
+ mapper.insertReference(oid, feature, ordinal, target, containment);
}
}
/**
+ * @param in
* @return
+ * @throws IOException
*/
- private ClassInfo receiveClassInfo()
+ private ClassInfo receiveClassInfo(ExtendedDataInputStream in) throws IOException
{
- int cid = receiveInt();
- ClassInfo classInfo = getMapper().getPackageManager().getClassInfo(cid);
- if (classInfo == null) throw new ImplementationError("Unknown cid " + cid);
+ int cid = in.readInt();
+ ClassInfo classInfo = mapper.getPackageManager().getClassInfo(cid);
+ if (classInfo == null)
+ {
+ throw new ImplementationError("Unknown cid " + cid);
+ }
return classInfo;
}
@@ -233,9 +270,9 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
*/
private long registerTempOID(long tempOID)
{
- OIDEncoder oidEncoder = getMapper().getOidEncoder();
+ OIDEncoder oidEncoder = mapper.getOidEncoder();
int rid = oidEncoder.getRID(-tempOID);
- ResourceInfo resourceInfo = getMapper().getResourceManager().getResourceInfo(rid, getMapper());
+ ResourceInfo resourceInfo = mapper.getResourceManager().getResourceInfo(rid, mapper);
long oidFragment = resourceInfo.getNextOIDFragment();
Long key = new Long(tempOID);
@@ -244,9 +281,11 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
tempOIDs.put(key, val);
oidList.add(val);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Mapping oid " + oidEncoder.toString(key) + " --> " + oidEncoder.toString(val));
+ }
- if (isDebugEnabled())
- debug("Mapping oid " + oidEncoder.toString(key) + " --> " + oidEncoder.toString(val));
return oid;
}
@@ -257,42 +296,43 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
private long resolveTempOID(long tempOID)
{
Long sourceVal = tempOIDs.get(new Long(tempOID));
-
if (sourceVal == null)
{
- OIDEncoder oidEncoder = getMapper().getOidEncoder();
+ OIDEncoder oidEncoder = mapper.getOidEncoder();
throw new ImplementationError("no mapping for temporary oid " + oidEncoder.toString(tempOID));
}
return sourceVal.longValue();
}
- private void receiveObjectChanges()
+ private void receiveObjectChanges(ExtendedDataInputStream in) throws IOException
{
- if (isDebugEnabled()) debug("receiveObjectChanges()");
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("receiveObjectChanges()");
+ }
for (;;)
{
- long oid = receiveLong();
+ long oid = in.readLong();
if (oid == CDOProtocol.NO_MORE_OBJECT_CHANGES)
{
break;
}
- int oca = receiveInt();
+ int oca = in.readInt();
int newOCA = lock(oid, oca);
-
- receiveReferenceChanges();
- receiveAttributeChanges(oid);
+ receiveReferenceChanges(in);
+ receiveAttributeChanges(in, oid);
rememberChangedObject(oid, newOCA);
}
}
- private void receiveReferenceChanges()
+ private void receiveReferenceChanges(ExtendedDataInputStream in) throws IOException
{
for (;;)
{
- byte changeKind = receiveByte();
+ byte changeKind = in.readByte();
if (changeKind == CDOProtocol.NO_MORE_REFERENCE_CHANGES)
{
break;
@@ -301,25 +341,20 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
switch (changeKind)
{
case CDOProtocol.FEATURE_SET:
- receiveReferenceSet();
+ receiveReferenceSet(in);
break;
-
case CDOProtocol.FEATURE_UNSET:
- receiveReferenceUnset();
+ receiveReferenceUnset(in);
break;
-
case CDOProtocol.LIST_ADD:
- receiveReferenceAdd();
+ receiveReferenceAdd(in);
break;
-
case CDOProtocol.LIST_REMOVE:
- receiveReferenceRemove();
+ receiveReferenceRemove(in);
break;
-
case CDOProtocol.LIST_MOVE:
- receiveReferenceMove();
+ receiveReferenceMove(in);
break;
-
default:
throw new ImplementationError("invalid changeKind: " + changeKind);
}
@@ -327,138 +362,142 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
}
/**
+ * @param in
* @param oid
* @param feature
+ * @throws IOException
*/
- private void receiveReferenceSet()
+ private void receiveReferenceSet(ExtendedDataInputStream in) throws IOException
{
// oid is not mapped for changes!
- long oid = receiveLong();
- int feature = receiveInt();
- long target = receiveLong();
- boolean content = receiveBoolean();
-
+ long oid = in.readLong();
+ int feature = in.readInt();
+ long target = in.readLong();
+ boolean containment = in.readBoolean();
if (target < 0)
{
target = resolveTempOID(target);
}
- if (isDebugEnabled())
+ if (TRACER.isEnabled())
{
- OIDEncoder oidEncoder = getMapper().getOidEncoder();
- debug("received reference set: oid=" + oidEncoder.toString(oid) + ", feature=" + feature
- + ", target=" + oidEncoder.toString(target) + ", content=" + content);
+ OIDEncoder oidEncoder = mapper.getOidEncoder();
+ TRACER.trace("received reference set: oid=" + oidEncoder.toString(oid) + ", feature="
+ + feature + ", target=" + oidEncoder.toString(target) + ", containment=" + containment);
}
- getMapper().insertReference(oid, feature, 0, target, content);
+ mapper.insertReference(oid, feature, 0, target, containment);
}
/**
+ * @param in
+ * @throws IOException
*
*/
- private void receiveReferenceUnset()
+ private void receiveReferenceUnset(ExtendedDataInputStream in) throws IOException
{
// oid is not mapped for changes!
- long oid = receiveLong();
- int feature = receiveInt();
-
- if (isDebugEnabled())
+ long oid = in.readLong();
+ int feature = in.readInt();
+ if (TRACER.isEnabled())
{
- OIDEncoder oidEncoder = getMapper().getOidEncoder();
- debug("received reference unset: oid=" + oidEncoder.toString(oid) + ", feature=" + feature);
+ OIDEncoder oidEncoder = mapper.getOidEncoder();
+ TRACER.trace("received reference unset: oid=" + oidEncoder.toString(oid) + ", feature="
+ + feature);
}
- getMapper().removeReference(oid, feature, 0);
+ mapper.removeReference(oid, feature, 0);
}
/**
+ * @param in
+ * @throws IOException
*
*/
- private void receiveReferenceAdd()
+ private void receiveReferenceAdd(ExtendedDataInputStream in) throws IOException
{
// oid is not mapped for changes!
- long oid = receiveLong();
- int feature = receiveInt();
- int ordinal = receiveInt() + 1;
- long target = receiveLong();
- boolean content = receiveBoolean();
-
+ long oid = in.readLong();
+ int feature = in.readInt();
+ int ordinal = in.readInt() + 1;
+ long target = in.readLong();
+ boolean containment = in.readBoolean();
if (target < 0)
{
target = resolveTempOID(target);
}
- if (isDebugEnabled())
+ if (TRACER.isEnabled())
{
- OIDEncoder oidEncoder = getMapper().getOidEncoder();
- debug("received reference add: oid=" + oidEncoder.toString(oid) + ", feature=" + feature
- + ", ordinal=" + ordinal + ", target=" + oidEncoder.toString(target) + ", content="
- + content);
+ OIDEncoder oidEncoder = mapper.getOidEncoder();
+ TRACER.trace("received reference add: oid=" + oidEncoder.toString(oid) + ", feature="
+ + feature + ", ordinal=" + ordinal + ", target=" + oidEncoder.toString(target)
+ + ", containment=" + containment);
}
if (ordinal == 0)
{
- ordinal = getMapper().getCollectionCount(oid, feature);
+ ordinal = mapper.getCollectionCount(oid, feature);
}
- getMapper().moveReferencesRelative(oid, feature, ordinal, Integer.MAX_VALUE, 1);
- getMapper().insertReference(oid, feature, ordinal, target, content);
+ mapper.moveReferencesRelative(oid, feature, ordinal, Integer.MAX_VALUE, 1);
+ mapper.insertReference(oid, feature, ordinal, target, containment);
}
/**
+ * @param in
+ * @throws IOException
*
*/
- private void receiveReferenceRemove()
+ private void receiveReferenceRemove(ExtendedDataInputStream in) throws IOException
{
// oid is not mapped for changes!
- long oid = receiveLong();
- int feature = receiveInt();
- int ordinal = receiveInt() + 1;
-
- if (isDebugEnabled())
+ long oid = in.readLong();
+ int feature = in.readInt();
+ int ordinal = in.readInt() + 1;
+ if (TRACER.isEnabled())
{
- OIDEncoder oidEncoder = getMapper().getOidEncoder();
- debug("receiveObjectChangesReferences(REMOVE, sourceId=" + oidEncoder.toString(oid)
+ OIDEncoder oidEncoder = mapper.getOidEncoder();
+ TRACER.trace("receiveObjectChangesReferences(REMOVE, sourceId=" + oidEncoder.toString(oid)
+ ", featureId=" + feature + ", sourceOrdinal=" + ordinal + ")");
}
- getMapper().removeReference(oid, feature, ordinal);
- getMapper().moveReferencesRelative(oid, feature, ordinal, Integer.MAX_VALUE, -1);
+ mapper.removeReference(oid, feature, ordinal);
+ mapper.moveReferencesRelative(oid, feature, ordinal, Integer.MAX_VALUE, -1);
}
/**
+ * @param in
+ * @throws IOException
*
*/
- private void receiveReferenceMove()
+ private void receiveReferenceMove(ExtendedDataInputStream in) throws IOException
{
// oid is not mapped for changes!
- long oid = receiveLong();
- int feature = receiveInt();
- int ordinal = receiveInt();
- int moveToIndex = receiveInt();
-
- if (isDebugEnabled())
+ long oid = in.readLong();
+ int feature = in.readInt();
+ int ordinal = in.readInt();
+ int moveToIndex = in.readInt();
+ if (TRACER.isEnabled())
{
- OIDEncoder oidEncoder = getMapper().getOidEncoder();
- debug("received reference move: oid=" + oidEncoder.toString(oid) + ", feature=" + feature
- + ", ordinal=" + ordinal + ", moveToIndex=" + moveToIndex);
+ OIDEncoder oidEncoder = mapper.getOidEncoder();
+ TRACER.trace("received reference move: oid=" + oidEncoder.toString(oid) + ", feature="
+ + feature + ", ordinal=" + ordinal + ", moveToIndex=" + moveToIndex);
}
ordinal++;
moveToIndex++;
-
- getMapper().moveReferenceAbsolute(oid, feature, -1, ordinal);
-
+ mapper.moveReferenceAbsolute(oid, feature, -1, ordinal);
if (moveToIndex > ordinal)
{
- getMapper().moveReferencesRelative(oid, feature, ordinal + 1, moveToIndex, -1);
+ mapper.moveReferencesRelative(oid, feature, ordinal + 1, moveToIndex, -1);
}
else if (moveToIndex < ordinal)
{
- getMapper().moveReferencesRelative(oid, feature, moveToIndex, ordinal - 1, 1);
+ mapper.moveReferencesRelative(oid, feature, moveToIndex, ordinal - 1, 1);
}
- getMapper().moveReferenceAbsolute(oid, feature, moveToIndex, -1);
+ mapper.moveReferenceAbsolute(oid, feature, moveToIndex, -1);
}
/**
@@ -468,19 +507,17 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
*/
private int lock(long oid, int oca)
{
- boolean ok = getMapper().lock(oid, oca);
-
+ boolean ok = mapper.lock(oid, oca);
if (!ok)
{
optimisticControlException = true;
-
- if (isDebugEnabled())
+ if (TRACER.isEnabled())
{
- debug("");
- debug("============================");
- debug("OPTIMISTIC CONTROL EXCEPTION");
- debug("============================");
- debug("");
+ TRACER.trace("");
+ TRACER.trace("============================");
+ TRACER.trace("OPTIMISTIC CONTROL EXCEPTION");
+ TRACER.trace("============================");
+ TRACER.trace("");
}
return oca;
@@ -500,33 +537,37 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
}
/**
+ * @param in
* @param info
* @param oid
+ * @throws IOException
* @throws InterruptedException
*/
- private void receiveAttributeChanges(long oid)
+ private void receiveAttributeChanges(ExtendedDataInputStream in, long oid) throws IOException
{
ClassInfo classInfo = null;
-
for (;;)
{
- int cid = receiveInt();
+ int cid = in.readInt();
if (cid == CDOProtocol.NO_MORE_SEGMENTS)
{
break;
}
- classInfo = getMapper().getPackageManager().getClassInfo(cid);
- receiveAttributeChangeSegment(oid, classInfo);
+ classInfo = mapper.getPackageManager().getClassInfo(cid);
+ receiveAttributeChangeSegment(in, oid, classInfo);
}
}
/**
+ * @param in
+ * @throws IOException
*
*/
- private void receiveAttributeChangeSegment(long oid, ClassInfo classInfo)
+ private void receiveAttributeChangeSegment(ExtendedDataInputStream in, long oid,
+ ClassInfo classInfo) throws IOException
{
- int count = receiveInt();
+ int count = in.readInt();
Object[] args = new Object[count + 1]; // last element is the oid
args[count] = oid;
int[] types = new int[count + 1];
@@ -538,14 +579,18 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
for (int i = 0; i < count; i++)
{
- int feature = receiveInt();
+ int feature = in.readInt();
AttributeInfo attributeInfo = classInfo.getAttributeInfo(feature);
- ColumnConverter converter = getMapper().getColumnConverter();
+ ColumnConverter converter = mapper.getColumnConverter();
- args[i] = converter.fromChannel(getChannel(), attributeInfo.getDataType());
+ args[i] = converter.fromChannel(in, attributeInfo.getDataType());
types[i] = attributeInfo.getColumnType();
- if (i > 0) sql.append(", ");
+ if (i > 0)
+ {
+ sql.append(", ");
+ }
+
sql.append(attributeInfo.getColumnName());
sql.append("=?");
}
@@ -553,19 +598,20 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
sql.append(" WHERE ");
sql.append(SQLConstants.USER_OID_COLUMN);
sql.append("=?");
-
- getMapper().sql(sql.toString(), args, types);
-
+ mapper.sql(sql.toString(), args, types);
}
- private void receiveObjectsToAttachAttributes(ClassInfo classInfo, long oid)
+ private void receiveObjectsToAttachAttributes(ExtendedDataInputStream in, ClassInfo classInfo,
+ long oid) throws IOException
{
- if (isDebugEnabled()) debug("receiveObjectsToAttachAttributes()");
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("receiveObjectsToAttachAttributes()");
+ }
while (classInfo != null)
{
AttributeInfo[] attributeInfos = classInfo.getAttributeInfos();
-
Object[] args = new Object[attributeInfos.length + 1]; // the first element is the oid
args[0] = oid;
@@ -575,22 +621,22 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
StringBuffer sql = new StringBuffer("INSERT INTO ");
sql.append(classInfo.getTableName());
sql.append(" VALUES(?");
-
for (int i = 0; i < attributeInfos.length; i++)
{
AttributeInfo attributeInfo = attributeInfos[i];
- if (isDebugEnabled()) debug("Receiving attribute " + attributeInfo.getName());
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Receiving attribute " + attributeInfo.getName());
+ }
- ColumnConverter converter = getMapper().getColumnConverter();
- args[i + 1] = converter.fromChannel(getChannel(), attributeInfo.getDataType());
+ ColumnConverter converter = mapper.getColumnConverter();
+ args[i + 1] = converter.fromChannel(in, attributeInfo.getDataType());
types[i + 1] = attributeInfo.getColumnType();
-
sql.append(", ?");
}
sql.append(")");
- getMapper().sql(sql.toString(), args, types);
-
+ mapper.sql(sql.toString(), args, types);
classInfo = classInfo.getParent();
}
}
@@ -599,30 +645,18 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
{
if (!changedObjectIds.isEmpty())
{
- Channel me = getChannel();
- ServerCDOProtocol cdo = (ServerCDOProtocol) me.getProtocol();
- cdo.fireInvalidationNotification(me, changedObjectIds);
+ ServerCDOProtocol cdo = (ServerCDOProtocol) getProtocol();
+ cdo.fireInvalidationNotification(cdo.getChannel(), changedObjectIds);
}
}
- private void transmitRescourceChanges()
+ private void transmitResourceChanges()
{
if (!newResources.isEmpty())
{
- Channel me = getChannel();
- ServerCDOProtocol cdo = (ServerCDOProtocol) me.getProtocol();
+ ServerCDOProtocol cdo = (ServerCDOProtocol) getProtocol();
ServerCDOResProtocol cdores = cdo.getServerCDOResProtocol();
cdores.fireResourcesChangedNotification(newResources);
}
}
-
- private Mapper getMapper()
- {
- if (mapper == null)
- {
- mapper = ((ServerCDOProtocol) getProtocol()).getMapper();
- }
-
- return mapper;
- }
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DeleteResourcesIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DeleteResourcesIndication.java
index feb2ff0..7b41df9 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DeleteResourcesIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DeleteResourcesIndication.java
@@ -11,14 +11,17 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.Channel;
-import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+import org.eclipse.net4j.signal.IndicationWithResponse;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
import org.eclipse.emf.cdo.core.CDOResProtocol;
import org.eclipse.emf.cdo.core.CDOResSignals;
import org.eclipse.emf.cdo.core.protocol.ResourceChangeInfo;
import org.eclipse.emf.cdo.server.Mapper;
import org.eclipse.emf.cdo.server.ServerCDOResProtocol;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
import org.springframework.transaction.TransactionException;
import org.springframework.transaction.TransactionStatus;
@@ -31,32 +34,50 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.io.IOException;
-public class DeleteResourcesIndication extends AbstractIndicationWithResponse implements
- CDOResSignals
+
+/**
+ * @author Eike Stepper
+ */
+public class DeleteResourcesIndication extends IndicationWithResponse implements CDOResSignals
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ DeleteResourcesIndication.class);
+
private boolean ok;
- public DeleteResourcesIndication()
+ private Mapper mapper;
+
+ private TransactionTemplate transactionTemplate;
+
+ public DeleteResourcesIndication(Mapper mapper, TransactionTemplate transactionTemplate)
{
+ this.mapper = mapper;
+ this.transactionTemplate = transactionTemplate;
}
- public short getSignalId()
+ @Override
+ protected short getSignalID()
{
return DELETE_RESOURCES;
}
- public void indicate()
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws IOException
{
Set<Integer> rids = new HashSet<Integer>();
for (;;)
{
- int rid = receiveInt();
- if (rid == CDOResProtocol.NO_MORE_RESOURCES) break;
+ int rid = in.readInt();
+ if (rid == CDOResProtocol.NO_MORE_RESOURCES)
+ {
+ break;
+ }
- if (isDebugEnabled())
+ if (TRACER.isEnabled())
{
- debug("Deleting rid " + rid);
+ TRACER.trace("Deleting rid " + rid);
}
rids.add(rid);
@@ -76,24 +97,21 @@ public class DeleteResourcesIndication extends AbstractIndicationWithResponse im
}
}
- public void respond()
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws IOException
{
- if (isDebugEnabled())
+ if (TRACER.isEnabled())
{
- debug("Deleted resources: " + ok);
+ TRACER.trace("Deleted resources: " + ok);
}
- transmitBoolean(ok);
+ out.writeBoolean(ok);
}
private Set<Long> deleteResources(final Set<Integer> rids)
{
try
{
- ServerCDOResProtocol protocol = (ServerCDOResProtocol) getProtocol();
- final Mapper mapper = protocol.getMapper();
-
- TransactionTemplate transactionTemplate = protocol.getTransactionTemplate();
return (Set<Long>) transactionTemplate.execute(new TransactionCallback()
{
public Object doInTransaction(TransactionStatus status)
@@ -109,7 +127,7 @@ public class DeleteResourcesIndication extends AbstractIndicationWithResponse im
}
catch (TransactionException ex)
{
- error("Error while committing transaction to database", ex);
+ CDOServer.LOG.error("Error while committing transaction to database", ex);
}
return null;
@@ -119,8 +137,7 @@ public class DeleteResourcesIndication extends AbstractIndicationWithResponse im
{
if (!changedObjectIds.isEmpty())
{
- Channel me = getChannel();
- ServerCDOResProtocol cdores = (ServerCDOResProtocol) me.getProtocol();
+ ServerCDOResProtocol cdores = (ServerCDOResProtocol) getProtocol();
cdores.fireInvalidationNotification(changedObjectIds);
}
}
@@ -129,12 +146,11 @@ public class DeleteResourcesIndication extends AbstractIndicationWithResponse im
{
if (!rids.isEmpty())
{
- Channel me = getChannel();
- ServerCDOResProtocol cdores = (ServerCDOResProtocol) me.getProtocol();
+ ServerCDOResProtocol cdores = (ServerCDOResProtocol) getProtocol();
cdores.fireRemovalNotification(rids);
}
}
-
+
private void transmitResourceChanges(Collection<Integer> rids)
{
if (!rids.isEmpty())
@@ -146,8 +162,7 @@ public class DeleteResourcesIndication extends AbstractIndicationWithResponse im
resourceChanges.add(info);
}
- Channel me = getChannel();
- ServerCDOResProtocol cdores = (ServerCDOResProtocol) me.getProtocol();
+ ServerCDOResProtocol cdores = (ServerCDOResProtocol) getProtocol();
cdores.fireResourcesChangedNotification(resourceChanges);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DescribePackageIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DescribePackageIndication.java
index 1f511e2..ba55aac 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DescribePackageIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/DescribePackageIndication.java
@@ -11,73 +11,101 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+import org.eclipse.net4j.signal.IndicationWithResponse;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
-import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.core.CDOSignals;
import org.eclipse.emf.cdo.server.AttributeInfo;
import org.eclipse.emf.cdo.server.ClassInfo;
import org.eclipse.emf.cdo.server.Mapper;
import org.eclipse.emf.cdo.server.PackageInfo;
-import org.eclipse.emf.cdo.server.ServerCDOProtocol;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.io.IOException;
-public class DescribePackageIndication extends AbstractIndicationWithResponse
+
+/**
+ * @author Eike Stepper
+ */
+public class DescribePackageIndication extends IndicationWithResponse
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ DescribePackageIndication.class);
+
+ private Mapper mapper;
+
private List<ClassInfo> infos;
- public short getSignalId()
+ public DescribePackageIndication(Mapper mapper)
{
- return CDOProtocol.DESCRIBE_PACKAGE;
+ this.mapper = mapper;
}
- public void indicate()
+ @Override
+ protected short getSignalID()
{
- int pid = getMapper().getNextPid();
- String packageName = receiveString();
- if (isDebugEnabled()) debug("Described package " + packageName);
+ return CDOSignals.DESCRIBE_PACKAGE;
+ }
- PackageInfo packageInfo = getMapper().getPackageManager().addPackage(pid, packageName);
- getMapper().insertPackage(packageInfo);
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws IOException
+ {
+ int pid = mapper.getNextPid();
+ String packageName = in.readString();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Described package " + packageName);
+ }
- infos = receiveClasses(packageInfo);
- getMapper().createAttributeTables(packageInfo);
+ PackageInfo packageInfo = mapper.getPackageManager().addPackage(pid, packageName);
+ mapper.insertPackage(packageInfo);
+
+ infos = receiveClasses(in, packageInfo);
+ mapper.createAttributeTables(packageInfo);
}
- public void respond()
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws IOException
{
- transmitInt(infos.size());
-
+ out.writeInt(infos.size());
for (Iterator<ClassInfo> iter = infos.iterator(); iter.hasNext();)
{
ClassInfo classInfo = iter.next();
- if (isDebugEnabled())
- debug("Responding class " + classInfo.getName() + " = " + classInfo.getCID());
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Responding class " + classInfo.getName() + " = " + classInfo.getCID());
+ }
- transmitInt(classInfo.getCID());
- transmitString(classInfo.getName());
+ out.writeInt(classInfo.getCID());
+ out.writeString(classInfo.getName());
}
}
- private List<ClassInfo> receiveClasses(PackageInfo packageInfo)
+ private List<ClassInfo> receiveClasses(ExtendedDataInputStream in, PackageInfo packageInfo)
+ throws IOException
{
List<ClassInfo> result = new ArrayList<ClassInfo>();
- int count = receiveInt();
-
+ int count = in.readInt();
for (int i = 0; i < count; i++)
{
- int cid = getMapper().getNextCID();
- String name = receiveString();
- String parentName = receiveString();
- String tableName = receiveString();
- if (isDebugEnabled()) debug("Described class " + name);
+ int cid = mapper.getNextCID();
+ String name = in.readString();
+ String parentName = in.readString();
+ String tableName = in.readString();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Described class " + name);
+ }
ClassInfo classInfo = packageInfo.addClass(cid, name, parentName, tableName);
- getMapper().insertClass(classInfo);
- receiveAttributes(classInfo);
+ mapper.insertClass(classInfo);
+ receiveAttributes(in, classInfo);
result.add(classInfo);
}
@@ -85,26 +113,25 @@ public class DescribePackageIndication extends AbstractIndicationWithResponse
return result;
}
- private void receiveAttributes(ClassInfo classInfo)
+ private void receiveAttributes(ExtendedDataInputStream in, ClassInfo classInfo)
+ throws IOException
{
- int count = receiveInt();
+ int count = in.readInt();
for (int i = 0; i < count; i++)
{
- String name = receiveString();
- int featureId = receiveInt();
- int dataType = receiveInt();
- String columnName = receiveString();
- int columnType = receiveInt();
- if (isDebugEnabled()) debug("Described attribute " + name);
+ String name = in.readString();
+ int featureId = in.readInt();
+ int dataType = in.readInt();
+ String columnName = in.readString();
+ int columnType = in.readInt();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Described attribute " + name);
+ }
AttributeInfo attributeInfo = classInfo.addAttribute(name, featureId, dataType, columnName,
columnType);
- getMapper().insertAttribute(attributeInfo, classInfo.getCID());
+ mapper.insertAttribute(attributeInfo, classInfo.getCID());
}
}
-
- private Mapper getMapper()
- {
- return ((ServerCDOProtocol) getProtocol()).getMapper();
- }
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidationNotificationRequest.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidationNotificationRequest.java
index d12b040..49925f1 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidationNotificationRequest.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/InvalidationNotificationRequest.java
@@ -11,35 +11,59 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.impl.AbstractRequest;
+import org.eclipse.net4j.signal.Request;
+import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
-import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.core.CDOSignals;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
+import java.io.IOException;
-public class InvalidationNotificationRequest extends AbstractRequest
+
+/**
+ * @author Eike Stepper
+ */
+public class InvalidationNotificationRequest extends Request
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ InvalidationNotificationRequest.class);
+
private Collection<Long> changedObjectIds;
- public InvalidationNotificationRequest(Collection<Long> changedObjectIds)
+ public InvalidationNotificationRequest(Channel channel, Collection<Long> changedObjectIds)
{
+ super(channel);
this.changedObjectIds = changedObjectIds;
}
- public short getSignalId()
+ @Override
+ protected short getSignalID()
{
- return CDOProtocol.INVALIDATION_NOTIFICATION;
+ return CDOSignals.INVALIDATION_NOTIFICATION;
}
- public void request()
+ @Override
+ protected void requesting(ExtendedDataOutputStream out) throws IOException
{
- transmitInt(changedObjectIds.size());
+ int size = changedObjectIds.size();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Transmitting " + size + " invalidations");
+ }
+
+ out.writeInt(size);
for (Long oid : changedObjectIds)
{
- transmitLong(oid);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Transmitting oid " + oid);
+ }
+
+ out.writeLong(oid);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadObjectIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadObjectIndication.java
index 599767a..ddbbf6e 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadObjectIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadObjectIndication.java
@@ -11,35 +11,54 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+import org.eclipse.net4j.signal.IndicationWithResponse;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
-import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.core.CDOSignals;
import org.eclipse.emf.cdo.server.Mapper;
-import org.eclipse.emf.cdo.server.ServerCDOProtocol;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
+import java.io.IOException;
-public class LoadObjectIndication extends AbstractIndicationWithResponse
+
+/**
+ * @author Eike Stepper
+ */
+public class LoadObjectIndication extends IndicationWithResponse
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ LoadObjectIndication.class);
+
+ private Mapper mapper;
+
private long oid;
- public short getSignalId()
+ public LoadObjectIndication(Mapper mapper)
+ {
+ this.mapper = mapper;
+ }
+
+ @Override
+ protected short getSignalID()
{
- return CDOProtocol.LOAD_OBJECT;
+ return CDOSignals.LOAD_OBJECT;
}
- public void indicate()
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws IOException
{
- oid = receiveLong();
- if (isDebugEnabled())
+ oid = in.readLong();
+ if (TRACER.isEnabled())
{
- Mapper mapper = ((ServerCDOProtocol) getProtocol()).getMapper();
- debug("Loading object " + mapper.getOidEncoder().toString(oid));
+ TRACER.trace("Loading object " + mapper.getOidEncoder().toString(oid));
}
}
- public void respond()
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws IOException
{
- Mapper mapper = ((ServerCDOProtocol) getProtocol()).getMapper();
- mapper.transmitObject(getChannel(), oid);
+ mapper.transmitObject(out, oid);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadResourceIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadResourceIndication.java
index eb141fb..fafa720 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadResourceIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/LoadResourceIndication.java
@@ -11,42 +11,58 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.Channel;
-import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+import org.eclipse.net4j.signal.IndicationWithResponse;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
-import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.core.CDOSignals;
import org.eclipse.emf.cdo.server.Mapper;
import org.eclipse.emf.cdo.server.ResourceInfo;
import org.eclipse.emf.cdo.server.ResourceManager;
-import org.eclipse.emf.cdo.server.ServerCDOProtocol;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
+import java.io.IOException;
-public class LoadResourceIndication extends AbstractIndicationWithResponse
+
+/**
+ * @author Eike Stepper
+ */
+public class LoadResourceIndication extends IndicationWithResponse
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ LoadResourceIndication.class);
+
+ private Mapper mapper;
+
private int rid;
- public short getSignalId()
+ public LoadResourceIndication(Mapper mapper)
{
- return CDOProtocol.LOAD_RESOURCE;
+ this.mapper = mapper;
}
- public void indicate()
+ @Override
+ protected short getSignalID()
{
- rid = receiveInt();
- if (isDebugEnabled())
+ return CDOSignals.LOAD_RESOURCE;
+ }
+
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws IOException
+ {
+ rid = in.readInt();
+ if (TRACER.isEnabled())
{
- debug("Loading rid " + rid);
+ TRACER.trace("Loading rid " + rid);
}
}
- public void respond()
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws IOException
{
- Mapper mapper = ((ServerCDOProtocol) getProtocol()).getMapper();
ResourceManager resourceManager = mapper.getResourceManager();
ResourceInfo resourceInfo = resourceManager.getResourceInfo(rid, mapper);
-
- Channel channel = getChannel();
- // ServerCDOProtocolImpl.setResourceInfo(channel, resourceInfo);
- mapper.transmitContent(channel, resourceInfo);
+ mapper.transmitContent(out, resourceInfo);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryAllResourcesIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryAllResourcesIndication.java
index 527115e..6c5b577 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryAllResourcesIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryAllResourcesIndication.java
@@ -11,34 +11,42 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.Protocol;
-import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+import org.eclipse.net4j.signal.IndicationWithResponse;
+import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
import org.eclipse.emf.cdo.core.CDOResSignals;
import org.eclipse.emf.cdo.server.Mapper;
-import org.eclipse.emf.cdo.server.ServerCDOResProtocol;
+import java.io.IOException;
-public class QueryAllResourcesIndication extends AbstractIndicationWithResponse implements
- CDOResSignals
+
+/**
+ * @author Eike Stepper
+ */
+public class QueryAllResourcesIndication extends IndicationWithResponse implements CDOResSignals
{
- public QueryAllResourcesIndication()
+ private Mapper mapper;
+
+ public QueryAllResourcesIndication(Mapper mapper)
{
+ this.mapper = mapper;
}
- public short getSignalId()
+ @Override
+ protected short getSignalID()
{
return QUERY_ALL_RESOURCES;
}
- public void indicate()
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws IOException
{
}
- public void respond()
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws IOException
{
- Protocol protocol = getProtocol();
- Mapper mapper = ((ServerCDOResProtocol) protocol).getMapper();
- mapper.transmitAllResources(channel);
+ mapper.transmitAllResources(out);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryExtentIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryExtentIndication.java
index aad9449..ab3061c 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryExtentIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryExtentIndication.java
@@ -11,36 +11,61 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+import org.eclipse.net4j.signal.IndicationWithResponse;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
-import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.core.CDOSignals;
import org.eclipse.emf.cdo.server.Mapper;
-import org.eclipse.emf.cdo.server.ServerCDOProtocol;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
+import java.io.IOException;
-public class QueryExtentIndication extends AbstractIndicationWithResponse
+
+/**
+ * @author Eike Stepper
+ */
+public class QueryExtentIndication extends IndicationWithResponse
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ QueryExtentIndication.class);
+
+ private Mapper mapper;
+
private int cid;
private boolean exactMatch;
private int rid;
- public short getSignalId()
+ public QueryExtentIndication(Mapper mapper)
{
- return CDOProtocol.QUERY_EXTENT;
+ this.mapper = mapper;
}
- public void indicate()
+ @Override
+ protected short getSignalID()
{
- cid = receiveInt();
- exactMatch = receiveBoolean();
- rid = receiveInt();
+ return CDOSignals.QUERY_EXTENT;
+ }
+
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws IOException
+ {
+ cid = in.readInt();
+ exactMatch = in.readBoolean();
+ rid = in.readInt();
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Received cid=" + cid + ", exactMatch=" + exactMatch + ", rid=" + rid);
+ }
}
- public void respond()
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws IOException
{
- Mapper mapper = ((ServerCDOProtocol) getProtocol()).getMapper();
- mapper.transmitExtent(getChannel(), cid, exactMatch, rid);
+ mapper.transmitExtent(out, cid, exactMatch, rid);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryXRefsIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryXRefsIndication.java
index d52954e..af5257d 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryXRefsIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryXRefsIndication.java
@@ -11,33 +11,58 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+import org.eclipse.net4j.signal.IndicationWithResponse;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
-import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.core.CDOSignals;
import org.eclipse.emf.cdo.server.Mapper;
-import org.eclipse.emf.cdo.server.ServerCDOProtocol;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
+import java.io.IOException;
-public class QueryXRefsIndication extends AbstractIndicationWithResponse
+
+/**
+ * @author Eike Stepper
+ */
+public class QueryXRefsIndication extends IndicationWithResponse
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ QueryXRefsIndication.class);
+
+ private Mapper mapper;
+
private long oid;
private int rid;
- public short getSignalId()
+ public QueryXRefsIndication(Mapper mapper)
{
- return CDOProtocol.QUERY_EXTENT;
+ this.mapper = mapper;
}
- public void indicate()
+ @Override
+ protected short getSignalID()
{
- oid = receiveLong();
- rid = receiveInt();
+ return CDOSignals.QUERY_EXTENT;
+ }
+
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws IOException
+ {
+ oid = in.readLong();
+ rid = in.readInt();
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Received oid=" + oid + ", rid=" + rid);
+ }
}
- public void respond()
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws IOException
{
- Mapper mapper = ((ServerCDOProtocol) getProtocol()).getMapper();
- mapper.transmitXRefs(getChannel(), oid, rid);
+ mapper.transmitXRefs(out, oid, rid);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/RemovalNotificationRequest.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/RemovalNotificationRequest.java
index d328650..530cec5 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/RemovalNotificationRequest.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/RemovalNotificationRequest.java
@@ -11,33 +11,59 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.impl.AbstractRequest;
+import org.eclipse.net4j.signal.Request;
+import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
-import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.core.CDOSignals;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
import java.util.Collection;
+import java.io.IOException;
-public class RemovalNotificationRequest extends AbstractRequest
+
+/**
+ * @author Eike Stepper
+ */
+public class RemovalNotificationRequest extends Request
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ RemovalNotificationRequest.class);
+
private Collection<Integer> rids;
- public RemovalNotificationRequest(Collection<Integer> rids)
+ public RemovalNotificationRequest(Channel channel, Collection<Integer> rids)
{
+ super(channel);
this.rids = rids;
}
- public short getSignalId()
+ @Override
+ protected short getSignalID()
{
- return CDOProtocol.REMOVAL_NOTIFICATION;
+ return CDOSignals.REMOVAL_NOTIFICATION;
}
- public void request()
+ @Override
+ protected void requesting(ExtendedDataOutputStream out) throws IOException
{
- transmitInt(rids.size());
+ int size = rids.size();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Transmitting " + size + " removals");
+ }
+
+ out.writeInt(size);
for (Integer rid : rids)
{
- transmitInt(rid);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Transmitting rid " + rid);
+ }
+
+ out.writeInt(rid);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcePathIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcePathIndication.java
index 9cc05cf..4a60971 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcePathIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcePathIndication.java
@@ -11,49 +11,77 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+import org.eclipse.net4j.signal.IndicationWithResponse;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
-import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.core.CDOSignals;
import org.eclipse.emf.cdo.server.Mapper;
import org.eclipse.emf.cdo.server.ResourceInfo;
import org.eclipse.emf.cdo.server.ResourceManager;
-import org.eclipse.emf.cdo.server.ServerCDOProtocol;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
+import java.io.IOException;
-public class ResourcePathIndication extends AbstractIndicationWithResponse
+
+/**
+ * @author Eike Stepper
+ */
+public class ResourcePathIndication extends IndicationWithResponse
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ ResourcePathIndication.class);
+
+ private Mapper mapper;
+
private String path;
- public short getSignalId()
+ public ResourcePathIndication(Mapper mapper)
+ {
+ this.mapper = mapper;
+ }
+
+ @Override
+ protected short getSignalID()
{
- return CDOProtocol.RESOURCE_PATH;
+ return CDOSignals.RESOURCE_PATH;
}
- public void indicate()
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws IOException
{
- path = receiveString();
- if (isDebugEnabled()) debug("Requested path " + path);
+ path = in.readString();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Requested path " + path);
+ }
}
- public void respond()
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws IOException
{
- Mapper mapper = ((ServerCDOProtocol) getProtocol()).getMapper();
ResourceManager resourceManager = mapper.getResourceManager();
ResourceInfo info = resourceManager.getResourceInfo(path, mapper);
-
if (info == null)
{
int rid = mapper.getNextRID();
resourceManager.registerResourceInfo(path, rid, 1);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("No resource with path " + path + " - reserving rid " + rid);
+ }
- if (isDebugEnabled()) debug("No resource with path " + path);
- if (isDebugEnabled()) debug("Reserving rid " + rid);
- transmitInt(-rid);
+ out.writeInt(-rid);
}
else
{
- if (isDebugEnabled()) debug("Responding rid " + info.getRID());
- transmitInt(info.getRID());
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Responding rid " + info.getRID());
+ }
+
+ out.writeInt(info.getRID());
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourceRIDIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourceRIDIndication.java
index 7cb3c1d..49a616f 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourceRIDIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourceRIDIndication.java
@@ -11,45 +11,75 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+import org.eclipse.net4j.signal.IndicationWithResponse;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataInputStream;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
-import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.core.CDOSignals;
import org.eclipse.emf.cdo.server.Mapper;
import org.eclipse.emf.cdo.server.ResourceInfo;
import org.eclipse.emf.cdo.server.ResourceManager;
-import org.eclipse.emf.cdo.server.ServerCDOProtocol;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
+import java.io.IOException;
-public class ResourceRIDIndication extends AbstractIndicationWithResponse
+
+/**
+ * @author Eike Stepper
+ */
+public class ResourceRIDIndication extends IndicationWithResponse
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ ResourceRIDIndication.class);
+
+ private Mapper mapper;
+
private int rid;
- public short getSignalId()
+ public ResourceRIDIndication(Mapper mapper)
{
- return CDOProtocol.RESOURCE_RID;
+ this.mapper = mapper;
}
- public void indicate()
+ @Override
+ protected short getSignalID()
{
- rid = receiveInt();
- if (isDebugEnabled()) debug("Requested rid " + rid);
+ return CDOSignals.RESOURCE_RID;
}
- public void respond()
+ @Override
+ protected void indicating(ExtendedDataInputStream in) throws IOException
+ {
+ rid = in.readInt();
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Requested rid " + rid);
+ }
+ }
+
+ @Override
+ protected void responding(ExtendedDataOutputStream out) throws IOException
{
- Mapper mapper = ((ServerCDOProtocol) getProtocol()).getMapper();
ResourceManager resourceManager = mapper.getResourceManager();
ResourceInfo info = resourceManager.getResourceInfo(rid, mapper);
-
if (info == null)
{
- if (isDebugEnabled()) debug("No resource with rid " + rid);
- transmitString(null);
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("No resource with rid " + rid);
+ }
+
+ out.writeString(null);
}
else
{
- if (isDebugEnabled()) debug("Responding path " + info.getPath());
- transmitString(info.getPath());
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Responding path " + info.getPath());
+ }
+
+ out.writeString(info.getPath());
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcesChangedRequest.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcesChangedRequest.java
index 79bebf2..afae679 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcesChangedRequest.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ResourcesChangedRequest.java
@@ -11,35 +11,61 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.impl.AbstractRequest;
+import org.eclipse.net4j.signal.Request;
+import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.util.om.ContextTracer;
+import org.eclipse.net4j.util.stream.ExtendedDataOutputStream;
import org.eclipse.emf.cdo.core.CDOResSignals;
import org.eclipse.emf.cdo.core.protocol.ResourceChangeInfo;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
import java.util.List;
+import java.io.IOException;
-public class ResourcesChangedRequest extends AbstractRequest
+
+/**
+ * @author Eike Stepper
+ */
+public class ResourcesChangedRequest extends Request
{
+ private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_PROTOCOL,
+ ResourcesChangedRequest.class);
+
private List<ResourceChangeInfo> infos;
- public ResourcesChangedRequest(List<ResourceChangeInfo> infos)
+ public ResourcesChangedRequest(Channel channel, List<ResourceChangeInfo> infos)
{
+ super(channel);
this.infos = infos;
}
- public short getSignalId()
+ @Override
+ protected short getSignalID()
{
return CDOResSignals.RESOURCES_CHANGED;
}
- public void request()
+ @Override
+ protected void requesting(ExtendedDataOutputStream out) throws IOException
{
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Transmitting " + infos.size() + " resource changes");
+ }
+
for (ResourceChangeInfo info : infos)
{
- info.transmit(getChannel());
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Transmitting changeKind=" + info.getChangeKind() + ", rid=" + info.getRID()
+ + ". path=" + info.getPath());
+ }
+
+ info.transmit(out);
}
- transmitByte(ResourceChangeInfo.NONE);
+ out.writeByte(ResourceChangeInfo.NONE);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOProtocolImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOProtocolImpl.java
index 4fc631f..34c8ef4 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOProtocolImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOProtocolImpl.java
@@ -11,23 +11,34 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.Channel;
-import org.eclipse.net4j.core.Indication;
-import org.eclipse.net4j.spring.ValidationException;
-import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.signal.Request;
+import org.eclipse.net4j.signal.SignalReactor;
+import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.transport.Protocol;
+import org.eclipse.net4j.transport.ProtocolFactory;
+import org.eclipse.net4j.transport.Connector.Type;
+import org.eclipse.net4j.util.Net4jUtil;
import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.core.ImplementationError;
import org.eclipse.emf.cdo.core.protocol.AbstractCDOProtocol;
import org.eclipse.emf.cdo.server.Mapper;
import org.eclipse.emf.cdo.server.ServerCDOProtocol;
import org.eclipse.emf.cdo.server.ServerCDOResProtocol;
import org.eclipse.emf.cdo.server.ServerCDOResProtocol.Listener;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
+
+import org.eclipse.internal.net4j.transport.AbstractProtocolFactory;
import org.springframework.transaction.support.TransactionTemplate;
import java.util.Collection;
+import java.util.Set;
+/**
+ * @author Eike Stepper
+ */
public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements ServerCDOProtocol,
Listener
{
@@ -37,49 +48,37 @@ public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements Server
protected ServerCDOResProtocol serverCDOResProtocol;
- public ServerCDOProtocolImpl()
- {
- }
-
- public int getType()
+ public ServerCDOProtocolImpl(Channel channel)
{
- return SERVER;
+ super(channel);
}
- public Indication createIndication(short signalId)
+ @Override
+ protected SignalReactor createSignalReactor(short signalID)
{
- switch (signalId)
+ switch (signalID)
{
case ANNOUNCE_PACKAGE:
- return new AnnouncePackageIndication();
-
+ return new AnnouncePackageIndication(mapper);
case DESCRIBE_PACKAGE:
- return new DescribePackageIndication();
-
+ return new DescribePackageIndication(mapper);
case RESOURCE_RID:
- return new ResourceRIDIndication();
-
+ return new ResourceRIDIndication(mapper);
case RESOURCE_PATH:
- return new ResourcePathIndication();
-
+ return new ResourcePathIndication(mapper);
case LOAD_RESOURCE:
- return new LoadResourceIndication();
-
+ return new LoadResourceIndication(mapper);
case LOAD_OBJECT:
- return new LoadObjectIndication();
-
+ return new LoadObjectIndication(mapper);
case COMMIT_TRANSACTION:
- return new CommitTransactionIndication();
-
+ return new CommitTransactionIndication(mapper, transactionTemplate);
case QUERY_EXTENT:
- return new QueryExtentIndication();
-
+ return new QueryExtentIndication(mapper);
case QUERY_XREFS:
- return new QueryXRefsIndication();
-
+ return new QueryXRefsIndication(mapper);
default:
- throw new ImplementationError("Invalid " + CDOProtocol.PROTOCOL_NAME + " signalId: "
- + signalId);
+ throw new ImplementationError("Invalid " + CDOProtocol.PROTOCOL_NAME + " signalID: "
+ + signalID);
}
}
@@ -90,7 +89,7 @@ public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements Server
public void setMapper(Mapper mapper)
{
- doSet("mapper", mapper);
+ this.mapper = mapper;
}
public TransactionTemplate getTransactionTemplate()
@@ -100,7 +99,7 @@ public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements Server
public void setTransactionTemplate(TransactionTemplate transactionTemplate)
{
- doSet("transactionTemplate", transactionTemplate);
+ this.transactionTemplate = transactionTemplate;
}
public ServerCDOResProtocol getServerCDOResProtocol()
@@ -110,7 +109,7 @@ public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements Server
public void setServerCDOResProtocol(ServerCDOResProtocol serverCDOResProtocol)
{
- doSet("serverCDOResProtocol", serverCDOResProtocol);
+ this.serverCDOResProtocol = serverCDOResProtocol;
}
public void notifyRemoval(ServerCDOResProtocol protocol, Collection<Integer> rids)
@@ -125,53 +124,65 @@ public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements Server
public void fireRemovalNotification(Collection<Integer> rids)
{
- for (Channel channel : getChannels())
+ for (Channel channel : getCDOServerChannels())
{
try
{
- RemovalNotificationRequest signal = new RemovalNotificationRequest(rids);
- channel.transmit(signal);
+ Request signal = new RemovalNotificationRequest(channel, rids);
+ signal.send();
}
catch (Exception ex)
{
- error("Error while transmitting removal notifications for rids " + rids, ex);
+ CDOServer.LOG.error("Error while transmitting removal notifications for rids " + rids, ex);
}
}
}
public void fireInvalidationNotification(Channel initiator, Collection<Long> changedObjectIds)
{
- for (Channel channel : getChannels())
+ for (Channel channel : getCDOServerChannels())
{
if (initiator == null || channel != initiator
&& channel.getConnector().getType() == initiator.getConnector().getType())
{
try
{
- InvalidationNotificationRequest signal = new InvalidationNotificationRequest(
- changedObjectIds);
- channel.transmit(signal);
+ Request signal = new InvalidationNotificationRequest(channel, changedObjectIds);
+ signal.send();
}
catch (Exception ex)
{
- error("Error while transmitting invalidation notifications for oids " + changedObjectIds, ex);
+ CDOServer.LOG.error("Error while transmitting invalidation notifications for oids "
+ + changedObjectIds, ex);
}
}
}
}
+ protected Collection<Channel> getCDOServerChannels()
+ {
+ return Net4jUtil.getChannels(getProtocolID(), ProtocolFactory.FOR_SERVERS);
+ }
+
@Override
- protected void validate() throws ValidationException
+ protected void onAboutToActivate() throws Exception
{
- super.validate();
- assertNotNull("mapper");
- assertNotNull("transactionTemplate");
+ super.onAboutToActivate();
+ if (mapper == null)
+ {
+ throw new IllegalStateException("mapper == null");
+ }
+
+ if (transactionTemplate == null)
+ {
+ throw new IllegalStateException("transactionTemplate == null");
+ }
}
@Override
- protected void activate() throws Exception
+ protected void onActivate() throws Exception
{
- super.activate();
+ super.onActivate();
if (serverCDOResProtocol != null)
{
serverCDOResProtocol.addListener(this);
@@ -179,13 +190,60 @@ public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements Server
}
@Override
- protected void deactivate() throws Exception
+ protected void onDeactivate() throws Exception
{
if (serverCDOResProtocol != null)
{
serverCDOResProtocol.removeListener(this);
+ serverCDOResProtocol = null;
}
- super.deactivate();
+ mapper = null;
+ transactionTemplate = null;
+ super.onDeactivate();
+ }
+
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Factory extends AbstractProtocolFactory
+ {
+ private Mapper mapper;
+
+ private TransactionTemplate transactionTemplate;
+
+ public Factory(Mapper mapper, TransactionTemplate transactionTemplate)
+ {
+ this.mapper = mapper;
+ this.transactionTemplate = transactionTemplate;
+ }
+
+ public Protocol createProtocol(Channel channel)
+ {
+ try
+ {
+ ServerCDOProtocolImpl protocol = new ServerCDOProtocolImpl(channel);
+ protocol.setMapper(mapper);
+ protocol.setTransactionTemplate(transactionTemplate);
+ protocol.activate();
+ return protocol;
+ }
+ catch (Exception ex)
+ {
+ CDOServer.LOG.error(ex);
+ return null;
+ }
+ }
+
+ public Set<Type> getConnectorTypes()
+ {
+ return ProtocolFactory.FOR_SERVERS;
+ }
+
+ public String getID()
+ {
+ return PROTOCOL_NAME;
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOResProtocolImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOResProtocolImpl.java
index 8634f46..d9a5aa0 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOResProtocolImpl.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOResProtocolImpl.java
@@ -11,23 +11,34 @@
package org.eclipse.emf.cdo.server.protocol;
-import org.eclipse.net4j.core.Channel;
-import org.eclipse.net4j.core.Indication;
-import org.eclipse.net4j.spring.ValidationException;
-import org.eclipse.net4j.util.ImplementationError;
-
+import org.eclipse.net4j.signal.Request;
+import org.eclipse.net4j.signal.SignalReactor;
+import org.eclipse.net4j.transport.Channel;
+import org.eclipse.net4j.transport.Protocol;
+import org.eclipse.net4j.transport.ProtocolFactory;
+import org.eclipse.net4j.transport.Connector.Type;
+import org.eclipse.net4j.util.Net4jUtil;
+
+import org.eclipse.emf.cdo.core.ImplementationError;
import org.eclipse.emf.cdo.core.protocol.AbstractCDOResProtocol;
import org.eclipse.emf.cdo.core.protocol.ResourceChangeInfo;
import org.eclipse.emf.cdo.server.Mapper;
import org.eclipse.emf.cdo.server.ServerCDOResProtocol;
+import org.eclipse.emf.cdo.server.internal.CDOServer;
+
+import org.eclipse.internal.net4j.transport.AbstractProtocolFactory;
import org.springframework.transaction.support.TransactionTemplate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Set;
+/**
+ * @author Eike Stepper
+ */
public class ServerCDOResProtocolImpl extends AbstractCDOResProtocol implements
ServerCDOResProtocol
{
@@ -37,27 +48,22 @@ public class ServerCDOResProtocolImpl extends AbstractCDOResProtocol implements
protected transient List<Listener> listeners = new ArrayList<Listener>();
- public ServerCDOResProtocolImpl()
- {
- }
-
- public int getType()
+ public ServerCDOResProtocolImpl(Channel channel)
{
- return SERVER;
+ super(channel);
}
- public Indication createIndication(short signalId)
+ @Override
+ protected SignalReactor createSignalReactor(short signalID)
{
- switch (signalId)
+ switch (signalID)
{
case QUERY_ALL_RESOURCES:
- return new QueryAllResourcesIndication();
-
+ return new QueryAllResourcesIndication(mapper);
case DELETE_RESOURCES:
- return new DeleteResourcesIndication();
-
+ return new DeleteResourcesIndication(mapper, transactionTemplate);
default:
- throw new ImplementationError("Invalid " + PROTOCOL_NAME + " signalId: " + signalId);
+ throw new ImplementationError("Invalid " + PROTOCOL_NAME + " signalID: " + signalID);
}
}
@@ -68,7 +74,7 @@ public class ServerCDOResProtocolImpl extends AbstractCDOResProtocol implements
public void setMapper(Mapper mapper)
{
- doSet("mapper", mapper);
+ this.mapper = mapper;
}
public TransactionTemplate getTransactionTemplate()
@@ -78,21 +84,21 @@ public class ServerCDOResProtocolImpl extends AbstractCDOResProtocol implements
public void setTransactionTemplate(TransactionTemplate transactionTemplate)
{
- doSet("transactionTemplate", transactionTemplate);
+ this.transactionTemplate = transactionTemplate;
}
public void fireResourcesChangedNotification(List<ResourceChangeInfo> resourceChanges)
{
- for (Channel channel : getChannels())
+ for (Channel channel : getCDOResServerChannels())
{
try
{
- ResourcesChangedRequest signal = new ResourcesChangedRequest(resourceChanges);
- channel.transmit(signal);
+ Request signal = new ResourcesChangedRequest(channel, resourceChanges);
+ signal.send();
}
catch (Exception ex)
{
- error("Error while notifying resource changes " + resourceChanges, ex);
+ CDOServer.LOG.error("Error while notifying resource changes " + resourceChanges, ex);
}
}
}
@@ -114,7 +120,7 @@ public class ServerCDOResProtocolImpl extends AbstractCDOResProtocol implements
listener.notifyRemoval(this, rids);
}
}
-
+
public void addListener(Listener listener)
{
listeners.add(listener);
@@ -125,10 +131,76 @@ public class ServerCDOResProtocolImpl extends AbstractCDOResProtocol implements
listeners.remove(listener);
}
- protected void validate() throws ValidationException
+ protected Collection<Channel> getCDOResServerChannels()
{
- super.validate();
- assertNotNull("mapper");
- assertNotNull("transactionTemplate");
+ return Net4jUtil.getChannels(getProtocolID(), ProtocolFactory.FOR_SERVERS);
+ }
+
+ @Override
+ protected void onAboutToActivate() throws Exception
+ {
+ super.onAboutToActivate();
+ if (mapper == null)
+ {
+ throw new IllegalStateException("mapper == null");
+ }
+
+ if (transactionTemplate == null)
+ {
+ throw new IllegalStateException("transactionTemplate == null");
+ }
+ }
+
+ @Override
+ protected void onDeactivate() throws Exception
+ {
+ listeners = null;
+ mapper = null;
+ transactionTemplate = null;
+ super.onDeactivate();
+ }
+
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Factory extends AbstractProtocolFactory
+ {
+ private Mapper mapper;
+
+ private TransactionTemplate transactionTemplate;
+
+ public Factory(Mapper mapper, TransactionTemplate transactionTemplate)
+ {
+ this.mapper = mapper;
+ this.transactionTemplate = transactionTemplate;
+ }
+
+ public Protocol createProtocol(Channel channel)
+ {
+ try
+ {
+ ServerCDOResProtocolImpl protocol = new ServerCDOResProtocolImpl(channel);
+ protocol.setMapper(mapper);
+ protocol.setTransactionTemplate(transactionTemplate);
+ protocol.activate();
+ return protocol;
+ }
+ catch (Exception ex)
+ {
+ CDOServer.LOG.error(ex);
+ return null;
+ }
+ }
+
+ public Set<Type> getConnectorTypes()
+ {
+ return ProtocolFactory.FOR_SERVERS;
+ }
+
+ public String getID()
+ {
+ return PROTOCOL_NAME;
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
index 74f4fc3..5efd9a9 100644
--- a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo.tests; singleton:=true
-Bundle-Version: 0.7.0.qualifier
+Bundle-Version: 0.8.0.qualifier
Bundle-Activator: org.eclipse.emf.cdo.tests.internal.CDOTestPlugin
Bundle-ClassPath: cdo.tests.jar
Bundle-Vendor: %providerName
@@ -12,6 +12,4 @@ Require-Bundle: org.eclipse.core.runtime,
org.junit,
org.eclipse.emf.cdo.client,
org.eclipse.emf.cdo.server,
- org.eclipse.net4j.embedded,
- org.eclipse.net4j.socket,
org.eclipse.emf.cdo.client.ocl
diff --git a/plugins/org.eclipse.emf.cdo.tests/launches/CDO All Tests.launch b/plugins/org.eclipse.emf.cdo.tests/launches/CDO All Tests.launch
index 5214bdc..5f94cac 100644
--- a/plugins/org.eclipse.emf.cdo.tests/launches/CDO All Tests.launch
+++ b/plugins/org.eclipse.emf.cdo.tests/launches/CDO All Tests.launch
@@ -4,21 +4,22 @@
<stringAttribute key="bootstrap" value=""/>
<booleanAttribute key="useProduct" value="false"/>
<stringAttribute key="deselected_workspace_plugins" value="org.eclipse.net4j.examples.mvc.swt,org.eclipse.net4j.examples.prov.client.ui,org.eclipse.net4j.examples.mvc,org.eclipse.net4j.examples.prov.server,org.eclipse.emf.cdo.dbgen.edit,org.eclipse.emf.cdo.examples.library,org.eclipse.emf.cdo.examples.library.ui,org.eclipse.emf.cdo.analysis.gmf,org.eclipse.emf.cdo.mapping.editor,org.eclipse.net4j.examples.server,org.eclipse.net4j.tests,org.eclipse.emf.cdo.doc,org.eclipse.datatools.enablement.mysql,org.eclipse.net4j.spring.tests,org.eclipse.emf.cdo,org.eclipse.emf.cdo.dbgen.editor,org.eclipse.net4j.examples.prov.edit,org.eclipse.emf.cdo.utilities.migrator,org.eclipse.emf.cdo.analysis,org.eclipse.emf.cdo.examples.server,org.eclipse.datatools.enablement.mysql.dbdefinition,org.eclipse.net4j.examples.prov,org.eclipse.emf.cdo.examples.client,org.eclipse.emf.cdo.examples.ui,org.eclipse.net4j.examples.client.ui,org.eclipse.net4j.examples.client,org.eclipse.net4j.doc,org.eclipse.net4j.examples.prov.client,org.eclipse.net4j.examples.prov.editor,org.eclipse.net4j"/>
-<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="tracing" value="true"/>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
</listAttribute>
-<stringAttribute key="selected_target_plugins" value="com.ibm.icu,org.apache.ant,org.apache.xerces,org.eclipse.ant.core,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.filesystem,org.eclipse.core.filesystem.win32.x86,org.eclipse.core.jobs,org.eclipse.core.resources,org.eclipse.core.resources.compatibility,org.eclipse.core.resources.win32,org.eclipse.core.runtime,org.eclipse.core.runtime.compatibility,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.core.variables,org.eclipse.emf.common,org.eclipse.emf.ecore,org.eclipse.emf.ecore.change,org.eclipse.emf.ecore.edit,org.eclipse.emf.ecore.xmi,org.eclipse.emf.edit,org.eclipse.emf.ocl,org.eclipse.equinox.common,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.osgi,org.eclipse.update.configurator,org.junit"/>
+<stringAttribute key="selected_target_plugins" value="com.ibm.icu,org.apache.ant,org.apache.xerces,org.eclipse.ant.core,org.eclipse.core.contenttype,org.eclipse.core.expressions,org.eclipse.core.filesystem,org.eclipse.core.filesystem.win32.x86,org.eclipse.core.jobs,org.eclipse.core.resources,org.eclipse.core.resources.compatibility,org.eclipse.core.resources.win32,org.eclipse.core.runtime,org.eclipse.core.runtime.compatibility,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.core.variables,org.eclipse.emf.common,org.eclipse.emf.ecore,org.eclipse.emf.ecore.change,org.eclipse.emf.ecore.edit,org.eclipse.emf.ecore.xmi,org.eclipse.emf.edit,org.eclipse.emf.ocl,org.eclipse.equinox.common,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.equinox.servlet.api,org.eclipse.osgi,org.eclipse.osgi.services,org.eclipse.update.configurator,org.junit"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="automaticValidate" value="true"/>
+<stringAttribute key="selectedPlugin" value="org.eclipse.net4j"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<booleanAttribute key="automaticAdd" value="false"/>
-<stringAttribute key="checked" value="[NONE]"/>
-<stringAttribute key="selected_workspace_plugins" value="org.eclipse.emf.cdo.jdbc,org.eclipse.net4j.spring,org.eclipse.net4j.socket,org.eclipse.net4j.core,org.eclipse.net4j.spring.db,org.eclipse.emf.cdo.dbgen,org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo.mapping,org.eclipse.emf.cdo.core,org.eclipse.emf.cdo.client,org.eclipse.net4j.util,org.eclipse.emf.cdo.server,org.eclipse.emf.cdo.client.ocl,org.eclipse.net4j.embedded,org.eclipse.emf.cdo.jdbc.derby,org.eclipse.emf.cdo.dbgen.derby,org.eclipse.emf.cdo.dbgen.oracle,org.eclipse.emf.cdo.jdbc.hsqldb,org.eclipse.emf.cdo.jdbc.mysql,org.eclipse.emf.cdo.dbgen.ansi92,org.eclipse.emf.cdo.dbgen.mysql,org.eclipse.emf.cdo.dbgen.hsqldb"/>
+<stringAttribute key="checked" value="org.eclipse.emf.cdo.client,org.eclipse.emf.cdo.client.ocl,org.eclipse.emf.cdo.core,org.eclipse.emf.cdo.dbgen,org.eclipse.emf.cdo.jdbc,org.eclipse.emf.cdo.server,org.eclipse.net4j"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
-<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<stringAttribute key="selected_workspace_plugins" value="org.eclipse.emf.cdo.jdbc,org.eclipse.emf.cdo.tests,org.eclipse.emf.cdo.mapping,org.eclipse.emf.cdo.core,org.eclipse.emf.cdo.client,org.eclipse.emf.cdo.dbgen,org.eclipse.emf.cdo.client.ocl,org.eclipse.emf.cdo.server,org.eclipse.net4j,org.eclipse.emf.cdo.jdbc.derby,org.eclipse.emf.cdo.dbgen.derby,org.eclipse.emf.cdo.dbgen.oracle,org.eclipse.emf.cdo.jdbc.hsqldb,org.eclipse.emf.cdo.jdbc.mysql,org.eclipse.emf.cdo.dbgen.ansi92,org.eclipse.emf.cdo.dbgen.mysql,org.eclipse.emf.cdo.dbgen.hsqldb"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
<booleanAttribute key="clearws" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.emf.cdo.tests.model1.AllTests"/>
<stringAttribute key="pde.version" value="3.2a"/>
@@ -26,8 +27,8 @@
<booleanAttribute key="default" value="false"/>
<booleanAttribute key="clearConfig" value="true"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.emf.cdo.tests"/>
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllSuites.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllSuites.java
index 83ad15b..f5a5736 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllSuites.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllSuites.java
@@ -47,6 +47,7 @@ public class AllSuites extends TestSuite
protected void populateSuite()
{
+ // String mode = ITopologyConstants.EMBEDDED_MODE;
for (String mode : ITopologyConstants.SELF_CONTAINED_MODES)
{
TestSuite topologySuite = new TestSuite("Mode " + mode);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EMFDetachTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EMFDetachTest.java
new file mode 100644
index 0000000..b10eafa
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EMFDetachTest.java
@@ -0,0 +1,131 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.tests;
+
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.change.ChangeDescription;
+import org.eclipse.emf.ecore.change.util.ChangeRecorder;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
+
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+
+public class EMFDetachTest extends TestCase
+{
+ private EClass treeNodeClass;
+
+ private EAttribute nameAttribute;
+
+ private EReference childrenReference;
+
+ private EPackage modelPackage;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ treeNodeClass = EcoreFactory.eINSTANCE.createEClass();
+ treeNodeClass.setName("TreeNode");
+
+ nameAttribute = EcoreFactory.eINSTANCE.createEAttribute();
+ nameAttribute.setName("nameAttribute");
+ nameAttribute.setEType(EcorePackage.eINSTANCE.getEString());
+
+ childrenReference = EcoreFactory.eINSTANCE.createEReference();
+ childrenReference.setName("childrenReference");
+ childrenReference.setEType(treeNodeClass);
+ childrenReference.setContainment(true);
+ childrenReference.setLowerBound(0);
+ childrenReference.setUpperBound(-1);
+
+ treeNodeClass.getEStructuralFeatures().add(nameAttribute);
+ treeNodeClass.getEStructuralFeatures().add(childrenReference);
+
+ modelPackage = EcoreFactory.eINSTANCE.createEPackage();
+ modelPackage.setName("modelPackage");
+ modelPackage.setNsPrefix("modelPackage");
+ modelPackage.setNsURI("http://modelPackage");
+ modelPackage.getEClassifiers().add(treeNodeClass);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ modelPackage = null;
+ childrenReference = null;
+ nameAttribute = null;
+ treeNodeClass = null;
+ super.tearDown();
+ }
+
+ public void testDetachSingle()
+ {
+ EObject root = createNode("root", null);
+ for (int i = 0; i < 5; i++)
+ {
+ createNode("child" + i, root);
+ }
+
+ Resource resource = new ResourceImpl();
+ resource.getContents().add(root);
+
+ System.out.println();
+ ChangeRecorder recorder = new ChangeRecorder(root);
+ removeNode(root, 2);
+ ChangeDescription changeDescription = recorder.endRecording();
+
+ System.out.println();
+ EList objectsToAttach = changeDescription.getObjectsToAttach();
+ for (Iterator it = objectsToAttach.iterator(); it.hasNext();)
+ {
+ EObject node = (EObject) it.next();
+ System.out.println("Node to attach: " + node.eGet(nameAttribute));
+
+ }
+
+ assertEquals(1, objectsToAttach.size());
+ }
+
+ private EObject createNode(String name, EObject parent)
+ {
+ EFactory factory = modelPackage.getEFactoryInstance();
+ EObject node = factory.create(treeNodeClass);
+ node.eSet(nameAttribute, name);
+
+ if (parent != null)
+ {
+ EList children = (EList) parent.eGet(childrenReference);
+ children.add(node);
+ }
+
+ System.out.println("Created node " + name);
+ return node;
+ }
+
+ private void removeNode(EObject parent, int index)
+ {
+ EList children = (EList) parent.eGet(childrenReference);
+ EObject child = (EObject) children.remove(index);
+ System.out.println("Removed node " + child.eGet(nameAttribute));
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/IOHelper.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/IOHelper.java
new file mode 100644
index 0000000..096661a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/IOHelper.java
@@ -0,0 +1,119 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.tests;
+
+
+import org.eclipse.net4j.util.IOUtil;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+
+
+public class IOHelper
+{
+ /**
+ * Copy chars from a <code>Reader</code> to a <code>Writer</code>.
+ *
+ * @param bufferSize
+ * Size of internal buffer to use.
+ */
+ public static void copy(Reader input, Writer output, int bufferSize) throws IOException
+ {
+ char buffer[] = new char[bufferSize];
+ int n = 0;
+ while ((n = input.read(buffer)) != -1)
+ {
+ output.write(buffer, 0, n);
+ }
+ }
+
+ public static void copy(InputStream input, OutputStream output, byte buffer[]) throws IOException
+ {
+ int n = 0;
+ while ((n = input.read(buffer)) != -1)
+ {
+ output.write(buffer, 0, n);
+ }
+ }
+
+ public static void copy(InputStream input, OutputStream output, int bufferSize)
+ throws IOException
+ {
+ copy(input, output, new byte[bufferSize]);
+ }
+
+ public static void copy(InputStream input, OutputStream output) throws IOException
+ {
+ copy(input, output, 4096);
+ }
+
+ public static void copy(File input, File output) throws IOException
+ {
+ FileInputStream fis = null;
+ FileOutputStream fos = null;
+ try
+ {
+ fis = new FileInputStream(input);
+ fos = new FileOutputStream(output);
+
+ copy(fis, fos);
+ }
+ finally
+ {
+ IOUtil.closeSilent(fis);
+ IOUtil.closeSilent(fos);
+ }
+ }
+
+ /**
+ * Read fully from reader
+ */
+ public static String readFully(Reader reader) throws IOException
+ {
+ StringWriter writer = new StringWriter();
+ copy(reader, writer, 1024);
+ return writer.toString();
+ }
+
+ /**
+ * Read fully from stream
+ */
+ public static String readFully(InputStream input) throws IOException
+ {
+ InputStreamReader reader = new InputStreamReader(input);
+ return readFully(reader);
+ }
+
+ /**
+ * Read fully from file
+ */
+ public static String readFully(File file) throws IOException
+ {
+ FileInputStream stream = null;
+ try
+ {
+ stream = new FileInputStream(file);
+ return readFully(stream);
+ }
+ finally
+ {
+ IOUtil.closeSilent(stream);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/internal/CDOTestPlugin.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/internal/CDOTestPlugin.java
index fa86dcf..dceb8de 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/internal/CDOTestPlugin.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/internal/CDOTestPlugin.java
@@ -11,10 +11,11 @@
package org.eclipse.emf.cdo.tests.internal;
-import org.eclipse.net4j.util.eclipse.AbstractPlugin;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
-public class CDOTestPlugin extends AbstractPlugin
+public class CDOTestPlugin implements BundleActivator
{
private static CDOTestPlugin instance;
@@ -28,4 +29,12 @@ public class CDOTestPlugin extends AbstractPlugin
{
return instance;
}
+
+ public void start(BundleContext context) throws Exception
+ {
+ }
+
+ public void stop(BundleContext context) throws Exception
+ {
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java
index 4894da5..d64151f 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java
@@ -177,6 +177,19 @@ public abstract class AbstractModel1Test extends AbstractTopologyTest
return node;
}
+ protected void createTree(ExtendedNode root, int levels, int children)
+ {
+ String name = root.getStringFeature();
+ for (int i = 0; i < children; i++)
+ {
+ ExtendedNode child = createExtended(name + (i + 1), root);
+ if (levels > 1)
+ {
+ createTree(child, levels - 1, children);
+ }
+ }
+ }
+
protected TreeNode findChild(String name, TreeNode parent)
{
return findNode(name, parent.getChildren());
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AllTests.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AllTests.java
index 4b5fdd1..cf250fc 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AllTests.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AllTests.java
@@ -28,7 +28,10 @@ public class AllTests
suite.addTestSuite(XRefsTest.class);
suite.addTestSuite(ExtentTest.class);
suite.addTestSuite(OCLTest.class);
+ suite.addTestSuite(BidiReferencesTest.class);
suite.addTestSuite(Bugzilla154389Test.class);
+ suite.addTestSuite(Bugzilla155899Test.class);
+ suite.addTestSuite(Bugzilla162017Test.class);
return suite;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BidiReferencesTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BidiReferencesTest.java
new file mode 100644
index 0000000..3ab026f
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BidiReferencesTest.java
@@ -0,0 +1,283 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.tests.model1;
+
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+import testmodel1.ExtendedNode;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+
+public class BidiReferencesTest extends AbstractModel1Test
+{
+ private static final int LEVELS = 3;
+
+ private static final int CHILDREN = 4;
+
+ private static final int NODECOUNT = getNodeCount(LEVELS, CHILDREN);
+
+ private static final int CHILDCOUNT = NODECOUNT - 1;
+
+ public void testBasicTree() throws Exception
+ {
+ ExtendedNode created = createExtended("node");
+ createTree(created, LEVELS, CHILDREN);
+ saveRoot(created, "/test/resource");
+
+ ExtendedNode loaded = (ExtendedNode) loadRoot("/test/resource");
+ assertTree("node", loaded, LEVELS, CHILDREN);
+
+ assertEquals(1, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_RESOURCE"));
+ assertEquals(NODECOUNT, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_OBJECT"));
+ assertEquals(NODECOUNT, jdbc().queryForInt("SELECT COUNT(*) FROM EXTENDED_NODE"));
+ assertEquals(CHILDCOUNT * 2, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+ assertEquals(CHILDCOUNT, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE WHERE CONTENT"));
+ }
+
+ public void testBasicBidis() throws Exception
+ {
+ ExtendedNode created = createExtended("node");
+ createTree(created, LEVELS, CHILDREN);
+ createBidi(created, "111", "211");
+ createBidi(created, "111", "212");
+ createBidi(created, "111", "213");
+ createBidi(created, "111", "311");
+ createBidi(created, "111", "312");
+ createBidi(created, "111", "313");
+ saveRoot(created, "/test/resource");
+
+ ExtendedNode loaded = (ExtendedNode) loadRoot("/test/resource");
+ assertTree("node", loaded, LEVELS, CHILDREN);
+ assertBidi(loaded, "111", "211");
+ assertBidi(loaded, "111", "212");
+ assertBidi(loaded, "111", "213");
+ assertBidi(loaded, "111", "311");
+ assertBidi(loaded, "111", "312");
+ assertBidi(loaded, "111", "313");
+
+ assertEquals(1, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_RESOURCE"));
+ assertEquals(NODECOUNT, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_OBJECT"));
+ assertEquals(NODECOUNT, jdbc().queryForInt("SELECT COUNT(*) FROM EXTENDED_NODE"));
+ assertEquals(CHILDCOUNT * 2 + 6 * 2, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+ assertEquals(CHILDCOUNT, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE WHERE CONTENT"));
+ }
+
+ public void testDetachCount() throws Exception
+ {
+ ExtendedNode created = createExtended("node"); // root node
+ createTree(created, LEVELS, CHILDREN); // tree of degree 4, height = root + 3
+ saveRoot(created, "/test/resource"); // commit
+ int expected = NODECOUNT;
+ assertEquals(expected, getNodeCount(created));
+ created.cdoGetResource().getResourceManager().close();
+
+ ExtendedNode loaded = (ExtendedNode) loadRoot("/test/resource"); // load another copy
+ assertEquals(expected, getNodeCount(loaded));
+ detachNode(loaded, "211"); // delete a leaf node
+ loaded.eResource().save(null); // commit
+ expected -= 1;
+ assertEquals(expected, getNodeCount(loaded));
+
+ detachNode(loaded, "4"); // delete a subtree
+ loaded.eResource().save(null); // commit
+ expected -= getNodeCount(LEVELS - 1, CHILDREN);
+ assertEquals(expected, getNodeCount(loaded));
+ }
+
+ public void testDetachWithoutBidi() throws Exception
+ {
+ ExtendedNode created = createExtended("node"); // root node
+ createTree(created, LEVELS, CHILDREN); // tree of degree 4, height = root + 3
+ saveRoot(created, "/test/resource"); // commit
+ int refs = CHILDCOUNT * 2; // expect num of refs = 2 per child
+ assertEquals(refs, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+ created.cdoGetResource().getResourceManager().close();
+
+ ExtendedNode loaded = (ExtendedNode) loadRoot("/test/resource"); // load another copy
+ detachNode(loaded, "211"); // delete a leaf node
+ loaded.eResource().save(null); // commit
+ refs -= 2; // expect -2 containment refs
+ assertEquals(refs, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+
+ detachNode(loaded, "4"); // delete a subtree
+ loaded.eResource().save(null); // commit
+ refs -= getNodeCount(LEVELS - 1, CHILDREN) * 2;
+ assertEquals(refs, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+ }
+
+ public void testDetachWithBidiSimple() throws Exception
+ {
+ ExtendedNode node = createExtended("node"); // root node
+ ExtendedNode node1 = createExtended("node1", node); // child node 1
+ ExtendedNode node2 = createExtended("node2", node); // child node 2
+
+ saveRoot(node, "/test/resource"); // commit
+ assertEquals(4, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+
+ node1.getBidiSource().add(node2);
+ node.eResource().save(null); // commit
+ assertEquals(6, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+
+ node.getChildren().remove(node1);
+ EList bidiTarget = node2.getBidiTarget();
+ assertTrue(bidiTarget.isEmpty());
+ node.eResource().save(null); // commit
+ assertEquals(2, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+ }
+
+ public void testDetachWithBidi() throws Exception
+ {
+ ExtendedNode created = createExtended("node"); // root node
+ createTree(created, LEVELS, CHILDREN); // tree of degree 4, height = root + 3
+ saveRoot(created, "/test/resource"); // commit
+ int refs = CHILDCOUNT * 2; // expect num of refs = 2 per child
+ assertEquals(refs, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+
+ // create 12 bidi refs
+ createBidi(created, "111", "211");
+ createBidi(created, "111", "212");
+ createBidi(created, "111", "213");
+ createBidi(created, "111", "214");
+ createBidi(created, "111", "311");
+ createBidi(created, "111", "312");
+ createBidi(created, "111", "313");
+ createBidi(created, "111", "314");
+ createBidi(created, "111", "411");
+ createBidi(created, "111", "412");
+ createBidi(created, "111", "413");
+ createBidi(created, "111", "414");
+ created.eResource().save(null); // commit
+ refs += 12 * 2; // expect 24 additional refs
+ assertEquals(refs, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+ created.cdoGetResource().getResourceManager().close();
+
+ ExtendedNode loaded = (ExtendedNode) loadRoot("/test/resource"); // load another copy
+ detachNode(loaded, "211"); // delete a leaf node with 1 bidi ref
+ loaded.eResource().save(null); // commit
+ refs -= 2 + 2; // expect -2 containment refs, -2 bidi refs
+ assertEquals(refs, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+ }
+
+ public void testRemoveBidi() throws Exception
+ {
+ ExtendedNode created = createExtended("node"); // root node
+ createTree(created, LEVELS, CHILDREN); // tree of degree 4, height = root + 3
+ saveRoot(created, "/test/resource"); // commit
+ int refs = CHILDCOUNT * 2; // expect num of refs = 2 per child
+ assertEquals(refs, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+
+ // create 12 bidi refs
+ createBidi(created, "111", "211");
+ createBidi(created, "111", "212");
+ createBidi(created, "111", "213");
+ createBidi(created, "111", "214");
+ createBidi(created, "111", "311");
+ createBidi(created, "111", "312");
+ createBidi(created, "111", "313");
+ createBidi(created, "111", "314");
+ createBidi(created, "111", "411");
+ createBidi(created, "111", "412");
+ createBidi(created, "111", "413");
+ createBidi(created, "111", "414");
+ created.eResource().save(null); // commit
+ refs += 12 * 2; // expect 24 additional refs
+ assertEquals(refs, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+ created.cdoGetResource().getResourceManager().close();
+
+ ExtendedNode loaded = (ExtendedNode) loadRoot("/test/resource"); // load another copy
+ ExtendedNode node211 = findPath(loaded, "211");
+ node211.getBidiSource().clear();
+ loaded.eResource().save(null); // commit
+ refs -= 2; // expect -2 bidi refs
+ assertEquals(refs, jdbc().queryForInt("SELECT COUNT(*) FROM CDO_REFERENCE"));
+ }
+
+ private void detachNode(ExtendedNode root, String path)
+ {
+ ExtendedNode node = findPath(root, path);
+ EList children = node.getParent().getChildren();
+ int size = children.size();
+ children.remove(node);
+ assertEquals(size - 1, children.size());
+ }
+
+ private void createBidi(ExtendedNode root, String path1, String path2)
+ {
+ ExtendedNode src = findPath(root, path1);
+ ExtendedNode dst = findPath(root, path2);
+ dst.getBidiSource().add(src);
+ }
+
+ private void assertBidi(ExtendedNode root, String path1, String path2)
+ {
+ ExtendedNode src = findPath(root, path1);
+ ExtendedNode dst = findPath(root, path2);
+ assertTrue(dst.getBidiSource().contains(src));
+ assertTrue(src.getBidiTarget().contains(dst));
+ }
+
+ private ExtendedNode findPath(ExtendedNode root, String path)
+ {
+ String name = "node";
+ List<String> list = new ArrayList<String>();
+ for (int i = 0; i < path.length(); i++)
+ {
+ name += path.charAt(i);
+ list.add(name);
+ }
+
+ return (ExtendedNode) findPath(list.toArray(new String[list.size()]), root);
+ }
+
+ private void assertTree(String name, ExtendedNode root, int levels, int children)
+ {
+ assertNode(name, root);
+ if (levels > 1)
+ {
+ assertEquals(children, root.getChildren().size());
+ for (int i = 0; i < children; i++)
+ {
+ assertTree(name + (i + 1), (ExtendedNode) root.getChildren().get(i), levels - 1, children);
+ }
+ }
+ }
+
+ private static int getNodeCount(EObject root)
+ {
+ int count = 1;
+ for (Iterator it = EcoreUtil.getAllContents(root, true); it.hasNext();)
+ {
+ it.next();
+ ++count;
+ }
+
+ return count;
+ }
+
+ private static int getNodeCount(int levels, int children)
+ {
+ int level = children;
+ int result = level;
+ for (int i = 1; i < levels; i++)
+ {
+ level *= children;
+ result += level;
+ }
+
+ return result + 1;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla154389Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla154389Test.java
index ef34403..e6ed88f 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla154389Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla154389Test.java
@@ -29,8 +29,6 @@ import testmodel1.TreeNode;
*
* So, it looks like the client and server don't match here.
*
- * Both client and server are current with CVS as of today.
- *
* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=154389
*/
public class Bugzilla154389Test extends AbstractModel1Test
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla162017Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla162017Test.java
new file mode 100644
index 0000000..4c5f525
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/Bugzilla162017Test.java
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.tests.model1;
+
+
+import testmodel1.ExtendedNode;
+
+
+/**
+ * transmit object change using incorrect EClass for attributes.
+ *
+ * When an attribute is changed in an EClass with a super class, and that
+ * attribute happens to be in the super class definition, the changes transmitted
+ * to the CDO server include the super class EClass, not the class that was modified.
+ *
+ * To temporarily fix this I added an new argument to the rememberAttributeChange()
+ * method. I added the EClass returned from the classInfo.getEClass() method.
+ * In this way rememberAttributeChange() does not depend of finding the EClass
+ * from the feature itself. A patch follows.
+ *
+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=162017
+ */
+public class Bugzilla162017Test extends AbstractModel1Test
+{
+ public void testChangeSuperClassAttribute() throws Exception
+ {
+ {
+ ExtendedNode node = createExtended("extended");
+ node.setBooleanFeature(true);
+ node.setIntFeature(4711);
+ node.setStringFeature("tree node feature");
+ node.setStringFeature2("extended node feature");
+ saveRoot(node, "/test/res");
+ }
+
+ {
+ ExtendedNode node = (ExtendedNode) loadRoot("/test/res");
+ assertEquals(true, node.isBooleanFeature());
+ assertEquals(4711, node.getIntFeature());
+ assertEquals("tree node feature", node.getStringFeature());
+ assertEquals("extended node feature", node.getStringFeature2());
+
+ node.setStringFeature("changed tree node feature");
+ node.eResource().save(null);
+ }
+
+ {
+ ExtendedNode node = (ExtendedNode) loadRoot("/test/res");
+ assertEquals(true, node.isBooleanFeature());
+ assertEquals(4711, node.getIntFeature());
+ assertEquals("changed tree node feature", node.getStringFeature());
+ assertEquals("extended node feature", node.getStringFeature2());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/NotificationTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/NotificationTest.java
index 234083c..8207bbc 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/NotificationTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/NotificationTest.java
@@ -30,7 +30,7 @@ public class NotificationTest extends AbstractModel1Test
final String RESOURCE = "/test/res";
final String ROOT = "root";
final String NEW_ROOT = "new root";
- final long TIME_LIMIT = 1000;
+ final long TIME_LIMIT = 10000;
// Client1 creates resource
TreeNode root = createNode(ROOT);
@@ -64,7 +64,7 @@ public class NotificationTest extends AbstractModel1Test
final String ROOT = "root";
final String CHILD = "a";
final String NEW_NAME = "a2";
- final long TIME_LIMIT = 1000;
+ final long TIME_LIMIT = 10000;
// Client1 creates resource
TreeNode root = createNode(ROOT);
@@ -100,7 +100,7 @@ public class NotificationTest extends AbstractModel1Test
final String ROOT = "root";
final String CHILD = "a";
final String NEW_NAME = "a2";
- final long TIME_LIMIT = 1000;
+ final long TIME_LIMIT = 10000;
// Client1 creates resource
TreeNode root = createNode(ROOT);
@@ -137,7 +137,7 @@ public class NotificationTest extends AbstractModel1Test
final String ROOT = "root";
final String CHILD = "a";
final String NEW_NAME = "a2";
- final long TIME_LIMIT = 1000;
+ final long TIME_LIMIT = 10000;
final boolean[] notificationReceived = { false};
// Client1 creates resource
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/SerializationTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/SerializationTest.java
index 1fd4876..1bfb44a 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/SerializationTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/SerializationTest.java
@@ -11,6 +11,8 @@
package org.eclipse.emf.cdo.tests.model1;
+import org.eclipse.emf.cdo.tests.IOHelper;
+
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
@@ -20,7 +22,7 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
-import org.eclipse.net4j.util.IOHelper;
+import org.eclipse.net4j.util.IOUtil;
import testmodel1.TreeNode;
@@ -200,8 +202,8 @@ public class SerializationTest extends AbstractModel1Test
}
finally
{
- IOHelper.close(is);
- IOHelper.close(os);
+ IOUtil.closeSilent(is);
+ IOUtil.closeSilent(os);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/AbstractTopology.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/AbstractTopology.java
deleted file mode 100644
index 299f443..0000000
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/AbstractTopology.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- **************************************************************************/
-package org.eclipse.emf.cdo.tests.topology;
-
-
-import org.eclipse.emf.cdo.client.ResourceManager;
-import org.eclipse.emf.cdo.tests.internal.CDOTestPlugin;
-
-import org.eclipse.emf.ecore.resource.ResourceSet;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.net4j.spring.Container;
-import org.eclipse.net4j.spring.impl.ContainerImpl;
-
-import org.osgi.framework.Bundle;
-
-import java.net.URL;
-
-
-public abstract class AbstractTopology implements ITopology
-{
- protected static final String NET4J_LOCATION = "META-INF/net4j/net4j.xml";
-
- protected static final String NET4J_CLIENT_LOCATION = "META-INF/net4j/client/net4j-client.xml";
-
- protected static final String NET4J_SERVER_LOCATION = "META-INF/net4j/server/net4j-server.xml";
-
- protected static final String NET4J_EMBEDDED_LOCATION = "META-INF/net4j/embedded/net4j-embedded.xml";
-
- protected static final String CDO_CLIENT_LOCATION = "META-INF/cdo/client/cdo-client.xml";
-
- protected static final String CDO_SERVER_LOCATION = "META-INF/cdo/server/cdo-server.xml";
-
- private String bundleLocation;
-
- private Container cdoClient;
-
- protected AbstractTopology()
- {
- }
-
- public void start() throws Exception
- {
- CDOTestPlugin plugin = CDOTestPlugin.getPlugin();
- Bundle bundle = plugin.getBundle();
- URL url = bundle.getEntry("/");
- bundleLocation = FileLocator.toFileURL(url).getFile();
- }
-
- public void stop() throws Exception
- {
- cdoClient.stop();
- cdoClient = null;
- }
-
- public ResourceManager createResourceManager(ResourceSet resourceSet)
- {
- ResourceManager resourceManager = (ResourceManager) cdoClient.getBean("resourceManager");
- resourceManager.setResourceSet(resourceSet);
-
- try
- {
- resourceManager.start();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- return null;
- }
-
- return resourceManager;
- }
-
- protected void createCDOClient(String name, Container parent)
- {
- cdoClient = createContainer(name, CDO_CLIENT_LOCATION, parent);
- }
-
- protected ContainerImpl createContainer(String name, String location, Container parent)
- {
- return new ContainerImpl(bundleLocation, location, name, parent, CDOTestPlugin.class
- .getClassLoader());
- }
-}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/AbstractTopologyTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/AbstractTopologyTest.java
index ab505cb..7337c1d 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/AbstractTopologyTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/AbstractTopologyTest.java
@@ -20,9 +20,11 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.springframework.jdbc.core.JdbcTemplate;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.PrintStreamLogHandler;
+import org.eclipse.net4j.util.om.PrintStreamTraceHandler;
-import java.io.IOException;
+import org.springframework.jdbc.core.JdbcTemplate;
import javax.sql.DataSource;
@@ -35,6 +37,12 @@ public abstract class AbstractTopologyTest extends TestCase implements ITopology
private ITopology topology;
+ private long startMemory;
+
+ private String label;
+
+ private static int run;
+
public String getMode()
{
return mode;
@@ -58,9 +66,17 @@ public abstract class AbstractTopologyTest extends TestCase implements ITopology
@Override
protected void setUp() throws Exception
{
+ OMPlatform.INSTANCE.addLogHandler(PrintStreamLogHandler.CONSOLE);
+ OMPlatform.INSTANCE.addTraceHandler(PrintStreamTraceHandler.CONSOLE);
+ OMPlatform.INSTANCE.setDebugging(true);
+
+ System.gc();
+ startMemory = getUsedMemory();
+
if (topology == null) topology = createTopology();
+ label = getName() + " [" + topology.getName() + "]";
System.out.println("=========================================================================");
- System.out.println("TC_START " + getName() + " [" + topology.getName() + "]");
+ System.out.println("TC_START " + label);
System.out.println("=========================================================================");
super.setUp();
@@ -70,19 +86,37 @@ public abstract class AbstractTopologyTest extends TestCase implements ITopology
@Override
protected void tearDown() throws Exception
{
- JdbcTemplate jdbc = getJdbcTemplate();
+ Thread.sleep(200);
+ JdbcTemplate jdbc = jdbc();
wipeDatabase(jdbc);
topology.stop();
+ topology = null;
super.tearDown();
+ System.gc();
+ long endMemory = getUsedMemory();
+
+ System.out.println("Memory-Delta " + getRun() + "\t " + (endMemory - startMemory));
System.out.println("=========================================================================");
- System.out.println("TC_END " + getName() + " [" + topology.getName() + "]");
+ System.out.println("TC_END " + label);
System.out.println("=========================================================================");
System.out.println();
System.out.println();
System.out.println();
System.out.println();
+ label = null;
+ mode = null;
+ }
+
+ private static long getUsedMemory()
+ {
+ return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
+ }
+
+ private static String getRun()
+ {
+ return String.format("%4d", new Object[] { ++run});
}
protected void wipeDatabase(JdbcTemplate jdbc)
@@ -113,20 +147,19 @@ public abstract class AbstractTopologyTest extends TestCase implements ITopology
return topology.getDataSource();
}
- protected JdbcTemplate getJdbcTemplate()
+ protected JdbcTemplate jdbc()
{
return new JdbcTemplate(getDataSource());
}
- protected ResourceManager createResourceManager(ResourceSet resourceSet)
+ protected ResourceManager createResourceManager(ResourceSet resourceSet) throws Exception
{
return topology.createResourceManager(resourceSet);
}
- protected ResourceManager createResourceManager()
+ protected ResourceManager createResourceManager() throws Exception
{
- ResourceSet resourceSet = new ResourceSetImpl();
- return topology.createResourceManager(resourceSet);
+ return createResourceManager(new ResourceSetImpl());
}
protected CDOResource createResource(String path, ResourceManager resourceManager)
@@ -135,7 +168,7 @@ public abstract class AbstractTopologyTest extends TestCase implements ITopology
return (CDOResource) resourceManager.createResource(uri);
}
- protected CDOResource createResource(String path)
+ protected CDOResource createResource(String path) throws Exception
{
return createResource(path, createResourceManager());
}
@@ -146,18 +179,18 @@ public abstract class AbstractTopologyTest extends TestCase implements ITopology
return (CDOResource) resourceManager.getResource(uri, true);
}
- protected CDOResource getResource(String path)
+ protected CDOResource getResource(String path) throws Exception
{
return getResource(path, createResourceManager());
}
- protected EObject loadRoot(String path) throws IOException
+ protected EObject loadRoot(String path) throws Exception
{
CDOResource resource = getResource(path);
return (EObject) resource.getContents().get(0);
}
- protected CDOResource saveRoot(EObject root, String path) throws IOException
+ protected CDOResource saveRoot(EObject root, String path) throws Exception
{
CDOResource resource = createResource(path);
resource.getContents().add(root);
@@ -167,33 +200,34 @@ public abstract class AbstractTopologyTest extends TestCase implements ITopology
protected ITopology createTopology()
{
- if (mode == null)
- {
- mode = System.getProperty(CDO_TEST_MODE_KEY, DEFAULT_MODE);
- }
-
- if (EMBEDDED_MODE.equalsIgnoreCase(mode))
- {
- return new EmbeddedTopology();
- }
-
- if (CLIENT_MODE.equalsIgnoreCase(mode))
- {
- return new ClientTopology();
- }
-
- if (CLIENT_SERVER_MODE.equalsIgnoreCase(mode))
- {
- return new ClientServerTopology();
- }
-
- if (CLIENT_SEPARATED_SERVER_MODE.equalsIgnoreCase(mode))
- {
- return new ClientSeparatedServerTopology();
- }
-
- fail("Topology not recognized: " + mode);
- return null; // Make compiler happy
+ return new ClientServerTopology();
+ // if (mode == null)
+ // {
+ // mode = System.getProperty(CDO_TEST_MODE_KEY, DEFAULT_MODE);
+ // }
+ //
+ // if (EMBEDDED_MODE.equalsIgnoreCase(mode))
+ // {
+ // return new EmbeddedTopology();
+ // }
+ //
+ // if (CLIENT_MODE.equalsIgnoreCase(mode))
+ // {
+ // return new ClientTopology();
+ // }
+ //
+ // if (CLIENT_SERVER_MODE.equalsIgnoreCase(mode))
+ // {
+ // return new ClientServerTopology();
+ // }
+ //
+ // if (CLIENT_SEPARATED_SERVER_MODE.equalsIgnoreCase(mode))
+ // {
+ // return new ClientSeparatedServerTopology();
+ // }
+ //
+ // fail("Topology not recognized: " + mode);
+ // return null; // Make compiler happy
}
protected void assertTrue(Object object)
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientSeparatedServerTopology.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientSeparatedServerTopology.java
index e4dede0..bf60469 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientSeparatedServerTopology.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientSeparatedServerTopology.java
@@ -11,26 +11,11 @@
package org.eclipse.emf.cdo.tests.topology;
-import org.eclipse.net4j.core.Acceptor;
-import org.eclipse.net4j.spring.Container;
-
import javax.sql.DataSource;
public class ClientSeparatedServerTopology extends AbstractTopology
{
- private Container serverNet4j;
-
- private Container net4jServer;
-
- private Container cdoServer;
-
- private Container clientNet4j;
-
- private Container net4jClient;
-
- private Acceptor acceptor;
-
public ClientSeparatedServerTopology()
{
}
@@ -62,17 +47,83 @@ public class ClientSeparatedServerTopology extends AbstractTopology
{
super.stop();
- //Stop client
- net4jClient.stop();
- clientNet4j.stop();
-
- //Stop server
- acceptor.stop();
- acceptor = null;
-
- cdoServer.stop();
- net4jServer.stop();
- serverNet4j.stop();
+ try
+ {
+ net4jClient.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ net4jClient = null;
+ }
+
+ try
+ {
+ clientNet4j.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ clientNet4j = null;
+ }
+
+ try
+ {
+ acceptor.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ acceptor = null;
+ }
+
+ try
+ {
+ cdoServer.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ cdoServer = null;
+ }
+
+ try
+ {
+ net4jServer.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ net4jServer = null;
+ }
+
+ try
+ {
+ serverNet4j.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ serverNet4j = null;
+ }
}
public DataSource getDataSource()
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientServerTopology.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientServerTopology.java
index c15bdc1..5258788 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientServerTopology.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientServerTopology.java
@@ -11,23 +11,76 @@
package org.eclipse.emf.cdo.tests.topology;
-import org.eclipse.net4j.core.Acceptor;
-import org.eclipse.net4j.spring.Container;
+import org.eclipse.emf.cdo.client.ResourceManager;
+import org.eclipse.emf.cdo.client.impl.AttributeConverterImpl;
+import org.eclipse.emf.cdo.client.impl.PackageManagerImpl;
+import org.eclipse.emf.cdo.client.impl.ResourceManagerImpl;
+import org.eclipse.emf.cdo.client.protocol.ClientCDOProtocolImpl;
+import org.eclipse.emf.cdo.client.protocol.ClientCDOResProtocolImpl;
+import org.eclipse.emf.cdo.core.impl.OIDEncoderImpl;
+import org.eclipse.emf.cdo.server.impl.ColumnConverterImpl;
+import org.eclipse.emf.cdo.server.impl.MapperImpl;
+import org.eclipse.emf.cdo.server.protocol.ServerCDOProtocolImpl;
+import org.eclipse.emf.cdo.server.protocol.ServerCDOResProtocolImpl;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+import org.eclipse.net4j.transport.BufferProvider;
+import org.eclipse.net4j.transport.Connector;
+import org.eclipse.net4j.transport.ProtocolFactory;
+import org.eclipse.net4j.transport.tcp.TCPAcceptor;
+import org.eclipse.net4j.transport.tcp.TCPSelector;
+import org.eclipse.net4j.util.Net4jUtil;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.registry.HashMapRegistry;
+import org.eclipse.net4j.util.registry.IRegistry;
+
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.jdbc.datasource.DriverManagerDataSource;
+import org.springframework.transaction.support.TransactionTemplate;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import javax.sql.DataSource;
-public class ClientServerTopology extends AbstractTopology
+public class ClientServerTopology implements ITopology
{
- private Container net4j;
+ public static final ExecutorService THREAD_POOL = Executors.newCachedThreadPool();
- private Container net4jServer;
+ private AttributeConverterImpl attributeConverter;
- private Container cdoServer;
+ private OIDEncoderImpl oidEncoder;
- private Container net4jClient;
+ private PackageManagerImpl clientPackageManager;
- private Acceptor acceptor;
+ private IRegistry<String, ProtocolFactory> clientRegistry;
+
+ private IRegistry<String, ProtocolFactory> serverRegistry;
+
+ private BufferProvider bufferPool;
+
+ private TCPSelector selector;
+
+ private TCPAcceptor acceptor;
+
+ private Connector connector;
+
+ private org.eclipse.emf.cdo.server.impl.PackageManagerImpl serverPackageManager;
+
+ private org.eclipse.emf.cdo.server.impl.ResourceManagerImpl serverResourceManager;
+
+ private ColumnConverterImpl columnConverter;
+
+ private DriverManagerDataSource dataSource;
+
+ private DataSourceTransactionManager transactionManager;
+
+ private TransactionTemplate transactionTemplate;
+
+ private JdbcTemplate jdbcTemplate;
public ClientServerTopology()
{
@@ -40,40 +93,111 @@ public class ClientServerTopology extends AbstractTopology
public void start() throws Exception
{
- super.start();
- net4j = createContainer("net4j", NET4J_LOCATION, null);
-
- // Start server
- net4jServer = createContainer("server", NET4J_SERVER_LOCATION, net4j);
- cdoServer = createContainer("cdo", CDO_SERVER_LOCATION, net4jServer);
-
- acceptor = (Acceptor) cdoServer.getBean("acceptor", Acceptor.class);
- acceptor.start();
-
- // Start client
- net4jClient = createContainer("client", NET4J_CLIENT_LOCATION, net4j);
- createCDOClient("cdo", net4jClient);
+ bufferPool = Net4jUtil.createBufferPool();
+ LifecycleUtil.activate(bufferPool);
+
+ selector = Net4jUtil.createTCPSelector();
+ LifecycleUtil.activate(selector);
+
+ oidEncoder = new OIDEncoderImpl();
+ oidEncoder.setFragmentBits(48);
+ LifecycleUtil.activate(oidEncoder);
+
+ // Server
+ columnConverter = new ColumnConverterImpl();
+ LifecycleUtil.activate(columnConverter);
+
+ serverPackageManager = new org.eclipse.emf.cdo.server.impl.PackageManagerImpl();
+ LifecycleUtil.activate(serverPackageManager);
+
+ serverResourceManager = new org.eclipse.emf.cdo.server.impl.ResourceManagerImpl();
+ LifecycleUtil.activate(serverResourceManager);
+
+ dataSource = new DriverManagerDataSource();
+ dataSource.setDriverClassName("org.hsqldb.jdbcDriver");
+ dataSource.setUrl("jdbc:hsqldb:.");
+ dataSource.setUsername("sa");
+
+ jdbcTemplate = new JdbcTemplate();
+ jdbcTemplate.setDataSource(dataSource);
+
+ MapperImpl mapper = new MapperImpl();
+ mapper.setColumnConverter(columnConverter);
+ mapper.setDataSource(dataSource);
+ mapper.setJdbcTemplate(jdbcTemplate);
+ mapper.setOidEncoder(oidEncoder);
+ mapper.setPackageManager(serverPackageManager);
+ mapper.setResourceManager(serverResourceManager);
+ mapper.setSqlDialectName("HSQLDB");
+ LifecycleUtil.activate(mapper);
+
+ transactionManager = new DataSourceTransactionManager();
+ transactionManager.setDataSource(dataSource);
+
+ transactionTemplate = new TransactionTemplate();
+
+ serverRegistry = new HashMapRegistry();
+ serverRegistry.register(new ServerCDOResProtocolImpl.Factory(mapper, transactionTemplate));
+ serverRegistry.register(new ServerCDOProtocolImpl.Factory(mapper, transactionTemplate));
+
+ acceptor = Net4jUtil.createTCPAcceptor(bufferPool, selector);
+ acceptor.setProtocolFactoryRegistry(serverRegistry);
+ acceptor.setReceiveExecutor(THREAD_POOL);
+ LifecycleUtil.activate(acceptor);
+
+ // Client
+ attributeConverter = new AttributeConverterImpl();
+ LifecycleUtil.activate(attributeConverter);
+
+ clientPackageManager = new PackageManagerImpl();
+ clientPackageManager.setAttributeConverter(attributeConverter);
+ clientPackageManager.setOidEncoder(oidEncoder);
+ clientPackageManager.setAutoPersistent(true);
+ LifecycleUtil.activate(clientPackageManager);
+
+ clientRegistry = new HashMapRegistry();
+ clientRegistry.register(new ClientCDOProtocolImpl.Factory());
+ clientRegistry.register(new ClientCDOResProtocolImpl.Factory());
+
+ connector = Net4jUtil.createTCPConnector(bufferPool, selector, "localhost");
+ connector.setProtocolFactoryRegistry(clientRegistry);
+ connector.setReceiveExecutor(THREAD_POOL);
+ LifecycleUtil.activate(connector);
}
public void stop() throws Exception
{
- super.stop();
+ LifecycleUtil.deactivate(connector);
+ connector = null;
- //Stop client
- net4jClient.stop();
+ LifecycleUtil.deactivate(selector);
+ selector = null;
- //Stop server
- acceptor.stop();
- acceptor = null;
+ LifecycleUtil.deactivate(bufferPool);
+ bufferPool = null;
- cdoServer.stop();
- net4jServer.stop();
+ LifecycleUtil.deactivate(clientPackageManager);
+ clientPackageManager = null;
- net4j.stop();
+ LifecycleUtil.deactivate(oidEncoder);
+ oidEncoder = null;
+
+ LifecycleUtil.deactivate(attributeConverter);
+ attributeConverter = null;
+ }
+
+ public ResourceManager createResourceManager(ResourceSet resourceSet) throws Exception
+ {
+ ResourceManagerImpl resourceManager = new ResourceManagerImpl();
+ resourceManager.setConnector(connector);
+ resourceManager.setPackageManager(clientPackageManager);
+ resourceManager.setResourceSet(resourceSet);
+ LifecycleUtil.activate(resourceManager);
+ return resourceManager;
}
public DataSource getDataSource()
{
- return (DataSource) cdoServer.getBean("dataSource");
+ return dataSource;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientTopology.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientTopology.java
index 80fd02d..1dcf97f 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientTopology.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ClientTopology.java
@@ -11,10 +11,9 @@
package org.eclipse.emf.cdo.tests.topology;
-import org.eclipse.net4j.spring.Container;
-
import javax.sql.DataSource;
+
/*
* TODO Test this topology (need external server for that)
*/
@@ -47,9 +46,31 @@ public class ClientTopology extends AbstractTopology
{
super.stop();
- //Stop client
- net4jClient.stop();
- net4j.stop();
+ try
+ {
+ net4jClient.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ net4jClient = null;
+ }
+
+ try
+ {
+ net4j.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ net4j = null;
+ }
}
public DataSource getDataSource()
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/EmbeddedTopology.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/EmbeddedTopology.java
index 1c0e12f..fb0040d 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/EmbeddedTopology.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/EmbeddedTopology.java
@@ -11,8 +11,6 @@
package org.eclipse.emf.cdo.tests.topology;
-import org.eclipse.net4j.spring.Container;
-
import javax.sql.DataSource;
@@ -45,9 +43,45 @@ public class EmbeddedTopology extends AbstractTopology
public void stop() throws Exception
{
super.stop();
- cdoServer.stop();
- net4jEmbedded.stop();
- net4j.stop();
+
+ try
+ {
+ cdoServer.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ cdoServer = null;
+ }
+
+ try
+ {
+ net4jEmbedded.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ net4jEmbedded = null;
+ }
+
+ try
+ {
+ net4j.stop();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ net4j = null;
+ }
}
public DataSource getDataSource()
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ITopology.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ITopology.java
index a3195c6..58aae5f 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ITopology.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ITopology.java
@@ -26,7 +26,7 @@ public interface ITopology
public void stop() throws Exception;
- public ResourceManager createResourceManager(ResourceSet resourceSet);
+ public ResourceManager createResourceManager(ResourceSet resourceSet) throws Exception;
public DataSource getDataSource();
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ITopologyConstants.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ITopologyConstants.java
index 52b16b4..f0e8358 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ITopologyConstants.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/topology/ITopologyConstants.java
@@ -24,17 +24,17 @@ public interface ITopologyConstants
public static final String EMBEDDED_MODE = "Embedded";
public static final String[] ALL_MODES = { //
- CLIENT_SEPARATED_SERVER_MODE, // 0
- CLIENT_SERVER_MODE, // 1
- CLIENT_MODE, // 2
- EMBEDDED_MODE // 3
- };
+ CLIENT_SEPARATED_SERVER_MODE, // 0
+ CLIENT_SERVER_MODE, // 1
+ CLIENT_MODE, // 2
+ EMBEDDED_MODE // 3
+ };
public static final String[] SELF_CONTAINED_MODES = { //
- CLIENT_SEPARATED_SERVER_MODE, // 0
- CLIENT_SERVER_MODE, // 1
- EMBEDDED_MODE // 2
- };
+ CLIENT_SEPARATED_SERVER_MODE, // 0
+ CLIENT_SERVER_MODE, // 1
+ EMBEDDED_MODE // 2
+ };
public static final String DEFAULT_MODE = EMBEDDED_MODE;
}