1 22 package org.jboss.mx.server; 23 24 import java.util.Arrays ; 25 26 import org.jboss.mx.interceptor.AbstractInterceptor; 27 28 29 35 public class Invocation 36 extends InvocationContext 37 { 38 private Object [] args; 39 40 private InvocationContext ctx; 41 42 public Invocation() {} 44 45 public Invocation(InvocationContext ic) 46 { 47 addContext(ic); 48 } 49 50 51 53 public void addContext(final InvocationContext ctx) 54 { 55 super.copy(ctx); 56 this.ctx = ctx; 57 } 58 59 public void setArgs(Object [] args) 60 { 61 this.args = args; 62 } 63 64 public Object [] getArgs() 65 { 66 return args; 67 } 68 69 int ic_counter = 0; 70 71 public AbstractInterceptor nextInterceptor() 72 { 73 if (interceptors == null) 74 return null; 75 76 if (ic_counter < interceptors.size()) 77 return (AbstractInterceptor)interceptors.get(ic_counter++); 78 else 79 return null; 80 } 81 82 83 public Object invoke() throws Throwable 84 { 85 AbstractInterceptor ic = nextInterceptor(); 86 87 if (ic == null) 88 return dispatch(); 89 else 90 return ic.invoke(this); 91 92 } 93 94 public Object dispatch() throws Throwable 95 { 96 return dispatcher.invoke(this); 97 } 98 99 Object retVal = null; 100 101 102 103 public String toString() 104 { 105 StringBuffer buffer = new StringBuffer (); 106 buffer.append(getName()); 107 String [] sig = getSignature(); 108 if (sig != null) 109 buffer.append(Arrays.asList(sig)); 110 buffer.append(' ').append(getType()); 111 return buffer.toString(); 112 } 113 114 public Class getAttributeTypeClass() throws ClassNotFoundException 115 { 116 return ctx.getAttributeTypeClass(); 117 } 118 119 public Class getReturnTypeClass() throws ClassNotFoundException 120 { 121 return ctx.getReturnTypeClass(); 122 } 123 124 public Class [] getSignatureClasses() throws ClassNotFoundException 125 { 126 return ctx.getSignatureClasses(); 127 } 128 } 129 130 131 132 133 | Popular Tags |