Source Code Cross Referenced for StatsRecorder.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » services » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » uPortal_rel 2 6 1 GA » org.jasig.portal.services 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright 2002, 2005 The JA-SIG Collaborative.  All rights reserved.
002:         *  See license distributed with this file and
003:         *  available online at http://www.uportal.org/license.html
004:         */
005:
006:        package org.jasig.portal.services;
007:
008:        import org.apache.commons.logging.Log;
009:        import org.apache.commons.logging.LogFactory;
010:        import org.jasig.portal.ChannelDefinition;
011:        import org.jasig.portal.UserProfile;
012:        import org.jasig.portal.layout.node.IUserLayoutChannelDescription;
013:        import org.jasig.portal.layout.node.IUserLayoutFolderDescription;
014:        import org.jasig.portal.security.IPerson;
015:        import org.jasig.portal.services.stats.DoNothingStatsRecorder;
016:        import org.jasig.portal.services.stats.IStatsRecorder;
017:        import org.jasig.portal.services.stats.StatsRecorderLayoutEventListener;
018:        import org.jasig.portal.services.stats.StatsRecorderSettings;
019:        import org.jasig.portal.spring.PortalApplicationContextFacade;
020:        import org.springframework.beans.BeansException;
021:
022:        /**
023:         * 
024:         * Static cover for the primary instance of IStatsRecorder.
025:         * 
026:         * This class makes the primary instance of IStatsRecorder defined as a
027:         * Spring bean named "statsRecorder" available via static lookup.
028:         * 
029:         * Various parts of the portal call
030:         * the static methods in this service to record events such as 
031:         * when a user logs in, logs out, and subscribes to a channel.
032:         * We forward those method calls to the configured instance of IStatsRecorder.
033:         * 
034:         * Object instances configured via Spring and therefore ammenable to Dependency
035:         * Injection can and probably should receive their IStatsRecorded instance via 
036:         * injection rather than statically accessing this class.
037:         * 
038:         * @author Ken Weiner, kweiner@unicon.net
039:         * @version $Revision: 36546 $ $Date: 2006-04-11 12:18:23 -0700 (Tue, 11 Apr 2006) $
040:         * 
041:         * @deprecated IStatsRecorder implementation is replaced with a much more flexible system 
042:         * based on the Spring ApplicationEventPublisher and Event Listeners. 
043:         * For more information see:
044:         * http://www.ja-sig.org/wiki/display/UPC/Proposal+to+Deprecate+IStatsRecorder
045:         */
046:        public final class StatsRecorder {
047:
048:            /**
049:             * The name of the Spring-configured IStatsRecorder instance to which we
050:             * expect to delegate.
051:             */
052:            public static final String BACKING_BEAN_NAME = "statsRecorder";
053:
054:            private static final Log log = LogFactory
055:                    .getLog(StatsRecorder.class);
056:
057:            private static IStatsRecorder STATS_RECORDER;
058:
059:            /*
060:             * Static block in which we discover our backing IStatsRecorder.
061:             */
062:            static {
063:
064:                synchronized (StatsRecorder.class) {
065:                    try {
066:                        // our first preference is to get the stats recorder from the 
067:                        // PortalApplicationContextFacade (which fronts Spring bean configuration)
068:                        STATS_RECORDER = (IStatsRecorder) PortalApplicationContextFacade
069:                                .getPortalApplicationContext()
070:                                .getBean(BACKING_BEAN_NAME,
071:                                        IStatsRecorder.class);
072:
073:                    } catch (BeansException be) {
074:                        // don't let exceptions about misconfiguration of the stats recorder propogate
075:                        // to the uPortal code that called StatsRecorder.  Instead, fall back on 
076:                        // failing to record anything, logging the configuration problem.
077:                        log
078:                                .error(
079:                                        "Unable to retrieve IStatsRecorder instance from Portal Application Context: is there a bean of name ["
080:                                                + BACKING_BEAN_NAME + "] ?", be);
081:                        STATS_RECORDER = new DoNothingStatsRecorder();
082:                    }
083:                }
084:
085:            }
086:
087:            private StatsRecorder() {
088:                // do nothing
089:                // we're a static cover, no need to instantiate.
090:            }
091:
092:            /**
093:             * Creates an instance of a 
094:             * <code>StatsRecorderLayoutEventListener</code>.
095:             * 
096:             * There is currently no difference between calling this method and using the 
097:             * StatsRecorderLayoutEventListener constructor directly.
098:             * 
099:             * @return a new stats recorder layout event listener instance
100:             */
101:            public final static StatsRecorderLayoutEventListener newLayoutEventListener(
102:                    IPerson person, UserProfile profile) {
103:                return new StatsRecorderLayoutEventListener(person, profile);
104:            }
105:
106:            /**
107:             * Record the successful login of a user.
108:             * @param person the person who is logging in
109:             */
110:            public static void recordLogin(IPerson person) {
111:                STATS_RECORDER.recordLogin(person);
112:            }
113:
114:            /**
115:             * Record the logout of a user.
116:             * @param person the person who is logging out
117:             */
118:            public static void recordLogout(IPerson person) {
119:                STATS_RECORDER.recordLogout(person);
120:            }
121:
122:            /**
123:             * Record that a new session is created for a user.
124:             * @param person the person whose session is being created
125:             */
126:            public static void recordSessionCreated(IPerson person) {
127:                STATS_RECORDER.recordSessionCreated(person);
128:            }
129:
130:            /**
131:             * Record that a user's session is destroyed
132:             * (when the user logs out or his/her session
133:             * simply times out)
134:             * @param person the person whose session is ending
135:             */
136:            public static void recordSessionDestroyed(IPerson person) {
137:                STATS_RECORDER.recordSessionDestroyed(person);
138:            }
139:
140:            /**
141:             * Record that a new channel is being published
142:             * @param person the person publishing the channel
143:             * @param channelDef the channel being published
144:             */
145:            public static void recordChannelDefinitionPublished(IPerson person,
146:                    ChannelDefinition channelDef) {
147:                STATS_RECORDER.recordChannelDefinitionPublished(person,
148:                        channelDef);
149:            }
150:
151:            /**
152:             * Record that an existing channel is being modified
153:             * @param person the person modifying the channel
154:             * @param channelDef the channel being modified
155:             */
156:            public static void recordChannelDefinitionModified(IPerson person,
157:                    ChannelDefinition channelDef) {
158:                STATS_RECORDER.recordChannelDefinitionModified(person,
159:                        channelDef);
160:            }
161:
162:            /**
163:             * Record that a channel is being removed
164:             * @param person the person removing the channel
165:             * @param channelDef the channel being modified
166:             */
167:            public static void recordChannelDefinitionRemoved(IPerson person,
168:                    ChannelDefinition channelDef) {
169:                STATS_RECORDER.recordChannelDefinitionRemoved(person,
170:                        channelDef);
171:            }
172:
173:            /**
174:             * Record that a channel is being added to a user layout
175:             * @param person the person adding the channel
176:             * @param profile the profile of the layout to which the channel is being added
177:             * @param channelDesc the channel being subscribed to
178:             */
179:            public static void recordChannelAddedToLayout(IPerson person,
180:                    UserProfile profile,
181:                    IUserLayoutChannelDescription channelDesc) {
182:                STATS_RECORDER.recordChannelAddedToLayout(person, profile,
183:                        channelDesc);
184:            }
185:
186:            /**
187:             * Record that a channel is being updated in a user layout
188:             * @param person the person updating the channel
189:             * @param profile the profile of the layout in which the channel is being updated
190:             * @param channelDesc the channel being updated
191:             */
192:            public static void recordChannelUpdatedInLayout(IPerson person,
193:                    UserProfile profile,
194:                    IUserLayoutChannelDescription channelDesc) {
195:                STATS_RECORDER.recordChannelUpdatedInLayout(person, profile,
196:                        channelDesc);
197:            }
198:
199:            /**
200:             * Record that a channel is being moved in a user layout
201:             * @param person the person moving the channel
202:             * @param profile the profile of the layout in which the channel is being moved
203:             * @param channelDesc the channel being moved
204:             */
205:            public static void recordChannelMovedInLayout(IPerson person,
206:                    UserProfile profile,
207:                    IUserLayoutChannelDescription channelDesc) {
208:                STATS_RECORDER.recordChannelMovedInLayout(person, profile,
209:                        channelDesc);
210:            }
211:
212:            /**
213:             * Record that a channel is being removed from a user layout
214:             * @param person the person removing the channel
215:             * @param profile the profile of the layout to which the channel is being added
216:             * @param channelDesc the channel being removed from a user layout
217:             */
218:            public static void recordChannelRemovedFromLayout(IPerson person,
219:                    UserProfile profile,
220:                    IUserLayoutChannelDescription channelDesc) {
221:                STATS_RECORDER.recordChannelRemovedFromLayout(person, profile,
222:                        channelDesc);
223:            }
224:
225:            /**
226:             * Record that a folder is being added to a user layout
227:             * @param person the person adding the folder
228:             * @param profile the profile of the layout to which the folder is being added
229:             * @param folderDesc the folder being subscribed to
230:             */
231:            public static void recordFolderAddedToLayout(IPerson person,
232:                    UserProfile profile, IUserLayoutFolderDescription folderDesc) {
233:                STATS_RECORDER.recordFolderAddedToLayout(person, profile,
234:                        folderDesc);
235:            }
236:
237:            /**
238:             * Record that a folder is being updated in a user layout
239:             * @param person the person updating the folder
240:             * @param profile the profile of the layout in which the folder is being updated
241:             * @param folderDesc the folder being updated
242:             */
243:            public static void recordFolderUpdatedInLayout(IPerson person,
244:                    UserProfile profile, IUserLayoutFolderDescription folderDesc) {
245:                STATS_RECORDER.recordFolderUpdatedInLayout(person, profile,
246:                        folderDesc);
247:            }
248:
249:            /**
250:             * Record that a folder is being moved in a user layout
251:             * @param person the person moving the folder
252:             * @param profile the profile of the layout in which the folder is being moved
253:             * @param folderDesc the folder being moved
254:             */
255:            public static void recordFolderMovedInLayout(IPerson person,
256:                    UserProfile profile, IUserLayoutFolderDescription folderDesc) {
257:                STATS_RECORDER.recordFolderMovedInLayout(person, profile,
258:                        folderDesc);
259:            }
260:
261:            /**
262:             * Record that a folder is being removed from a user layout
263:             * @param person the person removing the folder
264:             * @param profile the profile of the layout to which the folder is being added
265:             * @param folderDesc the folder being removed from a user layout
266:             */
267:            public static void recordFolderRemovedFromLayout(IPerson person,
268:                    UserProfile profile, IUserLayoutFolderDescription folderDesc) {
269:                STATS_RECORDER.recordFolderRemovedFromLayout(person, profile,
270:                        folderDesc);
271:            }
272:
273:            /**
274:             * Record that a channel is being instantiated
275:             * @param person the person for whom the channel is instantiated
276:             * @param profile the profile of the layout for whom the channel is instantiated
277:             * @param channelDesc the channel being instantiated
278:             */
279:            public static void recordChannelInstantiated(IPerson person,
280:                    UserProfile profile,
281:                    IUserLayoutChannelDescription channelDesc) {
282:                STATS_RECORDER.recordChannelInstantiated(person, profile,
283:                        channelDesc);
284:            }
285:
286:            /**
287:             * Record that a channel is being rendered
288:             * @param person the person for whom the channel is rendered
289:             * @param profile the profile of the layout for whom the channel is rendered
290:             * @param channelDesc the channel being rendered
291:             */
292:            public static void recordChannelRendered(IPerson person,
293:                    UserProfile profile,
294:                    IUserLayoutChannelDescription channelDesc) {
295:                STATS_RECORDER.recordChannelRendered(person, profile,
296:                        channelDesc);
297:            }
298:
299:            /**
300:             * Record that a channel is being targeted.  In other words,
301:             * the user is interacting with the channel via either a 
302:             * hyperlink or form submission.
303:             * @param person the person interacting with the channel
304:             * @param profile the profile of the layout in which the channel resides
305:             * @param channelDesc the channel being targeted
306:             */
307:            public static void recordChannelTargeted(IPerson person,
308:                    UserProfile profile,
309:                    IUserLayoutChannelDescription channelDesc) {
310:                STATS_RECORDER.recordChannelTargeted(person, profile,
311:                        channelDesc);
312:            }
313:
314:            /**
315:             * This method is deprecated.  Stats recorder settings are no longer necessarily
316:             * global.  This method (continues to) access information about only one 
317:             * particular way in which StatsRecorder can be configured, that of portal.properties
318:             * entries specifying booleans about which kinds of statistics should be recorded,
319:             * fronting the StatsRecorderSettings static singleton.
320:             * 
321:             * Instead of using the Static Singleton (anti-)pattern, you can instead wire
322:             * together and configure your IStatsRecorder as a Spring-managed bean named
323:             * "statsRecorder" and there apply, in a strongly typed and more flexible way,
324:             * your desired statistics recording configuration.
325:             * 
326:             * Specifically, the ConditionalStatsRecorder wrapper now provides a 
327:             * JavaBean-properties approach to querying the settings that were previously
328:             * accessible via this method.
329:             * 
330:             * Note that since StatsRecorderSettings is a Static Singleton, this implementation
331:             * of this method continues to do what the 2.5.0 implementation did.  The change
332:             * since 2.5.0 is that StatsRecorderSettings is no longer necessarily 
333:             * controlling of StatsRecorder behavior.
334:             * 
335:             * Gets the value of a particular stats recorder from StatsRecorderSettings.
336:             * Possible settings are available from <code>StatsRecorderSettings</code>.
337:             * For example: <code>StatsRecorder.get(StatsRecorderSettings.RECORD_LOGIN)</code>
338:             * @param setting the setting
339:             * @return the value for the setting
340:             * @deprecated since uPortal 2.5.1, recorder settings are no longer global
341:             */
342:            public static boolean get(int setting) {
343:                return StatsRecorderSettings.instance().get(setting);
344:            }
345:
346:            /**
347:             * This method is deprecated.  Stats recorder settings are no longer necessarily
348:             * global.  This method (continues to) provide a very thin layer in front of just
349:             * one particular way in which StatsRecorder can be configured, that of
350:             * portal.poperties specifying booleans about which kinds of statistics should be
351:             * recorded, fronting the StatsRecorderSettings static singleton.
352:             * 
353:             * Instead of using the Static Singleton (anti-)patterh, you can instead wire 
354:             * together and configure your IStatsRecorder as a Spring-managed bean named
355:             * "statsRecorder" and there apply, in a strongly typed and more flexible way, 
356:             * your desired statistics recording configuration.
357:             * 
358:             * Specifically, the ConditionalStatsRecorder wrapper now provides a 
359:             * JavaBean-properties approach to configuring the stats recorder even filtering
360:             * that was previously configurable via this method.
361:             * 
362:             * Note that since StatsRecorderSettings is a Static Singleton, this implementation
363:             * of this method continues to do what the 2.5.0 implementation did.  The change
364:             * since 2.5.-0 is that StatsRecorderSettings is no longer necessarily controlling
365:             * of StatsRecorderBehavior.
366:             * 
367:             * CALLING THIS METHOD MAY HAVE NO EFFECT ON StatsRecorder BEHAVIOR.
368:             * This method will only have effect if the IStatsRecorder implementation
369:             * is actually using StatsRecorderSettings.
370:             * 
371:             * Sets the value of a particular stats recorder setting.
372:             * Possible settings are available from <code>StatsRecorderSettings</code>.
373:             * For example: <code>StatsRecorder.set(StatsRecorderSettings.RECORD_LOGIN, true)</code>
374:             * @param setting the setting to change
375:             * @param newValue the new value for the setting
376:             * @deprecated since uPortal 2.5.1, recorder settings are no longer necessarily global
377:             */
378:            public static void set(int setting, boolean newValue) {
379:                StatsRecorderSettings.instance().set(setting, newValue);
380:            }
381:
382:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.