comparison gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionFactory.java @ 337:a887074460b6

Last Step of the Refactoring Work on the Transition Model. Splitted Businesslogic between States and Transitions. Splitted the ConfigurationElements of State and Transition in several XML-Fragments. gnv-artifacts/trunk@403 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 08 Dec 2009 13:38:21 +0000
parents
children 9a828e5a2390
comparison
equal deleted inserted replaced
336:1b9ca0f2d498 337:a887074460b6
1 /**
2 *
3 */
4 package de.intevation.gnv.transition;
5
6 import org.apache.log4j.Logger;
7 import org.w3c.dom.Node;
8
9 import de.intevation.gnv.artifacts.GNVArtifactBase;
10
11 /**
12 * @author Tim Englich <tim.englich@intevation.de>
13 *
14 */
15 public class TransitionFactory {
16
17 /**
18 * the logger, used to log exceptions and additonaly information
19 */
20 private static Logger log = Logger.getLogger(GNVArtifactBase.class);
21
22 private static TransitionFactory instance = null;
23
24 /**
25 * Constructor
26 */
27 public TransitionFactory() {
28 super();
29 }
30
31 public static TransitionFactory getInstance() {
32 if (instance == null) {
33 instance = new TransitionFactory();
34 }
35 return instance;
36 }
37
38 public Transition createTransition(Node configuration) {
39 log.debug("TransitionFactory.createTransition");
40 Transition state = null;
41 try {
42 String classname = ((org.w3c.dom.Element)configuration).getAttribute("transition");
43 state = (Transition) (Class.forName(classname).newInstance());
44 state.setup(configuration);
45 } catch (InstantiationException e) {
46 log.error(e, e);
47 } catch (IllegalAccessException e) {
48 log.error(e, e);
49 } catch (ClassNotFoundException e) {
50 log.error(e, e);
51 }
52 return state;
53 }
54
55 }

http://dive4elements.wald.intevation.org