Source Code Cross Referenced for EventObservingCourier.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » util » 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 » ERP CRM Financial » sakai » org.sakaiproject.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/courier/tags/sakai_2-4-1/courier-util/util/src/java/org/sakaiproject/util/EventObservingCourier.java $
003:         * $Id: EventObservingCourier.java 7855 2006-04-17 15:33:53Z ggolden@umich.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007:         * 
008:         * Licensed under the Educational Community License, Version 1.0 (the "License"); 
009:         * you may not use this file except in compliance with the License. 
010:         * You may obtain a copy of the License at
011:         * 
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         * 
014:         * Unless required by applicable law or agreed to in writing, software 
015:         * distributed under the License is distributed on an "AS IS" BASIS, 
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
017:         * See the License for the specific language governing permissions and 
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.util;
021:
022:        import org.sakaiproject.event.api.Event;
023:        import org.sakaiproject.event.api.EventTrackingService;
024:        import org.sakaiproject.tool.api.SessionBindingEvent;
025:        import org.sakaiproject.tool.api.SessionBindingListener;
026:
027:        /**
028:         * <p>
029:         * EventObservingCourier is an ObservingCourier that watches Events, of a particular reference root. It automatically registers / un-registers as an observer with the event service.
030:         * </p>
031:         */
032:        public class EventObservingCourier extends
033:                org.sakaiproject.util.ObservingCourier implements 
034:                SessionBindingListener {
035:            /** Constructor discovered injected EventTrackingService. */
036:            protected EventTrackingService m_eventTrackingService = null;
037:
038:            /**
039:             * Construct.
040:             * 
041:             * @param location
042:             *        The key identifying the Portal Page Instance.
043:             * @param elementId
044:             *        The key identifying the element on the Portal Page that would need a courier delivered message when things change.
045:             * @param The
046:             *        event resource pattern - we watch for only events whose ref start with this.
047:             */
048:            public EventObservingCourier(String location, String elementId,
049:                    String resourcePattern) {
050:                super (location, elementId);
051:                m_resourcePattern = resourcePattern;
052:
053:                // "inject" a eventTrackingService
054:                m_eventTrackingService = org.sakaiproject.event.cover.EventTrackingService
055:                        .getInstance();
056:
057:                // register to listen to events
058:                m_eventTrackingService.addObserver(this );
059:                // %%% add the pattern to have it filtered there?
060:            }
061:
062:            /** The event resource pattern - we watch for only events that start with this */
063:            protected String m_resourcePattern = null;
064:
065:            public String getResourcePattern() {
066:                return m_resourcePattern;
067:            }
068:
069:            public void setResourcePattern(String pattern) {
070:                m_resourcePattern = pattern;
071:            }
072:
073:            // %%% re-register? add the pattern to have it filtered there?
074:
075:            /**
076:             * Check to see if we want to process or ignore this update.
077:             * 
078:             * @param arg
079:             *        The arg from the update.
080:             * @return true to continue, false to quit.
081:             */
082:            public boolean check(Object arg) {
083:                // arg is Event
084:                if (!(arg instanceof  Event))
085:                    return false;
086:                Event event = (Event) arg;
087:
088:                // if this is just a read, not a modify event, we can ignore it
089:                if (!event.getModify())
090:                    return false;
091:
092:                String key = null;
093:
094:                // filter out events not for us
095:                if (m_resourcePattern != null) {
096:                    key = event.getResource();
097:
098:                    // if this resource is not in my pattern of resources, we can ignore it
099:                    if (!key.startsWith(m_resourcePattern))
100:                        return false;
101:                }
102:
103:                return true;
104:            }
105:
106:            protected void finalize() {
107:                // stop observing the presence location
108:                m_eventTrackingService.deleteObserver(this );
109:            }
110:
111:            /**********************************************************************************************************************************************************************************************************************************************************
112:             * SessionBindingListener implementation
113:             *********************************************************************************************************************************************************************************************************************************************************/
114:
115:            public void valueBound(SessionBindingEvent event) {
116:            }
117:
118:            public void valueUnbound(SessionBindingEvent event) {
119:                // stop observing the presence location
120:                m_eventTrackingService.deleteObserver(this);
121:            }
122:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.