1 22 package org.jboss.deployment; 23 24 import org.jboss.logging.Logger; 25 import org.jboss.mx.server.Invocation; 26 import org.jboss.system.InterceptorServiceMBeanSupport; 27 28 48 public abstract class SubDeployerInterceptorSupport extends InterceptorServiceMBeanSupport 49 implements SubDeployerInterceptorMBean 50 { 51 52 54 57 public SubDeployerInterceptorSupport() 58 { 59 super(); 60 } 61 62 69 public SubDeployerInterceptorSupport(final Class type) 70 { 71 super(type); 72 } 73 74 81 public SubDeployerInterceptorSupport(final String category) 82 { 83 super(category); 84 } 85 86 93 public SubDeployerInterceptorSupport(final Logger log) 94 { 95 super(log); 96 } 97 98 100 107 protected void attach() throws Exception 108 { 109 super.attach(new XMBeanInterceptor()); 110 } 111 112 114 117 protected Object init(Invocation invocation, DeploymentInfo di) throws Throwable 118 { 119 return invokeNext(invocation); 120 } 121 122 125 protected Object create(Invocation invocation, DeploymentInfo di) throws Throwable 126 { 127 return invokeNext(invocation); 128 } 129 130 133 protected Object start(Invocation invocation, DeploymentInfo di) throws Throwable 134 { 135 return invokeNext(invocation); 136 } 137 138 141 protected Object stop(Invocation invocation, DeploymentInfo di) throws Throwable 142 { 143 return invokeNext(invocation); 144 } 145 146 149 protected Object destroy(Invocation invocation, DeploymentInfo di) throws Throwable 150 { 151 return invokeNext(invocation); 152 } 153 154 156 160 private class XMBeanInterceptor extends SubDeployerInterceptor 161 { 162 public XMBeanInterceptor() 163 { 164 super("XMBeanInterceptor('" + SubDeployerInterceptorSupport.this.getServiceName() + "')"); 165 } 166 167 protected Object init(Invocation invocation, DeploymentInfo di) throws Throwable 168 { 169 logSubDeployerInvocation(invocation, di); 170 171 return SubDeployerInterceptorSupport.this.init(invocation, di); 173 } 174 175 protected Object create(Invocation invocation, DeploymentInfo di) throws Throwable 176 { 177 logSubDeployerInvocation(invocation, di); 178 179 return SubDeployerInterceptorSupport.this.create(invocation, di); 181 } 182 183 protected Object start(Invocation invocation, DeploymentInfo di) throws Throwable 184 { 185 logSubDeployerInvocation(invocation, di); 186 187 return SubDeployerInterceptorSupport.this.start(invocation, di); 189 } 190 191 protected Object stop(Invocation invocation, DeploymentInfo di) throws Throwable 192 { 193 logSubDeployerInvocation(invocation, di); 194 195 return SubDeployerInterceptorSupport.this.stop(invocation, di); 197 } 198 199 protected Object destroy(Invocation invocation, DeploymentInfo di) throws Throwable 200 { 201 logSubDeployerInvocation(invocation, di); 202 203 return SubDeployerInterceptorSupport.this.destroy(invocation, di); 205 } 206 207 protected void logSubDeployerInvocation(Invocation invocation, DeploymentInfo di) 208 { 209 if (SubDeployerInterceptorSupport.this.log.isTraceEnabled()) 210 { 211 StringBuffer sbuf = new StringBuffer (); 212 sbuf.append("intercepting ").append(invocation.getName()) 213 .append("(), url=").append(di.url.toString()) 214 .append(", state=").append(di.state.toString()); 215 216 SubDeployerInterceptorSupport.this.log.trace(sbuf.toString()); 217 } 218 } 219 } 220 } 221 | Popular Tags |