Source Code Cross Referenced for CVSRoot.java in  » Source-Control » gruntspud » gruntspud » 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 » gruntspud » gruntspud 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Gruntspud
003:         *
004:         *  Copyright (C) 2002 Brett Smith.
005:         *
006:         *  Written by: Brett Smith <t_magicthize@users.sourceforge.net>
007:         *
008:         *  This program is free software; you can redistribute it and/or
009:         *  modify it under the terms of the GNU Library General Public License
010:         *  as published by the Free Software Foundation; either version 2 of
011:         *  the License, or (at your option) any later version.
012:         *  This program is distributed in the hope that it will be useful,
013:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015:         *  GNU Library General Public License for more details.
016:         *
017:         *  You should have received a copy of the GNU Library General Public
018:         *  License along with this program; if not, write to the Free Software
019:         *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
020:         */
021:
022:        package gruntspud;
023:
024:        /**
025:         * Description of the Class
026:         *
027:         * @author magicthize
028:         */
029:        public class CVSRoot {
030:            private String connectionType = null;
031:            private String user = null;
032:            private String host = null;
033:            private String repository = null;
034:            private int port = 0;
035:
036:            /**
037:             * Construct a new empty <code>CVSRoot</code>
038:             * @throws IllegalArgumentException DOCUMENT ME!
039:             */
040:            public CVSRoot() throws IllegalArgumentException {
041:                port = -1;
042:                user = "";
043:                host = "";
044:                repository = "";
045:                connectionType = "";
046:            }
047:
048:            /**
049:             * Construct a new <code>CVSRoot</code> given a string. The root will be
050:             * split up type, user, host and repository (depending on the type some of
051:             * these may not be applicable or available)
052:             *
053:             * @param s
054:             *
055:             * @exception IllegalArgumentException  Description of the Exception
056:             */
057:            public CVSRoot(String s) throws IllegalArgumentException {
058:                port = -1;
059:
060:                if (!s.startsWith(":")) {
061:                    throw new IllegalArgumentException("CVSROOT '" + s
062:                            + "' does not start with :");
063:                }
064:
065:                int i = 0;
066:                int j = s.indexOf(':', 1);
067:
068:                if (j == -1) {
069:                    throw new IllegalArgumentException("CVSROOT '" + s
070:                            + "' has no connection method");
071:                }
072:
073:                connectionType = s.substring(i + 1, j);
074:                i = j;
075:                j = s.indexOf('@', j + 1);
076:
077:                if (j != -1) {
078:                    user = s.substring(i + 1, j);
079:                    i = j;
080:                } else {
081:                    j = i;
082:
083:                    // search for host
084:                }
085:                j = s.indexOf(':', j + 1);
086:
087:                if (j == -1) {
088:                    // ??? j is -1
089:                    j = s.indexOf('/', j + 1);
090:
091:                    if (j != -1) {
092:                        host = s.substring(i + 1, j);
093:                        repository = s.substring(j);
094:                    } else {
095:                        repository = s;
096:                    }
097:                } else {
098:                    if (connectionType.equals("local")) {
099:
100:                        // no host
101:                        repository = s.substring(i + 1);
102:                    } else {
103:                        host = s.substring(i + 1, j);
104:                        repository = s.substring(j + 1);
105:                    }
106:                }
107:
108:                boolean flag = true;
109:                int k = 0;
110:                String s1 = "";
111:                int z = repository.indexOf(':', 0);
112:
113:                StringBuffer nb = new StringBuffer();
114:                for (int p = 0; p < repository.length(); p++) {
115:                    char ch = repository.charAt(p);
116:                    if (ch >= '0' && ch <= '9')
117:                        nb.append(ch);
118:                    else
119:                        break;
120:                }
121:                if (nb.length() != 0) {
122:                    try {
123:                        port = Integer.parseInt(nb.toString());
124:                    } catch (Exception e) {
125:                    }
126:                    repository = repository.substring(nb.length());
127:                }
128:                if (repository.charAt(0) == ':')
129:                    repository = repository.substring(1);
130:
131:                if ((connectionType == null) || (repository == null)) {
132:                    throw new IllegalArgumentException(
133:                            "Somethind is missing from CVSROOT '" + s + "'");
134:                } else {
135:
136:                    return;
137:                }
138:            }
139:
140:            /**
141:             * Description of the Method
142:             *
143:             * @param o  Description of the Parameter
144:             *
145:             * @return Description of the Return Value
146:             */
147:            public boolean equals(Object o) {
148:                return String.valueOf(o).equals(toString());
149:            }
150:
151:            /**
152:             * Gets the connectionType attribute of the CVSRoot object
153:             *
154:             * @return The connectionType value
155:             */
156:            public String getConnectionType() {
157:                return connectionType;
158:            }
159:
160:            /**
161:             * Gets the user attribute of the CVSRoot object
162:             *
163:             * @return The user value
164:             */
165:            public String getUser() {
166:                return user;
167:            }
168:
169:            /**
170:             * Gets the host attribute of the CVSRoot object
171:             *
172:             * @return The host value
173:             */
174:            public String getHost() {
175:                return host;
176:            }
177:
178:            /**
179:             * Gets the repository attribute of the CVSRoot object
180:             *
181:             * @return The repository value
182:             */
183:            public String getRepository() {
184:                return repository;
185:            }
186:
187:            /**
188:             * Gets the port attribute of the CVSRoot object
189:             *
190:             * @return The port value
191:             */
192:            public int getPort() {
193:                return port;
194:            }
195:
196:            /**
197:             * Gets the connectionType attribute of the CVSRoot object
198:             *
199:             * @param connectionType DOCUMENT ME!
200:             */
201:            public void setConnectionType(String connectionType) {
202:                this .connectionType = connectionType;
203:            }
204:
205:            /**
206:             * Gets the user attribute of the CVSRoot object
207:             *
208:             * @param user DOCUMENT ME!
209:             */
210:            public void setUser(String user) {
211:                this .user = user;
212:            }
213:
214:            /**
215:             * Gets the host attribute of the CVSRoot object
216:             *
217:             * @param host DOCUMENT ME!
218:             */
219:            public void setHost(String host) {
220:                this .host = host;
221:            }
222:
223:            /**
224:             * Gets the repository attribute of the CVSRoot object
225:             *
226:             * @param repository DOCUMENT ME!
227:             */
228:            public void setRepository(String repository) {
229:                this .repository = repository;
230:            }
231:
232:            /**
233:             * Gets the port attribute of the CVSRoot object
234:             *
235:             * @param port DOCUMENT ME!
236:             */
237:            public void setPort(int port) {
238:                this .port = port;
239:            }
240:
241:            /**
242:             * Description of the Method
243:             *
244:             * @return Description of the Return Value
245:             */
246:            public String toString() {
247:                StringBuffer buf = new StringBuffer();
248:                buf.append(':');
249:                buf.append(getConnectionType());
250:                buf.append(':');
251:
252:                if ((user != null) && !user.equals("")) {
253:                    buf.append(user);
254:
255:                }
256:                if ((host != null) && !host.equals("")) {
257:                    if ((user != null) && !user.equals("")) {
258:                        buf.append('@');
259:
260:                    }
261:                    buf.append(getHost());
262:
263:                    if (getPort() != -1) {
264:                        buf.append(':');
265:                        buf.append(getPort());
266:
267:                        //
268:                        //                if ( (repository != null) && !repository.equals("")) {
269:                        //                    buf.append(":");
270:                        //                }
271:                    } else if ((repository != null) && !repository.equals("")) {
272:                        buf.append(":");
273:                    }
274:                }
275:
276:                buf.append(((repository == null) || repository.equals("")) ? ""
277:                        : repository);
278:
279:                return buf.toString();
280:            }
281:
282:            /**
283:             * DOCUMENT ME!
284:             *
285:             * @param context DOCUMENT ME!
286:             */
287:            public void debugDetails(GruntspudContext context) {
288:                Constants.SYSTEM_LOG.debug("CVSROOT ..");
289:                Constants.SYSTEM_LOG.debug(" type       = "
290:                        + getConnectionType());
291:                Constants.SYSTEM_LOG.debug(" user       = " + getUser());
292:                Constants.SYSTEM_LOG.debug(" host       = " + getHost());
293:                Constants.SYSTEM_LOG.debug(" repository = " + getRepository());
294:                Constants.SYSTEM_LOG.debug(" port       = " + getPort());
295:            }
296:
297:            /**
298:             * The main program for the CVSRoot class
299:             *
300:             * @param args                          The command line arguments
301:             *
302:             * @exception IllegalArgumentException  Description of the Exception
303:             */
304:            public static void main(String[] args)
305:                    throws IllegalArgumentException {
306:                CVSRoot r = new CVSRoot(args[0]);
307:            }
308:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.