1 22 package org.jboss.deployment; 23 24 import org.jboss.mx.interceptor.AbstractInterceptor; 25 import org.jboss.mx.interceptor.Interceptor; 26 import org.jboss.mx.server.Invocation; 27 28 38 public abstract class SubDeployerInterceptor extends AbstractInterceptor 39 { 40 42 45 public SubDeployerInterceptor() 46 { 47 super(); 48 } 49 50 55 public SubDeployerInterceptor(String name) 56 { 57 super(name); 59 } 60 61 63 69 public Object invoke(Invocation invocation) throws Throwable 70 { 71 String type = invocation.getType(); 72 73 if (type.equals(Invocation.OP_INVOKE)) 75 { 76 Object args[] = invocation.getArgs(); 77 Object retn = invocation.getReturnTypeClass(); 78 79 if ((args.length == 1) && (args[0] instanceof DeploymentInfo) && (retn == null)) 81 { 82 String method = invocation.getName(); 83 DeploymentInfo di = (DeploymentInfo)args[0]; 84 85 if (method.equals("init")) 86 { 87 return init(invocation, di); 88 } 89 else if (method.equals("create")) 90 { 91 return create(invocation, di); 92 } 93 else if (method.equals("start")) 94 { 95 return start(invocation, di); 96 } 97 else if (method.equals("stop")) 98 { 99 return stop(invocation, di); 100 } 101 else if (method.equals("destroy")) 102 { 103 return destroy(invocation, di); 104 } 105 } 106 } 107 return invokeNext(invocation); 110 } 111 112 114 117 protected Object invokeNext(Invocation invocation) throws Throwable 118 { 119 Interceptor next = invocation.nextInterceptor(); 122 if (next != null) 123 { 124 return next.invoke(invocation); 125 } 126 else 127 { 128 return invocation.dispatch(); 129 } 130 } 131 132 134 137 protected Object init(Invocation invocation, DeploymentInfo di) throws Throwable 138 { 139 return invokeNext(invocation); 140 } 141 142 protected Object create(Invocation invocation, DeploymentInfo di) throws Throwable 143 { 144 return invokeNext(invocation); 145 } 146 147 protected Object start(Invocation invocation, DeploymentInfo di) throws Throwable 148 { 149 return invokeNext(invocation); 150 } 151 152 protected Object stop(Invocation invocation, DeploymentInfo di) throws Throwable 153 { 154 return invokeNext(invocation); 155 } 156 157 protected Object destroy(Invocation invocation, DeploymentInfo di) throws Throwable 158 { 159 return invokeNext(invocation); 160 } 161 162 } | Popular Tags |