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  package org.apache.jetspeed.profiler.rules;
18  
19  import java.io.Serializable;
20  
21  /***
22   * A RuleCriterion specifies one criterion in a list of profiling rule criteria.
23   * This list is used to build normalized profiling locator and then 
24   * locate a portal resource based on the request. 
25   *
26   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
27   * @version $Id: RuleCriterion.java 516448 2007-03-09 16:25:47Z ate $
28   */
29  public interface RuleCriterion extends Serializable
30  {
31      public static final int FALLBACK_CONTINUE = 1;
32      public static final int FALLBACK_STOP = 0;
33      public static final int FALLBACK_LOOP = 2;
34      
35      /***
36       * Gets the rule request type for this specific criterion.
37       * Rule types determine which type of request property, parameter or attribute
38       * to look at when building a profiling locator.
39       *  
40       * @return The request type associated with this criterion.
41       */
42      String getType();
43  
44      /***
45       * Sets the rule request type for this specific criterion.
46       * Rule types determine which type of request property, parameter or attribute
47       * to look at when building a profiling locator.
48       *  
49       * @param The request type associated with this criterion.
50       */    
51      void setType(String type);
52  
53      /***
54       * Sets the fallback order for this criterion.
55       * Lower numbers are returned first during iteration.
56       * Higher numbers should be put on the locator stack first.
57       * 
58       * @return The fallback order for this criterion.
59       */
60      int getFallbackOrder();
61      
62      
63      /***
64       * Gets the fallback order for this criterion.
65       * Lower numbers are returned first during iteration.
66       * Higher numbers should be put on the locator stack first.
67       * 
68       * @param order The fallback order for this criterion.
69       */
70      void setFallbackOrder(int order);
71  
72      /***
73       * Gets the fallback type for this criterion. 
74       * Fallback types are used when locating a profiled resource.
75       * The type tells the Profiling rule what to do next on failed criterion matching.
76       * 
77       * Known values:
78       * 
79       *   FALLBACK_CONTINUE - evaluate this criterion and if it fails continue to the next criterion
80       *   FALLBACK_STOP - evaluate this criterion and if it fails stop evaluation criteria for this rule
81       *   FALLBACK_LOOP - evaluate this criterion and if it fails continue evaluating
82       * 
83       * @return The fallback type for this criterion, should be a valid value as shown above.
84       */
85      int getFallbackType();
86  
87      /***
88       * Sets the fallback type for this criterion. 
89       * Fallback types are used when locating a profiled resource.
90       * The type tells the Profiling rule what to do next on failed criterion matching.
91       * 
92       * Known values:
93       * 
94       *   FALLBACK_CONTINUE - evaluate this criterion and if it fails continue to the next criterion
95       *   FALLBACK_STOP - evaluate this criterion and if it fails stop evaluation criteria for this rule
96       *   FALLBACK_LOOP - evaluate this criterion and if it fails continue evaluating
97       * 
98       * @param The fallback type for this criterion, should be a valid value as shown above.
99       */    
100     void setFallbackType(int order);
101     
102     /***
103      * Gets the name of the parameter, attribute or property in the portal request.
104      * This name is used to lookup the value of the request parameter, attribute, or 
105      * property when building a profile locator.
106      *  
107      * @return The name of the request parameter, attribute or property.
108      */    
109     String getName();
110 
111     /***
112      * Sets the name of the parameter, attribute or property in the portal request.
113      * This name is used to lookup the value of the request parameter, attribute, or 
114      * property when building a profile locator.
115      *  
116      * @param The name of the request parameter, attribute or property.
117      */        
118     void setName(String name);
119 
120    
121     /***
122      * Gets the value of the parameter, attribute or property in the portal request.
123      *  
124      * @return The value of the request parameter, attribute or property.
125      */    
126     String getValue();
127 
128     /***
129      * Sets the value of the parameter, attribute or property in the portal request.
130      *  
131      * @param The value of the request parameter, attribute or property.
132      */        
133     void setValue(String value);
134 
135     /***
136      * Gets the unique rule identifier for the associated owner rule 
137      * 
138      * @return The rule's unique identifier
139      */
140     String getRuleId();
141 
142     /***
143      * Sets the unique rule identifier for the associated owner rule 
144      * 
145      * @param id The rule's unique identifier
146      */    
147     void setRuleId(String ruleId);
148     
149 }