1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.profiler.rules;
18
19 import java.io.Serializable;
20 import java.util.Collection;
21 import org.apache.jetspeed.profiler.ProfileLocator;
22 import org.apache.jetspeed.profiler.Profiler;
23 import org.apache.jetspeed.request.RequestContext;
24
25 /***
26 * A ProfilingRule defines a list of criteria used when evaluating a request
27 * to determine the location of a specific resource. Profiling rules are
28 * used by the Profiler Service to generically locate portal resources
29 * based on the decoupled criteria for known portlet request data.
30 * A rule consists of an ordered list of criteria which should be applied
31 * in the given order of the SortedMap provided by this rule.
32 * Following this order, fallback searches may be applied to find resources
33 * using a less-specific algorithm until the least specific resource criterion
34 * is considered. When all criteria are exhausted, the rule will fail.
35 *
36 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
37 * @version $Id: ProfilingRule.java 516448 2007-03-09 16:25:47Z ate $
38 */
39 public interface ProfilingRule extends Serializable
40 {
41
42 /***
43 * Define the basic supported rule types in the default Jetspeed implementation.
44 * Other rule types can be added.
45 * Rule types define a grouping of rule parameters.
46 * For example, request parameters refer to parameters on the request
47 */
48
49 /*** Standard rule criteria used by Jetspeed traditionally such as media type, language, username, role */
50 public final static String STANDARD = "standard";
51 /*** Request parameters as defined in the Portlet spec 1.0 PLT.11.1.1 */
52 public final static String REQUEST_PARAMETER = "request";
53 /*** Request attributes as defined in the Portlet spec 1.0 PLT.11.1.3 */
54 public final static String REQUEST_ATTRIBUTE = "attribute";
55 /*** Session Attribute */
56 public final static String SESSION_ATTRIBUTE = "session";
57 /*** User attributes as defined in the Portlet spec 1.0 PLT.17 */
58 public final static String USER_ATTRIBUTE = "user";
59 /*** Composite Capabilities and Preference Profile as defined http://www.w3.org/TR/NOTE-CCPP/" target="alexandria_uri">http://www.w3.org/TR/NOTE-CCPP/ */
60 public final static String CCPP_PROPERTY = "ccpp";
61
62 /***
63 * Standard properties used traditionally in Jetspeed
64 */
65 public final static String STANDARD_PAGE = "page";
66 public final static String STANDARD_GROUP_ROLE_USER = "group.role.user";
67 public final static String STANDARD_USER = "user";
68 public final static String STANDARD_GROUP = "group";
69 public final static String STANDARD_ROLE = "role";
70 public final static String STANDARD_MEDIATYPE = "mediatype";
71 public final static String STANDARD_COUNTRY = "country";
72 public final static String STANDARD_LANGUAGE = "language";
73 public final static String STANDARD_ROLE_FALLBACK = "roles";
74
75 /***
76 * Given a criterion name, look up a value resolver
77 *
78 * @param name The name of the criterion
79 * @return
80 */
81 RuleCriterionResolver getResolver(String name);
82
83 /***
84 * Applying the profiling rule generates a generic profile locator.
85 * With this locator we can then locate a profiling resource.
86 *
87 * @param context
88 * @param service
89 * @return
90 */
91 ProfileLocator apply(RequestContext context, Profiler service);
92
93 /***
94 * Returns a sorted map (ordered) of rule criteria.
95 * Each criteria consists of a normalized property/attribute/parameter
96 * associated with a request type.
97 *
98 * @return a sorted map of rule criteria.
99 */
100 Collection getRuleCriteria();
101
102 /***
103 * Gets the unique identifier for this rule
104 *
105 * @return The unique identifier
106 */
107 String getId();
108
109 /***
110 * Sets the unique identifier for this rule
111 *
112 * @param id The unique identifier
113 */
114 void setId(String id);
115
116 /***
117 * Gets the title used for with the rule for displaying descriptive text.
118 *
119 * @return The title of this rule.
120 */
121 String getTitle();
122
123 /***
124 * Set the title used for with the rule for displaying descriptive text.
125 *
126 * @param title The title of this rule.
127 */
128 void setTitle(String title);
129
130 /***
131 * Get the implementing classname of this rule from the database.
132 * The class must exist in the hiearchy and in fact refers to itself when instantiated.
133 *
134 * @return The classname of this instance.
135 */
136 String getClassname();
137
138 /***
139 * Sets the implementing classname of this rule from the database.
140 * The class must exist in the hiearchy and in fact refers to itself when instantiated.
141 *
142 * @param classname The classname of this instance.
143 */
144 void setClassname(String classname);
145
146 ProfileResolvers getResolvers();
147 void setResolvers(ProfileResolvers resolvers);
148
149 }