Source Code Cross Referenced for ObservingCourier.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/ObservingCourier.java $
003:         * $Id: ObservingCourier.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 java.util.Observable;
023:        import java.util.Observer;
024:
025:        import org.sakaiproject.courier.api.CourierService;
026:        import org.sakaiproject.tool.cover.SessionManager;
027:
028:        /**
029:         * <p>
030:         * ObservingCourier is an observer which uses the courier service to notify when things change.
031:         * </p>
032:         */
033:        public abstract class ObservingCourier implements 
034:                org.sakaiproject.courier.api.ObservingCourier, Observer {
035:            /** Constructor discovered injected CourierService. */
036:            protected CourierService m_courierService = null;
037:
038:            /** The location (id not ref). */
039:            protected String m_location = null;
040:
041:            /**
042:             * Construct.
043:             * 
044:             * @param location
045:             *        The key identifying the client window to which this courier delivers updates.
046:             * @param elementId
047:             *        The key identifying the element on the Portal Page that would need a courier delivered message when things change.
048:             */
049:            public ObservingCourier(String location, String elementId) {
050:                m_deliveryId = SessionManager.getCurrentSession().getId()
051:                        + location;
052:                m_elementId = elementId;
053:                m_location = location;
054:
055:                // "inject" a CourierService
056:                m_courierService = org.sakaiproject.courier.cover.CourierService
057:                        .getInstance();
058:            }
059:
060:            /** The key identifying the Portal PageSession. */
061:            protected String m_deliveryId = "";
062:
063:            public String getDeliveryId() {
064:                return m_deliveryId;
065:            }
066:
067:            public void setDeliveryId(String id) {
068:                m_deliveryId = id;
069:            }
070:
071:            /** The key identifying the element on the Portal Page. */
072:            protected String m_elementId = "";
073:
074:            public String getElementId() {
075:                return m_elementId;
076:            }
077:
078:            public void setElementId(String id) {
079:                m_elementId = id;
080:            }
081:
082:            /** The enabled state. */
083:            protected boolean m_enabled = true;
084:
085:            public boolean getEnabled() {
086:                return m_enabled;
087:            }
088:
089:            public void enable() {
090:                m_enabled = true;
091:            }
092:
093:            public void disable() {
094:                m_enabled = false;
095:            }
096:
097:            /**
098:             * Accept notification that the portal element has just been delivered. If there are pending requests to deliver, they can be cleared.
099:             */
100:            public void justDelivered() {
101:                m_courierService.clear(getDeliveryId(), getElementId());
102:            }
103:
104:            /**
105:             * Check to see if we want to process or ignore this update.
106:             * 
107:             * @param arg
108:             *        The arg from the update.
109:             * @return true to continue, false to quit.
110:             */
111:            public boolean check(Object arg) {
112:                return true;
113:            }
114:
115:            /**
116:             * Access the location this observer is observing.
117:             * 
118:             * @return the location this observer is observing.
119:             */
120:            public String getLocation() {
121:                return m_location;
122:            }
123:
124:            /**********************************************************************************************************************************************************************************************************************************************************
125:             * Observer implementation
126:             *********************************************************************************************************************************************************************************************************************************************************/
127:
128:            /**
129:             * 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
130:             * cause the courier service to deliver to the interface controlled by my controller. Extensions can override.
131:             * 
132:             * @param o
133:             *        the observable object.
134:             * @param arg
135:             *        an argument passed to the <code>notifyObservers</code> method.
136:             */
137:            public void update(Observable o, Object arg) {
138:                // ignore changes when not enabled
139:                if (!getEnabled()) {
140:                    return;
141:                }
142:
143:                if (!check(arg))
144:                    return;
145:
146:                m_courierService.deliver(new DirectRefreshDelivery(
147:                        getDeliveryId(), getElementId()));
148:            }
149:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.