Source Code Cross Referenced for SVNAdminArea14Factory.java in  » Source-Control » tmatesoft-SVN » org » tmatesoft » svn » core » internal » wc » admin » 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 » Source Control » tmatesoft SVN » org.tmatesoft.svn.core.internal.wc.admin 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ====================================================================
003:         * Copyright (c) 2004-2008 TMate Software Ltd.  All rights reserved.
004:         *
005:         * This software is licensed as described in the file COPYING, which
006:         * you should have received as part of this distribution.  The terms
007:         * are also available at http://svnkit.com/license.html
008:         * If newer versions of this license are posted there, you may use a
009:         * newer version instead, at your option.
010:         * ====================================================================
011:         */
012:        package org.tmatesoft.svn.core.internal.wc.admin;
013:
014:        import java.io.BufferedReader;
015:        import java.io.File;
016:        import java.io.IOException;
017:        import java.io.InputStreamReader;
018:
019:        import org.tmatesoft.svn.core.SVNErrorCode;
020:        import org.tmatesoft.svn.core.SVNErrorMessage;
021:        import org.tmatesoft.svn.core.SVNException;
022:        import org.tmatesoft.svn.core.internal.wc.SVNErrorManager;
023:        import org.tmatesoft.svn.core.internal.wc.SVNFileType;
024:        import org.tmatesoft.svn.core.internal.wc.SVNFileUtil;
025:
026:        /**
027:         * @version 1.1.1
028:         * @author  TMate Software Ltd.
029:         */
030:        class SVNAdminArea14Factory extends SVNAdminAreaFactory {
031:
032:            public static final int WC_FORMAT = 8;
033:
034:            protected void doCreateVersionedDirectory(File path, String url,
035:                    String rootURL, String uuid, long revNumber)
036:                    throws SVNException {
037:                SVNAdminArea adminArea = new SVNAdminArea14(path);
038:                adminArea.createVersionedDirectory(path, url, rootURL, uuid,
039:                        revNumber, true);
040:            }
041:
042:            protected SVNAdminArea doOpen(File path, int version)
043:                    throws SVNException {
044:                if (version != WC_FORMAT) {
045:                    return null;
046:                }
047:                return new SVNAdminArea14(path);
048:            }
049:
050:            protected SVNAdminArea doUpgrade(SVNAdminArea adminArea)
051:                    throws SVNException {
052:                if (adminArea == null
053:                        || adminArea.getClass() == SVNAdminArea14.class) {
054:                    return adminArea;
055:                }
056:                SVNAdminArea14 newestAdminArea = new SVNAdminArea14(adminArea
057:                        .getRoot());
058:                newestAdminArea.setLocked(true);
059:                return newestAdminArea.upgradeFormat(adminArea);
060:            }
061:
062:            public int getSupportedVersion() {
063:                return WC_FORMAT;
064:            }
065:
066:            protected int doCheckWC(File path) throws SVNException {
067:                File adminDir = new File(path, SVNFileUtil
068:                        .getAdminDirectoryName());
069:                File entriesFile = new File(adminDir, "entries");
070:                int formatVersion = -1;
071:
072:                BufferedReader reader = null;
073:                String line = null;
074:
075:                try {
076:                    reader = new BufferedReader(new InputStreamReader(
077:                            SVNFileUtil.openFileForReading(entriesFile),
078:                            "UTF-8"));
079:                    line = reader.readLine();
080:                } catch (IOException e) {
081:                    SVNErrorMessage err = SVNErrorMessage
082:                            .create(SVNErrorCode.IO_ERROR,
083:                                    "Cannot read entries file ''{0}'': {1}",
084:                                    new Object[] { entriesFile,
085:                                            e.getLocalizedMessage() });
086:                    SVNErrorManager.error(err, e);
087:                } catch (SVNException svne) {
088:                    SVNFileType type = SVNFileType.getType(path);
089:                    if (type != SVNFileType.DIRECTORY || !entriesFile.exists()) {
090:                        if (type == SVNFileType.NONE) {
091:                            SVNErrorMessage err = SVNErrorMessage.create(
092:                                    SVNErrorCode.IO_ERROR,
093:                                    "''{0}'' does not exist", path);
094:                            SVNErrorManager.error(err);
095:                        }
096:                        return 0;
097:                    }
098:                    throw svne;
099:                } finally {
100:                    SVNFileUtil.closeFile(reader);
101:                }
102:
103:                if (line == null || line.length() == 0) {
104:                    SVNErrorMessage err = SVNErrorMessage.create(
105:                            SVNErrorCode.STREAM_UNEXPECTED_EOF,
106:                            "Reading ''{0}''", entriesFile);
107:                    SVNErrorManager.error(err);
108:                }
109:
110:                try {
111:                    formatVersion = Integer.parseInt(line.trim());
112:                } catch (NumberFormatException e) {
113:                    SVNErrorMessage err = SVNErrorMessage.create(
114:                            SVNErrorCode.BAD_VERSION_FILE_FORMAT,
115:                            "First line of ''{0}'' contains non-digit",
116:                            entriesFile);
117:                    SVNErrorManager.error(err);
118:                }
119:                return formatVersion;
120:            }
121:
122:            protected int getVersion(File path) throws SVNException {
123:                File adminDir = new File(path, SVNFileUtil
124:                        .getAdminDirectoryName());
125:                File entriesFile = new File(adminDir, "entries");
126:                int formatVersion = -1;
127:
128:                BufferedReader reader = null;
129:                String line = null;
130:
131:                try {
132:                    reader = new BufferedReader(new InputStreamReader(
133:                            SVNFileUtil.openFileForReading(entriesFile),
134:                            "UTF-8"));
135:                    line = reader.readLine();
136:                } catch (IOException e) {
137:                    SVNErrorMessage err = SVNErrorMessage
138:                            .create(SVNErrorCode.IO_ERROR,
139:                                    "Cannot read entries file ''{0}'': {1}",
140:                                    new Object[] { entriesFile,
141:                                            e.getLocalizedMessage() });
142:                    SVNErrorManager.error(err, e);
143:                } catch (SVNException svne) {
144:                    SVNErrorMessage err = SVNErrorMessage.create(
145:                            SVNErrorCode.WC_NOT_DIRECTORY,
146:                            "''{0}'' is not a working copy", path);
147:                    err.setChildErrorMessage(svne.getErrorMessage());
148:                    SVNErrorManager.error(err, svne);
149:                } finally {
150:                    SVNFileUtil.closeFile(reader);
151:                }
152:
153:                if (line == null || line.length() == 0) {
154:                    SVNErrorMessage err = SVNErrorMessage.create(
155:                            SVNErrorCode.STREAM_UNEXPECTED_EOF,
156:                            "Reading ''{0}''", entriesFile);
157:                    SVNErrorMessage err1 = SVNErrorMessage.create(
158:                            SVNErrorCode.WC_NOT_DIRECTORY,
159:                            "''{0}'' is not a working copy", path);
160:                    err1.setChildErrorMessage(err);
161:                    SVNErrorManager.error(err1);
162:                }
163:
164:                try {
165:                    formatVersion = Integer.parseInt(line.trim());
166:                } catch (NumberFormatException e) {
167:                    SVNErrorMessage err = SVNErrorMessage.create(
168:                            SVNErrorCode.BAD_VERSION_FILE_FORMAT,
169:                            "First line of ''{0}'' contains non-digit",
170:                            entriesFile);
171:                    SVNErrorMessage err1 = SVNErrorMessage.create(
172:                            SVNErrorCode.WC_NOT_DIRECTORY,
173:                            "''{0}'' is not a working copy", path);
174:                    err1.setChildErrorMessage(err);
175:                    SVNErrorManager.error(err1);
176:                }
177:                return formatVersion;
178:            }
179:        }
w_ww___.__j_a___v___a___2_s.c__o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.