KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > services > Profiler


1 /*
2  * Copyright 2000-2001,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
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 JavaDoc;
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 JavaDoc PARAM_MEDIA_TYPE = "media-type";
45     public final static String JavaDoc PARAM_ROLE = "role";
46     public final static String JavaDoc PARAM_GROUP = "group";
47     public final static String JavaDoc PARAM_PAGE = "page";
48     public final static String JavaDoc PARAM_USER = "user";
49     public final static String JavaDoc PARAM_ANON = "anon";
50     public final static String JavaDoc PARAM_LANGUAGE = "language";
51     public final static String JavaDoc PARAM_COUNTRY = "country";
52     public final static String JavaDoc DEFAULT_PROFILE = "default";
53     public final static String JavaDoc FULL_DEFAULT_PROFILE = "default.psml";
54     public final static String JavaDoc 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 JavaDoc 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 }
199
Popular Tags