01: /* TransformFactory.java
02: *
03: * DDSteps - Data Driven JUnit Test Steps
04: * Copyright (C) 2005 Jayway AB
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License version 2.1 as published by the Free Software Foundation.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, visit
17: * http://www.opensource.org/licenses/lgpl-license.php
18: */
19: package org.ddsteps.dataset.transform;
20:
21: import org.ddsteps.DDStepsException;
22:
23: /**
24: * Creates different kinds of Transformers.
25: * <p>
26: * If you are not using Spring, you will probably want to use this factory.
27: *
28: * @author Adam Skogman
29: * @version $Id: TransformFactory.java,v 1.2 2006/04/05 18:11:33 adamskogman Exp $
30: */
31: public class TransformFactory {
32:
33: /**
34: * Just creates one instance, cache it here.
35: */
36: protected static PropertyPlaceholderTransformer propertyPlaceholderTransformer;
37:
38: /**
39: * Creates a PropertyPlaceholderTransformer. Leaves all settings on default.
40: * Honors the InitializingBean protocol of the Transformer.
41: *
42: * @return Never null.
43: */
44: public static synchronized PropertyPlaceholderTransformer createPropertyReplacementTransformer() {
45:
46: if (propertyPlaceholderTransformer == null) {
47: propertyPlaceholderTransformer = new PropertyPlaceholderTransformer();
48:
49: try {
50: propertyPlaceholderTransformer.afterPropertiesSet();
51: } catch (Exception e) {
52: throw new DDStepsException(
53: "Could not create a PropertyPlaceholderTransformer.",
54: e);
55: }
56: }
57:
58: return propertyPlaceholderTransformer;
59:
60: }
61:
62: }
|