1 23 24 29 30 package com.sun.enterprise.config.serverbeans; 31 32 import com.sun.enterprise.config.pluggable.ConfigBeanInterceptor; 33 import com.sun.enterprise.config.ConfigBean; 34 35 import com.sun.enterprise.util.RelativePathResolver; 39 40 import java.io.Serializable ; 41 42 46 public class ServerBeanInterceptor implements ConfigBeanInterceptor, Serializable , Cloneable { 47 48 49 public ServerBeanInterceptor() { 50 } 51 52 53 57 public Object resolveTokensForString(Object value) { 58 if (isResolvingPaths() && value != null && value instanceof String ) { 59 return resolveStringTokens((String )value); 60 } 61 return value; 62 } 63 64 68 public String resolveStringTokens(String string) { 69 return RelativePathResolver.resolvePath(string); 70 } 71 72 public Object postGetValue(ConfigBean cb, String name, Object res) { 73 return resolveTokensForString(res); 74 } 75 76 80 private boolean _isResolvingPaths = true; 81 82 public void setResolvingPaths(boolean isResolvingPaths) { 83 _isResolvingPaths = isResolvingPaths; 84 } 85 86 public boolean isResolvingPaths() { 87 return _isResolvingPaths; 88 } 89 90 public String postGetAttributeValue(String name, String res) { 91 if (isResolvingPaths()) { 92 return resolveStringTokens(res); 93 } else { 94 return res; 95 } 96 } 97 98 public Object [] postGetValues(String name, Object [] res) { 99 100 if (isResolvingPaths()&& res != null && res instanceof String []) { 102 for(int ii=0; ii < res.length; ii++) { 104 res[ii]=resolveStringTokens((String )res[ii]); 105 } 106 } 107 return res; 108 } 109 110 public Object preClone() { 111 boolean orig = isResolvingPaths(); 112 setResolvingPaths(false); 113 return new Boolean (orig); 114 } 115 116 public void postClone(Object o) { 117 setResolvingPaths(((Boolean )o).booleanValue()); 118 } 119 120 public Object clone() { 121 ConfigBeanInterceptor cbiClone = new ServerBeanInterceptor(); 122 cbiClone.setResolvingPaths(this.isResolvingPaths()); 123 return cbiClone; 124 } 125 126 130 public String toString() { 131 return "{resolvingPaths=" + isResolvingPaths() + "}"; 132 } 133 } 134 | Popular Tags |