You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2006/11/25 20:02:51 UTC
svn commit: r479169 - in
/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input:
AbstractInputModule.java AbstractJXPathModule.java BaseLinkModule.java
InputModuleHelper.java
Author: cziegeler
Date: Sat Nov 25 11:02:50 2006
New Revision: 479169
URL: http://svn.apache.org/viewvc?view=rev&rev=479169
Log:
Clean up input modules a little bit
Modified:
cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/AbstractInputModule.java
cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/AbstractJXPathModule.java
cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/BaseLinkModule.java
cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/InputModuleHelper.java
Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/AbstractInputModule.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/AbstractInputModule.java?view=diff&rev=479169&r1=479168&r2=479169
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/AbstractInputModule.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/AbstractInputModule.java Sat Nov 25 11:02:50 2006
@@ -14,12 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.cocoon.components.modules.input;
import java.util.Iterator;
import java.util.Map;
-import java.util.Vector;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.configuration.Configurable;
@@ -28,6 +26,7 @@
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.cocoon.util.HashMap;
+import org.apache.commons.collections.iterators.EmptyIterator;
/**
* AbstractInputModule gives you the infrastructure for easily
@@ -36,27 +35,15 @@
*
* @version $Id$
*/
-public abstract class AbstractInputModule extends AbstractLogEnabled
+public abstract class AbstractInputModule
+ extends AbstractLogEnabled
implements InputModule, Configurable, Disposable {
/**
- * For those modules that access only one attribute, have a
- * fixed collection we can return an iterator for.
- */
- final static Vector returnNames;
- static {
- Vector tmp = new Vector();
- tmp.add("attribute");
- returnNames = tmp;
- }
-
-
-
- /**
* Stores (global) configuration parameters as <code>key</code> /
* <code>value</code> pairs.
*/
- protected HashMap settings = null;
+ protected HashMap settings;
/**
* Configures the database access helper.
@@ -79,7 +66,7 @@
}
/**
- * dispose
+ * @see org.apache.avalon.framework.activity.Disposable#dispose()
*/
public void dispose() {
// Purposely empty so that we don't need to implement it in every
@@ -91,7 +78,7 @@
// since the ones below have a cyclic dependency!
//
- /* (non-Javadoc)
+ /**
* @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)
*/
public Object getAttribute(String name, Configuration modeConf, Map objectModel) throws ConfigurationException {
@@ -99,7 +86,7 @@
return (result == null ? null : result[0]);
}
- /* (non-Javadoc)
+ /**
* @see org.apache.cocoon.components.modules.input.InputModule#getAttributeValues(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)
*/
public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
@@ -109,10 +96,10 @@
}
- /* (non-Javadoc)
+ /**
* @see org.apache.cocoon.components.modules.input.InputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration, java.util.Map)
*/
public Iterator getAttributeNames(Configuration modeConf, Map objectModel) throws ConfigurationException {
- return AbstractInputModule.returnNames.iterator();
+ return EmptyIterator.INSTANCE;
}
}
Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/AbstractJXPathModule.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/AbstractJXPathModule.java?view=diff&rev=479169&r1=479168&r2=479169
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/AbstractJXPathModule.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/AbstractJXPathModule.java Sat Nov 25 11:02:50 2006
@@ -89,14 +89,15 @@
* @exception ConfigurationException if an error occurs
*/
public void configure(Configuration config) throws ConfigurationException {
-
this.configuration = JXPathHelper.setup(config);
}
+ /**
+ * @see org.apache.cocoon.components.modules.input.AbstractInputModule#getAttribute(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)
+ */
public Object getAttribute(String name, Configuration modeConf, Map objectModel)
throws ConfigurationException {
-
Object contextObj = getContextObject(modeConf, objectModel);
if (modeConf != null) {
name = modeConf.getChild("parameter").getValue(this.parameter != null ? this.parameter : name);
@@ -105,17 +106,21 @@
}
+ /**
+ * @see org.apache.cocoon.components.modules.input.AbstractInputModule#getAttributeNames(org.apache.avalon.framework.configuration.Configuration, java.util.Map)
+ */
public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
throws ConfigurationException {
-
Object contextObj = getContextObject(modeConf, objectModel);
return JXPathHelper.getAttributeNames(this.configuration, contextObj);
}
+ /**
+ * @see org.apache.cocoon.components.modules.input.AbstractInputModule#getAttributeValues(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)
+ */
public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
throws ConfigurationException {
-
Object contextObj = getContextObject(modeConf, objectModel);
if (modeConf != null) {
name = modeConf.getChild("parameter").getValue(this.parameter != null ? this.parameter : name);
Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/BaseLinkModule.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/BaseLinkModule.java?view=diff&rev=479169&r1=479168&r2=479169
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/BaseLinkModule.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/BaseLinkModule.java Sat Nov 25 11:02:50 2006
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.cocoon.components.modules.input;
import java.util.Iterator;
Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/InputModuleHelper.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/InputModuleHelper.java?view=diff&rev=479169&r1=479168&r2=479169
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/InputModuleHelper.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/modules/input/InputModuleHelper.java Sat Nov 25 11:02:50 2006
@@ -186,7 +186,6 @@
return getAttributeValues(objectModel, null, module, name, deflt);
}
-
/**
* Get an iterator to a collection of attribute names from a
* module.
@@ -208,8 +207,6 @@
public Iterator getAttributeNames(Map objectModel, String module) throws InputModuleException {
return getAttributeNames(objectModel, (Configuration)null, module);
}
-
-
/**
* Releases all obtained module references.