1 18 19 20 package org.apache.catalina.startup; 21 22 import org.apache.catalina.Context; 23 import org.apache.catalina.deploy.NamingResources; 24 import org.apache.tomcat.util.IntrospectionUtils; 25 import org.apache.tomcat.util.digester.Rule; 26 27 28 38 39 public class SetNextNamingRule extends Rule { 40 41 42 44 45 54 public SetNextNamingRule(String methodName, 55 String paramType) { 56 57 this.methodName = methodName; 58 this.paramType = paramType; 59 60 } 61 62 63 65 66 69 protected String methodName = null; 70 71 72 75 protected String paramType = null; 76 77 78 80 81 84 public void end() throws Exception { 85 86 Object child = digester.peek(0); 88 Object parent = digester.peek(1); 89 90 NamingResources namingResources = null; 91 if (parent instanceof Context) { 92 namingResources = ((Context) parent).getNamingResources(); 93 } else { 94 namingResources = (NamingResources) parent; 95 } 96 97 IntrospectionUtils.callMethod1(namingResources, methodName, 99 child, paramType, digester.getClassLoader()); 100 101 } 102 103 104 107 public String toString() { 108 109 StringBuffer sb = new StringBuffer ("SetNextRule["); 110 sb.append("methodName="); 111 sb.append(methodName); 112 sb.append(", paramType="); 113 sb.append(paramType); 114 sb.append("]"); 115 return (sb.toString()); 116 117 } 118 119 120 } 121 | Popular Tags |