public Object invoke(Invocation invocation) throws Throwable {
String type = invocation.getType();
// make sure this is an operation invocation
if (type.equals(Invocation.OP_INVOKE))
{
Object args[] = invocation.getArgs();
Object retn = invocation.getReturnTypeClass();
// make sure the signature matches - > void < methodName >(DeploymentInfo di)
if ((args.length == 1) && (args[0] instanceof DeploymentInfo) && (retn == null))
{
String method = invocation.getName();
DeploymentInfo di = (DeploymentInfo)args[0];
if (method.equals("init"))
{
return init(invocation, di);
}
else if (method.equals("create"))
{
return create(invocation, di);
}
else if (method.equals("start"))
{
return start(invocation, di);
}
else if (method.equals("stop"))
{
return stop(invocation, di);
}
else if (method.equals("destroy"))
{
return destroy(invocation, di);
}
}
}
// if we reached this point invocation is of no interest
// to SubDeployerInterceptor so simply forward it
return invokeNext(invocation);
}
This invoke method checks for invocations of interest, .i.e.
init(), create(), start(), stop(), destroy() operation calls
with a single DeploymentInfo argument and wraps the invocation
with calls to corresponding init(), create(), etc. methods. |