diff options
author | Eike Stepper | 2006-06-25 04:20:11 +0000 |
---|---|---|
committer | Eike Stepper | 2006-06-25 04:20:11 +0000 |
commit | 32c6590e80202e0d7369c49bba3f223f535295fc (patch) | |
tree | b130ffa50f44d3c6b6fdf94364ab9f714d5dc731 /plugins/org.eclipse.emf.cdo.examples.server/src | |
parent | e0a5d4ef6fa79caa6069a73e389d20778ef4a8b0 (diff) | |
download | cdo-32c6590e80202e0d7369c49bba3f223f535295fc.tar.gz cdo-32c6590e80202e0d7369c49bba3f223f535295fc.tar.xz cdo-32c6590e80202e0d7369c49bba3f223f535295fc.zip |
added mapper check
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.examples.server/src')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/ExampleServerApplication.java | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/ExampleServerApplication.java b/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/ExampleServerApplication.java index 578ef78186..6d3f9f59c6 100644 --- a/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/ExampleServerApplication.java +++ b/plugins/org.eclipse.emf.cdo.examples.server/src/org/eclipse/emf/cdo/examples/server/internal/ExampleServerApplication.java @@ -11,20 +11,27 @@ package org.eclipse.emf.cdo.examples.server.internal; +import org.eclipse.net4j.spring.Container; +import org.eclipse.net4j.spring.ValidationException; import org.eclipse.net4j.util.thread.DeadlockDetector; +import org.eclipse.emf.cdo.server.Mapper; + import org.eclipse.core.runtime.IPlatformRunnable; public class ExampleServerApplication implements IPlatformRunnable { + private static final String ACTIVE_MSG = "Mapper is not active"; + public ExampleServerApplication() { } public Object run(Object args) throws Exception { - System.out.println("HIT ANY KEY FOR SHUTDOWN!!!"); + validateContainer(); + System.out.println("HIT ENTER FOR SHUTDOWN!!!"); while (System.in.available() == 0) { @@ -33,4 +40,31 @@ public class ExampleServerApplication implements IPlatformRunnable return null; } + + private void validateContainer() + { + Mapper mapper = getMapper(); + assertTrue(mapper.isActive(), ACTIVE_MSG); + } + + private Mapper getMapper() + { + try + { + Container container = ExampleServerPlugin.getContainer(); + return (Mapper) container.getBean("mapper", Mapper.class); + } + catch (Exception ex) + { + throw new ValidationException(ACTIVE_MSG, ex); + } + } + + private void assertTrue(boolean condition, String msg) + { + if (!condition) + { + throw new ValidationException(msg); + } + } } |