Source Code Cross Referenced for SVNCommandStatusHandler.java in  » Source-Control » tmatesoft-SVN » org » tmatesoft » svn » cli » 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.cli 
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.cli;
013:
014:        import java.io.PrintStream;
015:
016:        import org.tmatesoft.svn.core.SVNNodeKind;
017:        import org.tmatesoft.svn.core.internal.util.SVNFormatUtil;
018:        import org.tmatesoft.svn.core.wc.ISVNStatusHandler;
019:        import org.tmatesoft.svn.core.wc.SVNStatus;
020:        import org.tmatesoft.svn.core.wc.SVNStatusType;
021:
022:        /**
023:         * 
024:         * @version 1.1.1
025:         * @author  TMate Software Ltd.
026:         */
027:        public class SVNCommandStatusHandler implements  ISVNStatusHandler {
028:
029:            private PrintStream myOut;
030:            private boolean myDetailed;
031:            private boolean myShowLastCommitted;
032:            private boolean mySkipUnrecognized;
033:            private boolean myShowReposLocks;
034:
035:            public SVNCommandStatusHandler(PrintStream out, boolean detailed,
036:                    boolean showLastCommitted, boolean skipUnrecognized,
037:                    boolean showReposLocks) {
038:                myOut = out;
039:                myDetailed = detailed;
040:                myShowLastCommitted = showLastCommitted;
041:                mySkipUnrecognized = skipUnrecognized;
042:                myShowReposLocks = showReposLocks;
043:            }
044:
045:            public void handleStatus(SVNStatus status) {
046:                if (status == null
047:                        || (mySkipUnrecognized && status.getURL() == null)
048:                        || (status.getContentsStatus() == SVNStatusType.STATUS_NONE && status
049:                                .getRemoteContentsStatus() == SVNStatusType.STATUS_NONE)) {
050:                    return;
051:                }
052:                StringBuffer result = new StringBuffer();
053:                if (!myDetailed) {
054:                    result.append(getStatusChar(status.getContentsStatus()));
055:                    result.append(getStatusChar(status.getPropertiesStatus()));
056:                    result.append(status.isLocked() ? 'L' : ' ');
057:                    result.append(status.isCopied() ? '+' : ' ');
058:                    result.append(status.isSwitched() ? 'S' : ' ');
059:                    result.append(status.getLocalLock() != null ? 'K' : ' ');
060:                    result.append(" ");
061:                    result.append(SVNFormatUtil.formatPath(status.getFile()));
062:                } else {
063:                    String wcRevision;
064:                    char remoteStatus;
065:                    if (status.getURL() == null) {
066:                        wcRevision = "";
067:                    } else if (!status.getRevision().isValid()) {
068:                        wcRevision = " ? ";
069:                    } else if (status.isCopied()) {
070:                        wcRevision = "-";
071:                    } else {
072:                        wcRevision = Long.toString(status.getRevision()
073:                                .getNumber());
074:                        if (status.getKind() == SVNNodeKind.DIR
075:                                && status.getContentsStatus() == SVNStatusType.STATUS_MISSING) {
076:                            wcRevision = " ? ";
077:                        }
078:                    }
079:                    if (status.getRemotePropertiesStatus() != SVNStatusType.STATUS_NONE
080:                            || status.getRemoteContentsStatus() != SVNStatusType.STATUS_NONE) {
081:                        remoteStatus = '*';
082:                    } else {
083:                        remoteStatus = ' ';
084:                    }
085:                    char lockStatus;
086:                    if (myShowReposLocks) {
087:                        if (status.getRemoteLock() != null) {
088:                            if (status.getLocalLock() != null) {
089:                                lockStatus = status.getLocalLock().getID()
090:                                        .equals(status.getRemoteLock().getID()) ? 'K'
091:                                        : 'T';
092:                            } else {
093:                                lockStatus = 'O';
094:                            }
095:                        } else if (status.getLocalLock() != null) {
096:                            lockStatus = 'B';
097:                        } else {
098:                            lockStatus = ' ';
099:                        }
100:                    } else {
101:                        lockStatus = status.getLocalLock() != null ? 'K' : ' ';
102:                    }
103:                    if (myShowLastCommitted) {
104:                        String commitRevision = "";
105:                        String commitAuthor = "";
106:
107:                        if (status.getURL() != null
108:                                && status.getCommittedRevision().isValid()) {
109:                            commitRevision = status.getCommittedRevision()
110:                                    .toString();
111:                        } else if (status.getURL() != null) {
112:                            commitRevision = " ? ";
113:                        }
114:                        if (status.getURL() != null
115:                                && status.getAuthor() != null) {
116:                            commitAuthor = status.getAuthor();
117:                        } else if (status.getURL() != null) {
118:                            commitAuthor = " ? ";
119:                        }
120:                        result
121:                                .append(getStatusChar(status
122:                                        .getContentsStatus()));
123:                        result.append(getStatusChar(status
124:                                .getPropertiesStatus()));
125:                        result.append(status.isLocked() ? 'L' : ' ');
126:                        result.append(status.isCopied() ? '+' : ' ');
127:                        result.append(status.isSwitched() ? 'S' : ' ');
128:                        result.append(lockStatus);
129:                        result.append(" ");
130:                        result.append(remoteStatus);
131:                        result.append("   ");
132:                        result.append(SVNCommand.formatString(wcRevision, 6,
133:                                false)); // 6 chars
134:                        result.append("   ");
135:                        result.append(SVNCommand.formatString(commitRevision,
136:                                6, false)); // 6 chars
137:                        result.append(" ");
138:                        result.append(SVNCommand.formatString(commitAuthor, 12,
139:                                true)); // 12 chars
140:                        result.append(" ");
141:                        result.append(SVNFormatUtil
142:                                .formatPath(status.getFile()));
143:                    } else {
144:                        result
145:                                .append(getStatusChar(status
146:                                        .getContentsStatus()));
147:                        result.append(getStatusChar(status
148:                                .getPropertiesStatus()));
149:                        result.append(status.isLocked() ? 'L' : ' ');
150:                        result.append(status.isCopied() ? '+' : ' ');
151:                        result.append(status.isSwitched() ? 'S' : ' ');
152:                        result.append(lockStatus);
153:                        result.append(" ");
154:                        result.append(remoteStatus);
155:                        result.append("   ");
156:                        result.append(SVNCommand.formatString(wcRevision, 6,
157:                                false)); // 6 chars
158:                        result.append("   ");
159:                        result.append(SVNFormatUtil
160:                                .formatPath(status.getFile()));
161:                    }
162:                }
163:                myOut.println(result.toString());
164:
165:            }
166:
167:            private static char getStatusChar(SVNStatusType type) {
168:                if (type == SVNStatusType.STATUS_NONE) {
169:                    return ' ';
170:                } else if (type == SVNStatusType.STATUS_NORMAL) {
171:                    return ' ';
172:                } else if (type == SVNStatusType.STATUS_ADDED) {
173:                    return 'A';
174:                } else if (type == SVNStatusType.STATUS_MISSING) {
175:                    return '!';
176:                } else if (type == SVNStatusType.STATUS_INCOMPLETE) {
177:                    return '!';
178:                } else if (type == SVNStatusType.STATUS_DELETED) {
179:                    return 'D';
180:                } else if (type == SVNStatusType.STATUS_REPLACED) {
181:                    return 'R';
182:                } else if (type == SVNStatusType.STATUS_MODIFIED) {
183:                    return 'M';
184:                } else if (type == SVNStatusType.STATUS_CONFLICTED) {
185:                    return 'C';
186:                } else if (type == SVNStatusType.STATUS_OBSTRUCTED) {
187:                    return '~';
188:                } else if (type == SVNStatusType.STATUS_IGNORED) {
189:                    return 'I';
190:                } else if (type == SVNStatusType.STATUS_EXTERNAL) {
191:                    return 'X';
192:                } else if (type == SVNStatusType.STATUS_UNVERSIONED) {
193:                    return '?';
194:                }
195:                return '?';
196:            }
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.