sylvain 01/07/20 01:42:24
Modified: src/org/apache/cocoon/acting Tag: cocoon_20_branch
AbstractAction.java
src/org/apache/cocoon/matching Tag: cocoon_20_branch
WildcardHeaderMatcherFactory.java
WildcardParameterValueMatcherFactory.java
WildcardSessionStateMatcherFactory.java
src/org/apache/cocoon/selection Tag: cocoon_20_branch
HeaderSelectorFactory.java
RequestSelectorFactory.java
SessionStateSelectorFactory.java
Log:
Removed map:parameter in configuration
Revision Changes Path
No revision
No revision
1.2.2.2 +17 -18 xml-cocoon2/src/org/apache/cocoon/acting/AbstractAction.java
Index: AbstractAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/AbstractAction.java,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- AbstractAction.java 2001/07/13 13:37:08 1.2.2.1
+++ AbstractAction.java 2001/07/20 08:42:24 1.2.2.2
@@ -21,7 +21,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a>
- * @version CVS $Revision: 1.2.2.1 $ $Date: 2001/07/13 13:37:08 $
+ * @version CVS $Revision: 1.2.2.2 $ $Date: 2001/07/20 08:42:24 $
*/
public abstract class AbstractAction extends AbstractLoggable
implements Action, Configurable, Disposable {
@@ -35,27 +35,26 @@
/**
* Configures the Action.
*
- * Takes <code><map:parameter/></code> from action declaration and stores
- * them as key (<code>name</code>) and value (<code>value</code>)
- * in <code>settings</code>. This way global configuration options
- * can be used with actions.
- *
- * For nested configurations override this function in your
- * action.
+ * Takes the children from the <code>Configuration</code> and stores them
+ * them as key (configuration name) and value (configuration value)
+ * in <code>settings</code>.
+ * <br/>
+ * This automates parsing of flat string-only configurations.
+ * For nested configurations, override this function in your action.
*/
public void configure(Configuration conf) throws ConfigurationException {
if (conf != null) {
- String key = null;
- String val = null;
- Configuration[] parameters = conf.getChildren("map:parameter");
- this.settings = new HashMap(parameters.length);
- for ( int i = 0; i < parameters.length; i++) {
- key = parameters[i].getAttribute("name");
- val = parameters[i].getAttribute("value");
- if ( key != null )
- this.settings.put(key, val);
- }
- }
+ String key = null;
+ String val = null;
+ Configuration[] parameters = conf.getChildren();
+ this.settings = new HashMap(parameters.length);
+ for ( int i = 0; i < parameters.length; i++) {
+ key = parameters[i].getName();
+ val = parameters[i].getValue(null);
+ if ( key != null )
+ this.settings.put(key, val);
+ }
+ }
}
/**
No revision
No revision
1.1.2.2 +13 -21
xml-cocoon2/src/org/apache/cocoon/matching/WildcardHeaderMatcherFactory.java
Index: WildcardHeaderMatcherFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/matching/WildcardHeaderMatcherFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- WildcardHeaderMatcherFactory.java 2001/07/13 13:39:16 1.1.2.1
+++ WildcardHeaderMatcherFactory.java 2001/07/20 08:42:24 1.1.2.2
@@ -25,7 +25,7 @@
* </table>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:39:16 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/07/20 08:42:24 $
*/
public class WildcardHeaderMatcherFactory extends WildcardURIMatcherFactory {
@@ -35,31 +35,23 @@
*/
public String generateMethodSource (NodeList conf)
throws ConfigurationException {
- String parameterName = null;
- Node node = null;
- Node attrNode = null;
- NamedNodeMap attributes = null;
+ String parameterName = null;
+
int count = conf.getLength();
for(int k = 0; k < count;k++) {
- node = conf.item(k);
- if (node.getNodeName() != null &&
- node.getNodeName().equals("map:parameter"))
- {
- attributes = node.getAttributes();
- if (attributes != null) {
- attrNode = attributes.getNamedItem("name");
- if (attrNode != null &&
- attrNode.getNodeValue().equals("parameter-name"))
- {
- attrNode = attributes.getNamedItem("value");
- if (attrNode != null )
- parameterName=attrNode.getNodeValue();
- }
- }
- }
+ Node node = conf.item(k);
+ if (node.getNodeName() != null &&
+ node.getNodeName().equals("parameter-name"))
+ {
+ Node textNode = node.getFirstChild();
+ if (textNode != null) {
+ parameterName = textNode.getNodeValue().trim();
+ }
+ }
}
- return "HashMap map = new HashMap(1);" +
+
+ return "HashMap map = new HashMap(1);" +
"String theParameter = null;" +
"if (parameters == null) {"+
" theParameter = XSPRequestHelper.getHeader(objectModel,
\""+parameterName+"\");" +
1.1.2.2 +12 -20
xml-cocoon2/src/org/apache/cocoon/matching/WildcardParameterValueMatcherFactory.java
Index: WildcardParameterValueMatcherFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/matching/WildcardParameterValueMatcherFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- WildcardParameterValueMatcherFactory.java 2001/07/13 13:39:19 1.1.2.1
+++ WildcardParameterValueMatcherFactory.java 2001/07/20 08:42:24 1.1.2.2
@@ -29,7 +29,7 @@
* </table>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:39:19 $ */
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/07/20 08:42:24 $ */
public class WildcardParameterValueMatcherFactory extends WildcardURIMatcherFactory
{
@@ -38,30 +38,22 @@
*/
public String generateMethodSource (NodeList conf)
throws ConfigurationException {
- String parameterName = null;
- Node node = null;
- Node attrNode = null;
- NamedNodeMap attributes = null;
+ String parameterName = null;
+
int count = conf.getLength();
for(int k = 0; k < count;k++) {
- node = conf.item(k);
- if (node.getNodeName() != null &&
- node.getNodeName().equals("map:parameter"))
- {
- attributes = node.getAttributes();
- if (attributes != null) {
- attrNode = attributes.getNamedItem("name");
- if (attrNode != null &&
- attrNode.getNodeValue().equals("parameter-name"))
- {
- attrNode = attributes.getNamedItem("value");
- if (attrNode != null )
- parameterName=attrNode.getNodeValue();
- }
- }
- }
+ Node node = conf.item(k);
+ if (node.getNodeName() != null &&
+ node.getNodeName().equals("parameter-name"))
+ {
+ Node textNode = node.getFirstChild();
+ if (textNode != null) {
+ parameterName = textNode.getNodeValue().trim();
+ }
+ }
}
+
return "HashMap map = new HashMap(1);" +
"String theParameter = null; " +
"if (parameters == null) {"+
1.1.2.2 +12 -21
xml-cocoon2/src/org/apache/cocoon/matching/WildcardSessionStateMatcherFactory.java
Index: WildcardSessionStateMatcherFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/matching/WildcardSessionStateMatcherFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- WildcardSessionStateMatcherFactory.java 2001/07/13 13:39:20 1.1.2.1
+++ WildcardSessionStateMatcherFactory.java 2001/07/20 08:42:24 1.1.2.2
@@ -26,7 +26,7 @@
* </table>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:39:20 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/07/20 08:42:24 $
*/
public class WildcardSessionStateMatcherFactory extends WildcardURIMatcherFactory {
@@ -36,30 +36,22 @@
*/
public String generateMethodSource (NodeList conf)
throws ConfigurationException {
- String statekey=Constants.SESSION_STATE_ATTRIBUTE;
- Node node = null;
- Node attrNode = null;
- NamedNodeMap attributes = null;
+ String statekey=Constants.SESSION_STATE_ATTRIBUTE;
+
int count = conf.getLength();
for(int k = 0; k < count;k++) {
- node = conf.item(k);
- if (node.getNodeName() != null &&
- node.getNodeName().equals("map:parameter"))
- {
- attributes = node.getAttributes();
- if (attributes != null) {
- attrNode = attributes.getNamedItem("name");
- if (attrNode != null &&
- attrNode.getNodeValue().equals("state-key"))
- {
- attrNode = attributes.getNamedItem("value");
- if (attrNode != null )
- statekey=attrNode.getNodeValue();
- }
- }
- }
+ Node node = conf.item(k);
+ if (node.getNodeName() != null &&
+ node.getNodeName().equals("state-key"))
+ {
+ Node textNode = node.getFirstChild();
+ if (textNode != null) {
+ statekey = textNode.getNodeValue().trim();
+ }
+ }
}
+
return "HashMap map = new HashMap(1);" +
"String currentState = null; " +
"if (parameters == null) {"+
@@ -73,5 +65,4 @@
"} else {" +
"return null;}";
}
-
}
No revision
No revision
1.1.2.2 +11 -20
xml-cocoon2/src/org/apache/cocoon/selection/HeaderSelectorFactory.java
Index: HeaderSelectorFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/selection/HeaderSelectorFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- HeaderSelectorFactory.java 2001/07/13 13:39:31 1.1.2.1
+++ HeaderSelectorFactory.java 2001/07/20 08:42:24 1.1.2.2
@@ -27,35 +27,26 @@
* </table>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:39:31 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/07/20 08:42:24 $
*/
public class HeaderSelectorFactory extends ParameterSelectorFactory {
public String generateMethodSource (NodeList conf)
throws ConfigurationException {
- String parameterName = null;
- Node node = null;
- Node attrNode = null;
- NamedNodeMap attributes = null;
+ String parameterName = null;
+
int count = conf.getLength();
for(int k = 0; k < count;k++) {
- node = conf.item(k);
- if (node.getNodeName() != null &&
- node.getNodeName().equals("map:parameter"))
- {
- attributes = node.getAttributes();
- if (attributes != null) {
- attrNode = attributes.getNamedItem("name");
- if (attrNode != null &&
- attrNode.getNodeValue().equals("parameter-name"))
- {
- attrNode = attributes.getNamedItem("value");
- if (attrNode != null )
- parameterName=attrNode.getNodeValue();
- }
- }
- }
+ Node node = conf.item(k);
+ if (node.getNodeName() != null &&
+ node.getNodeName().equals("parameter-name"))
+ {
+ Node textNode = node.getFirstChild();
+ if (textNode != null) {
+ parameterName = textNode.getNodeValue().trim();
+ }
+ }
}
StringBuffer sb = new StringBuffer();
1.1.2.2 +11 -20
xml-cocoon2/src/org/apache/cocoon/selection/RequestSelectorFactory.java
Index: RequestSelectorFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/selection/RequestSelectorFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- RequestSelectorFactory.java 2001/07/13 13:39:35 1.1.2.1
+++ RequestSelectorFactory.java 2001/07/20 08:42:24 1.1.2.2
@@ -27,35 +27,26 @@
* </table>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:39:35 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/07/20 08:42:24 $
*/
public class RequestSelectorFactory extends ParameterSelectorFactory {
public String generateMethodSource (NodeList conf)
throws ConfigurationException {
- String parameterName = null;
- Node node = null;
- Node attrNode = null;
- NamedNodeMap attributes = null;
+ String parameterName = null;
+
int count = conf.getLength();
for(int k = 0; k < count;k++) {
- node = conf.item(k);
- if (node.getNodeName() != null &&
- node.getNodeName().equals("map:parameter"))
- {
- attributes = node.getAttributes();
- if (attributes != null) {
- attrNode = attributes.getNamedItem("name");
- if (attrNode != null &&
- attrNode.getNodeValue().equals("parameter-name"))
- {
- attrNode = attributes.getNamedItem("value");
- if (attrNode != null )
- parameterName=attrNode.getNodeValue();
- }
- }
- }
+ Node node = conf.item(k);
+ if (node.getNodeName() != null &&
+ node.getNodeName().equals("parameter-name"))
+ {
+ Node textNode = node.getFirstChild();
+ if (textNode != null) {
+ parameterName = textNode.getNodeValue().trim();
+ }
+ }
}
StringBuffer sb = new StringBuffer();
1.1.2.2 +11 -20
xml-cocoon2/src/org/apache/cocoon/selection/SessionStateSelectorFactory.java
Index: SessionStateSelectorFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/selection/SessionStateSelectorFactory.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- SessionStateSelectorFactory.java 2001/07/13 13:39:40 1.1.2.1
+++ SessionStateSelectorFactory.java 2001/07/20 08:42:24 1.1.2.2
@@ -28,35 +28,26 @@
* </table>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/07/13 13:39:40 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/07/20 08:42:24 $
*/
public class SessionStateSelectorFactory extends ParameterSelectorFactory {
public String generateMethodSource (NodeList conf)
throws ConfigurationException {
- String statekey=Constants.SESSION_STATE_ATTRIBUTE;
- Node node = null;
- Node attrNode = null;
- NamedNodeMap attributes = null;
+ String statekey=Constants.SESSION_STATE_ATTRIBUTE;
+
int count = conf.getLength();
for(int k = 0; k < count;k++) {
- node = conf.item(k);
- if (node.getNodeName() != null &&
- node.getNodeName().equals("map:parameter"))
- {
- attributes = node.getAttributes();
- if (attributes != null) {
- attrNode = attributes.getNamedItem("name");
- if (attrNode != null &&
- attrNode.getNodeValue().equals("state-key"))
- {
- attrNode = attributes.getNamedItem("value");
- if (attrNode != null )
- statekey=attrNode.getNodeValue();
- }
- }
- }
+ Node node = conf.item(k);
+ if (node.getNodeName() != null &&
+ node.getNodeName().equals("state-key"))
+ {
+ Node textNode = node.getFirstChild();
+ if (textNode != null) {
+ statekey = textNode.getNodeValue().trim();
+ }
+ }
}
StringBuffer sb = new StringBuffer();
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]