Source Code Cross Referenced for UpdateEventHandler.java in  » Source-Control » tmatesoft-SVN » org » tmatesoft » svn » examples » wc » 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.examples.wc 
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.examples.wc;
013:
014:        import org.tmatesoft.svn.core.SVNCancelException;
015:        import org.tmatesoft.svn.core.wc.ISVNEventHandler;
016:        import org.tmatesoft.svn.core.wc.SVNEvent;
017:        import org.tmatesoft.svn.core.wc.SVNStatusType;
018:        import org.tmatesoft.svn.core.wc.SVNEventAction;
019:
020:        /*
021:         * This class is an implementation of ISVNEventHandler intended for  processing   
022:         * events generated by do*() methods of an SVNUpdateClient object. An  instance  
023:         * of this handler will be provided to  an  SVNUpdateClient. When calling,  for 
024:         * example, SVNWCClient.doUpdate(..) on some path, that method will generate an 
025:         * event for each 'update'/'add'/'delete'/.. action it will perform upon  every 
026:         * path being updated. And this event is passed to 
027:         * 
028:         * ISVNEventHandler.handleEvent(SVNEvent event,  double progress) 
029:         * 
030:         * to notify the handler.  The  event  contains detailed  information about the 
031:         * path, action performed upon the path and some other. 
032:         */
033:        public class UpdateEventHandler implements  ISVNEventHandler {
034:            /*
035:             * progress  is  currently  reserved  for future purposes and now is always
036:             * ISVNEventHandler.UNKNOWN  
037:             */
038:            public void handleEvent(SVNEvent event, double progress) {
039:                /*
040:                 * Gets the current action. An action is represented by SVNEventAction.
041:                 * In case of an update an  action  can  be  determined  via  comparing 
042:                 * SVNEvent.getAction() and SVNEventAction.UPDATE_-like constants. 
043:                 */
044:                SVNEventAction action = event.getAction();
045:                String pathChangeType = " ";
046:                if (action == SVNEventAction.UPDATE_ADD) {
047:                    /*
048:                     * the item was added
049:                     */
050:                    pathChangeType = "A";
051:                } else if (action == SVNEventAction.UPDATE_DELETE) {
052:                    /*
053:                     * the item was deleted
054:                     */
055:                    pathChangeType = "D";
056:                } else if (action == SVNEventAction.UPDATE_UPDATE) {
057:                    /*
058:                     * Find out in details what  state the item is (after  having  been 
059:                     * updated).
060:                     * 
061:                     * Gets  the  status  of  file/directory  item   contents.  It   is 
062:                     * SVNStatusType  who contains information on the state of an item.
063:                     */
064:                    SVNStatusType contentsStatus = event.getContentsStatus();
065:                    if (contentsStatus == SVNStatusType.CHANGED) {
066:                        /*
067:                         * the  item  was  modified in the repository (got  the changes 
068:                         * from the repository
069:                         */
070:                        pathChangeType = "U";
071:                    } else if (contentsStatus == SVNStatusType.CONFLICTED) {
072:                        /*
073:                         * The file item is in  a  state  of Conflict. That is, changes
074:                         * received from the repository during an update, overlap  with 
075:                         * local changes the user has in his working copy.
076:                         */
077:                        pathChangeType = "C";
078:                    } else if (contentsStatus == SVNStatusType.MERGED) {
079:                        /*
080:                         * The file item was merGed (those  changes that came from  the 
081:                         * repository  did  not  overlap local changes and were  merged 
082:                         * into the file).
083:                         */
084:                        pathChangeType = "G";
085:                    }
086:                } else if (action == SVNEventAction.UPDATE_EXTERNAL) {
087:                    /*for externals definitions*/
088:                    System.out.println("Fetching external item into '"
089:                            + event.getFile().getAbsolutePath() + "'");
090:                    System.out.println("External at revision "
091:                            + event.getRevision());
092:                    return;
093:                } else if (action == SVNEventAction.UPDATE_COMPLETED) {
094:                    /*
095:                     * Updating the working copy is completed. Prints out the revision.
096:                     */
097:                    System.out.println("At revision " + event.getRevision());
098:                    return;
099:                } else if (action == SVNEventAction.ADD) {
100:                    System.out.println("A     " + event.getPath());
101:                    return;
102:                } else if (action == SVNEventAction.DELETE) {
103:                    System.out.println("D     " + event.getPath());
104:                    return;
105:                } else if (action == SVNEventAction.LOCKED) {
106:                    System.out.println("L     " + event.getPath());
107:                    return;
108:                } else if (action == SVNEventAction.LOCK_FAILED) {
109:                    System.out.println("failed to lock    " + event.getPath());
110:                    return;
111:                }
112:
113:                /*
114:                 * Now getting the status of properties of an item. SVNStatusType  also
115:                 * contains information on the properties state.
116:                 */
117:                SVNStatusType propertiesStatus = event.getPropertiesStatus();
118:                /*
119:                 * At first consider properties are normal (unchanged).
120:                 */
121:                String propertiesChangeType = " ";
122:                if (propertiesStatus == SVNStatusType.CHANGED) {
123:                    /*
124:                     * Properties were updated.
125:                     */
126:                    propertiesChangeType = "U";
127:                } else if (propertiesStatus == SVNStatusType.CONFLICTED) {
128:                    /*
129:                     * Properties are in conflict with the repository.
130:                     */
131:                    propertiesChangeType = "C";
132:                } else if (propertiesStatus == SVNStatusType.MERGED) {
133:                    /*
134:                     * Properties that came from the repository were  merged  with  the
135:                     * local ones.
136:                     */
137:                    propertiesChangeType = "G";
138:                }
139:
140:                /*
141:                 * Gets the status of the lock.
142:                 */
143:                String lockLabel = " ";
144:                SVNStatusType lockType = event.getLockStatus();
145:
146:                if (lockType == SVNStatusType.LOCK_UNLOCKED) {
147:                    /*
148:                     * The lock is broken by someone.
149:                     */
150:                    lockLabel = "B";
151:                }
152:
153:                System.out.println(pathChangeType + propertiesChangeType
154:                        + lockLabel + "       " + event.getPath());
155:            }
156:
157:            /*
158:             * Should be implemented to check if the current operation is cancelled. If 
159:             * it is, this method should throw an SVNCancelException. 
160:             */
161:            public void checkCancelled() throws SVNCancelException {
162:            }
163:
164:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.