summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Campo2008-01-16 11:52:57 (EST)
committerChristian Campo2008-01-16 11:52:57 (EST)
commit35054313b2495ae248152c9cc06f0c55596479dc (patch)
treee4b06e7171364fd9e8898bd23d0de9fa125ada3e
downloadorg.eclipse.riena.old-35054313b2495ae248152c9cc06f0c55596479dc.zip
org.eclipse.riena.old-35054313b2495ae248152c9cc06f0c55596479dc.tar.gz
org.eclipse.riena.old-35054313b2495ae248152c9cc06f0c55596479dc.tar.bz2
initial checkin
-rw-r--r--org.eclipse.riena.exceptionhandler/.classpath7
-rw-r--r--org.eclipse.riena.exceptionhandler/.project28
-rw-r--r--org.eclipse.riena.exceptionhandler/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--org.eclipse.riena.exceptionhandler/META-INF/MANIFEST.MF11
-rw-r--r--org.eclipse.riena.exceptionhandler/about.html24
-rw-r--r--org.eclipse.riena.exceptionhandler/build.properties4
-rw-r--r--org.eclipse.riena.exceptionhandler/src/org/eclipse/riena/internal/exceptionhandler/Activator.java46
-rw-r--r--org.eclipse.riena.exceptionhandler/src/org/eclipse/riena/internal/exceptionhandler/DefaultExceptionHandler.java63
-rw-r--r--org.eclipse.riena.exceptionmanager/.classpath7
-rw-r--r--org.eclipse.riena.exceptionmanager/.project28
-rw-r--r--org.eclipse.riena.exceptionmanager/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--org.eclipse.riena.exceptionmanager/META-INF/MANIFEST.MF11
-rw-r--r--org.eclipse.riena.exceptionmanager/about.html24
-rw-r--r--org.eclipse.riena.exceptionmanager/build.properties4
-rw-r--r--org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/Activator.java85
-rw-r--r--org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/ExceptionHandlerManagerDefault.java111
-rw-r--r--org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/TopologicalNode.java56
-rw-r--r--org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/TopologicalSort.java71
18 files changed, 588 insertions, 0 deletions
diff --git a/org.eclipse.riena.exceptionhandler/.classpath b/org.eclipse.riena.exceptionhandler/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/org.eclipse.riena.exceptionhandler/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.riena.exceptionhandler/.project b/org.eclipse.riena.exceptionhandler/.project
new file mode 100644
index 0000000..22caaf0
--- /dev/null
+++ b/org.eclipse.riena.exceptionhandler/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.riena.exceptionhandler</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.riena.exceptionhandler/.settings/org.eclipse.pde.core.prefs b/org.eclipse.riena.exceptionhandler/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 0000000..3761b3e
--- /dev/null
+++ b/org.eclipse.riena.exceptionhandler/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Thu Sep 06 15:38:38 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/org.eclipse.riena.exceptionhandler/META-INF/MANIFEST.MF b/org.eclipse.riena.exceptionhandler/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..ae3acea
--- /dev/null
+++ b/org.eclipse.riena.exceptionhandler/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Riena ExceptionHandler (Incubation)
+Bundle-SymbolicName: org.eclipse.riena.exceptionhandler
+Bundle-Version: 0.0.1
+Bundle-Activator: org.eclipse.riena.internal.exceptionhandler.Activator
+Eclipse-LazyStart: true
+Import-Package: org.eclipse.equinox.log,
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.log;version="1.3.0"
+Require-Bundle: org.eclipse.riena.core
diff --git a/org.eclipse.riena.exceptionhandler/about.html b/org.eclipse.riena.exceptionhandler/about.html
new file mode 100644
index 0000000..fc81119
--- /dev/null
+++ b/org.eclipse.riena.exceptionhandler/about.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+
+
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head><body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+<div style="position: absolute; width: 28px; height: 28px; z-index: 1000; display: none;"></div><img style="position: absolute; width: 35px; height: 29px; z-index: 1000; display: none;" src="about-Dateien/launch.png"></body></html> \ No newline at end of file
diff --git a/org.eclipse.riena.exceptionhandler/build.properties b/org.eclipse.riena.exceptionhandler/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/org.eclipse.riena.exceptionhandler/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/org.eclipse.riena.exceptionhandler/src/org/eclipse/riena/internal/exceptionhandler/Activator.java b/org.eclipse.riena.exceptionhandler/src/org/eclipse/riena/internal/exceptionhandler/Activator.java
new file mode 100644
index 0000000..dc263f2
--- /dev/null
+++ b/org.eclipse.riena.exceptionhandler/src/org/eclipse/riena/internal/exceptionhandler/Activator.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG and others.
+ * 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.exceptionhandler;
+
+import java.util.Hashtable;
+
+import org.eclipse.riena.core.exception.IExceptionHandler;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+public class Activator implements BundleActivator {
+
+ private ServiceRegistration handlerReg;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ DefaultExceptionHandler handler = new DefaultExceptionHandler();
+
+ Hashtable<String, String> properties = new Hashtable<String, String>(0);
+ handlerReg = context.registerService(IExceptionHandler.ID, handler, properties);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ handlerReg.unregister();
+ handlerReg = null;
+ }
+
+}
diff --git a/org.eclipse.riena.exceptionhandler/src/org/eclipse/riena/internal/exceptionhandler/DefaultExceptionHandler.java b/org.eclipse.riena.exceptionhandler/src/org/eclipse/riena/internal/exceptionhandler/DefaultExceptionHandler.java
new file mode 100644
index 0000000..3011dbf
--- /dev/null
+++ b/org.eclipse.riena.exceptionhandler/src/org/eclipse/riena/internal/exceptionhandler/DefaultExceptionHandler.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG and others.
+ * 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.exceptionhandler;
+
+import org.eclipse.equinox.log.Logger;
+import org.eclipse.riena.core.exception.IExceptionHandler;
+import org.eclipse.riena.core.exception.IExceptionHandlerManager.Action;
+import org.osgi.service.log.LogService;
+
+/**
+ *
+ */
+public class DefaultExceptionHandler implements IExceptionHandler {
+
+ /**
+ * This handler name is "riena.exceptionhandler.default"
+ */
+ public static final String NAME = "riena.exceptionhandler.default";
+
+ /**
+ * this handler will not be invoked before any other handler
+ *
+ * @see org.eclipse.riena.core.exception.IExceptionHandler#getBefore()
+ */
+ public String getBefore() {
+ // this handler will not be invoked before any other handler
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.core.exception.IExceptionHandler#getName()
+ */
+ public String getName() {
+ return NAME;
+ }
+
+ public Action handleCaught(Throwable t, String msg, Logger logger) {
+ if (logger != null) {
+ logger.log(LogService.LOG_ERROR, msg, t);
+ return Action.Ok;
+ }
+ return Action.NotHandled;
+ }
+
+ public Action handleUncaught(Throwable t, String msg, Logger logger) {
+ if (logger != null) {
+ logger.log(LogService.LOG_ERROR, msg, t);
+ return Action.Ok;
+ }
+ return Action.NotHandled;
+ }
+
+}
diff --git a/org.eclipse.riena.exceptionmanager/.classpath b/org.eclipse.riena.exceptionmanager/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/org.eclipse.riena.exceptionmanager/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.riena.exceptionmanager/.project b/org.eclipse.riena.exceptionmanager/.project
new file mode 100644
index 0000000..63147f3
--- /dev/null
+++ b/org.eclipse.riena.exceptionmanager/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.riena.exceptionmanager</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.riena.exceptionmanager/.settings/org.eclipse.pde.core.prefs b/org.eclipse.riena.exceptionmanager/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 0000000..9b231f6
--- /dev/null
+++ b/org.eclipse.riena.exceptionmanager/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Fri Sep 07 08:49:09 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/org.eclipse.riena.exceptionmanager/META-INF/MANIFEST.MF b/org.eclipse.riena.exceptionmanager/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..63463de
--- /dev/null
+++ b/org.eclipse.riena.exceptionmanager/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Riena ExceptionManager (Incubation)
+Bundle-SymbolicName: org.eclipse.riena.exceptionmanager
+Bundle-Version: 0.0.1
+Bundle-Activator: org.eclipse.riena.internal.exceptionmanager.Activator
+Eclipse-LazyStart: true
+Import-Package: org.eclipse.equinox.log,
+ org.osgi.framework;version="1.3.0"
+Require-Bundle: org.eclipse.riena.core
+Export-Package: org.eclipse.riena.internal.exceptionmanager;x-friends:="org.eclipse.riena.exceptionmanager.test"
diff --git a/org.eclipse.riena.exceptionmanager/about.html b/org.eclipse.riena.exceptionmanager/about.html
new file mode 100644
index 0000000..fc81119
--- /dev/null
+++ b/org.eclipse.riena.exceptionmanager/about.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+
+
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head><body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+<div style="position: absolute; width: 28px; height: 28px; z-index: 1000; display: none;"></div><img style="position: absolute; width: 35px; height: 29px; z-index: 1000; display: none;" src="about-Dateien/launch.png"></body></html> \ No newline at end of file
diff --git a/org.eclipse.riena.exceptionmanager/build.properties b/org.eclipse.riena.exceptionmanager/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/org.eclipse.riena.exceptionmanager/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/Activator.java b/org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/Activator.java
new file mode 100644
index 0000000..510b1e3
--- /dev/null
+++ b/org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/Activator.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG and others.
+ * 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.exceptionmanager;
+
+import java.util.Hashtable;
+
+import org.eclipse.riena.core.exception.IExceptionHandler;
+import org.eclipse.riena.core.exception.IExceptionHandlerManager;
+import org.eclipse.riena.core.service.ServiceInjector;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+public class Activator implements BundleActivator {
+ private static Activator plugin;
+
+ private BundleContext context;
+
+ private ServiceInjector handlerManagerInjector;
+
+ private ServiceRegistration handlerManagerReg;
+
+ public static Activator getPlugin() {
+ return plugin;
+ }
+
+ public BundleContext getContext() {
+ return context;
+ }
+
+ private void registerExceptionHandlerManager() {
+ ExceptionHandlerManagerDefault handlerManager = new ExceptionHandlerManagerDefault();
+ String handlerId = IExceptionHandler.ID;
+ String bindMethod = "addHandler";
+ String unbindMethod = "removeHandler";
+
+ handlerManagerInjector = new ServiceInjector(context, handlerId, handlerManager, bindMethod, unbindMethod);
+ handlerManagerInjector.start();
+
+ Hashtable<String, String> properties = new Hashtable<String, String>(0);
+ handlerManagerReg = context.registerService(IExceptionHandlerManager.ID, handlerManager, properties);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ plugin = this;
+ this.context = context;
+
+ registerExceptionHandlerManager();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+
+ unregisterExceptionHandlerManager();
+
+ this.context = null;
+ plugin = null;
+ }
+
+ private void unregisterExceptionHandlerManager() {
+
+ handlerManagerReg.unregister();
+ handlerManagerReg = null;
+ handlerManagerInjector.dispose();
+ handlerManagerInjector = null;
+ }
+}
diff --git a/org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/ExceptionHandlerManagerDefault.java b/org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/ExceptionHandlerManagerDefault.java
new file mode 100644
index 0000000..7779bf1
--- /dev/null
+++ b/org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/ExceptionHandlerManagerDefault.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG and others.
+ * 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.exceptionmanager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.equinox.log.Logger;
+import org.eclipse.riena.core.exception.IExceptionHandler;
+import org.eclipse.riena.core.exception.IExceptionHandlerManager;
+
+/**
+ *
+ */
+public class ExceptionHandlerManagerDefault implements IExceptionHandlerManager {
+
+ private List<IExceptionHandler> handlers;
+
+ public ExceptionHandlerManagerDefault() {
+ handlers = new ArrayList<IExceptionHandler>();
+ }
+
+ public void addHandler(IExceptionHandler handler) {
+ handlers = sort(handlers, handler);
+ }
+
+ private List<IExceptionHandler> sort(List<IExceptionHandler> existsHandler, IExceptionHandler handler) {
+ List<TopologicalNode<IExceptionHandler>> nodes = new ArrayList<TopologicalNode<IExceptionHandler>>(existsHandler.size() + 1);
+ TopologicalNode<IExceptionHandler> node = new TopologicalNode<IExceptionHandler>(handler.getName(), handler.getBefore(), handler);
+ nodes.add(node);
+ for (IExceptionHandler nextHandler : existsHandler) {
+ node = new TopologicalNode<IExceptionHandler>(nextHandler.getName(), nextHandler.getBefore(), nextHandler);
+ nodes.add(node);
+ }
+ return TopologicalSort.sort(nodes);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.core.exception.IExceptionHandlerManager#handleCaught(java.lang.Throwable)
+ */
+ public Action handleCaught(Throwable t) {
+ return handleCaught(t, null, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.core.exception.IExceptionHandlerManager#handleCaught(java.lang.Throwable,
+ * org.eclipse.equinox.log.Logger)
+ */
+ public Action handleCaught(Throwable t, Logger logger) {
+ return handleCaught(t, null, logger);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.core.exception.IExceptionHandlerManager#handleCaught(java.lang.Throwable, java.lang.String)
+ */
+ public Action handleCaught(Throwable t, String msg) {
+ return handleCaught(t, msg, null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.core.exception.IExceptionHandlerManager#handleCaught(java.lang.Throwable, java.lang.String,
+ * org.eclipse.equinox.log.Logger)
+ */
+ public Action handleCaught(Throwable t, String msg, Logger logger) {
+ Action action = Action.NotHandled;
+ for (IExceptionHandler handler : handlers) {
+ action = handler.handleCaught(t, msg, logger);
+ if (action != Action.NotHandled) {
+ break;
+ }
+ }
+ return action;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.core.exception.IExceptionHandlerManager#handleUncaught(java.lang.Throwable,
+ * java.lang.Object, org.eclipse.equinox.log.Logger)
+ */
+ public Action handleUncaught(Throwable t, String msg, Logger logger) {
+ Action action = Action.NotHandled;
+ for (IExceptionHandler handler : handlers) {
+ action = handler.handleUncaught(t, msg, logger);
+ if (action != Action.NotHandled) {
+ break;
+ }
+ }
+ return action;
+ }
+
+ public void removeHandler(IExceptionHandler handler) {
+ handlers.remove(handler);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/TopologicalNode.java b/org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/TopologicalNode.java
new file mode 100644
index 0000000..8e73ca3
--- /dev/null
+++ b/org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/TopologicalNode.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG and others.
+ * 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.exceptionmanager;
+
+/**
+ *
+ */
+public class TopologicalNode<T> {
+ private String name;
+ private String before;
+ private int pointToMe;
+ private T element;
+
+ public TopologicalNode(String name, String before, T element) {
+ this.name = name;
+ this.before = before;
+ this.element = element;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getBefore() {
+ return before;
+ }
+
+ public int getPointToMe() {
+ return pointToMe;
+ }
+
+ public T getElement() {
+ return element;
+ }
+
+ public void increase() {
+ pointToMe++;
+ }
+
+ public void decrease() {
+ pointToMe--;
+ }
+
+ @Override
+ public String toString() {
+ return "[" + name + ",<-" + pointToMe + "]";
+ }
+}
diff --git a/org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/TopologicalSort.java b/org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/TopologicalSort.java
new file mode 100644
index 0000000..c7df117
--- /dev/null
+++ b/org.eclipse.riena.exceptionmanager/src/org/eclipse/riena/internal/exceptionmanager/TopologicalSort.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG and others.
+ * 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.exceptionmanager;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ */
+public class TopologicalSort {
+
+ public static <T> List<T> sort(List<TopologicalNode<T>> nodes) {
+ Map<String, TopologicalNode<T>> topSort = new HashMap<String, TopologicalNode<T>>(nodes.size());
+ for (TopologicalNode<T> node : nodes) {
+ topSort.put(node.getName(), node);
+ }
+
+ for (TopologicalNode<T> node : nodes) {
+ if (node.getBefore() != null) {
+ TopologicalNode<T> beforeNode = topSort.get(node.getBefore());
+ if (beforeNode != null) {
+ beforeNode.increase();
+ }
+ }
+ }
+
+ List<TopologicalNode<T>> workNodes = new ArrayList<TopologicalNode<T>>(nodes);
+ List<T> result = new ArrayList<T>(nodes.size());
+
+ while (!workNodes.isEmpty()) {
+ boolean foundNode = false;
+ Iterator<TopologicalNode<T>> itr = workNodes.iterator();
+ while (itr.hasNext()) {
+ TopologicalNode<T> node = itr.next();
+ if (node.getPointToMe() == 0) {
+ TopologicalNode<T> beforeNode = topSort.get(node.getBefore());
+ if (beforeNode != null) {
+ beforeNode.decrease();
+ foundNode = true;
+ }
+ itr.remove();
+ result.add(node.getElement());
+
+ }
+ }
+ if (!foundNode) {
+ // A recursion was detected, i.e. the nodes are not present a
+ // directed graph.
+ // The sorting stops here
+ for (TopologicalNode<T> node : workNodes) {
+ result.add(node.getElement());
+ }
+ break;
+ }
+ }
+
+ return result;
+ }
+}