"adrian(a)jboss.org" wrote :
| To what? Again this should probably be a seperate interface that can be
| optionally implemented.
|
| That a context has an associated classloader is true for JMX
| and sort of true for POJO (there is no first class support like the MBeanServer
methods)
| But is this really true of all contexts of a state machine?
|
So we should split DispatchContext into simple get/set interface and 'advanced'
interface with invoke, target, classloader.
Since how else would you get the parameters and signatures?
| protected Object invoke(KernelConfigurator configurator, DispatchContext context,
String name, List<ParameterMetaData> params) throws Throwable
| {
| String[] signature;
| Object[] parameters;
| if (params == null || params.isEmpty())
| {
| signature = new String[0];
| parameters = new Object[0];
| }
| else
| {
| int size = params.size();
| signature = Configurator.getParameterTypes(log.isTraceEnabled(), params);
| Object target = context.getTarget();
| // TODO - is this ok for non-POJO targets?
| if (target != null)
| {
| MethodInfo methodInfo =
Configurator.findMethodInfo(configurator.getClassInfo(target.getClass()), name,
signature);
| parameters = Configurator.getParameters(log.isTraceEnabled(),
context.getClassLoader(), methodInfo.getParameterTypes(), params);
| // add some more info, if not yet set
| for(int j = 0; j < size; j++)
| {
| if (signature[j] == null)
| {
| signature[j] = methodInfo.getParameterTypes()[j].getName();
| }
| }
| }
| else
| {
| parameters = new Object[size];
| ClassLoader classLoader = context.getClassLoader();
| for (int i = 0; i < size; i++)
| {
| ParameterMetaData pmd = params.get(i);
| TypeInfo typeInfo = null;
| if (signature[j] != null)
| {
| typeInfo = configurator.getClassInfo(signature[j], classLoader);
| }
| // typeInfo might be null, but we can still get value in some cases
| parameters[j] = pmd.getValue().getValue(typeInfo, classLoader);
| }
|
| }
| }
| return context.invoke(name, parameters, signature);
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4002911#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...