summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-09 12:14:15 (EDT)
committerEike Stepper2007-07-09 12:14:15 (EDT)
commitbab1629367ab2431add6d9f185c2733709eaccec (patch)
tree2a500b709c7ad8d93b92ac8d4505b565a21a265c
parent25ec9b94695d3ba071a9bbe957010fa93ab2094f (diff)
downloadcdo-bab1629367ab2431add6d9f185c2733709eaccec.zip
cdo-bab1629367ab2431add6d9f185c2733709eaccec.tar.gz
cdo-bab1629367ab2431add6d9f185c2733709eaccec.tar.bz2
task 1: Develop 0.8.0
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryManager.java79
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositoryManager.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF5
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/config/org.eclipse.emf.cdo.server.properties26
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java (renamed from plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java)37
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/SharedIcons.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/PluginDelegator.java6
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiActivator.java30
12 files changed, 182 insertions, 39 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server.db/META-INF/MANIFEST.MF
index 0ac4917..b06232b 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server.db/META-INF/MANIFEST.MF
@@ -9,3 +9,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.net4j.db;visibility:=reexport,
org.eclipse.emf.cdo.server;visibility:=reexport
Eclipse-LazyStart: true
+Export-Package: org.eclipse.emf.cdo.server.db;version="0.8.0",
+ org.eclipse.emf.cdo.server.internal.db;version="0.8.0",
+ org.eclipse.emf.cdo.server.internal.db.bundle;version="0.8.0"
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
index b809be6..b4c71c4 100644
--- 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
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.ITransaction;
+import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
import org.eclipse.net4j.util.store.IStoreManager;
import java.util.UUID;
@@ -22,7 +23,7 @@ import java.util.UUID;
/**
* @author Eike Stepper
*/
-public class Repository implements IRepository
+public class Repository extends Lifecycle implements IRepository
{
private static final long INITIAL_OID_VALUE = 1;
@@ -40,14 +41,14 @@ public class Repository implements IRepository
private long nextOIDValue = INITIAL_OID_VALUE;
- public Repository(String name)
+ public Repository(String name, IStoreManager<ITransaction> storeManager)
{
this.name = name;
this.uuid = UUID.randomUUID().toString();
sessionManager = new SessionManager(this);
resourceManager = new ResourceManager(this);
revisionManager = new RevisionManager(this);
- storeManager = new EmptyStoreManager();
+ this.storeManager = storeManager;
}
public String getName()
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
index 0e8b4c1..0e6f837 100644
--- 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
@@ -10,9 +10,13 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.server;
+import org.eclipse.emf.cdo.internal.server.bundle.OM;
import org.eclipse.emf.cdo.server.IRepositoryManager;
+import org.eclipse.emf.cdo.server.ITransaction;
import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.store.IStoreManager;
import java.util.HashMap;
import java.util.Map;
@@ -31,26 +35,73 @@ public final class RepositoryManager extends Lifecycle implements IRepositoryMan
{
}
- public Repository getRepository(String name, boolean createOnDemand)
+ public String[] getRepositoryNames()
{
- Repository repository = repositories.get(name);
- if (repository == null && createOnDemand)
+ synchronized (repositories)
{
- repository = new Repository(name);
+ return repositories.keySet().toArray(new String[repositories.size()]);
+ }
+ }
+
+ public Repository[] getRepositories()
+ {
+ synchronized (repositories)
+ {
+ return repositories.values().toArray(new Repository[repositories.size()]);
+ }
+ }
+
+ public Repository getRepository(String name)
+ {
+ synchronized (repositories)
+ {
+ Repository repository = repositories.get(name);
+ if (repository == null)
+ {
+ throw new RuntimeException("Repository not found: " + name);
+ }
+ return repository;
+ }
+ }
+
+ public Repository addRepository(String name, IStoreManager<ITransaction> storeManager)
+ {
+ synchronized (repositories)
+ {
+ Repository repository = repositories.get(name);
+ if (repository != null)
+ {
+ throw new RuntimeException("Repository already exists: " + name);
+ }
+ repository = new Repository(name, storeManager);
+ LifecycleUtil.activate(repository);
repositories.put(name, repository);
+ return repository;
}
+ }
- return repository;
+ public void clear()
+ {
+ synchronized (repositories)
+ {
+ repositories.clear();
+ }
}
public boolean isEmpty()
{
- return repositories.isEmpty();
+ synchronized (repositories)
+ {
+ return repositories.isEmpty();
+ }
}
- public void clear()
+ public int size()
{
- repositories.clear();
+ synchronized (repositories)
+ {
+ return repositories.size();
+ }
}
@Override
@@ -62,6 +113,18 @@ public final class RepositoryManager extends Lifecycle implements IRepositoryMan
@Override
protected void doDeactivate() throws Exception
{
+ for (Repository repository : getRepositories())
+ {
+ try
+ {
+ LifecycleUtil.deactivate(repository);
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.warn(ex);
+ }
+ }
+
super.doDeactivate();
}
}
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 70e9c31..6c23209 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
@@ -59,12 +59,12 @@ public class OpenSessionIndication extends IndicationWithResponse
@Override
protected void responding(ExtendedDataOutputStream out) throws IOException
{
- Repository repository = RepositoryManager.INSTANCE.getRepository(repositoryName, true);
+ Repository repository = RepositoryManager.INSTANCE.getRepository(repositoryName);
if (repository == null)
{
if (PROTOCOL.isEnabled())
{
- PROTOCOL.format("IRepository {0} not found", repositoryName);
+ PROTOCOL.format("Repository {0} not found", repositoryName);
}
out.writeInt(CDOProtocolConstants.ERROR_REPOSITORY_NOT_FOUND);
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
index 43a8524..350b813 100644
--- 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
@@ -12,6 +12,8 @@ package org.eclipse.emf.cdo.server;
import org.eclipse.emf.cdo.internal.server.RepositoryManager;
+import org.eclipse.net4j.util.store.IStoreManager;
+
/**
* @author Eike Stepper
*/
@@ -19,5 +21,17 @@ public interface IRepositoryManager
{
public static final IRepositoryManager INSTANCE = RepositoryManager.INSTANCE;
- public IRepository getRepository(String name, boolean createOnDemand);
+ public String[] getRepositoryNames();
+
+ public IRepository[] getRepositories();
+
+ public IRepository getRepository(String name);
+
+ public IRepository addRepository(String name, IStoreManager<ITransaction> storeManager);
+
+ public void clear();
+
+ public boolean isEmpty();
+
+ public int size();
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
index fb1b4fa..79aad52 100644
--- a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo.ui;singleton:=true
Bundle-Version: 0.8.0.qualifier
-Bundle-Activator: org.eclipse.emf.cdo.internal.ui.bundle.CDOUI$Activator
+Bundle-Activator: org.eclipse.emf.cdo.internal.ui.bundle.OM$Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.edit.ui;visibility:=reexport,
org.eclipse.emf.ecore.edit;visibility:=reexport,
org.eclipse.emf.cdo;visibility:=reexport,
- org.eclipse.emf.cdo.edit
+ org.eclipse.emf.cdo.edit,
+ org.eclipse.emf.cdo.server.db
Export-Package: org.eclipse.emf.cdo.internal.ui.bundle;version="0.8.0",
org.eclipse.emf.cdo.internal.ui.editor;version="0.8.0",
org.eclipse.emf.cdo.internal.ui.views;version="0.8.0",
diff --git a/plugins/org.eclipse.emf.cdo.ui/config/org.eclipse.emf.cdo.server.properties b/plugins/org.eclipse.emf.cdo.ui/config/org.eclipse.emf.cdo.server.properties
index e2be2f1..31c3dbf 100644
--- a/plugins/org.eclipse.emf.cdo.ui/config/org.eclipse.emf.cdo.server.properties
+++ b/plugins/org.eclipse.emf.cdo.ui/config/org.eclipse.emf.cdo.server.properties
@@ -1,15 +1,15 @@
-repositories = repo1, repo2
+repositories = repo1, repo2
-repo1.store = db
-repo1.store.db.instanceID = TEST0001
-repo1.store.db.dbAdapter = derby
-repo1.store.db.derby.driverClass = org.apache.derby.jdbc.EmbeddedDataSource
-repo1.store.db.derby.databaseName = C:/temp/cdodb1
-repo1.store.db.derby.createDatabase = create
+repo1.type = db
+repo1.instanceID = TEST0001
+repo1.dbAdapter = derby
+repo1.dataSource.driverClass = org.apache.derby.jdbc.EmbeddedDataSource
+repo1.dataSource.databaseName = C:/temp/cdodb1
+repo1.dataSource.createDatabase = create
-repo2.store = db
-repo2.store.db.instanceID = TEST0002
-repo2.store.db.dbAdapter = derby
-repo2.store.db.derby.driverClass = org.apache.derby.jdbc.EmbeddedDataSource
-repo2.store.db.derby.databaseName = C:/temp/cdodb2
-repo2.store.db.derby.createDatabase = create
+repo2.type = db
+repo2.instanceID = TEST0002
+repo2.dbAdapter = derby
+repo2.dataSource.driverClass = org.apache.derby.jdbc.EmbeddedDataSource
+repo2.dataSource.databaseName = C:/temp/cdodb2
+repo2.dataSource.createDatabase = create
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
index 3668152..a549327 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/CDOUI.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
@@ -10,6 +10,9 @@
**************************************************************************/
package org.eclipse.emf.cdo.internal.ui.bundle;
+import org.eclipse.emf.cdo.internal.server.EmptyStoreManager;
+import org.eclipse.emf.cdo.server.IRepositoryManager;
+
import org.eclipse.net4j.internal.util.om.OSGiActivator;
import org.eclipse.net4j.util.om.OMBundle;
import org.eclipse.net4j.util.om.OMLogger;
@@ -19,17 +22,17 @@ import org.eclipse.net4j.util.om.OMTracer;
/**
* @author Eike Stepper
*/
-public final class CDOUI
+public final class OM
{
public static final String BUNDLE_ID = "org.eclipse.emf.cdo.ui"; //$NON-NLS-1$
- public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, CDOUI.class);
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
public static final OMLogger LOG = BUNDLE.logger();
- private CDOUI()
+ private OM()
{
}
@@ -43,5 +46,33 @@ public final class CDOUI
{
return BUNDLE;
}
+
+ @Override
+ protected void start() throws Exception
+ {
+ IRepositoryManager.INSTANCE.addRepository("repo1", new EmptyStoreManager());
+ // Properties properties = BUNDLE.getConfigProperties();
+ // String repositories = properties.getProperty("repositories");
+ // if (repositories != null)
+ // {
+ // StringTokenizer tokenizer = new StringTokenizer(repositories, ",");
+ // while (tokenizer.hasMoreTokens())
+ // {
+ // String repositoryName = tokenizer.nextToken().trim();
+ // String storeType = properties.getProperty(repositoryName + ".type");
+ // IDBAdapter adapter = DBUtil.getDBAdapter("derby");
+ // DataSource dataSource = DBUtil.createDataSource(properties,
+ // repositoryName + ".dataSource");
+ // CDODBStoreManager storeManager = new CDODBStoreManager(adapter,
+ // dataSource);
+ // IRepositoryManager.INSTANCE.addRepository("repo1", storeManager);
+ // }
+ // }
+ }
+
+ @Override
+ protected void stop() throws Exception
+ {
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/SharedIcons.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/SharedIcons.java
index 9875f50..36204f0 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/SharedIcons.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/SharedIcons.java
@@ -76,7 +76,7 @@ public class SharedIcons
private static ImageDescriptor createDescriptor(String key)
{
- ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(CDOUI.BUNDLE_ID, key);
+ ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(OM.BUNDLE_ID, key);
if (descriptor != null)
{
REGISTRY.put(key, descriptor);
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
index d3f5413..cffa48a 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
@@ -11,7 +11,7 @@ import org.eclipse.emf.cdo.CDOSessionViewsEvent;
import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.CDOViewCommittedEvent;
import org.eclipse.emf.cdo.CDOViewDirtyEvent;
-import org.eclipse.emf.cdo.internal.ui.bundle.CDOUI;
+import org.eclipse.emf.cdo.internal.ui.bundle.OM;
import org.eclipse.emf.cdo.internal.ui.views.CDOEventHandler;
import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.model.CDOPackage;
@@ -151,7 +151,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
/**
* @ADDED
*/
- public static final String EDITOR_ID = CDOUI.BUNDLE_ID + ".CDOEditor";
+ public static final String EDITOR_ID = OM.BUNDLE_ID + ".CDOEditor";
/**
* @ADDED
@@ -2133,7 +2133,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
}
catch (Exception ex)
{
- CDOUI.LOG.error(ex);
+ OM.LOG.error(ex);
}
}
});
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/PluginDelegator.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/PluginDelegator.java
index a19965d..7a00ab9 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/PluginDelegator.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/PluginDelegator.java
@@ -6,7 +6,7 @@
*/
package org.eclipse.emf.cdo.internal.ui.editor;
-import org.eclipse.emf.cdo.internal.ui.bundle.CDOUI;
+import org.eclipse.emf.cdo.internal.ui.bundle.OM;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.ui.EclipseUIPlugin;
@@ -52,11 +52,11 @@ public final class PluginDelegator extends EMFPlugin
{
if (logEntry instanceof Throwable)
{
- CDOUI.LOG.error((Throwable)logEntry);
+ OM.LOG.error((Throwable)logEntry);
}
else
{
- CDOUI.LOG.info(logEntry.toString());
+ OM.LOG.info(logEntry.toString());
}
}
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiActivator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiActivator.java
index d517878..bdd44af 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiActivator.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiActivator.java
@@ -74,4 +74,34 @@ public abstract class OSGiActivator implements BundleActivator
}
protected abstract OMBundle getOMBundle();
+
+ @Override
+ protected final Object clone() throws CloneNotSupportedException
+ {
+ return super.clone();
+ }
+
+ @Override
+ public final boolean equals(Object obj)
+ {
+ return super.equals(obj);
+ }
+
+ @Override
+ protected final void finalize() throws Throwable
+ {
+ super.finalize();
+ }
+
+ @Override
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ @Override
+ public final String toString()
+ {
+ return super.toString();
+ }
}