1 23 package com.sun.enterprise.deployment; 24 25 import java.io.*; 26 import java.util.*; 27 import com.sun.enterprise.deployment.EnvironmentProperty; 28 import com.sun.enterprise.deployment.web.InitializationParameter; 29 import com.sun.enterprise.deployment.web.ServletFilter; 30 import com.sun.enterprise.deployment.web.ServletFilterMapping; 31 32 36 public class ServletFilterDescriptor 37 extends Descriptor 38 implements ServletFilter 39 { 40 41 42 private String className = ""; 43 44 45 private String displayName = ""; 46 47 48 private String filterName = ""; 49 50 51 private Vector initParms = new Vector(); 52 53 55 56 57 public ServletFilterDescriptor() { 58 super("", ""); 59 this.setClassName(""); 60 } 61 62 63 public ServletFilterDescriptor(String className, String name) { 64 super(name, ""); 65 this.setClassName(className); 66 } 67 68 70 71 72 public void setClassName(String name) { 73 this.className = (name != null)? name : ""; 74 } 75 76 77 public String getClassName() { 78 if (this.className == null) { 79 this.className = ""; 80 } 81 return this.className; 82 } 83 84 85 public void setDisplayName(String name) { 86 this.displayName = (name != null)? name : ""; 87 } 88 89 90 public String getDisplayName() { 91 String n = this.displayName; 92 if ((n == null) || n.equals("")) { 93 n = this.getName(); 94 } 95 return n; 96 } 97 98 99 public void setName(String filterName) { 100 this.filterName = filterName; 101 } 102 103 104 public String getName() { 105 if ((filterName == null) || filterName.equals("")) { 106 String c = this.getClassName(); 107 int p = c.lastIndexOf('.'); 108 filterName = (p < 0)? c : c.substring(p + 1); 109 } 110 return filterName; 111 } 112 113 115 116 117 public void setInitializationParameters(Collection c) { 118 this.initParms.clear(); 119 this.initParms.addAll(c); 120 } 121 122 123 public Vector getInitializationParameters() { 124 return (Vector)this.initParms.clone(); 125 } 126 127 128 public void addInitializationParameter(InitializationParameter ref) { 129 this.initParms.addElement(ref); 130 } 131 132 133 public void addInitializationParameter(EnvironmentProperty ref) { 134 addInitializationParameter((InitializationParameter) ref); 135 } 136 137 138 public void removeInitializationParameter(InitializationParameter ref) { 139 this.initParms.removeElement(ref); 140 } 141 142 144 145 146 public boolean equals(Object obj) { 147 152 153 if (obj instanceof ServletFilter) { 156 if (this.getClassName().equals( 157 ((ServletFilter)obj).getClassName()) 158 && this.getName().equals( 159 ((ServletFilter)obj).getName())) { 160 return true; 161 } 162 } 163 164 return false; 165 } 166 } 167 | Popular Tags |