Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo')
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Mapper.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/MapperImpl.java24
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/impl/SQLConstants.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/CommitTransactionIndication.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryXRefsIndication.java43
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/ServerCDOProtocolImpl.java3
6 files changed, 80 insertions, 1 deletions
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 66eb60e00f..7fe1225916 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
@@ -77,6 +77,8 @@ public interface Mapper extends Service
public void transmitExtent(Channel channel, int cid, boolean exactMatch, int rid);
+ public void transmitXRefs(Channel channel, long oid, int rid);
+
public void createAttributeTables(PackageInfo packageInfo);
public void insertResource(int rid, String path);
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 90bd517bd6..411878d684 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
@@ -939,7 +939,31 @@ public class MapperImpl extends ServiceImpl implements Mapper, SQLConstants
});
channel.transmitLong(CDOProtocol.NO_MORE_OBJECTS);
+ }
+
+ public void transmitXRefs(final Channel channel, final long oid, int rid)
+ {
+ Object[] args = { new Long(oid)};
+ if (isDebugEnabled()) debug(StringHelper.replaceWildcards(SELECT_XREFS_OF_OBJECT, "?", args));
+ jdbcTemplate.query(SELECT_XREFS_OF_OBJECT, args, new RowCallbackHandler()
+ {
+ public void processRow(ResultSet resultSet) throws SQLException
+ {
+ long referer = resultSet.getLong(1);
+ int feature = resultSet.getInt(2);
+ int cid = resultSet.getInt(3);
+ if (isDebugEnabled())
+ debug("XRef: referer=" + oidEncoder.toString(referer) + ", feature=" + feature + ", cid="
+ + cid);
+
+ channel.transmitLong(referer);
+ channel.transmitInt(feature);
+ channel.transmitInt(cid);
+ }
+ });
+
+ channel.transmitLong(CDOProtocol.NO_MORE_OBJECTS);
}
public void createAttributeTables(PackageInfo packageInfo)
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 e89ae95e92..7b0ceef1c9 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
@@ -135,6 +135,13 @@ public interface SQLConstants
+ "=? AND " + REFERENCE_TABLE + "." + REFERENCE_OID_COLUMN + "=" + OBJECT_TABLE + "."
+ OBJECT_OID_COLUMN;
+ public static final String SELECT_XREFS_OF_OBJECT = "SELECT " + REFERENCE_TABLE + "."
+ + 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_OID_COLUMN + "=" + OBJECT_TABLE + "." + OBJECT_OID_COLUMN;
+
public static final String SELECT_ALL_RESOURCES = "SELECT " + RESOURCE_RID_COLUMN + ", "
+ RESOURCE_PATH_COLUMN + " FROM " + RESOURCE_TABLE;
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 e7e8f0c543..6068090a6e 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
@@ -150,7 +150,7 @@ public class CommitTransactionIndication extends AbstractIndicationWithResponse
{
long oid = receiveLong();
- if (oid == 0)
+ if (oid == CDOProtocol.NO_MORE_OBJECTS)
{
break;
}
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
new file mode 100644
index 0000000000..d52954e8f9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/protocol/QueryXRefsIndication.java
@@ -0,0 +1,43 @@
+/***************************************************************************
+ * 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.protocol;
+
+
+import org.eclipse.net4j.core.impl.AbstractIndicationWithResponse;
+
+import org.eclipse.emf.cdo.core.CDOProtocol;
+import org.eclipse.emf.cdo.server.Mapper;
+import org.eclipse.emf.cdo.server.ServerCDOProtocol;
+
+
+public class QueryXRefsIndication extends AbstractIndicationWithResponse
+{
+ private long oid;
+
+ private int rid;
+
+ public short getSignalId()
+ {
+ return CDOProtocol.QUERY_EXTENT;
+ }
+
+ public void indicate()
+ {
+ oid = receiveLong();
+ rid = receiveInt();
+ }
+
+ public void respond()
+ {
+ Mapper mapper = ((ServerCDOProtocol) getProtocol()).getMapper();
+ mapper.transmitXRefs(getChannel(), oid, rid);
+ }
+}
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 3da09f3ad8..b0a3eb284b 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
@@ -69,6 +69,9 @@ public class ServerCDOProtocolImpl extends AbstractCDOProtocol implements Server
case QUERY_EXTENT:
return new QueryExtentIndication();
+ case QUERY_XREFS:
+ return new QueryXRefsIndication();
+
default:
throw new ImplementationError("Invalid " + CDOProtocol.PROTOCOL_NAME + " signalId: "
+ signalId);

Back to the top