summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-16 11:54:27 (EDT)
committerEike Stepper2007-07-16 11:54:27 (EDT)
commit9da2ca0ee937abcb293c78192a951fee3e383eb8 (patch)
tree6c491dad8abdc10355d15582c0e643fc64df223a
parent0349c6691b715480880d58b48d880d790e3a3e91 (diff)
downloadcdo-9da2ca0ee937abcb293c78192a951fee3e383eb8.zip
cdo-9da2ca0ee937abcb293c78192a951fee3e383eb8.tar.gz
cdo-9da2ca0ee937abcb293c78192a951fee3e383eb8.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryManager.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java30
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepositoryManager.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISessionManager.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryNotFoundException.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/SessionCreationException.java40
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/SafeAction.java2
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Signal.java4
9 files changed, 115 insertions, 18 deletions
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 64b6984..a534277 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
@@ -13,6 +13,7 @@ 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.IStore;
+import org.eclipse.emf.cdo.server.RepositoryNotFoundException;
import org.eclipse.net4j.internal.util.lifecycle.Lifecycle;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
@@ -50,15 +51,16 @@ public final class RepositoryManager extends Lifecycle implements IRepositoryMan
}
}
- public Repository getRepository(String name)
+ public Repository getRepository(String name) throws RepositoryNotFoundException
{
synchronized (repositories)
{
Repository repository = repositories.get(name);
if (repository == null)
{
- throw new RuntimeException("Repository not found: " + name);
+ throw new RepositoryNotFoundException(name);
}
+
return repository;
}
}
@@ -72,6 +74,7 @@ public final class RepositoryManager extends Lifecycle implements IRepositoryMan
{
throw new RuntimeException("Repository already exists: " + name);
}
+
repository = new Repository(name, store);
LifecycleUtil.activate(repository);
repositories.put(name, repository);
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
index e612d8b..b780911 100644
--- 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
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.internal.server.bundle.OM;
import org.eclipse.emf.cdo.internal.server.protocol.CDOServerProtocol;
import org.eclipse.emf.cdo.server.ISessionManager;
+import org.eclipse.emf.cdo.server.SessionCreationException;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
@@ -51,7 +52,7 @@ public class SessionManager implements ISessionManager
}
}
- public Session openSession(CDOServerProtocol protocol)
+ public Session openSession(CDOServerProtocol protocol) throws SessionCreationException
{
int id = ++lastSessionID;
if (TRACER.isEnabled())
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 bd35da9..3722492 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
@@ -20,6 +20,8 @@ import org.eclipse.emf.cdo.protocol.model.CDOPackage;
import org.eclipse.emf.cdo.protocol.model.CDOPackageManager;
import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.ISession;
+import org.eclipse.emf.cdo.server.RepositoryNotFoundException;
+import org.eclipse.emf.cdo.server.SessionCreationException;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.signal.IndicationWithResponse;
@@ -60,8 +62,20 @@ public class OpenSessionIndication extends IndicationWithResponse
@Override
protected void responding(ExtendedDataOutputStream out) throws IOException
{
- Repository repository = RepositoryManager.INSTANCE.getRepository(repositoryName);
- if (repository == null)
+ try
+ {
+ Repository repository = RepositoryManager.INSTANCE.getRepository(repositoryName);
+ SessionManager sessionManager = repository.getSessionManager();
+
+ CDOServerProtocol serverProtocol = (CDOServerProtocol)getProtocol();
+ Session session = sessionManager.openSession(serverProtocol);
+ serverProtocol.setSession(session);
+
+ writeSessionID(out, session);
+ writeRepositoryUUID(out, repository);
+ writePackageURIs(out, repository.getPackageManager());
+ }
+ catch (RepositoryNotFoundException ex)
{
if (PROTOCOL.isEnabled())
{
@@ -69,13 +83,8 @@ public class OpenSessionIndication extends IndicationWithResponse
}
out.writeInt(CDOProtocolConstants.ERROR_REPOSITORY_NOT_FOUND);
- return;
}
-
- CDOServerProtocol serverProtocol = (CDOServerProtocol)getProtocol();
- SessionManager sessionManager = repository.getSessionManager();
- Session session = sessionManager.openSession(serverProtocol);
- if (session == null)
+ catch (SessionCreationException ex)
{
if (PROTOCOL.isEnabled())
{
@@ -85,11 +94,6 @@ public class OpenSessionIndication extends IndicationWithResponse
out.writeInt(CDOProtocolConstants.ERROR_NO_SESSION);
return;
}
-
- serverProtocol.setSession(session);
- writeSessionID(out, session);
- writeRepositoryUUID(out, repository);
- writePackageURIs(out, repository.getPackageManager());
}
private void writeSessionID(ExtendedDataOutputStream out, ISession session) throws IOException
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 da4ee8b..df6f00b 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
@@ -23,7 +23,10 @@ public interface IRepositoryManager
public IRepository[] getRepositories();
- public IRepository getRepository(String name);
+ /**
+ * @return Never <code>null</code>
+ */
+ public IRepository getRepository(String name) throws RepositoryNotFoundException;
public IRepository addRepository(String name, IStore store);
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
index 8d14c42..bcabc5e 100644
--- 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
@@ -21,5 +21,8 @@ public interface ISessionManager
public ISession[] getSessions();
- public ISession openSession(CDOServerProtocol protocol);
+ /**
+ * @return Never <code>null</code>
+ */
+ public ISession openSession(CDOServerProtocol protocol) throws SessionCreationException;
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryNotFoundException.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryNotFoundException.java
new file mode 100644
index 0000000..93b601e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/RepositoryNotFoundException.java
@@ -0,0 +1,37 @@
+/***************************************************************************
+ * 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.util.CDOException;
+
+/**
+ * @author Eike Stepper
+ */
+public class RepositoryNotFoundException extends CDOException
+{
+ private static final long serialVersionUID = 1L;
+
+ public RepositoryNotFoundException(String repositoryName)
+ {
+ super(repositoryName);
+ }
+
+ public String getRepositoryName()
+ {
+ return super.getMessage();
+ }
+
+ @Override
+ public String getMessage()
+ {
+ return "Repository not found: " + getRepositoryName();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/SessionCreationException.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/SessionCreationException.java
new file mode 100644
index 0000000..62a9026
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/SessionCreationException.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.server;
+
+import org.eclipse.emf.cdo.protocol.util.CDOException;
+
+/**
+ * @author Eike Stepper
+ */
+public class SessionCreationException extends CDOException
+{
+ private static final long serialVersionUID = 1L;
+
+ public SessionCreationException()
+ {
+ }
+
+ public SessionCreationException(String message)
+ {
+ super(message);
+ }
+
+ public SessionCreationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public SessionCreationException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/SafeAction.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/SafeAction.java
index 35bcdbf..a134735 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/SafeAction.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/SafeAction.java
@@ -3,6 +3,7 @@ package org.eclipse.net4j.ui.actions;
import org.eclipse.net4j.internal.ui.bundle.OM;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
/**
@@ -51,6 +52,7 @@ public abstract class SafeAction extends Action
catch (Exception ex)
{
OM.LOG.error(ex);
+ MessageDialog.openError(null, getText(), ex.getMessage() + "\nSee the Error log for details.");
}
}
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Signal.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Signal.java
index 98d56cf..56ed2bf 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Signal.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/Signal.java
@@ -81,6 +81,10 @@ public abstract class Signal implements Runnable
{
throw new TimeoutException("Timeout");
}
+ catch (Exception ex)
+ {
+ throw ex;
+ }
finally
{
getProtocol().stopSignal(this);