Source Code Cross Referenced for Checkpoint.java in  » Web-Crawler » heritrix » org » archive » crawler » datamodel » 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 » Web Crawler » heritrix » org.archive.crawler.datamodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Checkpoint
002:         *
003:         * $Id: Checkpoint.java 4047 2005-12-17 02:31:52Z stack-sf $
004:         *
005:         * Created on Apr 25, 2004
006:         *
007:         * Copyright (C) 2004 Internet Archive.
008:         *
009:         * This file is part of the Heritrix web crawler (crawler.archive.org).
010:         *
011:         * Heritrix is free software; you can redistribute it and/or modify
012:         * it under the terms of the GNU Lesser Public License as published by
013:         * the Free Software Foundation; either version 2.1 of the License, or
014:         * any later version.
015:         *
016:         * Heritrix is distributed in the hope that it will be useful,
017:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
018:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
019:         * GNU Lesser Public License for more details.
020:         *
021:         * You should have received a copy of the GNU Lesser Public License
022:         * along with Heritrix; if not, write to the Free Software
023:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024:         */
025:        package org.archive.crawler.datamodel;
026:
027:        import java.io.File;
028:        import java.io.IOException;
029:        import java.io.ObjectInputStream;
030:        import java.io.Serializable;
031:
032:        import org.archive.crawler.util.CheckpointUtils;
033:        import org.archive.util.FileUtils;
034:
035:        /**
036:         * Record of a specific checkpoint on disk.
037:         * Used recovering from a checkpoint or displaying list of checkpoints done
038:         * so far.
039:         * @author gojomo
040:         */
041:        public class Checkpoint implements  Serializable {
042:            /**
043:             * Generated by eclipse.
044:             */
045:            private static final long serialVersionUID = 5121498771788002844L;
046:
047:            /**
048:             * Flag label for invalid Checkpoints
049:             */
050:            private static final String INVALID = "INVALID";
051:
052:            /** 
053:             * Name of file written with timestamp into valid checkpoints.
054:             */
055:            public static final String VALIDITY_STAMP_FILENAME = "valid";
056:
057:            private transient String timestamp;
058:            private File directory;
059:
060:            /**
061:             * Publically inaccessible default constructor.
062:             */
063:            protected Checkpoint() {
064:                super ();
065:            }
066:
067:            /**
068:             * Create a Checkpoint instance based on the given prexisting
069:             * checkpoint directory
070:             *
071:             * @param checkpointDir Directory that holds checkpoint.
072:             */
073:            public Checkpoint(File checkpointDir) {
074:                this .directory = checkpointDir;
075:                readValid();
076:            }
077:
078:            private void readObject(ObjectInputStream s) throws IOException,
079:                    ClassNotFoundException {
080:                s.defaultReadObject();
081:                readValid();
082:            }
083:
084:            protected void readValid() {
085:                File validityStamp = new File(this .directory,
086:                        VALIDITY_STAMP_FILENAME);
087:                if (validityStamp.exists() == false) {
088:                    this .timestamp = INVALID;
089:                } else {
090:                    try {
091:                        this .timestamp = FileUtils.readFileAsString(
092:                                validityStamp).trim();
093:                    } catch (IOException e) {
094:                        e.printStackTrace();
095:                        this .timestamp = INVALID;
096:                    }
097:                }
098:            }
099:
100:            /**
101:             * @return Return true if this checkpoint appears complete/resumable
102:             * (has 'valid' stamp file).
103:             */
104:            public boolean isValid() {
105:                return timestamp != INVALID;
106:            }
107:
108:            /**
109:             * @return Returns name of this Checkpoint
110:             */
111:            public String getName() {
112:                return this .directory.getName();
113:            }
114:
115:            /**
116:             * @return Return the combination of given name and timestamp most commonly
117:             * used in administrative interface.
118:             */
119:            public String getDisplayName() {
120:                return getName() + " [" + getTimestamp() + "]";
121:            }
122:
123:            /**
124:             * @return Returns the timestamp.
125:             */
126:            public String getTimestamp() {
127:                return timestamp;
128:            }
129:
130:            /**
131:             * @return Returns the checkpoint directory.
132:             */
133:            public File getDirectory() {
134:                return this .directory;
135:            }
136:
137:            /**
138:             * @return True if this checkpoint contains bdb logs (It won't if we're
139:             * doing 'fast' checkpoints).
140:             */
141:            public boolean hasBdbjeLogs() {
142:                boolean decision = false;
143:                File bdbjeDir = CheckpointUtils
144:                        .getBdbSubDirectory(this .directory);
145:                if (bdbjeDir.exists()) {
146:                    String[] files = bdbjeDir.list(CheckpointUtils
147:                            .getJeLogsFilter());
148:                    decision = (files != null && files.length > 0);
149:                }
150:                return decision;
151:            }
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.