Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactFactoryUtilities.java @ 171:7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
gnv-artifacts/trunk@208 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 09 Oct 2009 07:54:48 +0000 |
parents | 158e89c2263b |
children | 9a828e5a2390 |
comparison
equal
deleted
inserted
replaced
170:7be22e76c270 | 171:7fb9441dd8af |
---|---|
7 import org.w3c.dom.Document; | 7 import org.w3c.dom.Document; |
8 import org.w3c.dom.Node; | 8 import org.w3c.dom.Node; |
9 | 9 |
10 import de.intevation.artifacts.ArtifactFactory; | 10 import de.intevation.artifacts.ArtifactFactory; |
11 | 11 |
12 | |
13 /** | 12 /** |
14 * @author Tim Englich <tim.englich@intevation.de> | 13 * @author Tim Englich <tim.englich@intevation.de> |
15 * | 14 * |
16 */ | 15 */ |
17 public class ArtifactFactoryUtilities { | 16 public class ArtifactFactoryUtilities { |
18 /** | 17 /** |
19 * the logger, used to log exceptions and additonaly information | 18 * the logger, used to log exceptions and additonaly information |
20 */ | 19 */ |
21 private static Logger log = Logger.getLogger(ArtifactFactoryUtilities.class); | 20 private static Logger log = Logger |
21 .getLogger(ArtifactFactoryUtilities.class); | |
22 | |
22 /** | 23 /** |
23 * Constructor | 24 * Constructor |
24 */ | 25 */ |
25 public ArtifactFactoryUtilities() { | 26 public ArtifactFactoryUtilities() { |
26 } | 27 } |
27 | 28 |
28 public ArtifactFactory createArtitfactFactor(Document config, Node artifactFactoryNode){ | 29 public ArtifactFactory createArtitfactFactor(Document config, |
29 String className =artifactFactoryNode.getTextContent(); | 30 Node artifactFactoryNode) { |
31 String className = artifactFactoryNode.getTextContent(); | |
30 | 32 |
31 ArtifactFactory factory = null; | 33 ArtifactFactory factory = null; |
32 | 34 |
33 try { | 35 try { |
34 Class clazz = Class.forName(className); | 36 Class clazz = Class.forName(className); |
35 factory = (ArtifactFactory)clazz.newInstance(); | 37 factory = (ArtifactFactory) clazz.newInstance(); |
36 } | 38 } catch (ClassNotFoundException cnfe) { |
37 catch (ClassNotFoundException cnfe) { | |
38 log.error(cnfe.getLocalizedMessage(), cnfe); | 39 log.error(cnfe.getLocalizedMessage(), cnfe); |
39 } | 40 } catch (InstantiationException ie) { |
40 catch (InstantiationException ie) { | |
41 log.error(ie.getLocalizedMessage(), ie); | 41 log.error(ie.getLocalizedMessage(), ie); |
42 } | 42 } catch (ClassCastException cce) { |
43 catch (ClassCastException cce) { | |
44 log.error(cce.getLocalizedMessage(), cce); | 43 log.error(cce.getLocalizedMessage(), cce); |
45 } | 44 } catch (IllegalAccessException iae) { |
46 catch (IllegalAccessException iae) { | |
47 log.error(iae.getLocalizedMessage(), iae); | 45 log.error(iae.getLocalizedMessage(), iae); |
48 } | 46 } |
49 | 47 |
50 if (factory != null) { | 48 if (factory != null) { |
51 factory.setup(config, artifactFactoryNode); | 49 factory.setup(config, artifactFactoryNode); |
52 log.info("Registering '" + factory.getName() + "' as artifact factory."); | 50 log.info("Registering '" + factory.getName() |
51 + "' as artifact factory."); | |
53 } | 52 } |
54 return factory; | 53 return factory; |
55 } | 54 } |
56 } | 55 } |