unico 2003/10/31 09:02:34
Modified: src/java/org/apache/cocoon/components/modules/input
PropertiesFileModule.java
Log:
extend AbstractJXPathModule as suggested by Konstantin Piroumian
Revision Changes Path
1.2 +13 -19
cocoon-2.2/src/java/org/apache/cocoon/components/modules/input/PropertiesFileModule.java
Index: PropertiesFileModule.java
===================================================================
RCS file:
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/modules/input/PropertiesFileModule.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PropertiesFileModule.java 31 Oct 2003 13:12:05 -0000 1.1
+++ PropertiesFileModule.java 31 Oct 2003 17:02:34 -0000 1.2
@@ -52,14 +52,12 @@
import java.io.IOException;
import java.io.InputStream;
-import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
@@ -76,15 +74,22 @@
* </p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Unico Hommes</a>
+ *
+ * @avalon.component
+ * @avalon.service type="InputModule"
+ * @x-avalon.lifestyle type="singleton"
+ * @x-avalon.info name="properties-file-module"
*/
-public class PropertiesFileModule extends AbstractLogEnabled
+public class PropertiesFileModule extends AbstractJXPathModule
implements InputModule, Serviceable, Configurable, ThreadSafe {
private SourceResolver m_resolver;
private Properties m_properties;
-
+ /**
+ * @avalon.dependency type="SourceResolver"
+ */
public void service(ServiceManager manager) throws ServiceException {
m_resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
}
@@ -96,6 +101,7 @@
* </p>
*/
public void configure(Configuration configuration) throws
ConfigurationException {
+ super.configure(configuration);
String file = configuration.getChild("file").getAttribute("src");
load(file);
}
@@ -126,22 +132,10 @@
}
}
- public Object getAttribute(String name,Configuration modeConf,Map
objectModel)
- throws ConfigurationException {
-
- return m_properties.getProperty(name);
- }
-
- public Iterator getAttributeNames(Configuration modeConf, Map
objectModel)
+ protected Object getContextObject(Configuration modeConf, Map
objectModel)
throws ConfigurationException {
- return m_properties.keySet().iterator();
+ return m_properties;
}
-
- public Object[] getAttributeValues(String name,Configuration
modeConf,Map objectModel)
- throws ConfigurationException {
-
- return new Object[] { getAttribute(name,modeConf,objectModel) };
- }
-
+
}