Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManager.java')
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ResourceManager.java94
1 files changed, 94 insertions, 0 deletions
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<CDOID, String> idToPathMap = new HashMap();
+
+ private Map<String, CDOID> 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");
+ }
+}

Back to the top