1 23 24 package com.sun.enterprise.deployment.runtime.web; 25 26 import com.sun.enterprise.deployment.runtime.RuntimeDescriptor; 27 28 35 public class ConstraintField extends RuntimeDescriptor 36 { 37 38 static public final String VALUE = "Value"; static public final String NAME = "Name"; 40 static public final String SCOPE = "Scope"; 41 static public final String MATCH_EXPR = "MatchExpr"; 42 static public final String CACHE_ON_MATCH = "CacheOnMatch"; 43 static public final String CACHE_ON_MATCH_FAILURE = "CacheOnMatchFailure"; 44 45 public ConstraintField(ConstraintField other) 46 { 47 super(other); 48 } 49 50 public ConstraintField() 51 { 52 setAttributeValue(SCOPE, "request.parameter"); 53 setAttributeValue(CACHE_ON_MATCH, "true"); 54 setAttributeValue(CACHE_ON_MATCH_FAILURE, "false"); 55 } 56 57 public void setValue(int index, String value) 59 { 60 this.setValue(VALUE, index, value); 61 } 62 63 public String getValue(int index) 65 { 66 return (String )this.getValue(VALUE, index); 67 } 68 69 public void setValue(String [] value) 71 { 72 this.setValue(VALUE, value); 73 } 74 75 public String [] getValue() 77 { 78 return (String [])this.getValues(VALUE); 79 } 80 81 public int sizeValue() 83 { 84 return this.size(VALUE); 85 } 86 87 public int addValue(String value) 89 { 90 int index = this.addValue(VALUE, value); 91 if (getAttributeValue(VALUE, index, MATCH_EXPR)==null) 92 setAttributeValue(VALUE, index, MATCH_EXPR, "equals"); 93 if (getAttributeValue(VALUE, index, CACHE_ON_MATCH)==null) 94 setAttributeValue(VALUE, index, CACHE_ON_MATCH, "true"); 95 if (getAttributeValue(VALUE, index, CACHE_ON_MATCH_FAILURE)==null) 96 setAttributeValue(VALUE, index, CACHE_ON_MATCH_FAILURE, "false"); 97 return index; 98 } 99 100 public int removeValue(String value) 105 { 106 return this.removeValue(VALUE, value); 107 } 108 109 public boolean verify() 111 { 112 return true; 113 } 114 } 115 | Popular Tags |