01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: XmlSelectorProperty.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.selector;
09:
10: import com.uwyn.rife.ioc.exceptions.PropertyValueException;
11: import com.uwyn.rife.rep.Rep;
12: import com.uwyn.rife.xml.exceptions.XmlErrorException;
13:
14: /**
15: * Selects an XML file according to the <code>rife.application</code>
16: * application property. The filename will be
17: * <code>${prefix}-${rife.application}.xml</code>.
18: *
19: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
20: * @version $Revision: 3634 $
21: * @see XmlSelector
22: * @since 1.0
23: */
24: public class XmlSelectorProperty implements XmlSelector {
25: public String getXmlPath(String prefix) {
26: try {
27: return prefix
28: + Rep.getProperties().get("rife.application")
29: .getValueString() + ".xml";
30: } catch (PropertyValueException e) {
31: throw new XmlErrorException(
32: "Error while obtain the String value of property 'rife.application'.",
33: e);
34: }
35: }
36: }
|