Package org.apache.qpid.agent.binding

Examples of org.apache.qpid.agent.binding.MethodBinding


            dec.readStr8(); // pkg
            dec.readStr8(); // cls
            dec.readBin128(); // hash
            String mname = dec.readStr8();
            ClassBinding cls = getClassBinding(mo);
            MethodBinding method = cls.getMethod(mname);
            if (method == null)
            {
                methodResponse(seq, replyTo, 2, String.format(
                        "no such method: %s", mname));
            } else
            {
                log.trace("Handle method: " + method.getName());
                List<ParameterBinding> params = method.getInParameters();
                Object[] args = new Object[params.size()];
                int idx = 0;
                for (ParameterBinding p : params)
                {
                    TypeBinding typeBinding = p.getType();
                    log
                            .trace(String
                                    .format(
                                            "Decoding parameter with type %s ref package %s ref class %s ",
                                            typeBinding.getCode(), typeBinding
                                                    .getRefPackage(),
                                            typeBinding.getRefClass()));
                    args[idx++] = typeBinding.decode(dec);
                    log.trace("Done");
                }
                try
                {
                    Object[] result = mo.invoke(method, args);
                    methodResponse(seq, replyTo, 0, null, method, result);
                } catch (BindingException ex)
                {
                    log
                            .error(
                                    String
                                            .format(
                                                    "An exception occured invoking method %s. Stack trace sent to console.",
                                                    method.getName()), ex);
                    StringWriter str = new StringWriter();
                    PrintWriter writer = new PrintWriter(str);
                    ex.printStackTrace(writer);
                    writer.flush();
                    methodResponse(seq, replyTo, 7, str.toString());
                }
                log.trace("Done with method: " + method.getName());
            }
        }
    }
View Full Code Here


            dec.readStr8(); // pkg
            dec.readStr8(); // cls
            dec.readBin128(); // hash
            String mname = dec.readStr8();
            ClassBinding cls = getClassBinding(mo);
            MethodBinding method = cls.getMethod(mname);
            if (method == null)
            {
                methodResponse(seq, replyTo, 2, String.format(
                        "no such method: %s", mname));
            } else
            {
                log.trace("Handle method: " + method.getName());
                List<ParameterBinding> params = method.getInParameters();
                Object[] args = new Object[params.size()];
                int idx = 0;
                for (ParameterBinding p : params)
                {
                    TypeBinding typeBinding = p.getType();
                    log
                            .trace(String
                                    .format(
                                            "Decoding parameter with type %s ref package %s ref class %s ",
                                            typeBinding.getCode(), typeBinding
                                                    .getRefPackage(),
                                            typeBinding.getRefClass()));
                    args[idx++] = typeBinding.decode(dec);
                    log.trace("Done");
                }
                try
                {
                    Object[] result = mo.invoke(method, args);
                    methodResponse(seq, replyTo, 0, null, method, result);
                } catch (BindingException ex)
                {
                    log
                            .error(
                                    String
                                            .format(
                                                    "An exception occured invoking method %s. Stack trace sent to console.",
                                                    method.getName()), ex);
                    StringWriter str = new StringWriter();
                    PrintWriter writer = new PrintWriter(str);
                    ex.printStackTrace(writer);
                    writer.flush();
                    methodResponse(seq, replyTo, 7, str.toString());
                }
                log.trace("Done with method: " + method.getName());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.agent.binding.MethodBinding

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.