Source Code Cross Referenced for CvsDirectoryHandler.java in  » Web-Server » Jigsaw » org » w3c » jigedit » cvs » 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 » Web Server » Jigsaw » org.w3c.jigedit.cvs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // CvsDirectoryHandler.java
002:        // $Id: CvsDirectoryHandler.java,v 1.5 2000/08/16 21:37:31 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1996.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        //
007:        // FIXME add extra environment parameter to all public methods
008:        // witch run cvs.
009:        //
010:
011:        package org.w3c.jigedit.cvs;
012:
013:        import org.w3c.cvs.CvsDirectory;
014:        import org.w3c.cvs.CvsException;
015:
016:        import org.w3c.www.http.HTTP;
017:        import org.w3c.www.http.HttpMessage;
018:
019:        import org.w3c.jigsaw.http.HTTPException;
020:        import org.w3c.jigsaw.http.Reply;
021:        import org.w3c.jigsaw.http.Request;
022:
023:        import org.w3c.jigsaw.auth.AuthFilter;
024:
025:        import org.w3c.tools.resources.ProtocolException;
026:
027:        import org.w3c.jigsaw.html.HtmlGenerator;
028:
029:        public class CvsDirectoryHandler implements  CvsHandlerInterface {
030:            private static final boolean debug = false;
031:
032:            CvsDirectory cvs = null;
033:
034:            protected Reply badAction(Request request, String action) {
035:                Reply error = request.makeReply(HTTP.BAD_REQUEST);
036:                HtmlGenerator g = CvsFrame.getHtmlGenerator("Bad CVS command");
037:                g.append("<center>");
038:                g
039:                        .append("[ <A HREF=\"./CVS\">Back</A> ]<hr noshade width=\"80%\">");
040:                g.append("<p>Your command " + "<strong>" + action + "</strong>"
041:                        + " wasn't undesrtood.<p>");
042:                g.append("<hr noshade width=\"80%\"></center>");
043:                error.setStream(g);
044:                return error;
045:            }
046:
047:            /**
048:             * Perform the action on the entity matching the given regexp
049:             * @param request The request that triggered this method call.
050:             * @param action The action to perform.
051:             * @param regexp The regular expression to match
052:             * @param comment A string of comments describing the change.
053:             * @exception ProtocolException If running the action failed.
054:             */
055:            public void perform(Request request, String action, String regexp,
056:                    String comment) throws ProtocolException {
057:                try {
058:                    String u = (String) request
059:                            .getState(AuthFilter.STATE_AUTHUSER);
060:                    String env[] = { "USER=" + u, "LOGNAME=" + u };
061:                    if (action.equals("add")) {
062:                        cvs.addRegexp(regexp, env);
063:                    } else if (action.equals("update")) {
064:                        cvs.updateRegexp(regexp);
065:                    } else if (action.equals("commit")) {
066:                        String jcomment = null;
067:                        if (comment != null) {
068:                            jcomment = ((u != null) ? "(" + u + ") " + comment
069:                                    : comment);
070:                        } else {
071:                            jcomment = ((u != null) ? "(" + u
072:                                    + ") changed through Jigsaw, no comments"
073:                                    : "changed through Jigsaw, no comments");
074:                        }
075:                        cvs.commitRegexp(regexp, jcomment, env);
076:                    } else if (action.equals("addcom")) {
077:                        cvs.addRegexp(regexp, env);
078:                        String jcomment = null;
079:                        if (comment != null) {
080:                            jcomment = ((u != null) ? "(" + u + ") " + comment
081:                                    : comment);
082:                        } else {
083:                            jcomment = ((u != null) ? "(" + u
084:                                    + ") changed through Jigsaw, no comments"
085:                                    : "changed through Jigsaw, no comments");
086:                        }
087:                        cvs.commitRegexp(regexp, jcomment, env);
088:                    } else {
089:                        throw new HTTPException(badAction(request, action));
090:                    }
091:                } catch (CvsException ex) {
092:                    String msg = action + " in " + cvs.getDirectory()
093:                            + " failed";
094:                    throw new HTTPException(CvsFrame.error(request, msg, ex));
095:                }
096:            }
097:
098:            /**
099:             * Perform the action on the entity matching the given regexp
100:             * @param request The request that triggered this method call.
101:             * @param action The action to perform.
102:             * @param regexp The regular expression to match
103:             * @exception ProtocolException If running the action failed.
104:             */
105:            public void perform(Request request, String action, String regexp)
106:                    throws ProtocolException {
107:                perform(request, action, regexp, null);
108:            }
109:
110:            /**
111:             * Perform the action on the given entity.
112:             * @param request The request that triggered this method call.
113:             * @param action The action to perform.
114:             * @param names Name of files to apply the action to.
115:             * @exception ProtocolException If running the action failed.
116:             */
117:
118:            public void perform(Request request, String action, String names[],
119:                    String revs[]) throws ProtocolException {
120:                perform(request, action, names, revs, null);
121:            }
122:
123:            /**
124:             * Perform the action on the given entity.
125:             * @param action The action to perform.
126:             * @param names The names on which the action should be performed.
127:             * @param comment A string of comments describing the change.
128:             * @exception ProtocolException If running the action failed.
129:             */
130:
131:            public void perform(Request request, String action, String names[],
132:                    String revs[], String comment) throws ProtocolException {
133:                String u = (String) request.getState(AuthFilter.STATE_AUTHUSER);
134:                String env[] = { "USER=" + u, "LOGNAME=" + u };
135:                String jcomment = null;
136:                if (comment != null) {
137:                    jcomment = ((u != null) ? "(" + u + ") " + comment
138:                            : comment);
139:                } else {
140:                    jcomment = ((u != null) ? "(" + u
141:                            + ") changed through Jigsaw, no comments"
142:                            : "changed through Jigsaw, no comments");
143:                }
144:
145:                if (debug)
146:                    for (int i = 0; i < names.length; i++)
147:                        System.out.println("*** perform " + action + " on "
148:                                + names[i]);
149:                try {
150:                    if (action.equals("add")) {
151:                        cvs.add(names, env);
152:                    } else if (action.equals("revert")) {
153:                        String msg = ((u != null) ? "(" + u + ") " + comment
154:                                : comment);
155:                        for (int i = 0; i < names.length; i++)
156:                            cvs.revert(names[i], revs[i], msg, env);
157:                    } else if (action.equals("remove")) {
158:                        cvs.remove(names, jcomment, env);
159:                    } else if (action.equals("update")) {
160:                        cvs.update(names);
161:                    } else if (action.equals("commit")) {
162:                        cvs.commit(names, jcomment, env);
163:                    } else if (action.equals("addcom")) {
164:                        cvs.add(names, env);
165:                        cvs.commit(names, jcomment, env);
166:                    } else {
167:                        throw new HTTPException(badAction(request, action));
168:                    }
169:                } catch (CvsException ex) {
170:                    String msg = action + " in " + cvs.getDirectory()
171:                            + " failed";
172:                    throw new HTTPException(CvsFrame.error(request, msg, ex));
173:                }
174:            }
175:
176:            CvsDirectoryHandler(CvsDirectory cvs) {
177:                super();
178:                this.cvs = cvs;
179:            }
180:
181:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.