Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionFactory.java @ 127:f6f0e4ce4a35
merged gnv-artifacts/0.1
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:13:41 +0200 |
parents | 4d6a82b96059 |
children | 7fb9441dd8af |
comparison
equal
deleted
inserted
replaced
49:94a07d1d9316 | 127:f6f0e4ce4a35 |
---|---|
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.artifactdatabase.Config; | |
10 import de.intevation.gnv.artifacts.GNVArtifactBase; | |
11 | |
12 /** | |
13 * @author Tim Englich <tim.englich@intevation.de> | |
14 * | |
15 */ | |
16 public class TransitionFactory { | |
17 | |
18 /** | |
19 * the logger, used to log exceptions and additonaly information | |
20 */ | |
21 private static Logger log = Logger.getLogger(GNVArtifactBase.class); | |
22 | |
23 private static TransitionFactory instance = null; | |
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 | |
39 public Transition createTransition(Node configuration){ | |
40 log.debug("TransitionFactory.createTransition"); | |
41 Transition transition = null; | |
42 try { | |
43 String classname = Config.getStringXPath(configuration, "@transition"); | |
44 transition = (Transition)(Class.forName(classname).newInstance()); | |
45 transition.setup(configuration); | |
46 } catch (InstantiationException e) { | |
47 log.error(e,e); | |
48 } catch (IllegalAccessException e) { | |
49 log.error(e,e); | |
50 } catch (ClassNotFoundException e) { | |
51 log.error(e,e); | |
52 } | |
53 return transition; | |
54 } | |
55 | |
56 } |