Source Code Cross Referenced for PresenceObservingCourier.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/presence/tags/sakai_2-4-1/presence-util/util/src/java/org/sakaiproject/util/PresenceObservingCourier.java $
003:         * $Id: PresenceObservingCourier.java 8204 2006-04-24 19:35:57Z 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 java.util.Observable;
023:
024:        import org.sakaiproject.event.api.Event;
025:        import org.sakaiproject.presence.cover.PresenceService;
026:
027:        /**
028:         * <p>
029:         * PresenceObservingCourier is an EventObservingCourier which watches for only presence service events at a particular location, and delivers a direct refresh delivery.
030:         * </p>
031:         */
032:        public class PresenceObservingCourier extends EventObservingCourier {
033:            /**
034:             * This variant, watches presense changes at the specified location, and sends the notifications to 
035:             * that same location.  The elementID is null so the main window is refreshed when the notification 
036:             * is received.
037:             * 
038:             * @param location
039:             *        The location under observation *and* the location for the delivery of the events.
040:             */
041:            public PresenceObservingCourier(String location) {
042:                super (location, null, PresenceService
043:                        .presenceReference(location));
044:            }
045:
046:            /**
047:             * This variant watches changes in a window and sends change notifications to the same window.
048:             * In the case where there are multiple iframes in the tool, elementID sends notification to 
049:             * the frame specified by elementId.
050:             * 
051:             * @param location
052:             *        The location under observation *and* the location for the delivery of the events.
053:             * @param elementId
054:             *        The html element to refresh.  If this is null the main window is refreshed.
055:             */
056:            public PresenceObservingCourier(String location, String elementId) {
057:                super (location, elementId, PresenceService
058:                        .presenceReference(location));
059:            }
060:
061:            /**
062:             * This variant watches changes in one window (watchLocation) and sends the notifications to a different
063:             * window (location)..  
064:             * 
065:             * @param location
066:             *        The location which will receive the notifications.
067:             * @param elementId
068:             *        The html element to refresh.  If this is null, the main window is refreshed.
069:             * @param watchLocation
070:             *        The location being observed.
071:             */
072:            public PresenceObservingCourier(String location, String elementId,
073:                    String watchLocation) {
074:                super (location, elementId, PresenceService
075:                        .presenceReference(watchLocation));
076:            }
077:
078:            /**
079:             * Check to see if we want to process or ignore this update.
080:             * 
081:             * @param arg
082:             *        The arg from the update.
083:             * @return true to continue, false to quit.
084:             */
085:            public boolean check(Object arg) {
086:                // arg is Event
087:                if (!(arg instanceof  Event))
088:                    return false;
089:                Event event = (Event) arg;
090:                String key = event.getResource();
091:
092:                // reject non presence events
093:                String function = event.getEvent();
094:                if (!(function.equals(PresenceService.EVENT_PRESENCE) || function
095:                        .equals(PresenceService.EVENT_ABSENCE)))
096:                    return false;
097:
098:                // look for matches to the pattern
099:                if (m_resourcePattern != null) {
100:                    if (!key.equals(m_resourcePattern))
101:                        return false;
102:                }
103:
104:                return true;
105:            }
106:
107:            /**
108:             * This method is called whenever the observed object is changed. An application calls an <tt>Observable</tt> object's <code>notifyObservers</code> method to have all the object's observers notified of the change. default implementation is to
109:             * cause the courier service to deliver to the interface controlled by my controller. Extensions can override.
110:             * 
111:             * @param o
112:             *        the observable object.
113:             * @param arg
114:             *        an argument passed to the <code>notifyObservers</code> method.
115:             */
116:            public void update(Observable o, Object arg) {
117:                // ignore changes when not enabled
118:                if (!getEnabled()) {
119:                    return;
120:                }
121:
122:                if (!check(arg))
123:                    return;
124:
125:                if (m_elementId == null) {
126:                    m_courierService.deliver(new DirectRefreshDelivery(
127:                            getDeliveryId()));
128:                } else {
129:                    m_courierService.deliver(new DirectRefreshDelivery(
130:                            getDeliveryId(), m_elementId));
131:                }
132:            }
133:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.