diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java new file mode 100644 index 0000000000..d02b9fa470 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/NOOPStoreAccessor.java @@ -0,0 +1,154 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 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.internal.server; + +import org.eclipse.emf.cdo.internal.protocol.model.CDOPackageImpl; +import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl; +import org.eclipse.emf.cdo.protocol.CDOID; +import org.eclipse.emf.cdo.protocol.model.CDOClassRef; +import org.eclipse.emf.cdo.protocol.model.CDOFeature; +import org.eclipse.emf.cdo.protocol.model.CDOPackageInfo; +import org.eclipse.emf.cdo.protocol.revision.CDORevision; +import org.eclipse.emf.cdo.server.ISession; +import org.eclipse.emf.cdo.server.IStoreChunkReader; +import org.eclipse.emf.cdo.server.IStoreWriter; +import org.eclipse.emf.cdo.server.IView; + +import org.eclipse.net4j.util.io.CloseableIterator; + +import java.util.Collection; +import java.util.Collections; + +/** + * @author Eike Stepper + */ +public class NOOPStoreAccessor implements IStoreWriter +{ + private NOOPStore store; + + private Object context; + + private boolean reader; + + private NOOPStoreAccessor(NOOPStore store, Object context, boolean reader) + { + this.store = store; + this.context = context; + this.reader = reader; + } + + public NOOPStoreAccessor(NOOPStore store, ISession session) + { + this(store, session, true); + } + + public NOOPStoreAccessor(NOOPStore store, IView view) + { + this(store, view, false); + } + + public void release() + { + } + + public NOOPStore getStore() + { + return store; + } + + public boolean isReader() + { + return reader; + } + + public ISession getSession() + { + if (context instanceof IView) + { + return ((IView)context).getSession(); + } + + return (ISession)context; + } + + public IView getView() + { + if (context instanceof IView) + { + return (IView)context; + } + + return null; + } + + public IStoreChunkReader createChunkReader(CDORevision revision, CDOFeature feature) + { + return new NOOPStoreChunkReader(this, revision, feature); + } + + public Collection<CDOPackageInfo> readPackageInfos() + { + return Collections.emptySet(); + } + + public void readPackage(CDOPackageImpl cdoPackage) + { + throw new UnsupportedOperationException(); + } + + public CloseableIterator<CDOID> readObjectIDs(boolean withTypes) + { + throw new UnsupportedOperationException(); + } + + public CDOClassRef readObjectType(CDOID id) + { + throw new UnsupportedOperationException(); + } + + public CDORevision readRevision(CDOID id, int referenceChunk) + { + throw new UnsupportedOperationException(); + } + + public CDORevision readRevisionByTime(CDOID id, int referenceChunk, long timeStamp) + { + throw new UnsupportedOperationException(); + } + + public CDORevision readRevisionByVersion(CDOID id, int referenceChunk, int version) + { + throw new UnsupportedOperationException(); + } + + public CDOID readResourceID(String path) + { + throw new UnsupportedOperationException(); + } + + public String readResourcePath(CDOID id) + { + throw new UnsupportedOperationException(); + } + + public CDORevisionImpl verifyRevision(CDORevisionImpl revision) + { + return revision; + } + + public void writePackages(CDOPackageImpl... cdoPackages) + { + } + + public void writeRevision(CDORevisionImpl revision) + { + } +} |