Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionFactory.java @ 52:4d6a82b96059
First Implementation of the GNV-Artifacts
gnv-artifacts/trunk@32 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Mon, 07 Sep 2009 15:29:24 +0000 |
parents | |
children | 7fb9441dd8af |
comparison
equal
deleted
inserted
replaced
51:71788b63b146 | 52:4d6a82b96059 |
---|---|
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 } |