diff options
author | Eike Stepper | 2010-07-05 12:41:13 +0000 |
---|---|---|
committer | Eike Stepper | 2010-07-05 12:41:13 +0000 |
commit | 97aff316c9b855723991bf052f2907693e76ee1f (patch) | |
tree | 99121e02dc70334bda0d01db7984aa291cfbe88c /plugins/org.eclipse.emf.cdo.server.net4j/src | |
parent | cbd68ba48a0f1b186c4fde0cb86d728b51b5dd66 (diff) | |
download | cdo-97aff316c9b855723991bf052f2907693e76ee1f.tar.gz cdo-97aff316c9b855723991bf052f2907693e76ee1f.tar.xz cdo-97aff316c9b855723991bf052f2907693e76ee1f.zip |
[300149] Support remote cross referencing with a convenient API on the client and SPI on the server for the stores to implement
https://bugs.eclipse.org/bugs/show_bug.cgi?id=300149
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.net4j/src')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/QueryIndication.java | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/QueryIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/QueryIndication.java index 38e4ddc3d3..fd416aca46 100644 --- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/QueryIndication.java +++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/QueryIndication.java @@ -11,6 +11,7 @@ */ package org.eclipse.emf.cdo.server.internal.net4j.protocol; +import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.protocol.CDODataInput; import org.eclipse.emf.cdo.common.protocol.CDODataOutput; import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; @@ -23,6 +24,8 @@ import org.eclipse.emf.cdo.spi.server.InternalView; import org.eclipse.net4j.util.om.trace.ContextTracer; +import org.eclipse.emf.ecore.EReference; + import java.io.IOException; /** @@ -32,6 +35,8 @@ public class QueryIndication extends CDOReadIndication { private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_PROTOCOL, QueryIndication.class); + private boolean xrefs; + private InternalQueryResult queryResult; public QueryIndication(CDOServerProtocol protocol) @@ -43,10 +48,13 @@ public class QueryIndication extends CDOReadIndication protected void indicating(CDODataInput in) throws IOException { int viewID = in.readInt(); - CDOQueryInfo cdoQuery = new CDOQueryInfoImpl(in); // TODO Add CDODataInput.readCDOQueryInfo() InternalView view = getSession().getView(viewID); + + CDOQueryInfo queryInfo = new CDOQueryInfoImpl(in); + xrefs = queryInfo.getQueryLanguage().equals(CDOProtocolConstants.QUERY_LANGUAGE_XREFS); + InternalQueryManager queryManager = getRepository().getQueryManager(); - queryResult = queryManager.execute(view, cdoQuery); + queryResult = queryManager.execute(view, queryInfo); } @Override @@ -64,7 +72,26 @@ public class QueryIndication extends CDOReadIndication // Object to return numberOfResults++; out.writeBoolean(true); - out.writeCDORevisionOrPrimitive(object); + + if (xrefs) + { + Object[] values = (Object[])object; + CDOID targetID = (CDOID)values[0]; + CDOID sourceID = (CDOID)values[1]; + EReference sourceReference = (EReference)values[2]; + int sourceIndex = (Integer)values[3]; + + out.writeCDOID(targetID); + out.writeCDOID(sourceID); + out.writeCDOClassifierRef(sourceReference.eClass()); + out.writeString(sourceReference.getName()); + out.writeInt(sourceIndex); + } + else + { + out.writeCDORevisionOrPrimitive(object); + } + if (queryResult.peek() == null) { flush(); |