KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > services > LinkFactory


1 // Copyright 2004, 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.tapestry.services;
16
17 import java.util.Map JavaDoc;
18
19 import org.apache.tapestry.IRequestCycle;
20 import org.apache.tapestry.engine.ILink;
21 import org.apache.tapestry.engine.ServiceEncoder;
22
23 /**
24  * A source of {@link org.apache.tapestry.engine.ILink}instances. This is primarily used by
25  * {@link org.apache.tapestry.engine.IEngineService}s.
26  *
27  * @author Howard M. Lewis Ship
28  * @since 4.0
29  */

30 public interface LinkFactory
31 {
32     /**
33      * Constructs an {@link org.apache.tapestry.engine.ILink}.
34      *
35      * @param cycle
36      * the current request cycle
37      * @param parameters
38      * A map; keys are strings and values are strings or string arrays (exception: key
39      * {@link ServiceConstants#PARAMETER} is an array of objects. Certain keys,
40      * defined in {@link ServiceConstants} may have special meaning. The map will
41      * typically be modified internally. May not be null.
42      * @param stateful
43      * If true, then the final URL should be encoded (with the session id) if necessary.
44      * If false, the session encoding should not occur. The latter case is useful for
45      * services that will absolutely not need any access to user-specific state.
46      */

47     public ILink constructLink(IRequestCycle cycle, Map JavaDoc parameters, boolean stateful);
48
49     /**
50      * A secondary function of the service is to convert encoded (aka "squeezed") listener
51      * parameters back into an array of Objects. This does (barely) makes sense .. the link factory
52      * is responsible for encoding the listener parameters, it should be responsible for decoding
53      * them.
54      *
55      * @param cycle
56      * the current request cycle
57      * @return an array of Object[]. May return an empty array, but won't return null.
58      */

59
60     public Object JavaDoc[] extractListenerParameters(IRequestCycle cycle);
61
62     /**
63      * Returns an array of {@link org.apache.tapestry.engine.ServiceEncoder}, ordering into
64      * execution order. May return an empty array, but won't return null.
65      */

66
67     public ServiceEncoder[] getServiceEncoders();
68 }
Popular Tags