diff options
author | Eike Stepper | 2010-10-08 13:31:40 +0000 |
---|---|---|
committer | Eike Stepper | 2010-10-08 13:31:40 +0000 |
commit | 7bfe12fe5466a6f34e467252dcac8839ac3f1e4e (patch) | |
tree | 0b0a37ffbf5a44bbe5d763693d1b510bf5e3f938 | |
parent | 90e3fff4bb1b1c7f4c9734f1d43ccc97f12787d3 (diff) | |
download | cdo-7bfe12fe5466a6f34e467252dcac8839ac3f1e4e.tar.gz cdo-7bfe12fe5466a6f34e467252dcac8839ac3f1e4e.tar.xz cdo-7bfe12fe5466a6f34e467252dcac8839ac3f1e4e.zip |
[256931] Provide common query language
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256931
3 files changed, 103 insertions, 10 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java index 36b3c40e4a..1383175f86 100644 --- a/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java +++ b/plugins/org.eclipse.emf.cdo.server.ocl/src/org/eclipse/emf/cdo/server/ocl/OCLQueryHandler.java @@ -78,7 +78,7 @@ public class OCLQueryHandler implements IQueryHandler { String queryString = info.getQueryString(); Map<String, Object> parameters = new HashMap<String, Object>(info.getParameters()); - boolean legacyModeEnabled = false; // TODO Add this to CDOQueryInfo! + boolean legacyModeEnabled = true; // TODO Add this to CDOQueryInfo! CDOExtentMap extentMap = null; try diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java index 7b045f93cb..3a80d155f7 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java @@ -33,8 +33,13 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager; import org.eclipse.emf.cdo.spi.server.InternalRepository; import org.eclipse.emf.cdo.spi.server.InternalSession; import org.eclipse.emf.cdo.transaction.CDOTransaction; +import org.eclipse.emf.cdo.util.CDOUtil; +import org.eclipse.emf.cdo.view.CDOAdapterPolicy; import org.eclipse.emf.cdo.view.CDOFeatureAnalyzer; import org.eclipse.emf.cdo.view.CDOFetchRuleManager; +import org.eclipse.emf.cdo.view.CDOInvalidationPolicy; +import org.eclipse.emf.cdo.view.CDORevisionPrefetchingPolicy; +import org.eclipse.emf.cdo.view.CDOStaleReferencePolicy; import org.eclipse.emf.cdo.view.CDOView; import org.eclipse.emf.internal.cdo.session.SessionUtil; @@ -44,6 +49,8 @@ import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType; import org.eclipse.net4j.util.event.IListener; import org.eclipse.net4j.util.lifecycle.LifecycleException; import org.eclipse.net4j.util.lifecycle.LifecycleState; +import org.eclipse.net4j.util.options.IOptionsContainer; +import org.eclipse.net4j.util.ref.ReferenceType; import org.eclipse.net4j.util.ref.ReferenceValueMap; import org.eclipse.emf.common.notify.Adapter; @@ -69,8 +76,13 @@ import java.util.Set; /** * @author Eike Stepper */ -public class ServerCDOView extends AbstractCDOView +public class ServerCDOView extends AbstractCDOView implements org.eclipse.emf.cdo.view.CDOView.Options { + private static final CDOAdapterPolicy[] ADAPTER_POLICIES = new CDOAdapterPolicy[0]; + + private static final CDORevisionPrefetchingPolicy REVISION_PREFETCHING = CDOUtil + .createRevisionPrefetchingPolicy(NO_REVISION_PREFETCHING); + private InternalCDOSession session; private CDORevisionProvider revisionProvider; @@ -83,7 +95,7 @@ public class ServerCDOView extends AbstractCDOView this.revisionProvider = revisionProvider; setViewSet(SessionUtil.prepareResourceSet(new ResourceSetImpl())); - setObjects(new ReferenceValueMap.Soft<CDOID, InternalCDOObject>()); + setObjects(new ReferenceValueMap.Weak<CDOID, InternalCDOObject>()); activate(); } @@ -102,6 +114,11 @@ public class ServerCDOView extends AbstractCDOView return getTimeStamp(); } + public Options options() + { + return this; + } + public InternalCDORevision getRevision(CDOID id, boolean loadOnDemand) { return (InternalCDORevision)revisionProvider.getRevision(id); @@ -134,11 +151,6 @@ public class ServerCDOView extends AbstractCDOView throw new UnsupportedOperationException(); } - public Options options() - { - throw new UnsupportedOperationException(); - } - public boolean waitForUpdate(long updateTime, long timeoutMillis) { throw new UnsupportedOperationException(); @@ -210,6 +222,86 @@ public class ServerCDOView extends AbstractCDOView return false; } + public IOptionsContainer getContainer() + { + return this; + } + + public ReferenceType getCacheReferenceType() + { + return ReferenceType.WEAK; + } + + public boolean setCacheReferenceType(ReferenceType referenceType) + { + throw new UnsupportedOperationException(); + } + + public CDOInvalidationPolicy getInvalidationPolicy() + { + return CDOInvalidationPolicy.DEFAULT; + } + + public void setInvalidationPolicy(CDOInvalidationPolicy policy) + { + throw new UnsupportedOperationException(); + } + + public boolean isInvalidationNotificationEnabled() + { + return false; + } + + public void setInvalidationNotificationEnabled(boolean enabled) + { + throw new UnsupportedOperationException(); + } + + public CDOAdapterPolicy[] getChangeSubscriptionPolicies() + { + return ADAPTER_POLICIES; + } + + public void addChangeSubscriptionPolicy(CDOAdapterPolicy policy) + { + throw new UnsupportedOperationException(); + } + + public void removeChangeSubscriptionPolicy(CDOAdapterPolicy policy) + { + throw new UnsupportedOperationException(); + } + + public CDOAdapterPolicy getStrongReferencePolicy() + { + return CDOAdapterPolicy.ALL; + } + + public void setStrongReferencePolicy(CDOAdapterPolicy policy) + { + throw new UnsupportedOperationException(); + } + + public CDOStaleReferencePolicy getStaleReferenceBehaviour() + { + return CDOStaleReferencePolicy.EXCEPTION; + } + + public void setStaleReferenceBehaviour(CDOStaleReferencePolicy policy) + { + throw new UnsupportedOperationException(); + } + + public CDORevisionPrefetchingPolicy getRevisionPrefetchingPolicy() + { + return REVISION_PREFETCHING; + } + + public void setRevisionPrefetchingPolicy(CDORevisionPrefetchingPolicy prefetchingPolicy) + { + throw new UnsupportedOperationException(); + } + /** * @author Eike Stepper */ diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java index b718348fa3..baa66dbac1 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/OCLQueryTest.java @@ -124,11 +124,12 @@ public class OCLQueryTest extends AbstractCDOTest public void test() throws Exception { + SalesOrder salesOrder = salesOrders.get(0); CDOQuery query = transaction.createQuery("ocl", "self.orderDetails"); - query.setParameter("context", salesOrders.get(0)); + query.setParameter("context", salesOrder); List<OrderDetail> orderDetails = query.getResult(OrderDetail.class); - assertEquals(NUM_OF_PRODUCTS, orderDetails.size()); + assertEquals(salesOrder.getOrderDetails().size(), orderDetails.size()); } public void testProductIterator() throws Exception |