Source Code Cross Referenced for BatchJobStatus.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » kfs » batch » 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 » Kuali Financial System » org.kuali.kfs.batch 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 The Kuali Foundation.
003:         * 
004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         * http://www.opensource.org/licenses/ecl1.php
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.kuali.kfs.batch;
017:
018:        import java.util.Date;
019:        import java.util.LinkedHashMap;
020:        import java.util.List;
021:        import java.util.Map;
022:
023:        import org.kuali.core.bo.TransientBusinessObjectBase;
024:        import org.kuali.kfs.context.SpringContext;
025:        import org.kuali.kfs.service.SchedulerService;
026:        import org.quartz.JobDetail;
027:
028:        public class BatchJobStatus extends TransientBusinessObjectBase {
029:
030:            // private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BatchJobStatus.class);
031:
032:            private JobDescriptor jobDescriptor;
033:
034:            private JobDetail jobDetail;
035:
036:            private static SchedulerService schedulerService;
037:
038:            private SchedulerService getSchedulerService() {
039:                if (schedulerService == null) {
040:                    schedulerService = SpringContext
041:                            .getBean(SchedulerService.class);
042:                }
043:                return schedulerService;
044:            }
045:
046:            // for DD purposes only
047:            public BatchJobStatus() {
048:            }
049:
050:            public BatchJobStatus(JobDescriptor jobDescriptor,
051:                    JobDetail jobDetail) {
052:                this .jobDescriptor = jobDescriptor;
053:                this .jobDetail = jobDetail;
054:            }
055:
056:            public String getName() {
057:                return jobDetail.getName();
058:            }
059:
060:            public String getGroup() {
061:                return jobDetail.getGroup();
062:            }
063:
064:            public String getFullName() {
065:                return jobDetail.getGroup() + "." + jobDetail.getName();
066:            }
067:
068:            public Map<String, String> getDependencies() {
069:                return jobDescriptor.getDependencies();
070:            }
071:
072:            public List<Step> getSteps() {
073:                return jobDescriptor.getSteps();
074:            }
075:
076:            public String getStatus() {
077:                if (isRunning()) {
078:                    return SchedulerService.RUNNING_JOB_STATUS_CODE;
079:                }
080:                String tempStatus = schedulerService.getStatus(jobDetail);
081:                if (tempStatus == null) {
082:                    if (getNextRunDate() != null) {
083:                        return SchedulerService.SCHEDULED_JOB_STATUS_CODE;
084:                    } else if (getGroup().equals(
085:                            SchedulerService.SCHEDULED_GROUP)) {
086:                        return SchedulerService.PENDING_JOB_STATUS_CODE;
087:                    }
088:                }
089:                return tempStatus;
090:            }
091:
092:            public String getDependencyList() {
093:                StringBuffer sb = new StringBuffer(200);
094:                for (Map.Entry<String, String> entry : getDependencies()
095:                        .entrySet()) {
096:                    sb
097:                            .append(entry.getKey() + " (" + entry.getValue()
098:                                    + ") \n");
099:                }
100:                return sb.toString();
101:            }
102:
103:            public String getStepList() {
104:                StringBuffer sb = new StringBuffer(200);
105:                for (Step step : getSteps()) {
106:                    sb.append(step.getName() + " \n");
107:                }
108:                return sb.toString();
109:            }
110:
111:            public int getNumSteps() {
112:                return getSteps().size();
113:            }
114:
115:            @Override
116:            protected LinkedHashMap toStringMapper() {
117:                LinkedHashMap m = new LinkedHashMap();
118:
119:                m.put("name", getName());
120:                m.put("group", getGroup());
121:                m.put("status", getStatus());
122:                for (Object key : jobDetail.getJobDataMap().keySet()) {
123:                    m.put("jobDataMap." + key, jobDetail.getJobDataMap().get(
124:                            key));
125:                }
126:
127:                return m;
128:            }
129:
130:            public boolean isScheduled() {
131:                // is this instance in the scheuled group?
132:                if (getGroup().equals(SchedulerService.SCHEDULED_GROUP)) {
133:                    return true;
134:                }
135:                // does this job exist in the scheduled group?
136:                if (getSchedulerService().getJob(
137:                        SchedulerService.SCHEDULED_GROUP, getName()) != null) {
138:                    return true;
139:                }
140:                return false;
141:            }
142:
143:            public boolean isRunning() {
144:                return getSchedulerService().isJobRunning(getName());
145:            }
146:
147:            public void runJob(String requestorEmailAddress) {
148:                getSchedulerService().runJob(getName(), requestorEmailAddress);
149:            }
150:
151:            public void runJob(int startStep, int endStep, Date startTime,
152:                    String requestorEmailAddress) {
153:                getSchedulerService().runJob(getName(), startStep, endStep,
154:                        startTime, requestorEmailAddress);
155:            }
156:
157:            public void interrupt() {
158:                getSchedulerService().interruptJob(getName());
159:            }
160:
161:            public void schedule() {
162:                // if not already in scheduled group
163:                if (!isScheduled()) {
164:                    // make a copy and add to the scheduled group
165:                    getSchedulerService().addScheduled(jobDetail);
166:                }
167:            }
168:
169:            public void unschedule() {
170:                // if in scheduled group and scheduled group, remove it
171:                List<BatchJobStatus> jobs = getSchedulerService().getJobs(
172:                        SchedulerService.UNSCHEDULED_GROUP);
173:                boolean inUnscheduledGroup = false;
174:                for (BatchJobStatus detail : jobs) {
175:                    if (detail.getName().equals(getName())) {
176:                        inUnscheduledGroup = true;
177:                    }
178:                }
179:
180:                // if only in scheduled group, move it
181:                if (!inUnscheduledGroup) {
182:                    getSchedulerService().addUnscheduled(jobDetail);
183:                }
184:                getSchedulerService().removeScheduled(getName());
185:            }
186:
187:            public Date getNextRunDate() {
188:                return getSchedulerService().getNextStartTime(this);
189:            }
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.