Source Code Cross Referenced for StatusInformation.java in  » IDE-Netbeans » cvsclient » org » netbeans » lib » cvsclient » command » status » 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 » IDE Netbeans » cvsclient » org.netbeans.lib.cvsclient.command.status 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*****************************************************************************
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is the CVS Client Library.
027:         * The Initial Developer of the Original Software is Robert Greig.
028:         * Portions created by Robert Greig are Copyright (C) 2000.
029:         * All Rights Reserved.
030:         *
031:         * If you wish your version of this file to be governed by only the CDDL
032:         * or only the GPL Version 2, indicate your decision by adding
033:         * "[Contributor] elects to include this software in this distribution
034:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
035:         * single choice of license, a recipient has the option to distribute
036:         * your version of this file under either the CDDL, the GPL Version 2 or
037:         * to extend the choice of license to its licensees as provided above.
038:         * However, if you add GPL Version 2 code and therefore, elected the GPL
039:         * Version 2 license, then the option applies only if the new code is
040:         * made subject to such option by the copyright holder.
041:         *
042:         * Contributor(s): Robert Greig.
043:         *****************************************************************************/package org.netbeans.lib.cvsclient.command.status;
044:
045:        import java.io.*;
046:        import java.util.*;
047:
048:        import org.netbeans.lib.cvsclient.command.*;
049:        import org.netbeans.lib.cvsclient.file.*;
050:
051:        /**
052:         * Describes status information for a file. This is the result of doing a
053:         * cvs status command. The fields in instances of this object are populated
054:         * by response handlers.
055:         * @author  Robert Greig
056:         */
057:        public class StatusInformation extends FileInfoContainer {
058:            // Fields =================================================================
059:
060:            private File file;
061:            private FileStatus status;
062:            private String workingRevision;
063:            private String repositoryRevision;
064:            private String repositoryFileName;
065:            private String stickyDate;
066:            private String stickyOptions;
067:            private String stickyTag;
068:
069:            /**
070:             * Hold key pairs of existing tags.
071:             */
072:            private List tags;
073:
074:            private StringBuffer symNamesBuffer;
075:
076:            public StatusInformation() {
077:                setAllExistingTags(null);
078:            }
079:
080:            /**
081:             * Getter for property file.
082:             * @return Value of property file.
083:             */
084:            public File getFile() {
085:                return file;
086:            }
087:
088:            /**
089:             * Setter for property file.
090:             * @param file New value of property file.
091:             */
092:            public void setFile(File file) {
093:                this .file = file;
094:            }
095:
096:            /**
097:             * Getter for property status.
098:             * @return Value of property status.
099:             */
100:            public FileStatus getStatus() {
101:                return status;
102:            }
103:
104:            /**
105:             * Setter for property status.
106:             * @param status New value of property status.
107:             */
108:            public void setStatus(FileStatus status) {
109:                this .status = status;
110:            }
111:
112:            /**
113:             * Returns the status as a String.
114:             * The String returned are definitely the static-final-instances.
115:             */
116:            public String getStatusString() {
117:                if (status == null) {
118:                    return null;
119:                }
120:
121:                return status.toString();
122:            }
123:
124:            /**
125:             * Sets the status by the specified string.
126:             */
127:            public void setStatusString(String statusString) {
128:                setStatus(FileStatus.getStatusForString(statusString));
129:            }
130:
131:            /**
132:             * Getter for property workingRevision.
133:             * @return Value of property workingRevision.
134:             */
135:            public String getWorkingRevision() {
136:                return workingRevision;
137:            }
138:
139:            /**
140:             * Setter for property workingRevision.
141:             * @param workingRevision New value of property workingRevision.
142:             */
143:            public void setWorkingRevision(String workingRevision) {
144:                this .workingRevision = workingRevision;
145:            }
146:
147:            /**
148:             * Getter for property repositoryRevision.
149:             * @return Value of property repositoryRevision.
150:             */
151:            public String getRepositoryRevision() {
152:                return repositoryRevision;
153:            }
154:
155:            /**
156:             * Setter for property repositoryRevision.
157:             * @param repositoryRevision New value of property repositoryRevision.
158:             */
159:            public void setRepositoryRevision(String repositoryRevision) {
160:                this .repositoryRevision = repositoryRevision;
161:            }
162:
163:            /**
164:             * Getter for property repositoryFileName.
165:             * @return Value of property repositoryFileName.
166:             */
167:            public String getRepositoryFileName() {
168:                return repositoryFileName;
169:            }
170:
171:            /**
172:             * Setter for property repositoryFileName.
173:             * @param repositoryRevision New value of property repositoryFileName.
174:             */
175:            public void setRepositoryFileName(String repositoryFileName) {
176:                this .repositoryFileName = repositoryFileName;
177:            }
178:
179:            /**
180:             * Getter for property stickyTag.
181:             * @return Value of property stickyTag.
182:             */
183:            public String getStickyTag() {
184:                return stickyTag;
185:            }
186:
187:            /**
188:             * Setter for property stickyTag.
189:             * @param stickyTag New value of property stickyTag.
190:             */
191:            public void setStickyTag(String stickyTag) {
192:                this .stickyTag = stickyTag;
193:            }
194:
195:            /**
196:             * Getter for property stickyDate.
197:             * @return Value of property stickyDate.
198:             */
199:            public String getStickyDate() {
200:                return stickyDate;
201:            }
202:
203:            /**
204:             * Setter for property stickyDate.
205:             * @param stickyDate New value of property stickyDate.
206:             */
207:            public void setStickyDate(String stickyDate) {
208:                this .stickyDate = stickyDate;
209:            }
210:
211:            /**
212:             * Getter for property stickyOptions.
213:             * @return Value of property stickyOptions.
214:             */
215:            public String getStickyOptions() {
216:                return stickyOptions;
217:            }
218:
219:            /**
220:             * Setter for property stickyOptions.
221:             * @param stickyOptions New value of property stickyOptions.
222:             */
223:            public void setStickyOptions(String stickyOptions) {
224:                this .stickyOptions = stickyOptions;
225:            }
226:
227:            public void addExistingTag(String tagName, String revisionNumber) {
228:                if (symNamesBuffer == null) {
229:                    symNamesBuffer = new StringBuffer();
230:                }
231:                symNamesBuffer.append(tagName);
232:                symNamesBuffer.append(" "); //NOI18N
233:                symNamesBuffer.append(revisionNumber);
234:                symNamesBuffer.append("\n"); //NOI18N
235:            }
236:
237:            private void createSymNames() {
238:                tags = new LinkedList();
239:
240:                if (symNamesBuffer == null) {
241:                    return;
242:                }
243:
244:                int length = 0;
245:                int lastLength = 0;
246:                while (length < symNamesBuffer.length()) {
247:                    while (length < symNamesBuffer.length()
248:                            && symNamesBuffer.charAt(length) != '\n') {
249:                        length++;
250:                    }
251:
252:                    if (length > lastLength) {
253:                        String line = symNamesBuffer.substring(lastLength,
254:                                length);
255:                        String symName = line.substring(0, line.indexOf(' '));
256:                        String revisionNumber = line.substring(line
257:                                .indexOf(' ') + 1);
258:                        SymName newName = new SymName();
259:                        newName.setTag(symName);
260:                        newName.setRevision(revisionNumber);
261:                        tags.add(newName);
262:                        lastLength = length + 1;
263:                        length++;
264:                    }
265:                }
266:
267:                symNamesBuffer = null;
268:            }
269:
270:            public List getAllExistingTags() {
271:                if (tags == null) {
272:                    createSymNames();
273:                }
274:                return tags;
275:            }
276:
277:            public void setAllExistingTags(List tags) {
278:                this .tags = tags;
279:            }
280:
281:            /** Search the symbolic names by number of revision. If not found, return null.
282:             */
283:            public List getSymNamesForRevision(String revNumber) {
284:                if (tags == null) {
285:                    createSymNames();
286:                }
287:
288:                List list = new LinkedList();
289:
290:                for (Iterator it = tags.iterator(); it.hasNext();) {
291:                    StatusInformation.SymName item = (StatusInformation.SymName) it
292:                            .next();
293:                    if (item.getRevision().equals(revNumber)) {
294:                        list.add(item);
295:                    }
296:                }
297:                return list;
298:            }
299:
300:            /**
301:             * Search the symbolic names by name of tag (symbolic name).
302:             * If not found, return null.
303:             */
304:            public StatusInformation.SymName getSymNameForTag(String tagName) {
305:                if (tags == null) {
306:                    createSymNames();
307:                }
308:
309:                for (Iterator it = tags.iterator(); it.hasNext();) {
310:                    StatusInformation.SymName item = (StatusInformation.SymName) it
311:                            .next();
312:                    if (item.getTag().equals(tagName)) {
313:                        return item;
314:                    }
315:                }
316:                return null;
317:            }
318:
319:            /**
320:             * Return a string representation of this object. Useful for debugging.
321:             */
322:            public String toString() {
323:                StringBuffer buf = new StringBuffer();
324:                buf.append("\nFile: "); //NOI18N
325:                buf.append((file != null) ? file.getAbsolutePath() : "null"); //NOI18N
326:                buf.append("\nStatus is: "); //NOI18N
327:                buf.append(getStatusString());
328:                buf.append("\nWorking revision: "); //NOI18N
329:                buf.append(workingRevision);
330:                buf.append("\nRepository revision: "); //NOI18N
331:                buf.append("\nSticky date: "); //NOI18N
332:                buf.append(stickyDate);
333:                buf.append("\nSticky options: "); //NOI18N
334:                buf.append(stickyOptions);
335:                buf.append("\nSticky tag: "); //NOI18N
336:                buf.append(stickyTag);
337:                if (tags != null && tags.size() > 0) {
338:                    // we are having some tags to print
339:                    buf.append("\nExisting Tags:"); //NOI18N
340:                    for (Iterator it = tags.iterator(); it.hasNext();) {
341:                        buf.append("\n  "); //NOI18N
342:                        buf.append(it.next().toString());
343:                    }
344:                }
345:                return buf.toString();
346:            }
347:
348:            /**
349:             * An inner class storing information about a symbolic name.
350:             * Consists of a pair of Strings. tag + revision.
351:             */
352:            public static class SymName {
353:                private String tag;
354:                private String revision;
355:
356:                public SymName() {
357:                }
358:
359:                public String getTag() {
360:                    return tag;
361:                }
362:
363:                public void setTag(String symName) {
364:                    tag = symName;
365:                }
366:
367:                public void setRevision(String rev) {
368:                    revision = rev;
369:                }
370:
371:                public String getRevision() {
372:                    return revision;
373:                }
374:
375:                public String toString() {
376:                    return getTag() + " : " + getRevision(); //NOI18N
377:                }
378:            }
379:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.