Source Code Cross Referenced for ResultsLogger.java in  » Content-Management-System » dspace » org » dspace » checker » 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 » Content Management System » dspace » org.dspace.checker 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2004-2005, Hewlett-Packard Company and Massachusetts
003:         * Institute of Technology.  All rights reserved.
004:         *
005:         * Redistribution and use in source and binary forms, with or without
006:         * modification, are permitted provided that the following conditions are
007:         * met:
008:         *
009:         * - Redistributions of source code must retain the above copyright
010:         * notice, this list of conditions and the following disclaimer.
011:         *
012:         * - Redistributions in binary form must reproduce the above copyright
013:         * notice, this list of conditions and the following disclaimer in the
014:         * documentation and/or other materials provided with the distribution.
015:         *
016:         * - Neither the name of the Hewlett-Packard Company nor the name of the
017:         * Massachusetts Institute of Technology nor the names of their
018:         * contributors may be used to endorse or promote products derived from
019:         * this software without specific prior written permission.
020:         *
021:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
022:         * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
023:         * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
024:         * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
025:         * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
026:         * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
027:         * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
028:         * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
029:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
030:         * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
031:         * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
032:         * DAMAGE.
033:         */
034:        package org.dspace.checker;
035:
036:        import java.text.SimpleDateFormat;
037:        import java.util.Date;
038:
039:        import org.apache.log4j.Logger;
040:        import org.dspace.core.I18nUtil;
041:
042:        /**
043:         * <p>
044:         * Collects results from a Checksum process and outputs them to a Log4j Logger.
045:         * </p>
046:         * 
047:         * 
048:         * @author Jim Downing
049:         * @author Grace Carpenter
050:         * @author Nathan Sarr
051:         * 
052:         * 
053:         */
054:        public class ResultsLogger implements  ChecksumResultsCollector {
055:            /**
056:             * Usual Log4J logger.
057:             */
058:            private static final Logger LOG = Logger
059:                    .getLogger(ResultsLogger.class);
060:
061:            /**
062:             * Utility date format.
063:             */
064:            private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(
065:                    "MM/dd/yyyy hh:mm:ss");
066:
067:            /**
068:             * Date the current checking run started.
069:             */
070:            Date startDate = null;
071:
072:            /**
073:             * ChecksumResultDAO dependency variable.
074:             */
075:            private ChecksumResultDAO resultDAO;
076:
077:            /**
078:             * Blanked off, no-op constructor. Do not use.
079:             */
080:            private ResultsLogger() {
081:                ;
082:            }
083:
084:            /**
085:             * Main constructor.
086:             * 
087:             * @param startDt
088:             *            Date the checking run started.
089:             */
090:            public ResultsLogger(Date startDt) {
091:                this .resultDAO = new ChecksumResultDAO();
092:
093:                LOG.info(msg("run-start-time") + ": "
094:                        + DATE_FORMAT.format(startDt));
095:            }
096:
097:            /**
098:             * Get the i18N string.
099:             * 
100:             * @param key
101:             *            to get the message.
102:             * @return the message found.
103:             */
104:            private String msg(String key) {
105:                return I18nUtil.getMessage("org.dspace.checker.ResultsLogger."
106:                        + key);
107:            }
108:
109:            /**
110:             * Collect a result for logging.
111:             * 
112:             * @param info
113:             *            the BitstreamInfo representing the result.
114:             * @see org.dspace.checker.ChecksumResultsCollector#collect(org.dspace.checker.BitstreamInfo)
115:             */
116:            public void collect(BitstreamInfo info) {
117:                LOG
118:                        .info("******************************************************");
119:                LOG.info(msg("bitstream-id") + ": " + info.getBitstreamId());
120:                LOG.info(msg("bitstream-info-found") + ": "
121:                        + info.getInfoFound());
122:                LOG.info(msg("bitstream-marked-deleted") + ": "
123:                        + info.getDeleted());
124:                LOG.info(msg("bitstream-found") + ": "
125:                        + info.getBitstreamFound());
126:                LOG.info(msg("to-be-processed") + ": "
127:                        + info.getToBeProcessed());
128:                LOG.info(msg("internal-id") + ": " + info.getInternalId());
129:                LOG.info(msg("name") + ": " + info.getName());
130:                LOG.info(msg("store-number") + ": " + info.getStoreNumber());
131:                LOG.info(msg("size") + ": " + info.getSize());
132:                LOG.info(msg("bitstream-format") + ": "
133:                        + info.getBitstreamFormatId());
134:                LOG.info(msg("user-format-description") + ": "
135:                        + info.getUserFormatDescription());
136:                LOG.info(msg("source") + ": " + info.getSource());
137:                LOG.info(msg("checksum-algorithm") + ": "
138:                        + info.getChecksumAlgorithm());
139:                LOG.info(msg("previous-checksum") + ": "
140:                        + info.getStoredChecksum());
141:                LOG.info(msg("previous-checksum-date")
142:                        + ": "
143:                        + ((info.getProcessEndDate() != null) ? DATE_FORMAT
144:                                .format(info.getProcessEndDate()) : "unknown"));
145:                LOG.info(msg("new-checksum") + ": "
146:                        + info.getCalculatedChecksum());
147:                LOG.info(msg("checksum-comparison-result")
148:                        + ": "
149:                        + resultDAO.getChecksumCheckStr(info
150:                                .getChecksumCheckResult()));
151:                LOG.info("\n\n");
152:            }
153:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.