Source Code Cross Referenced for JCVSProjectDef.java in  » Source-Control » jcvsweb » com » ice » jcvsweb » bean » 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 » jcvsweb » com.ice.jcvsweb.bean 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.ice.jcvsweb.bean;
002:
003:        import java.io.File;
004:        import java.io.FileWriter;
005:        import java.io.PrintWriter;
006:        import java.util.HashMap;
007:        import java.util.Iterator;
008:
009:        import org.w3c.dom.Document;
010:        import org.w3c.dom.DocumentType;
011:        import org.w3c.dom.Element;
012:        import org.w3c.dom.Node;
013:        import org.w3c.dom.NodeList;
014:        import org.w3c.dom.Text;
015:        import org.xml.sax.Attributes;
016:        import org.xml.sax.SAXException;
017:
018:        import com.ice.cvsc.CVSRequest;
019:        import com.ice.jcvsweb.helper.XMLHelper;
020:
021:        /**
022:         * 
023:         * @author Tim Endres, <a href="mailto:time@jcvs.org">time@jcvs.org</a>
024:         * @see com.ice.cvsc
025:         */
026:
027:        public class JCVSProjectDef {
028:            /**
029:             * A local CVS working directory being presented by jCVS.
030:             */
031:            public static final String PTSTR_JCVS = "jcvs";
032:            /**
033:             * A simple link to another jCVS servlet.
034:             */
035:            public static final String PTSTR_LINK = "link";
036:
037:            /**
038:             * An undefined project.
039:             */
040:            public static final int PT_UNDEF = 0;
041:            /**
042:             * A local CVS working directory being presented by jCVS.
043:             */
044:            public static final int PT_JCVS = 1;
045:            /**
046:             * A simple link to another jCVS servlet.
047:             */
048:            public static final int PT_LINK = 2;
049:
050:            /**
051:             * This is the type of project definition. Currently, there are
052:             * "local servlet" (PT_JCVS), and "link to servlet" (PT_LINK) types.
053:             */
054:            private int type = PT_UNDEF;
055:
056:            /**
057:             * The key used to identify this project internally and in the URL.
058:             */
059:            private String key = null;
060:
061:            /**
062:             * The username of the owner of this project.
063:             */
064:            private String owner = null;
065:
066:            /**
067:             * The display name of this project.
068:             */
069:            private String name = null;
070:
071:            /**
072:             * A short title for this project.
073:             */
074:            private String title = null;
075:
076:            /**
077:             * The long and detailed description of this project definition.
078:             */
079:            private String desc = null;
080:
081:            /**
082:             * The CVS hostname.
083:             */
084:            private String host = null;
085:
086:            /**
087:             * The CVS port.
088:             */
089:            private int cvsPort = 2401;
090:
091:            /**
092:             * The CVS connection method (pserver, rsh, ssh).
093:             */
094:            private int cvsMethod = CVSRequest.METHOD_INETD;
095:
096:            /**
097:             * The root directory used for the CVS repository.
098:             */
099:            private String cvsRoot = null;
100:
101:            /**
102:             * The CVS login username.
103:             */
104:            private String login = null;
105:
106:            /**
107:             * The CVS login password.
108:             */
109:            private String pass = null;
110:
111:            /**
112:             * The local directory for jCVS working directories.
113:             */
114:            private String localDir = null;
115:
116:            /**
117:             * The temporary directory for jCVS to use during CVS operations.
118:             */
119:            private String tempDir = null;
120:
121:            /**
122:             * This url links to the Home Page.
123:             */
124:            private String homeUrl = null;
125:
126:            /**
127:             * This url links to the jCVS Servlet.
128:             */
129:            private String jcvsUrl = null;
130:
131:            /**
132:             * This project that this definition describes.
133:             */
134:            private JCVSProject project = null;
135:
136:            /**
137:             * This url links to the jCVS Servlet.
138:             */
139:            private HashMap views = null;
140:
141:            /**
142:             * This url links to the jCVS Servlet.
143:             */
144:            private boolean viewingRestricted = false;
145:
146:            /**
147:             * Sets the CVSRequest trace flags on view checkouts.
148:             */
149:            private boolean dbgChkOut = false;
150:
151:            public JCVSProjectDef() {
152:                this .views = new HashMap();
153:            }
154:
155:            public boolean isLink() {
156:                return (type == PT_LINK);
157:            }
158:
159:            public int getType() {
160:                return this .type;
161:            }
162:
163:            public void setType(int type) {
164:                this .type = type;
165:            }
166:
167:            public JCVSProject getProject() {
168:                return this .project;
169:            }
170:
171:            public void setProject(JCVSProject project) {
172:                this .project = project;
173:            }
174:
175:            public String getKey() {
176:                return this .key;
177:            }
178:
179:            public void setKey(String key) {
180:                this .key = key;
181:            }
182:
183:            public String getOwner() {
184:                return this .owner;
185:            }
186:
187:            public void setOwner(String owner) {
188:                this .owner = owner;
189:            }
190:
191:            public String getName() {
192:                return this .name;
193:            }
194:
195:            public void setName(String name) {
196:                this .name = name;
197:            }
198:
199:            public String getTitle() {
200:                return this .title;
201:            }
202:
203:            public void setTitle(String title) {
204:                this .title = title;
205:            }
206:
207:            public String getDescription() {
208:                return this .desc;
209:            }
210:
211:            public void setDescription(String desc) {
212:                this .desc = desc;
213:            }
214:
215:            public String getHomePage() {
216:                return this .homeUrl;
217:            }
218:
219:            public void setHomePage(String homeUrl) {
220:                this .homeUrl = homeUrl;
221:            }
222:
223:            public String getJcvsLink() {
224:                return this .jcvsUrl;
225:            }
226:
227:            public void setJcvsLink(String jcvsUrl) {
228:                this .jcvsUrl = jcvsUrl;
229:            }
230:
231:            public String getCvsHost() {
232:                return this .host;
233:            }
234:
235:            public void setCvsHost(String host) {
236:                this .host = host;
237:            }
238:
239:            public int getCvsPort() {
240:                return this .cvsPort;
241:            }
242:
243:            public void setCvsPort(int cvsPort) {
244:                this .cvsPort = cvsPort;
245:            }
246:
247:            public int getCvsMethod() {
248:                return this .cvsMethod;
249:            }
250:
251:            public void setCvsMethod(int cvsMethod) {
252:                this .cvsMethod = cvsMethod;
253:            }
254:
255:            public String getCvsMethodName() {
256:                return (this .cvsMethod == CVSRequest.METHOD_INETD ? "pserver"
257:                        : (this .cvsMethod == CVSRequest.METHOD_SSH ? "ssh"
258:                                : "rsh"));
259:                //	return CVSRequest.getConnMethodName( this.cvsMethod );
260:            }
261:
262:            public void setCvsMethodName(String methodName) {
263:                if ("ssh".equals(methodName))
264:                    this .cvsMethod = CVSRequest.METHOD_SSH;
265:                else if ("rsh".equals(methodName))
266:                    this .cvsMethod = CVSRequest.METHOD_RSH;
267:                else
268:                    this .cvsMethod = CVSRequest.METHOD_INETD;
269:            }
270:
271:            public String getCvsRoot() {
272:                return this .cvsRoot;
273:            }
274:
275:            public void setCvsRoot(String cvsRoot) {
276:                this .cvsRoot = cvsRoot;
277:            }
278:
279:            public String getCvsLogin() {
280:                return this .login;
281:            }
282:
283:            public void setCvsLogin(String login) {
284:                this .login = login;
285:            }
286:
287:            public String getCvsPassword() {
288:                return this .pass;
289:            }
290:
291:            public void setCvsPassword(String pass) {
292:                this .pass = pass;
293:            }
294:
295:            public String getLocalDirectory() {
296:                return this .localDir;
297:            }
298:
299:            public void setLocalDirectory(String localDir) {
300:                this .localDir = localDir;
301:            }
302:
303:            public String getTempDirectory() {
304:                return this .tempDir;
305:            }
306:
307:            public void setTempDirectory(String tempDir) {
308:                this .tempDir = tempDir;
309:            }
310:
311:            public boolean getViewingRestricted() {
312:                return this .viewingRestricted;
313:            }
314:
315:            public void setViewingRestricted(boolean viewingRestricted) {
316:                this .viewingRestricted = viewingRestricted;
317:            }
318:
319:            public boolean getDebugCheckout() {
320:                return this .dbgChkOut;
321:            }
322:
323:            public void setDebugCheckout(boolean dbgChkOut) {
324:                this .dbgChkOut = dbgChkOut;
325:            }
326:
327:            public void addView(JCVSProjectView view) {
328:                this .views.put(view.getKey(), view);
329:            }
330:
331:            public JCVSProjectView getView(String cvsTag) {
332:                return (JCVSProjectView) this .views.get(cvsTag);
333:            }
334:
335:            public Iterator getTagsIterator() {
336:                return this .views.keySet().iterator();
337:            }
338:
339:            public Iterator getViewIterator() {
340:                return this .views.values().iterator();
341:            }
342:
343:            public String toString() {
344:                StringBuffer sBuf = new StringBuffer(128);
345:
346:                sBuf.append("[ ");
347:                sBuf.append("key=").append(this .key).append(", ");
348:                sBuf.append("type=").append(this .type).append(", ");
349:                sBuf.append("owner=").append(this .owner).append(", ");
350:                sBuf.append("name=").append(this .name).append(", ");
351:                sBuf.append("viewRest=").append(this .viewingRestricted).append(
352:                        ", ");
353:                sBuf.append("host=").append(this .host).append(", ");
354:                sBuf.append("cvsRoot=").append(this .cvsRoot).append(", ");
355:                sBuf.append("login=").append(this .login).append(", ");
356:                sBuf.append("pass=").append(this .pass).append(", ");
357:                sBuf.append("tempDir=").append(this .tempDir).append(", ");
358:                sBuf.append("localDir=").append(this .localDir).append(", ");
359:                sBuf.append("title=").append(this .title).append(", ");
360:                sBuf.append("homeUrl=").append(this .homeUrl).append(", ");
361:                sBuf.append("jcvsUrl=").append(this .jcvsUrl).append(", ");
362:                sBuf.append(" ]");
363:
364:                return sBuf.toString();
365:            }
366:
367:            public void loadConfiguration(Node defNode) throws SAXException {
368:                NodeList children = defNode.getChildNodes();
369:                for (int ni = 0; ni < children.getLength(); ++ni) {
370:                    Node child = children.item(ni);
371:                    if (child != null
372:                            && child.getNodeType() == Node.ELEMENT_NODE) {
373:                        String name = child.getNodeName();
374:                        String value = XMLHelper
375:                                .getElementValue((Element) child);
376:
377:                        if ("type".equals(name)) {
378:                            if ("link".equals(value))
379:                                this .setType(PT_LINK);
380:                            else if ("jcvs".equals(value))
381:                                this .setType(PT_JCVS);
382:                        } else if ("host".equals(name)) {
383:                            this .setCvsHost(value);
384:                        } else if ("owner".equals(name)) {
385:                            this .setOwner(value);
386:                        } else if ("port".equals(name)) {
387:                            int port = 2401;
388:                            try {
389:                                port = Integer.parseInt(value);
390:                            } catch (Exception ex) {
391:                                port = 2401;
392:                            }
393:                            this .setCvsPort(port);
394:                        } else if ("method".equals(name)) {
395:                            int method = CVSRequest.METHOD_INETD;
396:
397:                            if ("ssh".equals(value))
398:                                method = CVSRequest.METHOD_SSH;
399:                            else if ("rsh".equals(value))
400:                                method = CVSRequest.METHOD_RSH;
401:
402:                            this .setCvsMethod(method);
403:                        } else if ("login".equals(name)) {
404:                            this .setCvsLogin(value);
405:                        } else if ("pass".equals(name)) {
406:                            this .setCvsPassword(value);
407:                        } else if ("cvsroot".equals(name)) {
408:                            this .setCvsRoot(value);
409:                        } else if ("name".equals(name)) {
410:                            this .setName(value);
411:                        } else if ("title".equals(name)) {
412:                            this .setTitle(value);
413:                        } else if ("tempdir".equals(name)) {
414:                            this .setTempDirectory(value);
415:                        } else if ("localdir".equals(name)) {
416:                            this .setLocalDirectory(value);
417:                        } else if ("desc".equals(name)) {
418:                            this .setDescription(value);
419:                        } else if ("homepage".equals(name)) {
420:                            this .setHomePage(value);
421:                        } else if ("jcvsurl".equals(name)) {
422:                            this .setJcvsLink(value);
423:                        } else if ("restricted".equals(name)) {
424:                            this .setViewingRestricted(value.equals("true"));
425:                        } else if ("debug-chkout".equals(name)) {
426:                            this .setDebugCheckout(value.equals("true"));
427:                        }
428:                    } else {
429:                        if (child.getNodeType() != Node.TEXT_NODE)
430:                            System.err.println("SKIP node type"
431:                                    + " ["
432:                                    + child.getNodeType()
433:                                    + "] '"
434:                                    + XMLHelper.getNodeTypeName(child
435:                                            .getNodeType()) + "' name = '"
436:                                    + child.getNodeName() + "'");
437:                    }
438:                }
439:
440:                // UNDONE HIGH
441:                //	if ( ! this.validate() )
442:                //		{
443:                // Validate the localdir, cvsroot, etc...
444:                //		}
445:            }
446:
447:            public void saveConfiguration(PrintWriter pW, String prefix) {
448:                pW.print(prefix);
449:                pW.println("<jcvs-def>");
450:                pW.println("");
451:
452:                pW.print(prefix);
453:                pW.print("	<key>");
454:                pW.print(this .key);
455:                pW.println("</key>");
456:
457:                pW.print(prefix);
458:                pW.print("	<type>");
459:                pW.print((this .type == PT_JCVS ? PTSTR_JCVS : PTSTR_LINK));
460:                pW.println("</type>");
461:
462:                pW.print(prefix);
463:                pW.print("	<owner>");
464:                pW.print(this .owner);
465:                pW.println("</owner>");
466:
467:                pW.print(prefix);
468:                pW.print("	<name>");
469:                pW.print(this .name);
470:                pW.println("</name>");
471:
472:                pW.print(prefix);
473:                pW.print("	<restricted>");
474:                pW.print(this .viewingRestricted ? "true" : "false");
475:                pW.println("</restricted>");
476:
477:                pW.print(prefix);
478:                pW.print("	<debug-chkout>");
479:                pW.print(this .dbgChkOut ? "true" : "false");
480:                pW.println("</debug-chkout>");
481:
482:                pW.print(prefix);
483:                pW.print("	<title>");
484:                pW.print(this .title);
485:                pW.println("</title>");
486:
487:                pW.print(prefix);
488:                pW.print("	<homepage>");
489:                pW.print(this .homeUrl);
490:                pW.println("</homepage>");
491:
492:                pW.print(prefix);
493:                pW.print("	<jcvsurl>");
494:                pW.print(this .jcvsUrl);
495:                pW.println("</jcvsurl>");
496:
497:                pW.print(prefix);
498:                pW.print("	<title>");
499:                pW.print(this .title);
500:                pW.println("</title>");
501:
502:                pW.print(prefix);
503:                pW.print("	<host>");
504:                pW.print(this .host);
505:                pW.println("</host>");
506:
507:                pW.print(prefix);
508:                pW.print("	<method>");
509:                pW.print(this .getCvsMethodName());
510:                pW.println("</method>");
511:
512:                pW.print(prefix);
513:                pW.print("	<port>");
514:                pW.print(this .cvsPort);
515:                pW.println("</port>");
516:
517:                pW.print(prefix);
518:                pW.print("	<login>");
519:                pW.print(this .login);
520:                pW.println("</login>");
521:
522:                pW.print(prefix);
523:                pW.print("	<pass>");
524:                pW.print(this .pass);
525:                pW.println("</pass>");
526:
527:                pW.print(prefix);
528:                pW.print("	<cvsroot>");
529:                pW.print(this .cvsRoot);
530:                pW.println("</cvsroot>");
531:
532:                pW.print(prefix);
533:                pW.print("	<localdir>");
534:                pW.print(this .localDir);
535:                pW.println("</localdir>");
536:
537:                pW.print(prefix);
538:                pW.print("	<tempdir>");
539:                pW.print(this .tempDir);
540:                pW.println("</tempdir>");
541:
542:                pW.print(prefix);
543:                pW.print("	<desc>");
544:                pW.print(this .desc);
545:                pW.println("</desc>");
546:
547:                pW.println("");
548:                pW.print(prefix);
549:                pW.println("</jcvs-def>");
550:            }
551:
552:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.