Source Code Cross Referenced for SVNVersionedProperties.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.util.Collection;
015:        import java.util.HashMap;
016:        import java.util.Iterator;
017:        import java.util.Map;
018:        import java.util.TreeSet;
019:
020:        import org.tmatesoft.svn.core.SVNException;
021:
022:        /**
023:         * @version 1.1.1
024:         * @author  TMate Software Ltd.
025:         */
026:        public abstract class SVNVersionedProperties {
027:            private Map myProperties;
028:            private boolean myIsModified;
029:
030:            protected SVNVersionedProperties(Map props) {
031:                myProperties = props;
032:                myIsModified = false;
033:            }
034:
035:            public abstract boolean containsProperty(String name)
036:                    throws SVNException;
037:
038:            public abstract String getPropertyValue(String name)
039:                    throws SVNException;
040:
041:            public boolean isModified() {
042:                return myIsModified;
043:            }
044:
045:            protected void setModified(boolean modified) {
046:                myIsModified = modified;
047:            }
048:
049:            public boolean isEmpty() throws SVNException {
050:                Map props = loadProperties();
051:                return props == null || props.isEmpty();
052:            }
053:
054:            public Collection getPropertyNames(Collection target)
055:                    throws SVNException {
056:                Map props = loadProperties();
057:
058:                target = target == null ? new TreeSet() : target;
059:                if (isEmpty()) {
060:                    return target;
061:                }
062:                for (Iterator names = props.keySet().iterator(); names
063:                        .hasNext();) {
064:                    target.add(names.next());
065:                }
066:                return target;
067:            }
068:
069:            public void setPropertyValue(String name, String value)
070:                    throws SVNException {
071:                Map props = loadProperties();
072:                if (value != null) {
073:                    props.put(name, value);
074:                } else {
075:                    props.remove(name);
076:                }
077:                myIsModified = true;
078:            }
079:
080:            public SVNVersionedProperties compareTo(
081:                    SVNVersionedProperties properties) throws SVNException {
082:                Map result = new HashMap();
083:                if (isEmpty()) {
084:                    result.putAll(properties.asMap());
085:                    return wrap(result);
086:                }
087:
088:                Collection props1 = getPropertyNames(null);
089:                Collection props2 = properties.getPropertyNames(null);
090:
091:                // missed in props2.
092:                Collection tmp = new TreeSet(props1);
093:                tmp.removeAll(props2);
094:                for (Iterator props = tmp.iterator(); props.hasNext();) {
095:                    String missing = (String) props.next();
096:                    result.put(missing, null);
097:                }
098:
099:                // added in props2.
100:                tmp = new TreeSet(props2);
101:                tmp.removeAll(props1);
102:
103:                for (Iterator props = tmp.iterator(); props.hasNext();) {
104:                    String added = (String) props.next();
105:                    result.put(added, properties.getPropertyValue(added));
106:                }
107:
108:                // changed in props2
109:                props2.retainAll(props1);
110:                for (Iterator props = props2.iterator(); props.hasNext();) {
111:                    String changed = (String) props.next();
112:                    String value1 = getPropertyValue(changed);
113:                    String value2 = properties.getPropertyValue(changed);
114:                    if (!value1.equals(value2)) {
115:                        result.put(changed, value2);
116:                    }
117:                }
118:                return wrap(result);
119:            }
120:
121:            public void copyTo(SVNVersionedProperties destination)
122:                    throws SVNException {
123:                Map props = loadProperties();
124:                if (isEmpty()) {
125:                    destination.removeAll();
126:                } else {
127:                    destination.put(props);
128:                }
129:            }
130:
131:            public void removeAll() throws SVNException {
132:                Map props = loadProperties();
133:                if (!isEmpty()) {
134:                    props.clear();
135:                    myIsModified = true;
136:                }
137:            }
138:
139:            public boolean equals(SVNVersionedProperties props)
140:                    throws SVNException {
141:                return compareTo(props).isEmpty();
142:            }
143:
144:            public Map asMap() throws SVNException {
145:                Map props = loadProperties() != null ? new HashMap(
146:                        loadProperties()) : new HashMap();
147:                return props;
148:            }
149:
150:            protected void put(Map props) throws SVNException {
151:                Map this Props = loadProperties();
152:                this Props.clear();
153:                this Props.putAll(props);
154:                myIsModified = true;
155:            }
156:
157:            protected Map getPropertiesMap() {
158:                return myProperties;
159:            }
160:
161:            protected void setPropertiesMap(Map props) {
162:                myProperties = props;
163:            }
164:
165:            protected abstract SVNVersionedProperties wrap(Map properties);
166:
167:            protected abstract Map loadProperties() throws SVNException;
168:
169:        }
w__ww_.___j___a__va_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.