summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-29 06:38:45 (EDT)
committerEike Stepper2007-08-29 06:38:45 (EDT)
commitfe556bf635a895e9087eacc211fcdec63c5a452f (patch)
tree2329a14d456433e803671f18827b60c92345c823
parent52ec43baf2638114018ba89aec79717b109f60e7 (diff)
downloadcdo-fe556bf635a895e9087eacc211fcdec63c5a452f.zip
cdo-fe556bf635a895e9087eacc211fcdec63c5a452f.tar.gz
cdo-fe556bf635a895e9087eacc211fcdec63c5a452f.tar.bz2
[201514] Make IRepository implementation configurable
https://bugs.eclipse.org/bugs/show_bug.cgi?id=201514
-rw-r--r--plugins/org.eclipse.emf.cdo.server/plugin.xml12
-rw-r--r--plugins/org.eclipse.emf.cdo.server/schema/repositoryFactories.exsd112
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java109
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfiguratorNew.java197
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryFactory.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/OM.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositoryFactory.java22
10 files changed, 456 insertions, 58 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/plugin.xml b/plugins/org.eclipse.emf.cdo.server/plugin.xml
index 97dbeb2..ca3d573 100644
--- a/plugins/org.eclipse.emf.cdo.server/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.server/plugin.xml
@@ -4,16 +4,20 @@
<plugin>
<extension-point id="storeFactories" name="CDO Store Factories" schema="schema/storeFactories.exsd"/>
+ <extension-point id="repositoryFactories" name="CDO Repository Factories" schema="schema/repositoryFactories.exsd"/>
<extension point="org.eclipse.net4j.util.factories">
<factory
productGroup="org.eclipse.net4j.serverProtocols"
type="cdo"
class="org.eclipse.emf.cdo.internal.server.protocol.CDOPluginProtocolFactory"/>
- <factory
- productGroup="org.eclipse.emf.cdo.server.repositories"
- type="default"
- class="org.eclipse.emf.cdo.internal.server.RepositoryFactory"/>
+ </extension>
+ <extension
+ point="org.eclipse.emf.cdo.server.repositoryFactories">
+ <repositoryFactory
+ class="org.eclipse.emf.cdo.internal.server.RepositoryFactory"
+ repositoryType="default">
+ </repositoryFactory>
</extension>
</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.server/schema/repositoryFactories.exsd b/plugins/org.eclipse.emf.cdo.server/schema/repositoryFactories.exsd
new file mode 100644
index 0000000..b961e43
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/schema/repositoryFactories.exsd
@@ -0,0 +1,112 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.cdo.server">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.emf.cdo.server" id="repositoryFactories" name="CDO Repository Factories"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="repositoryFactory" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="repositoryFactory">
+ <complexType>
+ <attribute name="repositoryType" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.cdo.server.IRepositoryFactory"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
index 36e7705..2e27ba7 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
@@ -11,11 +11,16 @@
package org.eclipse.emf.cdo.internal.server;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
+import org.eclipse.emf.cdo.server.CDOServerUtil;
import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.server.IRepositoryFactory;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.IStoreFactory;
+import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.StringUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -44,13 +49,28 @@ import java.util.Map;
*/
public class RepositoryConfigurator
{
- public RepositoryConfigurator()
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_REPOSITORY, RepositoryConfigurator.class);
+
+ private IManagedContainer container;
+
+ public RepositoryConfigurator(IManagedContainer container)
{
+ this.container = container;
+ }
+
+ public IManagedContainer getContainer()
+ {
+ return container;
}
public IRepository[] configure(File configFile) throws ParserConfigurationException, SAXException, IOException,
CoreException
{
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Configuring repositories from " + configFile.getAbsolutePath());
+ }
+
List<IRepository> repositories = new ArrayList();
Document document = getDocument(configFile);
NodeList elements = document.getElementsByTagName("repository");
@@ -59,6 +79,7 @@ public class RepositoryConfigurator
Element repositoryConfig = (Element)elements.item(i);
IRepository repository = configureRepository(repositoryConfig);
repositories.add(repository);
+ CDOServerUtil.addRepository(container, repository);
}
return repositories.toArray(new IRepository[repositories.size()]);
@@ -67,22 +88,40 @@ public class RepositoryConfigurator
protected IRepository configureRepository(Element repositoryConfig) throws CoreException
{
String repositoryName = repositoryConfig.getAttribute("name");
+ if (StringUtil.isEmpty(repositoryName))
+ {
+ throw new IllegalArgumentException("Repository name is missing or empty");
+ }
+
+ String repositoryType = repositoryConfig.getAttribute("type");
+ if (StringUtil.isEmpty(repositoryType))
+ {
+ repositoryType = RepositoryFactory.TYPE;
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Configuring repository {0} (type={1})", repositoryName, repositoryType);
+ }
+
+ IRepository repository = createRepository(repositoryType);
+ repository.setName(repositoryName);
+
Element storeConfig = getStoreConfig(repositoryConfig);
IStore store = configureStore(storeConfig);
- Map<String, String> properties = getProperties(repositoryConfig, 1);
+ store.setRepository(repository);
+ repository.setStore(store);
- Repository repository = createRepository(repositoryName, store);
+ Map<String, String> properties = getProperties(repositoryConfig, 1);
repository.setProperties(properties);
- store.setRepository(repository);
+
return repository;
}
- protected Repository createRepository(String repositoryName, IStore store)
+ protected IRepository createRepository(String repositoryType) throws CoreException
{
- Repository repository = new Repository();
- repository.setName(repositoryName);
- repository.setStore(store);
- return repository;
+ IRepositoryFactory factory = getRepositoryFactory(repositoryType);
+ return factory.createRepository();
}
protected IStore configureStore(Element storeConfig) throws CoreException
@@ -94,29 +133,33 @@ public class RepositoryConfigurator
protected IStoreFactory getStoreFactory(String type) throws CoreException
{
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] elements = registry.getConfigurationElementsFor(OM.BUNDLE_ID, "storeFactories");
- for (IConfigurationElement element : elements)
+ IStoreFactory factory = (IStoreFactory)createExecutableExtension("storeFactories", "storeFactory", "storeType",
+ type);
+ if (factory == null)
{
- if (ObjectUtil.equals(element.getName(), "storeFactory"))
- {
- String storeType = element.getAttribute("storeType");
- if (ObjectUtil.equals(storeType, type))
- {
- return (IStoreFactory)element.createExecutableExtension("class");
- }
- }
+ throw new IllegalStateException("Store factory not found: " + type);
+ }
+
+ return factory;
+ }
+
+ protected IRepositoryFactory getRepositoryFactory(String type) throws CoreException
+ {
+ IRepositoryFactory factory = (IRepositoryFactory)createExecutableExtension("repositoryFactories",
+ "repositoryFactory", "repositoryType", type);
+ if (factory == null)
+ {
+ throw new IllegalStateException("Repository factory not found: " + type);
}
- throw new IllegalStateException("Store factory not found: " + type);
+ return factory;
}
protected Document getDocument(File configFile) throws ParserConfigurationException, SAXException, IOException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
- Document document = builder.parse(configFile);
- return document;
+ return builder.parse(configFile);
}
protected Element getStoreConfig(Element repositoryConfig)
@@ -161,4 +204,24 @@ public class RepositoryConfigurator
}
}
}
+
+ private static Object createExecutableExtension(String extPointName, String elementName, String attributeName,
+ String type) throws CoreException
+ {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = registry.getConfigurationElementsFor(OM.BUNDLE_ID, extPointName);
+ for (IConfigurationElement element : elements)
+ {
+ if (ObjectUtil.equals(element.getName(), elementName))
+ {
+ String storeType = element.getAttribute(attributeName);
+ if (ObjectUtil.equals(storeType, type))
+ {
+ return element.createExecutableExtension("class");
+ }
+ }
+ }
+
+ return null;
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfiguratorNew.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfiguratorNew.java
new file mode 100644
index 0000000..3d19915
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfiguratorNew.java
@@ -0,0 +1,197 @@
+/***************************************************************************
+ * 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.OM;
+import org.eclipse.emf.cdo.server.IStore;
+import org.eclipse.emf.cdo.server.IStoreFactory;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.container.IElementProcessor;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.om.OMPlatform;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class RepositoryConfiguratorNew implements IElementProcessor
+{
+ private File configFile;
+
+ private Document document;
+
+ public RepositoryConfiguratorNew()
+ {
+ configFile = getConfigFile();
+ }
+
+ public Object process(IManagedContainer container, String productGroup, String factoryType, String description,
+ Object element)
+ {
+ if (element instanceof Repository)
+ {
+ element = process(container, factoryType, description, (Repository)element);
+ }
+
+ return element;
+ }
+
+ protected Repository process(IManagedContainer container, String factoryType, String name, Repository repository)
+ {
+ try
+ {
+ Element repositoryConfig = getRepositoryConfig(name);
+ if (repositoryConfig != null)
+ {
+ Element storeConfig = getStoreConfig(repositoryConfig);
+ IStore store = createStore(storeConfig);
+ store.setRepository(repository);
+
+ Map<String, String> properties = getProperties(repositoryConfig, 1);
+ repository.setProperties(properties);
+ }
+ else
+ {
+ OM.LOG.warn("No configuration found for repository " + name);
+ }
+
+ return repository;
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+
+ protected Element getRepositoryConfig(String name) throws ParserConfigurationException, SAXException, IOException
+ {
+ Document document = getDocument();
+ NodeList elements = document.getElementsByTagName("repository");
+ for (int i = 0; i < elements.getLength(); i++)
+ {
+ Element repositoryConfig = (Element)elements.item(i);
+ String repositoryName = repositoryConfig.getAttribute("name");
+ if (ObjectUtil.equals(repositoryName, name))
+ {
+ return repositoryConfig;
+ }
+ }
+
+ return null;
+ }
+
+ protected File getConfigFile()
+ {
+ return OMPlatform.INSTANCE.getConfigFile("cdo.server.xml");
+ }
+
+ protected Document getDocument() throws ParserConfigurationException, SAXException, IOException
+ {
+ if (document == null)
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ document = builder.parse(configFile);
+ }
+
+ return document;
+ }
+
+ protected IStore createStore(Element storeConfig) throws CoreException
+ {
+ String type = storeConfig.getAttribute("type");
+ IStoreFactory storeFactory = getStoreFactory(type);
+ return storeFactory.createStore(storeConfig);
+ }
+
+ protected IStoreFactory getStoreFactory(String type) throws CoreException
+ {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = registry.getConfigurationElementsFor(OM.BUNDLE_ID, "storeFactories");
+ for (IConfigurationElement element : elements)
+ {
+ if (ObjectUtil.equals(element.getName(), "storeFactory"))
+ {
+ String storeType = element.getAttribute("storeType");
+ if (ObjectUtil.equals(storeType, type))
+ {
+ return (IStoreFactory)element.createExecutableExtension("class");
+ }
+ }
+ }
+
+ throw new IllegalStateException("Store factory not found: " + type);
+ }
+
+ protected Element getStoreConfig(Element repositoryConfig)
+ {
+ NodeList storeConfigs = repositoryConfig.getElementsByTagName("store");
+ if (storeConfigs.getLength() != 1)
+ {
+ String repositoryName = repositoryConfig.getAttribute("name");
+ throw new IllegalStateException("Exactly one store must be configured for repository " + repositoryName);
+ }
+
+ return (Element)storeConfigs.item(0);
+ }
+
+ public static Map<String, String> getProperties(Element element, int levels)
+ {
+ Map<String, String> properties = new HashMap();
+ collectProperties(element, "", properties, levels);
+ return properties;
+ }
+
+ private static void collectProperties(Element element, String prefix, Map<String, String> properties, int levels)
+ {
+ if ("property".equals(element.getNodeName()))
+ {
+ String name = element.getAttribute("name");
+ String value = element.getAttribute("value");
+ properties.put(prefix + name, value);
+ prefix += name + ".";
+ }
+
+ if (levels > 0)
+ {
+ NodeList childNodes = element.getChildNodes();
+ for (int i = 0; i < childNodes.getLength(); i++)
+ {
+ Node childNode = childNodes.item(i);
+ if (childNode instanceof Element)
+ {
+ collectProperties((Element)childNode, prefix, properties, levels - 1);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryFactory.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryFactory.java
index fe428d2..87a7774 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryFactory.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryFactory.java
@@ -10,13 +10,15 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.server;
-import org.eclipse.net4j.internal.util.factory.Factory;
+import org.eclipse.emf.cdo.server.IRepository;
+import org.eclipse.emf.cdo.server.IRepositoryFactory;
+
import org.eclipse.net4j.util.container.IManagedContainer;
/**
* @author Eike Stepper
*/
-public class RepositoryFactory extends Factory<Repository>
+public class RepositoryFactory implements IRepositoryFactory
{
public static final String PRODUCT_GROUP = "org.eclipse.emf.cdo.server.repositories";
@@ -24,22 +26,19 @@ public class RepositoryFactory extends Factory<Repository>
public RepositoryFactory()
{
- super(PRODUCT_GROUP, TYPE);
}
- public Repository create(String name)
+ public String getRepositoryType()
{
- Repository repository = createRepository();
- repository.setName(name);
- return repository;
+ return TYPE;
}
- protected Repository createRepository()
+ public Repository createRepository()
{
return new Repository();
}
- public static Repository get(IManagedContainer container, String name)
+ public static IRepository get(IManagedContainer container, String name)
{
return (Repository)container.getElement(PRODUCT_GROUP, TYPE, name);
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/OM.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/OM.java
index ea02d46..7df0c53 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/bundle/OM.java
@@ -11,8 +11,6 @@
package org.eclipse.emf.cdo.internal.server.bundle;
import org.eclipse.emf.cdo.internal.server.RepositoryConfigurator;
-import org.eclipse.emf.cdo.server.CDOServerUtil;
-import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.net4j.util.container.IPluginContainer;
import org.eclipse.net4j.util.om.OMBundle;
@@ -48,22 +46,8 @@ public abstract class OM
static void start() throws Exception
{
- if (DEBUG.isEnabled())
- {
- DEBUG.trace(OM.class, "Configuring repositories");
- }
-
- RepositoryConfigurator configurator = new RepositoryConfigurator();
- IRepository[] repositories = configurator.configure(OMPlatform.INSTANCE.getConfigFile("cdo.server.xml"));
- for (IRepository repository : repositories)
- {
- if (DEBUG.isEnabled())
- {
- DEBUG.trace(OM.class, "Activating repository " + repository.getName());
- }
-
- CDOServerUtil.addRepository(IPluginContainer.INSTANCE, repository);
- }
+ RepositoryConfigurator configurator = new RepositoryConfigurator(IPluginContainer.INSTANCE);
+ configurator.configure(OMPlatform.INSTANCE.getConfigFile("cdo.server.xml"));
}
/**
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 b88607d..7b36a1f 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
@@ -99,9 +99,16 @@ public class OpenSessionIndication extends IndicationWithResponse
private Repository getRepository()
{
- CDOServerProtocol protocol = (CDOServerProtocol)getProtocol();
- IRepositoryProvider repositoryProvider = protocol.getInfraStructure();
- return (Repository)repositoryProvider.getRepository(repositoryName);
+ try
+ {
+ CDOServerProtocol protocol = (CDOServerProtocol)getProtocol();
+ IRepositoryProvider repositoryProvider = protocol.getInfraStructure();
+ return (Repository)repositoryProvider.getRepository(repositoryName);
+ }
+ catch (RuntimeException ex)
+ {
+ throw new RepositoryNotFoundException(repositoryName);
+ }
}
private void writeSessionID(ExtendedDataOutputStream out, ISession session) throws IOException
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
index 1fe2837..540e050 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/CDOServerUtil.java
@@ -42,7 +42,7 @@ public final class CDOServerUtil
public static void prepareContainer(IManagedContainer container, IRepositoryProvider repositoryProvider)
{
- container.registerFactory(new RepositoryFactory());
+ // container.registerFactory(new RepositoryFactory());
container.registerFactory(new CDOServerProtocolFactory(repositoryProvider));
}
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
index d308731..04e84db 100644
--- 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
@@ -14,6 +14,8 @@ import org.eclipse.emf.cdo.internal.server.TypeManager;
import org.eclipse.net4j.util.container.IContainer;
+import java.util.Map;
+
/**
* @author Eike Stepper
*/
@@ -21,8 +23,16 @@ public interface IRepository extends IContainer<IRepositoryElement>
{
public String getName();
+ public void setName(String name);
+
public IStore getStore();
+ public void setStore(IStore store);
+
+ public Map<String, String> getProperties();
+
+ public void setProperties(Map<String, String> properties);
+
public String getUUID();
public boolean isSupportingAudits();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositoryFactory.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositoryFactory.java
new file mode 100644
index 0000000..3a3e778
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositoryFactory.java
@@ -0,0 +1,22 @@
+/***************************************************************************
+ * 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 IRepositoryFactory
+{
+ public String getRepositoryType();
+
+ public IRepository createRepository();
+}