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


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/event/tags/sakai_2-4-1/event-impl/impl/src/java/org/sakaiproject/event/impl/DbNotificationService.java $
003:         * $Id: DbNotificationService.java 7319 2006-04-01 20:02:05Z 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.event.impl;
021:
022:        import java.util.Iterator;
023:        import java.util.List;
024:        import java.util.Vector;
025:
026:        import org.apache.commons.logging.Log;
027:        import org.apache.commons.logging.LogFactory;
028:        import org.sakaiproject.db.api.SqlService;
029:        import org.sakaiproject.event.api.Notification;
030:        import org.sakaiproject.event.api.NotificationEdit;
031:        import org.sakaiproject.util.BaseDbSingleStorage;
032:        import org.sakaiproject.util.StorageUser;
033:
034:        /**
035:         * <p>
036:         * DbNotificationService is ... %%%.
037:         * </p>
038:         */
039:        public abstract class DbNotificationService extends
040:                BaseNotificationService {
041:            /** Our logger. */
042:            private static Log M_log = LogFactory
043:                    .getLog(DbNotificationService.class);
044:
045:            /** Table name for users. */
046:            protected String m_tableName = "SAKAI_NOTIFICATION";
047:
048:            /** If true, we do our locks in the remote database, otherwise we do them here. */
049:            protected boolean m_locksInDb = true;
050:
051:            /**********************************************************************************************************************************************************************************************************************************************************
052:             * Dependencies
053:             *********************************************************************************************************************************************************************************************************************************************************/
054:
055:            /**
056:             * @return the MemoryService collaborator.
057:             */
058:            protected abstract SqlService sqlService();
059:
060:            /**********************************************************************************************************************************************************************************************************************************************************
061:             * Configuration
062:             *********************************************************************************************************************************************************************************************************************************************************/
063:
064:            /**
065:             * Configuration: set the table name
066:             * 
067:             * @param path
068:             *        The table name.
069:             */
070:            public void setTableName(String name) {
071:                m_tableName = name;
072:            }
073:
074:            /**
075:             * Configuration: set the locks-in-db
076:             * 
077:             * @param value
078:             *        The locks-in-db value.
079:             */
080:            public void setLocksInDb(String value) {
081:                m_locksInDb = new Boolean(value).booleanValue();
082:            }
083:
084:            /** Configuration: to run the ddl on init or not. */
085:            protected boolean m_autoDdl = false;
086:
087:            /**
088:             * Configuration: to run the ddl on init or not.
089:             * 
090:             * @param value
091:             *        the auto ddl value.
092:             */
093:            public void setAutoDdl(String value) {
094:                m_autoDdl = new Boolean(value).booleanValue();
095:            }
096:
097:            /**********************************************************************************************************************************************************************************************************************************************************
098:             * Init and Destroy
099:             *********************************************************************************************************************************************************************************************************************************************************/
100:
101:            /**
102:             * Final initialization, once all dependencies are set.
103:             */
104:            public void init() {
105:                try {
106:                    // if we are auto-creating our schema, check and create
107:                    if (m_autoDdl) {
108:                        sqlService().ddl(this .getClass().getClassLoader(),
109:                                "sakai_notification");
110:                    }
111:
112:                    super .init();
113:
114:                    M_log.info(".init(): table: " + m_tableName
115:                            + " locks-in-db: " + m_locksInDb);
116:                } catch (Throwable t) {
117:                    M_log.warn("init(): ", t);
118:                }
119:            }
120:
121:            /**********************************************************************************************************************************************************************************************************************************************************
122:             * BaseNotificationService extensions
123:             *********************************************************************************************************************************************************************************************************************************************************/
124:
125:            /**
126:             * Construct a Storage object.
127:             * 
128:             * @return The new storage object.
129:             */
130:            protected Storage newStorage() {
131:                return new DbStorage(this );
132:            }
133:
134:            /**********************************************************************************************************************************************************************************************************************************************************
135:             * Storage implementation
136:             *********************************************************************************************************************************************************************************************************************************************************/
137:
138:            protected class DbStorage extends BaseDbSingleStorage implements 
139:                    Storage {
140:                /**
141:                 * Construct.
142:                 * 
143:                 * @param user
144:                 *        The StorageUser class to call back for creation of Resource and Edit objects.
145:                 */
146:                public DbStorage(StorageUser user) {
147:                    super (m_tableName, "NOTIFICATION_ID", null, m_locksInDb,
148:                            "notification", user, sqlService());
149:                }
150:
151:                public boolean check(String id) {
152:                    return super .checkResource(id);
153:                }
154:
155:                public Notification get(String id) {
156:                    return (Notification) super .getResource(id);
157:                }
158:
159:                public List getAll() {
160:                    return super .getAllResources();
161:                }
162:
163:                /**
164:                 * Get a Set of all the notifications that are interested in this Event function. Note: instead of this looking, we could have an additional "key" in storage of the event... -ggolen
165:                 * 
166:                 * @param function
167:                 *        The Event function
168:                 * @return The Set (Notification) of all the notifications that are interested in this Event function.
169:                 */
170:                public List getAll(String function) {
171:                    List rv = new Vector();
172:                    if (function == null)
173:                        return rv;
174:
175:                    List all = super .getAllResources();
176:                    for (Iterator it = all.iterator(); it.hasNext();) {
177:                        Notification notification = (Notification) it.next();
178:                        if (notification.containsFunction(function)) {
179:                            rv.add(notification);
180:                        }
181:                    }
182:
183:                    return rv;
184:                }
185:
186:                public NotificationEdit put(String id) {
187:                    return (NotificationEdit) super .putResource(id, null);
188:                }
189:
190:                public NotificationEdit edit(String id) {
191:                    return (NotificationEdit) super .editResource(id);
192:                }
193:
194:                public void commit(NotificationEdit edit) {
195:                    super .commitResource(edit);
196:                }
197:
198:                public void cancel(NotificationEdit edit) {
199:                    super .cancelResource(edit);
200:                }
201:
202:                public void remove(NotificationEdit edit) {
203:                    super.removeResource(edit);
204:                }
205:            }
206:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.