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


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/sam/trunk/component/src/java/org/sakaiproject/tool/assessment/services/PersistenceService.java $
003:         * $Id: PersistenceService.java 9275 2006-05-10 22:58:35Z lydial@stanford.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 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.tool.assessment.services;
021:
022:        import org.apache.commons.logging.Log;
023:        import org.apache.commons.logging.LogFactory;
024:
025:        import org.sakaiproject.spring.SpringBeanLocator;
026:        import org.sakaiproject.tool.assessment.facade.AssessmentFacadeQueriesAPI;
027:        import org.sakaiproject.tool.assessment.facade.AssessmentGradingFacadeQueriesAPI;
028:        import org.sakaiproject.tool.assessment.facade.AuthzQueriesFacadeAPI;
029:        import org.sakaiproject.tool.assessment.facade.ItemFacadeQueriesAPI;
030:        import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacadeQueriesAPI;
031:        import org.sakaiproject.tool.assessment.facade.QuestionPoolFacadeQueriesAPI;
032:        import org.sakaiproject.tool.assessment.facade.SectionFacadeQueriesAPI;
033:        import org.sakaiproject.tool.assessment.facade.TypeFacadeQueriesAPI;
034:        import org.sakaiproject.tool.assessment.facade.authz.AuthorizationFacadeQueriesAPI;
035:        import org.sakaiproject.tool.assessment.facade.util.PagingUtilQueriesAPI;
036:        import org.sakaiproject.section.api.SectionAwareness;
037:        import org.sakaiproject.component.cover.ComponentManager;
038:
039:        /**
040:         * @author jlannan
041:         *
042:         * To change the template for this generated type comment go to
043:         * Window>Preferences>Java>Code Generation>Code and Comments
044:         */
045:        public class PersistenceService {
046:
047:            private static Log log = LogFactory
048:                    .getLog(PersistenceService.class);
049:            private QuestionPoolFacadeQueriesAPI questionPoolFacadeQueries;
050:            private TypeFacadeQueriesAPI typeFacadeQueries;
051:            private SectionFacadeQueriesAPI sectionFacadeQueries;
052:            private ItemFacadeQueriesAPI itemFacadeQueries;
053:            private AssessmentFacadeQueriesAPI assessmentFacadeQueries;
054:            private PublishedAssessmentFacadeQueriesAPI publishedAssessmentFacadeQueries;
055:            private AssessmentGradingFacadeQueriesAPI assessmentGradingFacadeQueries;
056:            private AuthorizationFacadeQueriesAPI authorizationFacadeQueries;
057:            private PagingUtilQueriesAPI pagingUtilQueries;
058:            private AuthzQueriesFacadeAPI authzQueriesFacade;
059:            private SectionAwareness sectionAwareness;
060:
061:            private static PersistenceService INSTANCE;
062:
063:            public static PersistenceService getInstance() {
064:                if (INSTANCE != null) {
065:                    return INSTANCE;
066:                } else {
067:                    return (PersistenceService) ComponentManager
068:                            .get("PersistenceService");
069:                    /*
070:                      SpringBeanLocator locator = SpringBeanLocator.getInstance();
071:                      return INSTANCE = (PersistenceService)locator.getBean("PersistenceService");
072:                    //return INSTANCE = (PersistenceService) ApplicationContextLocator.getInstance().getBean("PersistenceService");
073:                     */
074:                }
075:            }
076:
077:            private Integer deadlockInterval; // in ms
078:
079:            public void setDeadlockInterval(Integer deadlockInterval) {
080:                this .deadlockInterval = deadlockInterval;
081:            }
082:
083:            public Integer getDeadlockInterval() {
084:                return deadlockInterval;
085:            }
086:
087:            private Integer retryCount; // in ms
088:
089:            public void setRetryCount(Integer retryCount) {
090:                this .retryCount = retryCount;
091:            }
092:
093:            public Integer getRetryCount() {
094:                return retryCount;
095:            }
096:
097:            public QuestionPoolFacadeQueriesAPI getQuestionPoolFacadeQueries() {
098:                return questionPoolFacadeQueries;
099:            }
100:
101:            public void setQuestionPoolFacadeQueries(
102:                    QuestionPoolFacadeQueriesAPI questionPoolFacadeQueries) {
103:                this .questionPoolFacadeQueries = questionPoolFacadeQueries;
104:            }
105:
106:            public TypeFacadeQueriesAPI getTypeFacadeQueries() {
107:                return typeFacadeQueries;
108:            }
109:
110:            public void setTypeFacadeQueries(
111:                    TypeFacadeQueriesAPI typeFacadeQueries) {
112:                this .typeFacadeQueries = typeFacadeQueries;
113:            }
114:
115:            public SectionFacadeQueriesAPI getSectionFacadeQueries() {
116:                return sectionFacadeQueries;
117:            }
118:
119:            public void setSectionFacadeQueries(
120:                    SectionFacadeQueriesAPI sectionFacadeQueries) {
121:                this .sectionFacadeQueries = sectionFacadeQueries;
122:            }
123:
124:            public ItemFacadeQueriesAPI getItemFacadeQueries() {
125:                return itemFacadeQueries;
126:            }
127:
128:            public void setItemFacadeQueries(
129:                    ItemFacadeQueriesAPI itemFacadeQueries) {
130:                this .itemFacadeQueries = itemFacadeQueries;
131:            }
132:
133:            public AssessmentFacadeQueriesAPI getAssessmentFacadeQueries() {
134:                return assessmentFacadeQueries;
135:                //return (AssessmentFacadeQueriesAPI)ComponentManager.get(org.sakaiproject.tool.assessment.facade.AssessmentFacadeQueriesAPI.class);
136:            }
137:
138:            public void setAssessmentFacadeQueries(
139:                    AssessmentFacadeQueriesAPI assessmentFacadeQueries) {
140:                this .assessmentFacadeQueries = assessmentFacadeQueries;
141:            }
142:
143:            public PublishedAssessmentFacadeQueriesAPI getPublishedAssessmentFacadeQueries() {
144:                return publishedAssessmentFacadeQueries;
145:            }
146:
147:            public void setPublishedAssessmentFacadeQueries(
148:                    PublishedAssessmentFacadeQueriesAPI publishedAssessmentFacadeQueries) {
149:                this .publishedAssessmentFacadeQueries = publishedAssessmentFacadeQueries;
150:            }
151:
152:            public AssessmentGradingFacadeQueriesAPI getAssessmentGradingFacadeQueries() {
153:                return assessmentGradingFacadeQueries;
154:            }
155:
156:            public void setAssessmentGradingFacadeQueries(
157:                    AssessmentGradingFacadeQueriesAPI assessmentGradingFacadeQueries) {
158:                this .assessmentGradingFacadeQueries = assessmentGradingFacadeQueries;
159:            }
160:
161:            public AuthorizationFacadeQueriesAPI getAuthorizationFacadeQueries() {
162:                return authorizationFacadeQueries;
163:            }
164:
165:            public void setAuthorizationFacadeQueries(
166:                    AuthorizationFacadeQueriesAPI authorizationFacadeQueries) {
167:                this .authorizationFacadeQueries = authorizationFacadeQueries;
168:            }
169:
170:            public PagingUtilQueriesAPI getPagingUtilQueries() {
171:                return pagingUtilQueries;
172:            }
173:
174:            public void setPagingUtilQueries(
175:                    PagingUtilQueriesAPI pagingUtilQueries) {
176:                this .pagingUtilQueries = pagingUtilQueries;
177:            }
178:
179:            public AuthzQueriesFacadeAPI getAuthzQueriesFacade() {
180:                return authzQueriesFacade;
181:            }
182:
183:            public void setAuthzQueriesFacade(
184:                    AuthzQueriesFacadeAPI authzQueriesFacade) {
185:                this .authzQueriesFacade = authzQueriesFacade;
186:            }
187:
188:            public SectionAwareness getSectionAwareness() {
189:                return sectionAwareness;
190:
191:            }
192:
193:            public void setSectionAwareness(SectionAwareness sectionAwareness) {
194:                this .sectionAwareness = sectionAwareness;
195:            }
196:
197:            public int retryDeadlock(Exception e, int retryCount) {
198:                log.warn("Error saving to db...retry again....");
199:                String errorMessage = e.getMessage();
200:                log.warn(errorMessage);
201:                int index = errorMessage.indexOf("ORA-00060"); // deadlock
202:                int index2 = errorMessage.indexOf("SQL state [61000]"); // oracle deadlock
203:                int index3 = errorMessage.indexOf("SQL state [41000]"); // mysql deadlock
204:                if (index > -1 || index2 > -1 || index3 > -1) {
205:                    retryCount--;
206:                    try {
207:                        int ideadlockInterval = deadlockInterval.intValue();
208:                        Thread.currentThread().sleep(ideadlockInterval);
209:                    } catch (InterruptedException ex) {
210:                        log.warn(ex.getMessage());
211:                    }
212:                } else
213:                    retryCount = 0;
214:                return retryCount;
215:            }
216:
217:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.