Package org.apache.tomee.loader.service

Examples of org.apache.tomee.loader.service.ServiceException


        final Context ctx;
        try {
            ctx = new InitialContext(ctxParams);
        } catch (NamingException e) {
            throw new ServiceException(e);
        }
        return ctx;
    }
View Full Code Here


    public Object invokeJndiMethod(Context context, String path, String methodName, TypeAndValueEntry... params) {
        final Object obj;
        try {
            obj = context.lookup(path);
        } catch (NamingException e) {
            throw new ServiceException(e);
        }
        final Class<?> cls = obj.getClass();

        final Method method;
        final Object[] parameterValues;
        try {
            if (params == null) {
                parameterValues = null;
                method = cls.getMethod(methodName);
            } else {
                final Class<?>[] parameterTypes = new Class<?>[params.length];
                parameterValues = new Object[params.length];
                for (int i = 0; i < params.length; i++) {
                    parameterTypes[i] = params[i].type;
                    parameterValues[i] = params[i].value;
                }
                method = cls.getMethod(methodName, parameterTypes);
            }
        } catch (NoSuchMethodException e) {
            throw new ServiceException(e);
        }

        final Object result;
        try {
            if (parameterValues == null) {
                result = method.invoke(obj);
            } else {
                result = method.invoke(obj, parameterValues);
            }
        } catch (IllegalAccessException e) {
            throw new ServiceException(e);
        } catch (InvocationTargetException e) {
            throw new ServiceException(e);
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.tomee.loader.service.ServiceException

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.