1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.services;
18
19 import org.apache.jetspeed.om.profile.Profile;
20 import org.apache.jetspeed.om.profile.ProfileLocator;
21 import org.apache.jetspeed.om.profile.QueryLocator;
22 import org.apache.jetspeed.om.profile.ProfileException;
23 import org.apache.jetspeed.om.profile.Portlets;
24 import org.apache.jetspeed.services.profiler.ProfilerService;
25 import org.apache.turbine.services.TurbineServices;
26 import org.apache.turbine.util.RunData;
27 import org.apache.turbine.util.DynamicURI;
28 import org.apache.jetspeed.capability.CapabilityMap;
29 import org.apache.jetspeed.util.MimeType;
30 import java.util.Iterator;
31
32 /***
33 * <P>This is a commodity static accessor class around the
34 * <code>ProfilerService</code> interface</P>
35 *
36 * @see org.apache.jetspeed.services.Profiler
37 * @see org.apache.jetspeed.services.profiler.ProfilerService
38 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
39 * @author <a href="mailto:morciuch@apache.org">Mark Orciuch</a>
40 * @version $Id: Profiler.java,v 1.21 2004/02/23 04:00:57 jford Exp $
41 */
42 public class Profiler
43 {
44 public final static String PARAM_MEDIA_TYPE = "media-type";
45 public final static String PARAM_ROLE = "role";
46 public final static String PARAM_GROUP = "group";
47 public final static String PARAM_PAGE = "page";
48 public final static String PARAM_USER = "user";
49 public final static String PARAM_ANON = "anon";
50 public final static String PARAM_LANGUAGE = "language";
51 public final static String PARAM_COUNTRY = "country";
52 public final static String DEFAULT_PROFILE = "default";
53 public final static String FULL_DEFAULT_PROFILE = "default.psml";
54 public final static String DEFAULT_EXTENSION = ".psml";
55
56 /***
57 * Commodity method for getting a reference to the service
58 * singleton
59 */
60 private static ProfilerService getService()
61 {
62 return (ProfilerService)TurbineServices
63 .getInstance()
64 .getService(ProfilerService.SERVICE_NAME);
65 }
66
67 /***
68 * get the Profile object using the Rundata state and capability map
69 * this is the mapping functionality of the profiler
70 *
71 * @param rundata The rundata object for the current request.
72 * @param cm The device capability map for the current request.
73 * @return a Profile object if found by the manager or null
74 */
75 public static Profile getProfile(RunData rundata, CapabilityMap cm)
76 throws ProfileException
77 {
78 return getService().getProfile( rundata, cm );
79 }
80
81 /***
82 * @see ProfilerService#getProfile
83 */
84 public static Profile getProfile(RunData rundata)
85 throws ProfileException
86 {
87 return getService().getProfile( rundata );
88 }
89
90 /***
91 * @see ProfilerService#getProfile
92 * @deprecated Do not use a profiler method based on MimeType
93 */
94 public static Profile getProfile(RunData data, MimeType mt)
95 throws ProfileException
96 {
97 return getService().getProfile( data, mt );
98 }
99
100 /***
101 * get the Profile object using a profile locator
102 *
103 * @param locator The locator containing criteria describing the profile.
104 * @return a new Profile object
105 */
106 public static Profile getProfile(ProfileLocator locator)
107 throws ProfileException
108 {
109 return getService().getProfile( locator );
110 }
111
112
113 /***
114 * @see ProfilerService#makeDynamicURI
115 */
116 public static DynamicURI makeDynamicURI( RunData data, ProfileLocator locator )
117 throws ProfileException
118 {
119 return getService().makeDynamicURI( data, locator );
120 }
121
122 /***
123 * @see ProfilerService#createProfile
124 */
125 public static Profile createProfile()
126 {
127 return getService().createProfile();
128 }
129
130 /***
131 * @see ProfilerService#createProfile
132 */
133 public static Profile createProfile(ProfileLocator locator)
134 {
135 return getService().createProfile(locator);
136 }
137
138 /***
139 * @see ProfilerService#createProfile
140 */
141 public static ProfileLocator createLocator()
142 {
143 return getService().createLocator();
144 }
145
146 /***
147 * @see ProfilerService#createProfile
148 */
149 public static Profile createProfile( RunData data, Profile profile )
150 throws ProfileException
151 {
152 return getService().createProfile( data, profile );
153 }
154
155 /***
156 * @see ProfilerService#createProfile
157 */
158 public static Profile createProfile( RunData data, Profile profile, MimeType mt )
159 throws ProfileException
160 {
161 return getService().createProfile( data, profile, mt );
162 }
163
164 /***
165 * @see ProfilerService#createProfile
166 */
167 public static Profile createProfile(ProfileLocator locator, Portlets portlets)
168 throws ProfileException
169 {
170 return getService().createProfile(locator, portlets);
171 }
172
173 /***
174 * @see ProfilerService#removeProfile
175 */
176 public static void removeProfile(ProfileLocator locator)
177 throws ProfileException
178 {
179 getService().removeProfile( locator );
180 }
181
182 /***
183 * @see ProfilerService#query
184 */
185 public static Iterator query( QueryLocator locator )
186 {
187 return getService().query( locator );
188 }
189
190 /***
191 * @see ProfilerService#useRoleProfileMerging
192 */
193 public static boolean useRoleProfileMerging()
194 {
195 return getService().useRoleProfileMerging();
196 }
197
198 }