From 1f5ddf4721a15bc9a0b755b9a1352a6f757fae62 Mon Sep 17 00:00:00 2001 From: Eike Stepper Date: Fri, 6 Jul 2007 16:13:18 +0000 Subject: task 1: Develop 0.8.0 --- .../emf/cdo/internal/server/EmptyStoreManager.java | 40 +++++++++ .../cdo/internal/server/EmptyStoreTransaction.java | 23 ++++++ .../emf/cdo/internal/server/Repository.java | 84 +++++++++++++++++++ .../emf/cdo/internal/server/RepositoryImpl.java | 76 ----------------- .../emf/cdo/internal/server/RepositoryManager.java | 53 ++++++++++++ .../cdo/internal/server/RepositoryManagerImpl.java | 53 ------------ .../emf/cdo/internal/server/ResourceManager.java | 94 ++++++++++++++++++++++ .../cdo/internal/server/ResourceManagerImpl.java | 94 ---------------------- .../emf/cdo/internal/server/RevisionManager.java | 60 ++++++++++++++ .../cdo/internal/server/RevisionManagerImpl.java | 60 -------------- .../eclipse/emf/cdo/internal/server/Session.java | 63 +++++++++++++++ .../emf/cdo/internal/server/SessionImpl.java | 63 --------------- .../emf/cdo/internal/server/SessionManager.java | 85 +++++++++++++++++++ .../cdo/internal/server/SessionManagerImpl.java | 85 ------------------- .../emf/cdo/internal/server/StoreException.java | 38 +++++++++ .../emf/cdo/internal/server/StoreManager.java | 45 +++++++++++ .../emf/cdo/internal/server/StoreTransaction.java | 31 +++++++ .../server/protocol/CDOServerIndication.java | 20 ++--- .../server/protocol/CDOServerProtocol.java | 8 +- .../protocol/CommitTransactionIndication.java | 4 +- .../server/protocol/LoadObjectIndication.java | 4 +- .../server/protocol/OpenSessionIndication.java | 24 +++--- .../org/eclipse/emf/cdo/server/IRepository.java | 29 +++++++ .../eclipse/emf/cdo/server/IRepositoryManager.java | 23 ++++++ .../eclipse/emf/cdo/server/IResourceManager.java | 26 ++++++ .../eclipse/emf/cdo/server/IRevisionManager.java | 21 +++++ .../src/org/eclipse/emf/cdo/server/ISession.java | 25 ++++++ .../eclipse/emf/cdo/server/ISessionManager.java | 25 ++++++ .../org/eclipse/emf/cdo/server/IStoreManager.java | 28 +++++++ .../eclipse/emf/cdo/server/IStoreTransaction.java | 19 +++++ .../src/org/eclipse/emf/cdo/server/Repository.java | 27 ------- .../eclipse/emf/cdo/server/RepositoryManager.java | 23 ------ .../eclipse/emf/cdo/server/ResourceManager.java | 26 ------ .../eclipse/emf/cdo/server/RevisionManager.java | 21 ----- .../src/org/eclipse/emf/cdo/server/Session.java | 25 ------ .../org/eclipse/emf/cdo/server/SessionManager.java | 25 ------ 36 files changed, 842 insertions(+), 608 deletions(-) create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/EmptyStoreManager.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/EmptyStoreTransaction.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java delete mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryManager.java delete mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryManagerImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManager.java delete mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManagerImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java delete mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManagerImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java delete mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java delete mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManagerImpl.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreException.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreManager.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreTransaction.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositoryManager.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IResourceManager.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRevisionManager.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISession.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISessionManager.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreManager.java create mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreTransaction.java delete mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Repository.java delete mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryManager.java delete mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceManager.java delete mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RevisionManager.java delete mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Session.java delete mode 100644 plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/SessionManager.java diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/EmptyStoreManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/EmptyStoreManager.java new file mode 100644 index 0000000000..b19de757ad --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/EmptyStoreManager.java @@ -0,0 +1,40 @@ +/*************************************************************************** + * 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.server.IStoreTransaction; + +/** + * @author Eike Stepper + */ +public class EmptyStoreManager extends StoreManager +{ + private static final String STORE_TYPE = "EMPTY"; + + public EmptyStoreManager() + { + super(STORE_TYPE); + setInstanceID(STORE_TYPE); + } + + public IStoreTransaction startTransaction() + { + return new EmptyStoreTransaction(this); + } + + public void commitTransaction(IStoreTransaction transaction) + { + } + + public void rollbackTransaction(IStoreTransaction transaction) + { + } +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/EmptyStoreTransaction.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/EmptyStoreTransaction.java new file mode 100644 index 0000000000..44ac32af1a --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/EmptyStoreTransaction.java @@ -0,0 +1,23 @@ +/*************************************************************************** + * 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; + + +/** + * @author Eike Stepper + */ +public class EmptyStoreTransaction extends StoreTransaction +{ + public EmptyStoreTransaction(StoreManager store) + { + super(store); + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java new file mode 100644 index 0000000000..a920cb07e2 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java @@ -0,0 +1,84 @@ +/*************************************************************************** + * 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.CDOIDImpl; +import org.eclipse.emf.cdo.protocol.CDOID; +import org.eclipse.emf.cdo.server.IRepository; +import org.eclipse.emf.cdo.server.IStoreManager; + +import java.util.UUID; + +/** + * @author Eike Stepper + */ +public class Repository implements IRepository +{ + private static final long INITIAL_OID_VALUE = 1; + + private String name; + + private String uuid; + + private SessionManager sessionManager; + + private ResourceManager resourceManager; + + private RevisionManager revisionManager; + + private IStoreManager storeManager; + + private long nextOIDValue = INITIAL_OID_VALUE; + + public Repository(String name) + { + this.name = name; + this.uuid = UUID.randomUUID().toString(); + sessionManager = new SessionManager(this); + resourceManager = new ResourceManager(this); + revisionManager = new RevisionManager(this); + } + + public String getName() + { + return name; + } + + public String getUUID() + { + return uuid; + } + + public SessionManager getSessionManager() + { + return sessionManager; + } + + public ResourceManager getResourceManager() + { + return resourceManager; + } + + public RevisionManager getRevisionManager() + { + return revisionManager; + } + + public IStoreManager getStoreManager() + { + return storeManager; + } + + public CDOID getNextCDOID() + { + return CDOIDImpl.create(nextOIDValue++); + } +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryImpl.java deleted file mode 100644 index 0f5142764e..0000000000 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************************** - * 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.CDOIDImpl; -import org.eclipse.emf.cdo.protocol.CDOID; -import org.eclipse.emf.cdo.server.Repository; - -import java.util.UUID; - -/** - * @author Eike Stepper - */ -public class RepositoryImpl implements Repository -{ - private static final long INITIAL_OID_VALUE = 1; - - private String name; - - private String uuid; - - private SessionManagerImpl sessionManager; - - private ResourceManagerImpl resourceManager; - - private RevisionManagerImpl revisionManager; - - private long nextOIDValue = INITIAL_OID_VALUE; - - public RepositoryImpl(String name) - { - this.name = name; - this.uuid = UUID.randomUUID().toString(); - sessionManager = new SessionManagerImpl(this); - resourceManager = new ResourceManagerImpl(this); - revisionManager = new RevisionManagerImpl(this); - } - - public String getName() - { - return name; - } - - public String getUUID() - { - return uuid; - } - - public SessionManagerImpl getSessionManager() - { - return sessionManager; - } - - public ResourceManagerImpl getResourceManager() - { - return resourceManager; - } - - public RevisionManagerImpl getRevisionManager() - { - return revisionManager; - } - - public CDOID getNextCDOID() - { - return CDOIDImpl.create(nextOIDValue++); - } -} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryManager.java new file mode 100644 index 0000000000..c9cdd1e0b7 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryManager.java @@ -0,0 +1,53 @@ +/*************************************************************************** + * 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.server.IRepositoryManager; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author Eike Stepper + */ +public final class RepositoryManager implements IRepositoryManager +{ + // @Singleton + public static final RepositoryManager INSTANCE = new RepositoryManager(); + + private Map repositories = new HashMap(); + + private RepositoryManager() + { + } + + public Repository getRepository(String name, boolean createOnDemand) + { + Repository repository = repositories.get(name); + if (repository == null && createOnDemand) + { + repository = new Repository(name); + repositories.put(name, repository); + } + + return repository; + } + + public boolean isEmpty() + { + return repositories.isEmpty(); + } + + public void clear() + { + repositories.clear(); + } +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryManagerImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryManagerImpl.java deleted file mode 100644 index 6b2777ff13..0000000000 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryManagerImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************** - * 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.server.RepositoryManager; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Eike Stepper - */ -public final class RepositoryManagerImpl implements RepositoryManager -{ - // @Singleton - public static final RepositoryManagerImpl INSTANCE = new RepositoryManagerImpl(); - - private Map repositories = new HashMap(); - - private RepositoryManagerImpl() - { - } - - public RepositoryImpl getRepository(String name, boolean createOnDemand) - { - RepositoryImpl repository = repositories.get(name); - if (repository == null && createOnDemand) - { - repository = new RepositoryImpl(name); - repositories.put(name, repository); - } - - return repository; - } - - public boolean isEmpty() - { - return repositories.isEmpty(); - } - - public void clear() - { - repositories.clear(); - } -} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManager.java new file mode 100644 index 0000000000..412bbf0907 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManager.java @@ -0,0 +1,94 @@ +/*************************************************************************** + * 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.server.bundle.CDOServer; +import org.eclipse.emf.cdo.protocol.CDOID; +import org.eclipse.emf.cdo.server.IResourceManager; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author Eike Stepper + */ +public class ResourceManager implements IResourceManager +{ + private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_SESSION, SessionManager.class); + + private Repository repository; + + private Map idToPathMap = new HashMap(); + + private Map pathToIDMap = new HashMap(); + + public ResourceManager(Repository repository) + { + this.repository = repository; + } + + public Repository getRepository() + { + return repository; + } + + public CDOID getResourceID(String path) + { + CDOID id = pathToIDMap.get(path); + if (id == null) + { + id = loadID(path); + registerResource(id, path); + } + + return id; + } + + public String getResourcePath(CDOID id) + { + String path = idToPathMap.get(id); + if (path == null) + { + path = loadPath(id); + registerResource(id, path); + } + + return path; + } + + public void registerResource(CDOID id, String path) + { + final String oldPath = idToPathMap.put(id, path); + if (oldPath != path) + { + if (TRACER.isEnabled()) + { + TRACER.format("Registering resource: {0} --> {1}", id, path); + } + + pathToIDMap.put(path, id); + } + } + + private CDOID loadID(String path) + { + // TODO Implement method ResourceManager.loadID() + throw new UnsupportedOperationException("Not yet implemented"); + } + + private String loadPath(CDOID id) + { + // TODO Implement method ResourceManager.loadPath() + throw new UnsupportedOperationException("Not yet implemented"); + } +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManagerImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManagerImpl.java deleted file mode 100644 index d80a06fb1d..0000000000 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManagerImpl.java +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************************** - * 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.server.bundle.CDOServer; -import org.eclipse.emf.cdo.protocol.CDOID; -import org.eclipse.emf.cdo.server.ResourceManager; - -import org.eclipse.net4j.util.om.trace.ContextTracer; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Eike Stepper - */ -public class ResourceManagerImpl implements ResourceManager -{ - private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_SESSION, SessionManagerImpl.class); - - private RepositoryImpl repository; - - private Map idToPathMap = new HashMap(); - - private Map pathToIDMap = new HashMap(); - - public ResourceManagerImpl(RepositoryImpl repository) - { - this.repository = repository; - } - - public RepositoryImpl getRepository() - { - return repository; - } - - public CDOID getResourceID(String path) - { - CDOID id = pathToIDMap.get(path); - if (id == null) - { - id = loadID(path); - registerResource(id, path); - } - - return id; - } - - public String getResourcePath(CDOID id) - { - String path = idToPathMap.get(id); - if (path == null) - { - path = loadPath(id); - registerResource(id, path); - } - - return path; - } - - public void registerResource(CDOID id, String path) - { - final String oldPath = idToPathMap.put(id, path); - if (oldPath != path) - { - if (TRACER.isEnabled()) - { - TRACER.format("Registering resource: {0} --> {1}", id, path); - } - - pathToIDMap.put(path, id); - } - } - - private CDOID loadID(String path) - { - // TODO Implement method ResourceManagerImpl.loadID() - throw new UnsupportedOperationException("Not yet implemented"); - } - - private String loadPath(CDOID id) - { - // TODO Implement method ResourceManagerImpl.loadPath() - throw new UnsupportedOperationException("Not yet implemented"); - } -} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java new file mode 100644 index 0000000000..ecd4f1eda2 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java @@ -0,0 +1,60 @@ +/*************************************************************************** + * 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.resource.CDOPathFeatureImpl; +import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl; +import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionResolverImpl; +import org.eclipse.emf.cdo.protocol.CDOID; +import org.eclipse.emf.cdo.server.IRevisionManager; + +/** + * @author Eike Stepper + */ +public class RevisionManager extends CDORevisionResolverImpl implements IRevisionManager +{ + private Repository repository; + + public RevisionManager(Repository repository) + { + this.repository = repository; + } + + public Repository getRepository() + { + return repository; + } + + @Override + public void addRevision(CDORevisionImpl revision) + { + super.addRevision(revision); + if (revision.isResource()) + { + String path = (String)revision.getData().get(CDOPathFeatureImpl.INSTANCE, -1); + repository.getResourceManager().registerResource(revision.getID(), path); + } + } + + @Override + protected CDORevisionImpl loadRevision(CDOID id) + { + // TODO Implement method RevisionManager.loadRevision() + throw new UnsupportedOperationException("Not yet implemented"); + } + + @Override + protected CDORevisionImpl loadRevision(CDOID id, long timeStamp) + { + // TODO Implement method RevisionManager.loadRevision() + throw new UnsupportedOperationException("Not yet implemented"); + } +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManagerImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManagerImpl.java deleted file mode 100644 index 25fae0dd29..0000000000 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManagerImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * 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.resource.CDOPathFeatureImpl; -import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl; -import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionResolverImpl; -import org.eclipse.emf.cdo.protocol.CDOID; -import org.eclipse.emf.cdo.server.RevisionManager; - -/** - * @author Eike Stepper - */ -public class RevisionManagerImpl extends CDORevisionResolverImpl implements RevisionManager -{ - private RepositoryImpl repository; - - public RevisionManagerImpl(RepositoryImpl repository) - { - this.repository = repository; - } - - public RepositoryImpl getRepository() - { - return repository; - } - - @Override - public void addRevision(CDORevisionImpl revision) - { - super.addRevision(revision); - if (revision.isResource()) - { - String path = (String)revision.getData().get(CDOPathFeatureImpl.INSTANCE, -1); - repository.getResourceManager().registerResource(revision.getID(), path); - } - } - - @Override - protected CDORevisionImpl loadRevision(CDOID id) - { - // TODO Implement method RevisionManagerImpl.loadRevision() - throw new UnsupportedOperationException("Not yet implemented"); - } - - @Override - protected CDORevisionImpl loadRevision(CDOID id, long timeStamp) - { - // TODO Implement method RevisionManagerImpl.loadRevision() - throw new UnsupportedOperationException("Not yet implemented"); - } -} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java new file mode 100644 index 0000000000..ec4387c2d2 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java @@ -0,0 +1,63 @@ +/*************************************************************************** + * 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.revision.CDORevisionImpl; +import org.eclipse.emf.cdo.internal.server.bundle.CDOServer; +import org.eclipse.emf.cdo.internal.server.protocol.CDOServerProtocol; +import org.eclipse.emf.cdo.internal.server.protocol.InvalidationRequest; +import org.eclipse.emf.cdo.server.ISession; + +/** + * @author Eike Stepper + */ +public class Session implements ISession +{ + private SessionManager sessionManager; + + private CDOServerProtocol protocol; + + private int sessionID; + + public Session(SessionManager sessionManager, CDOServerProtocol protocol, int sessionID) + { + this.sessionManager = sessionManager; + this.protocol = protocol; + this.sessionID = sessionID; + } + + public SessionManager getSessionManager() + { + return sessionManager; + } + + public int getSessionID() + { + return sessionID; + } + + public CDOServerProtocol getProtocol() + { + return protocol; + } + + public void notifyInvalidation(long timeStamp, CDORevisionImpl[] dirtyObjects) + { + try + { + new InvalidationRequest(protocol.getChannel(), timeStamp, dirtyObjects).send(); + } + catch (Exception ex) + { + CDOServer.LOG.error(ex); + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionImpl.java deleted file mode 100644 index 4739b2df3d..0000000000 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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.revision.CDORevisionImpl; -import org.eclipse.emf.cdo.internal.server.bundle.CDOServer; -import org.eclipse.emf.cdo.internal.server.protocol.CDOServerProtocol; -import org.eclipse.emf.cdo.internal.server.protocol.InvalidationRequest; -import org.eclipse.emf.cdo.server.Session; - -/** - * @author Eike Stepper - */ -public class SessionImpl implements Session -{ - private SessionManagerImpl sessionManager; - - private CDOServerProtocol protocol; - - private int sessionID; - - public SessionImpl(SessionManagerImpl sessionManager, CDOServerProtocol protocol, int sessionID) - { - this.sessionManager = sessionManager; - this.protocol = protocol; - this.sessionID = sessionID; - } - - public SessionManagerImpl getSessionManager() - { - return sessionManager; - } - - public int getSessionID() - { - return sessionID; - } - - public CDOServerProtocol getProtocol() - { - return protocol; - } - - public void notifyInvalidation(long timeStamp, CDORevisionImpl[] dirtyObjects) - { - try - { - new InvalidationRequest(protocol.getChannel(), timeStamp, dirtyObjects).send(); - } - catch (Exception ex) - { - CDOServer.LOG.error(ex); - } - } -} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java new file mode 100644 index 0000000000..d299f99afc --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java @@ -0,0 +1,85 @@ +/*************************************************************************** + * 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.revision.CDORevisionImpl; +import org.eclipse.emf.cdo.internal.server.bundle.CDOServer; +import org.eclipse.emf.cdo.internal.server.protocol.CDOServerProtocol; +import org.eclipse.emf.cdo.server.ISessionManager; + +import org.eclipse.net4j.util.om.trace.ContextTracer; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author Eike Stepper + */ +public class SessionManager implements ISessionManager +{ + private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_SESSION, SessionManager.class); + + private Repository repository; + + private Map sessions = new HashMap(); + + private int lastSessionID; + + public SessionManager(Repository repository) + { + this.repository = repository; + } + + public Repository getRepository() + { + return repository; + } + + public Session[] getSessions() + { + synchronized (sessions) + { + return sessions.values().toArray(new Session[sessions.size()]); + } + } + + public Session openSession(CDOServerProtocol protocol) + { + int id = ++lastSessionID; + if (TRACER.isEnabled()) + { + TRACER.trace("Opening session " + id); + } + + Session session = new Session(this, protocol, id); + synchronized (sessions) + { + sessions.put(id, session); + } + + return session; + } + + public void sessionClosed(Session session) + { + } + + public void notifyInvalidation(long timeStamp, CDORevisionImpl[] dirtyObjects, Session excludedSession) + { + for (Session session : getSessions()) + { + if (session != excludedSession) + { + session.notifyInvalidation(timeStamp, dirtyObjects); + } + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManagerImpl.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManagerImpl.java deleted file mode 100644 index 9a7e7eec2e..0000000000 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManagerImpl.java +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - * 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.revision.CDORevisionImpl; -import org.eclipse.emf.cdo.internal.server.bundle.CDOServer; -import org.eclipse.emf.cdo.internal.server.protocol.CDOServerProtocol; -import org.eclipse.emf.cdo.server.SessionManager; - -import org.eclipse.net4j.util.om.trace.ContextTracer; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Eike Stepper - */ -public class SessionManagerImpl implements SessionManager -{ - private static final ContextTracer TRACER = new ContextTracer(CDOServer.DEBUG_SESSION, SessionManagerImpl.class); - - private RepositoryImpl repository; - - private Map sessions = new HashMap(); - - private int lastSessionID; - - public SessionManagerImpl(RepositoryImpl repository) - { - this.repository = repository; - } - - public RepositoryImpl getRepository() - { - return repository; - } - - public SessionImpl[] getSessions() - { - synchronized (sessions) - { - return sessions.values().toArray(new SessionImpl[sessions.size()]); - } - } - - public SessionImpl openSession(CDOServerProtocol protocol) - { - int id = ++lastSessionID; - if (TRACER.isEnabled()) - { - TRACER.trace("Opening session " + id); - } - - SessionImpl session = new SessionImpl(this, protocol, id); - synchronized (sessions) - { - sessions.put(id, session); - } - - return session; - } - - public void sessionClosed(SessionImpl session) - { - } - - public void notifyInvalidation(long timeStamp, CDORevisionImpl[] dirtyObjects, SessionImpl excludedSession) - { - for (SessionImpl session : getSessions()) - { - if (session != excludedSession) - { - session.notifyInvalidation(timeStamp, dirtyObjects); - } - } - } -} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreException.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreException.java new file mode 100644 index 0000000000..e295525630 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreException.java @@ -0,0 +1,38 @@ +/*************************************************************************** + * 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; + +/** + * @author Eike Stepper + */ +public class StoreException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + public StoreException() + { + } + + public StoreException(String message) + { + super(message); + } + + public StoreException(Throwable cause) + { + super(cause); + } + + public StoreException(String message, Throwable cause) + { + super(message, cause); + } +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreManager.java new file mode 100644 index 0000000000..bdb7d71072 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreManager.java @@ -0,0 +1,45 @@ +/*************************************************************************** + * 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.server.IStoreManager; + +import org.eclipse.net4j.internal.util.lifecycle.Lifecycle; + +/** + * @author Eike Stepper + */ +public abstract class StoreManager extends Lifecycle implements IStoreManager +{ + private String storeType; + + private String instanceID; + + public StoreManager(String storeType) + { + this.storeType = storeType; + } + + public String getStoreType() + { + return storeType; + } + + public String getInstanceID() + { + return instanceID; + } + + public void setInstanceID(String instanceID) + { + this.instanceID = instanceID; + } +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreTransaction.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreTransaction.java new file mode 100644 index 0000000000..0f7fc432e1 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/StoreTransaction.java @@ -0,0 +1,31 @@ +/*************************************************************************** + * 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.server.IStoreTransaction; + +/** + * @author Eike Stepper + */ +public abstract class StoreTransaction implements IStoreTransaction +{ + private StoreManager store; + + public StoreTransaction(StoreManager store) + { + this.store = store; + } + + public StoreManager getStore() + { + return store; + } +} \ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerIndication.java index 0fed2def2a..e040f762b4 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerIndication.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerIndication.java @@ -10,11 +10,11 @@ **************************************************************************/ package org.eclipse.emf.cdo.internal.server.protocol; -import org.eclipse.emf.cdo.internal.server.RepositoryImpl; -import org.eclipse.emf.cdo.internal.server.ResourceManagerImpl; -import org.eclipse.emf.cdo.internal.server.RevisionManagerImpl; -import org.eclipse.emf.cdo.internal.server.SessionImpl; -import org.eclipse.emf.cdo.internal.server.SessionManagerImpl; +import org.eclipse.emf.cdo.internal.server.Repository; +import org.eclipse.emf.cdo.internal.server.ResourceManager; +import org.eclipse.emf.cdo.internal.server.RevisionManager; +import org.eclipse.emf.cdo.internal.server.Session; +import org.eclipse.emf.cdo.internal.server.SessionManager; import org.eclipse.net4j.signal.IndicationWithResponse; @@ -36,27 +36,27 @@ public abstract class CDOServerIndication extends IndicationWithResponse return signalID; } - protected SessionManagerImpl getSessionManager() + protected SessionManager getSessionManager() { return getSession().getSessionManager(); } - protected RevisionManagerImpl getRevisionManager() + protected RevisionManager getRevisionManager() { return getRepository().getRevisionManager(); } - protected ResourceManagerImpl getResourceManager() + protected ResourceManager getResourceManager() { return getRepository().getResourceManager(); } - protected RepositoryImpl getRepository() + protected Repository getRepository() { return getSessionManager().getRepository(); } - protected SessionImpl getSession() + protected Session getSession() { return getProtocol().getSession(); } diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java index 21e73b0575..8c06590d76 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerProtocol.java @@ -10,7 +10,7 @@ **************************************************************************/ package org.eclipse.emf.cdo.internal.server.protocol; -import org.eclipse.emf.cdo.internal.server.SessionImpl; +import org.eclipse.emf.cdo.internal.server.Session; import org.eclipse.emf.cdo.protocol.CDOProtocolConstants; import org.eclipse.net4j.signal.SignalProtocol; @@ -21,7 +21,7 @@ import org.eclipse.net4j.signal.SignalReactor; */ public class CDOServerProtocol extends SignalProtocol { - private SessionImpl session; + private Session session; public CDOServerProtocol() { @@ -32,12 +32,12 @@ public class CDOServerProtocol extends SignalProtocol return CDOProtocolConstants.PROTOCOL_NAME; } - public SessionImpl getSession() + public Session getSession() { return session; } - public void setSession(SessionImpl session) + public void setSession(Session session) { this.session = session; } diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java index cc00bed875..7cbb82e6f6 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CommitTransactionIndication.java @@ -13,7 +13,7 @@ package org.eclipse.emf.cdo.internal.server.protocol; import org.eclipse.emf.cdo.internal.protocol.CDOIDImpl; import org.eclipse.emf.cdo.internal.protocol.bundle.CDOProtocol; import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl; -import org.eclipse.emf.cdo.internal.server.RevisionManagerImpl; +import org.eclipse.emf.cdo.internal.server.RevisionManager; import org.eclipse.emf.cdo.protocol.CDOID; import org.eclipse.emf.cdo.protocol.CDOProtocolConstants; @@ -125,7 +125,7 @@ public class CommitTransactionIndication extends CDOServerIndication private void addRevisions(CDORevisionImpl[] revisions) { - RevisionManagerImpl revisionManager = getRevisionManager(); + RevisionManager revisionManager = getRevisionManager(); for (CDORevisionImpl revision : revisions) { revision.setCreated(timeStamp); diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadObjectIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadObjectIndication.java index 5f8447c7c8..eef8864fcc 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadObjectIndication.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/LoadObjectIndication.java @@ -13,7 +13,7 @@ package org.eclipse.emf.cdo.internal.server.protocol; import org.eclipse.emf.cdo.internal.protocol.CDOIDImpl; import org.eclipse.emf.cdo.internal.protocol.bundle.CDOProtocol; import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl; -import org.eclipse.emf.cdo.internal.server.RevisionManagerImpl; +import org.eclipse.emf.cdo.internal.server.RevisionManager; import org.eclipse.emf.cdo.protocol.CDOID; import org.eclipse.emf.cdo.protocol.CDOProtocolConstants; @@ -63,7 +63,7 @@ public class LoadObjectIndication extends CDOServerIndication @Override protected void responding(ExtendedDataOutputStream out) throws IOException { - RevisionManagerImpl rm = getRevisionManager(); + RevisionManager rm = getRevisionManager(); CDORevisionImpl revision = timeStamp != null ? rm.getRevision(id, timeStamp) : rm.getRevision(id); revision.write(out, null); } diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java index 1565dd3962..70e9c31b70 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java @@ -11,13 +11,13 @@ package org.eclipse.emf.cdo.internal.server.protocol; import org.eclipse.emf.cdo.internal.protocol.bundle.CDOProtocol; -import org.eclipse.emf.cdo.internal.server.RepositoryImpl; -import org.eclipse.emf.cdo.internal.server.RepositoryManagerImpl; -import org.eclipse.emf.cdo.internal.server.SessionImpl; -import org.eclipse.emf.cdo.internal.server.SessionManagerImpl; +import org.eclipse.emf.cdo.internal.server.Repository; +import org.eclipse.emf.cdo.internal.server.RepositoryManager; +import org.eclipse.emf.cdo.internal.server.Session; +import org.eclipse.emf.cdo.internal.server.SessionManager; import org.eclipse.emf.cdo.protocol.CDOProtocolConstants; -import org.eclipse.emf.cdo.server.Repository; -import org.eclipse.emf.cdo.server.Session; +import org.eclipse.emf.cdo.server.IRepository; +import org.eclipse.emf.cdo.server.ISession; import org.eclipse.net4j.signal.IndicationWithResponse; import org.eclipse.net4j.util.om.trace.ContextTracer; @@ -59,12 +59,12 @@ public class OpenSessionIndication extends IndicationWithResponse @Override protected void responding(ExtendedDataOutputStream out) throws IOException { - RepositoryImpl repository = RepositoryManagerImpl.INSTANCE.getRepository(repositoryName, true); + Repository repository = RepositoryManager.INSTANCE.getRepository(repositoryName, true); if (repository == null) { if (PROTOCOL.isEnabled()) { - PROTOCOL.format("Repository {0} not found", repositoryName); + PROTOCOL.format("IRepository {0} not found", repositoryName); } out.writeInt(CDOProtocolConstants.ERROR_REPOSITORY_NOT_FOUND); @@ -72,8 +72,8 @@ public class OpenSessionIndication extends IndicationWithResponse } CDOServerProtocol serverProtocol = (CDOServerProtocol)getProtocol(); - SessionManagerImpl sessionManager = repository.getSessionManager(); - SessionImpl session = sessionManager.openSession(serverProtocol); + SessionManager sessionManager = repository.getSessionManager(); + Session session = sessionManager.openSession(serverProtocol); if (session == null) { if (PROTOCOL.isEnabled()) @@ -90,7 +90,7 @@ public class OpenSessionIndication extends IndicationWithResponse writeRepositoryUUID(out, repository); } - private void writeSessionID(ExtendedDataOutputStream out, Session session) throws IOException + private void writeSessionID(ExtendedDataOutputStream out, ISession session) throws IOException { if (PROTOCOL.isEnabled()) { @@ -100,7 +100,7 @@ public class OpenSessionIndication extends IndicationWithResponse out.writeInt(session.getSessionID()); } - private void writeRepositoryUUID(ExtendedDataOutputStream out, Repository repository) throws IOException + private void writeRepositoryUUID(ExtendedDataOutputStream out, IRepository repository) throws IOException { if (PROTOCOL.isEnabled()) { diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java new file mode 100644 index 0000000000..d3cebe4563 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java @@ -0,0 +1,29 @@ +/*************************************************************************** + * 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.server; + +/** + * @author Eike Stepper + */ +public interface IRepository +{ + public String getName(); + + public String getUUID(); + + public ISessionManager getSessionManager(); + + public IResourceManager getResourceManager(); + + public IRevisionManager getRevisionManager(); + + public IStoreManager getStoreManager(); +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositoryManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositoryManager.java new file mode 100644 index 0000000000..43a85245a5 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositoryManager.java @@ -0,0 +1,23 @@ +/*************************************************************************** + * 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.server; + +import org.eclipse.emf.cdo.internal.server.RepositoryManager; + +/** + * @author Eike Stepper + */ +public interface IRepositoryManager +{ + public static final IRepositoryManager INSTANCE = RepositoryManager.INSTANCE; + + public IRepository getRepository(String name, boolean createOnDemand); +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IResourceManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IResourceManager.java new file mode 100644 index 0000000000..6efdd4426d --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IResourceManager.java @@ -0,0 +1,26 @@ +/*************************************************************************** + * 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.server; + +import org.eclipse.emf.cdo.internal.server.Repository; +import org.eclipse.emf.cdo.protocol.CDOID; + +/** + * @author Eike Stepper + */ +public interface IResourceManager +{ + public Repository getRepository(); + + public CDOID getResourceID(String path); + + public String getResourcePath(CDOID id); +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRevisionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRevisionManager.java new file mode 100644 index 0000000000..538ab4957a --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRevisionManager.java @@ -0,0 +1,21 @@ +/*************************************************************************** + * 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.server; + +import org.eclipse.emf.cdo.protocol.revision.CDORevisionResolver; + +/** + * @author Eike Stepper + */ +public interface IRevisionManager extends CDORevisionResolver +{ + public IRepository getRepository(); +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISession.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISession.java new file mode 100644 index 0000000000..e5fcf2165c --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISession.java @@ -0,0 +1,25 @@ +/*************************************************************************** + * 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.server; + +import org.eclipse.emf.cdo.internal.server.protocol.CDOServerProtocol; + +/** + * @author Eike Stepper + */ +public interface ISession +{ + public ISessionManager getSessionManager(); + + public CDOServerProtocol getProtocol(); + + public int getSessionID(); +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISessionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISessionManager.java new file mode 100644 index 0000000000..8d14c42588 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISessionManager.java @@ -0,0 +1,25 @@ +/*************************************************************************** + * 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.server; + +import org.eclipse.emf.cdo.internal.server.protocol.CDOServerProtocol; + +/** + * @author Eike Stepper + */ +public interface ISessionManager +{ + public IRepository getRepository(); + + public ISession[] getSessions(); + + public ISession openSession(CDOServerProtocol protocol); +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreManager.java new file mode 100644 index 0000000000..2032c41264 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreManager.java @@ -0,0 +1,28 @@ +/*************************************************************************** + * 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.server; + +/** + * @author Eike Stepper + */ +public interface IStoreManager +{ + public String getStoreType(); + + public String getInstanceID(); + + public IStoreTransaction startTransaction(); + + public void commitTransaction(IStoreTransaction transaction); + + public void rollbackTransaction(IStoreTransaction transaction); + +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreTransaction.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreTransaction.java new file mode 100644 index 0000000000..eb96bea0b2 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreTransaction.java @@ -0,0 +1,19 @@ +/*************************************************************************** + * 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.server; + +/** + * @author Eike Stepper + */ +public interface IStoreTransaction +{ + +} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Repository.java deleted file mode 100644 index 4eb6f59d77..0000000000 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Repository.java +++ /dev/null @@ -1,27 +0,0 @@ -/*************************************************************************** - * 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.server; - -/** - * @author Eike Stepper - */ -public interface Repository -{ - public String getName(); - - public String getUUID(); - - public SessionManager getSessionManager(); - - public ResourceManager getResourceManager(); - - public RevisionManager getRevisionManager(); -} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryManager.java deleted file mode 100644 index 5362b81511..0000000000 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryManager.java +++ /dev/null @@ -1,23 +0,0 @@ -/*************************************************************************** - * 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.server; - -import org.eclipse.emf.cdo.internal.server.RepositoryManagerImpl; - -/** - * @author Eike Stepper - */ -public interface RepositoryManager -{ - public static final RepositoryManager INSTANCE = RepositoryManagerImpl.INSTANCE; - - public Repository getRepository(String name, boolean createOnDemand); -} 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 deleted file mode 100644 index e0cef522cc..0000000000 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ResourceManager.java +++ /dev/null @@ -1,26 +0,0 @@ -/*************************************************************************** - * 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.server; - -import org.eclipse.emf.cdo.internal.server.RepositoryImpl; -import org.eclipse.emf.cdo.protocol.CDOID; - -/** - * @author Eike Stepper - */ -public interface ResourceManager -{ - public RepositoryImpl getRepository(); - - public CDOID getResourceID(String path); - - public String getResourcePath(CDOID id); -} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RevisionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RevisionManager.java deleted file mode 100644 index acd54b22be..0000000000 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RevisionManager.java +++ /dev/null @@ -1,21 +0,0 @@ -/*************************************************************************** - * 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.server; - -import org.eclipse.emf.cdo.protocol.revision.CDORevisionResolver; - -/** - * @author Eike Stepper - */ -public interface RevisionManager extends CDORevisionResolver -{ - public Repository getRepository(); -} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Session.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Session.java deleted file mode 100644 index 0fee6b3663..0000000000 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/Session.java +++ /dev/null @@ -1,25 +0,0 @@ -/*************************************************************************** - * 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.server; - -import org.eclipse.emf.cdo.internal.server.protocol.CDOServerProtocol; - -/** - * @author Eike Stepper - */ -public interface Session -{ - public SessionManager getSessionManager(); - - public CDOServerProtocol getProtocol(); - - public int getSessionID(); -} diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/SessionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/SessionManager.java deleted file mode 100644 index 7359db392e..0000000000 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/SessionManager.java +++ /dev/null @@ -1,25 +0,0 @@ -/*************************************************************************** - * 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.server; - -import org.eclipse.emf.cdo.internal.server.protocol.CDOServerProtocol; - -/** - * @author Eike Stepper - */ -public interface SessionManager -{ - public Repository getRepository(); - - public Session[] getSessions(); - - public Session openSession(CDOServerProtocol protocol); -} -- cgit v1.2.3