1 64 65 package com.jcorporate.expresso.core.misc; 66 67 import org.apache.oro.text.regex.MalformedPatternException; 68 import org.apache.oro.text.regex.Pattern; 69 import org.apache.oro.text.regex.PatternCompiler; 70 import org.apache.oro.text.regex.Perl5Compiler; 71 72 import java.util.Vector ; 73 74 75 78 public class ConfigPathMapping { 79 static PatternCompiler compiler = new Perl5Compiler(); 80 private String urlPattern = null; 81 private String path = null; 82 private Vector params = new Vector (); 83 private Vector fixedParams = new Vector (); 84 private Pattern compiledRegExp = null; 85 86 public ConfigPathMapping() { 87 } 88 89 95 public void setUrlPattern(String newPattern) { 96 urlPattern = newPattern; 97 98 try { 99 compiledRegExp = compiler.compile(newPattern, Perl5Compiler.READ_ONLY_MASK); 100 } catch (MalformedPatternException mpe) { 101 throw new IllegalArgumentException ("Error compiling regular expression: " + newPattern + 102 mpe.getMessage()); 103 } 104 } 105 106 public void setPath(String newPath) { 107 path = newPath; 108 } 109 110 113 public String getUrlPattern() { 114 return urlPattern; 115 } 116 117 123 public Pattern getCompiledUrlPattern() { 124 return compiledRegExp; 125 } 126 127 public String getPath() { 128 return path; 129 } 130 131 public void addParam(ConfigPathParam newParam) { 132 params.addElement(newParam); 133 } 134 135 public Vector getParams() { 136 return params; 137 } 138 139 public void addFixedParam(ConfigPathFixedParam newFixedParam) { 140 fixedParams.addElement(newFixedParam); 141 } 142 143 public Vector getFixedParams() { 144 return fixedParams; 145 } 146 } | Popular Tags |