01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.components.treeprocessor.sitemap;
18:
19: import org.apache.avalon.framework.parameters.Parameters;
20: import org.apache.cocoon.components.treeprocessor.InvokeContext;
21: import org.apache.cocoon.components.treeprocessor.ParameterizableProcessingNode;
22: import org.apache.cocoon.components.treeprocessor.SimpleParentProcessingNode;
23: import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
24: import org.apache.cocoon.environment.Environment;
25:
26: import java.util.Map;
27:
28: /**
29: * Handles <map:act type="..."> (action-sets calls are handled by {@link ActSetNode}).
30: *
31: * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
32: * @version CVS $Id: ActSetNode.java 433543 2006-08-22 06:22:54Z crossley $
33: */
34:
35: public class ActSetNode extends SimpleParentProcessingNode implements
36: ParameterizableProcessingNode {
37:
38: /** The parameters of this node */
39: private Map parameters;
40:
41: /** The action set to call */
42: private ActionSetNode actionSet;
43:
44: public void setParameters(Map parameterMap) {
45: this .parameters = parameterMap;
46: }
47:
48: public void setActionSet(ActionSetNode actionSet) {
49: this .actionSet = actionSet;
50: }
51:
52: public final boolean invoke(Environment env, InvokeContext context)
53: throws Exception {
54:
55: // Perform any common invoke functionality
56: super .invoke(env, context);
57:
58: Parameters resolvedParams = VariableResolver.buildParameters(
59: this .parameters, context, env.getObjectModel());
60:
61: Map result = this .actionSet.call(env, context, resolvedParams);
62:
63: if (context.getRedirector().hasRedirected()) {
64: return true;
65:
66: } else if (result == null) {
67: return false;
68:
69: } else if (this .children == null) {
70: return true;
71:
72: } else {
73: return this.invokeNodes(this.children, env, context, null,
74: result);
75: }
76: }
77: }
|