1 package com.ibm.webdav; 2 3 15 import java.io.StreamTokenizer ; 16 import java.io.IOException ; 17 18 19 34 public abstract class ConditionFactor 35 { 36 38 private boolean not_ = false; 39 46 public static ConditionFactor create(StreamTokenizer tokenizer) throws WebDAVException { 47 boolean not = false; 48 ConditionFactor factor = null; 49 try { 50 int token = tokenizer.ttype; 51 if (token == StreamTokenizer.TT_WORD) { 52 if (tokenizer.sval.equalsIgnoreCase("Not")) { 53 not = true; 54 } else { 55 throw new WebDAVException(WebDAVStatus.SC_BAD_REQUEST, "Error parsing If header: expected Not"); 56 } 57 token = tokenizer.nextToken(); 58 } 59 switch (token) { 60 case '<' : 61 { 62 factor = StateToken.create(tokenizer); 63 break; 64 } 65 case '[' : 66 { 67 factor = EntityTag.create(tokenizer); 68 break; 69 } 70 default : 71 { 72 throw new WebDAVException(WebDAVStatus.SC_BAD_REQUEST, "Error parsing If header: saw: " + (char) token + " expected: < or ["); 73 } 74 } 75 } catch (IOException exc) { 76 } 77 factor.setNot(not); 78 return factor; 79 } 80 83 public boolean not() { 84 return not_; 85 } 86 91 public void setNot(boolean value) { 92 not_ = value; 93 } 94 98 public abstract String toString(); 99 } 100 | Popular Tags |