Source Code Cross Referenced for ConditionFactor.java in  » Content-Management-System » harmonise » com » ibm » webdav » 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 » Content Management System » harmonise » com.ibm.webdav 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.ibm.webdav;
002:
003:        /*
004:         * (C) Copyright IBM Corp. 2000  All rights reserved.
005:         *
006:         * The program is provided "AS IS" without any warranty express or
007:         * implied, including the warranty of non-infringement and the implied
008:         * warranties of merchantibility and fitness for a particular purpose.
009:         * IBM will not be liable for any damages suffered by you as a result
010:         * of using the Program. In no event will IBM be liable for any
011:         * special, indirect or consequential damages or lost profits even if
012:         * IBM has been advised of the possibility of their occurrence. IBM
013:         * will not be liable for any third party claims against you.
014:         */
015:        import java.io.StreamTokenizer;
016:        import java.io.IOException;
017:
018:        /** A ConditionFactor represents some state of a resource that must be
019:         * satisfied in order for the associated request to be valid. The ConditionFactors in
020:         * a ConditionTerm must all match with states of the resource, i.e., they are AND'ed
021:         * together. Conditions are contained in a Precondition which is used in a
022:         * WebDAV If header. ConditionFactors are either constructed by the client, or may
023:         * have been given to the client in a previous method request. A ConditionFactor can
024:         * be either a StateToken or an EntityTag as defined by section 9.4 of the WebDAV
025:         * spec.
026:         * @author Jim Amsden <jamsden@us.ibm.com>
027:         * @see com.ibm.webdav.Precondition
028:         * @see com.ibm.webdav.ConditionFactor
029:         * @see com.ibm.webdav.ConditionTerm
030:         * @see com.ibm.webdav.EntityTag
031:         * @see com.ibm.webdav.StateToken
032:         */
033:        public abstract class ConditionFactor {
034:            // ------------------------------------------------------------------------
035:
036:            private boolean not_ = false;
037:
038:            /** Create a ConditionFactor (either a StateToken or EntityTag) by parsing
039:             * the tokenizer contining an If header value.
040:             * @param tokenizer a StreamTokenizer containing the contents of a state token or entity tag
041:             *    from a WebDAV If header
042:             * @return the parsed ConditionFactor
043:             * @exception com.ibm.webdav.WebDAVException thrown if there is a syntax error in the If header
044:             */
045:            public static ConditionFactor create(StreamTokenizer tokenizer)
046:                    throws WebDAVException {
047:                boolean not = false;
048:                ConditionFactor factor = null;
049:                try {
050:                    int token = tokenizer.ttype;
051:                    if (token == StreamTokenizer.TT_WORD) {
052:                        if (tokenizer.sval.equalsIgnoreCase("Not")) {
053:                            not = true;
054:                        } else {
055:                            throw new WebDAVException(
056:                                    WebDAVStatus.SC_BAD_REQUEST,
057:                                    "Error parsing If header: expected Not");
058:                        }
059:                        token = tokenizer.nextToken();
060:                    }
061:                    switch (token) {
062:                    case '<': {
063:                        factor = StateToken.create(tokenizer);
064:                        break;
065:                    }
066:                    case '[': {
067:                        factor = EntityTag.create(tokenizer);
068:                        break;
069:                    }
070:                    default: {
071:                        throw new WebDAVException(WebDAVStatus.SC_BAD_REQUEST,
072:                                "Error parsing If header: saw: " + (char) token
073:                                        + " expected: < or [");
074:                    }
075:                    }
076:                } catch (IOException exc) {
077:                }
078:                factor.setNot(not);
079:                return factor;
080:            }
081:
082:            /** Negate the comparison on this ConditionFactor?
083:             @return true if the condition factor was negated in the If header
084:             */
085:            public boolean not() {
086:                return not_;
087:            }
088:
089:            /** Set how to compare to this ConditionFactor. Value is true implies match for
090:             * a valid request, false implies the request is valid only if the ConditionFactor
091:             * doesn't match.
092:             * @param value true means negate the condition
093:             */
094:            public void setNot(boolean value) {
095:                not_ = value;
096:            }
097:
098:            /** Return a String representation of this ConditionFactor as defined by the If
099:             * header in section 9.4 of the WebDAV spec.
100:             * @return a string representation of a state token or entity tag
101:             */
102:            public abstract String toString();
103:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.