2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to you under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      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  
18  package org.apache.shale.remoting;
19  
20  import javax.faces.context.FacesContext;
21  
22  /***
23   * <p>Configuration element describing the mapping between a view identifier
24   * URL pattern to a corresponding processor class.</p>
25   */
26  public interface Mapping {
27  
28  
29      /***
30       * <p>Return the {@link Mappings} instance this {@link Mapping} instance
31       * is associated with.</p>
32       */
33      public Mappings getMappings();
34  
35  
36      /***
37       * <p>Set the {@link Mappings} instance this {@link Mapping} instance
38       * is associated with.</p>
39       *
40       * @param mappings The new {@link Mappings} instance
41       */
42      public void setMappings(Mappings mappings);
43  
44  
45      /***
46       * <p>Return a description of the mechanism used to return the response
47       * from this processor.  This value <strong>may</strong> be interpreted,
48       * for example, by a JavaServer Faces component that wishes to calculate
49       * an appropriate URL for a component specific resource that is packaged
50       * in a particular manner.</p>
51       */
52       public Mechanism getMechanism();
53  
54  
55       /***
56        * <p>Set the mechanism used by this mapping.</p>
57        *
58        * @param mechanism The new mechanism
59        */
60       public void setMechanism(Mechanism mechanism);
61  
62  
63       /***
64       * <p>Return the matching pattern for the view identifier for this
65       * request, used to determine if this is the appropriate {@link Mapping}
66       * for processing the current request or not.</p>
67       */
68       public String getPattern();
69  
70  
71       /***
72        * <p>Set the matching pattern used by this mapping.</p>
73        *
74        * @param pattern The new pattern
75        */
76       public void setPattern(String pattern);
77  
78  
79       /***
80        * <p>Return the {@link Processor} instance to be used to process
81        * requests where the view identifier matches our <code>pattern</code>.</p>
82        */
83       public Processor getProcessor();
84  
85  
86       /***
87        * <p>Set the {@link Processor} instance used by this mapping.</p>
88        *
89        * @param processor The new {@link Processor} instance
90        */
91       public void setProcessor(Processor processor);
92  
93  
94       /***
95        * <p>Map the specified resource identifier to a complete URL that may
96        * be used to request this resource from the server.</p>
97        *
98        * @param context <code>FacesContext</code> for the current request
99        * @param resourceId Resource identifier to be mapped
100       */
101      public String mapResourceId(FacesContext context, String resourceId);
102 
103 
104      /***
105       * <p>If the specified view identifier matches the pattern specified by
106       * this {@link Mapping}, return the corresponding resource identifier
107       * that should be passed on to our {@link Processor}.  If the specified
108       * view identifier does not match, return <code>null</code> instead.</p>
109       *
110       * @param context <code>FacesContext</code> for the current request
111       */
112      public String mapViewId(FacesContext context);
113 
114 
115 }