Invoke an operation
@param name The bean name
@param index The method index
@param args The arguments
@return The result
@exception JMException Thrown if an error occurs
347226
public static OpResultInfo invokeOp(String name, int index, String[] args) throws JMException
   {
      MBeanServer server = getMBeanServer();
      ObjectName objName = new ObjectName(name);
      MBeanInfo info = server.getMBeanInfo(objName);
      MBeanOperationInfo[] opInfo = info.getOperations();
      MBeanOperationInfo op = opInfo[index];
      MBeanParameterInfo[] paramInfo = op.getSignature();
      String[] argTypes = new String[paramInfo.length];

      for (int p = 0; p < paramInfo.length; p++)
         argTypes[p] = paramInfo[p].getType();
 
      return invokeOpByName(name, op.getName(), argTypes, args);
   }
838583
public Object invoke(Method m, Object[] args) throws Throwable {
        Object retval = null;

        if (isControlBeanMethod(m)) {
            m = mapControlBeanMethodToEJB(m);
        }

        if (isHomeMethod(m)) {
            try {
                retval = m.invoke(_homeInstance, args);
            }
            catch (Exception e) {
                Throwable t = e;
                if (e instanceof InvocationTargetException)
                    t = ((InvocationTargetException) e).getTargetException();
                _lastException = t;
                throw t;
            }

            // If the method was successful and returns an instance of
            // the bean interface class, then reset the target instance.
            if (isSelectorMethod(m)) {
                releaseBeanInstance(false);
                retval = beanNarrow(retval);
                _beanInstance = retval;
            }

            return retval;
        }
        // is remote / bean interface
        else {
            if (_beanInstance == null)
                _beanInstance = resolveBeanInstance();

            // By convention, the below cond should never be true.  The bean
            // type-specific resolve should throw an appropriate exception
            // that is more specific.  This is a safety net.
            if (_beanInstance == null)
                throw new ControlException("Unable to resolve bean instance");

            try {
                return m.invoke(_beanInstance, args);
            }
            catch (Exception e) {
                Throwable t = e;
                if (e instanceof InvocationTargetException)
                    t = ((InvocationTargetException) e).getTargetException();
                _lastException = t;

                throw t;
            }
            finally {
                // Handle remove method properly
                if (isRemoveMethod(m))
                    releaseBeanInstance(true);
            }
        }
    }
549684
public static Object invokeMethod(Object object, String methodName, Object[] parameters) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        return invokeMethod(object, methodName, getTypes(parameters), parameters);
    }
754503
public Object invoke(ObjectName objectName,String operationName,Object[]  params, String[] signature)
   {
	   return invoke(null, objectName, operationName,params, signature);
   }
314513
@SuppressWarnings("unchecked")
    public static <T> T performMethodInvocation(Object tested, Method methodToInvoke, Object... arguments)
            throws Exception {
        final boolean accessible = methodToInvoke.isAccessible();
        if (!accessible) {
            methodToInvoke.setAccessible(true);
        }
        try {
            if (isPotentialVarArgsMethod(methodToInvoke, arguments)) {
                Class<?>[] parameterTypes = methodToInvoke.getParameterTypes();
                final int varArgsIndex = parameterTypes.length - 1;
                Class<?> varArgsType = parameterTypes[varArgsIndex].getComponentType();
                Object varArgsArrayInstance = createAndPopulateVarArgsArray(varArgsType, varArgsIndex, arguments);
                Object[] completeArgumentList = new Object[parameterTypes.length];
                System.arraycopy(arguments, 0, completeArgumentList, 0, varArgsIndex);
                completeArgumentList[completeArgumentList.length - 1] = varArgsArrayInstance;
                return (T) methodToInvoke.invoke(tested, completeArgumentList);
            } else {
                return (T) methodToInvoke.invoke(tested, arguments == null ? new Object[]{arguments} : arguments);
            }
        } catch (InvocationTargetException e) {
            Throwable cause = e.getCause();
            if (cause instanceof Exception) {
                throw (Exception) cause;
            } else if (cause instanceof Error) {
                throw (Error) cause;
            } else {
                throw new MethodInvocationException(cause);
            }
        } finally {
            if (!accessible) {
                methodToInvoke.setAccessible(false);
            }
        }
    }
1163017
@Override
    @Trivial
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if ("addTransformer".equals(method.getName())) {
            addTransformer((ClassFileTransformer) args[0], args.length > 1 ? (Boolean) args[1] : false);
            return null;
        }
        if ("removeTransformer".equals(method.getName())) {
            return removeTransformer((ClassFileTransformer) args[0]);
        }
        if ("appendToBootstrapClassLoaderSearch".equals(method.getName())) {
            appendToBootstrapClassLoaderSearch((JarFile) args[0]);
            return null;
        }
        if ("appendToSystemClassLoaderSearch".equals(method.getName())) {
            appendToSystemClassLoaderSearch((JarFile) args[0]);
            return null;
        }
        if ("setNativeMethodPrefix".equals(method.getName())) {
            setNativeMethodPrefix((ClassFileTransformer) args[0], (String) args[1]);
            return null;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, method.getName(), args);
        }

        Object retValue = method.invoke(instrumentation, args);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            if (void.class == method.getReturnType()) {
                Tr.exit(tc, method.getName());
            } else {
                Tr.exit(tc, method.getName(), retValue);
            }
        }
        return retValue;
    }
1295506
public Expression invoke(MethodRef method, Expression... args) {
    return method.invoke(ImmutableList.<Expression>builder().add(this).add(args).build());
  }
792911
public Object invokeMethod(String name, Object args) {
        try {
        return getMetaClass().invokeMethod(this, name, args);
        }
        catch (MissingMethodException e) {
            // lets apply the method to each item in the collection
            List answer = new ArrayList(size());
            for (Iterator iter = iterator(); iter.hasNext(); ) {
                Object element = iter.next();
                Object value = InvokerHelper.invokeMethod(element, name, args);
                answer.add(value);
            }
            return answer;
        }
    }
818186
public Object invoke (Object object, String methodName, Object... args) {
		return invoke(object, getIndex(methodName, args == null ? 0 : args.length), args);
	}
342359
@Override
    public void operationName(int index, String operationName)
            throws OperationFormatException {

        if (operationName == null || !ALPHANUMERICS_PATTERN.matcher(operationName).matches()) {
            throw new OperationFormatException("'" + operationName + "' is not a valid operation name.");
        }

        validatedOperationName(index, operationName);
    }
555477
@Override
    protected Object performInvocation(Exchange exchange, Object serviceObject, Method m, Object[] paramArray) throws Exception {
        paramArray = insertExchange(m, paramArray, exchange);
        return this.libertyJaxRsServerFactoryBean.performInvocation(exchange, serviceObject, m, paramArray);
    }
743603
@Override
    public int executeCommand(final IndexCommand command) throws IndexingException {
        LOGGER.trace("executeCommand() called...");

        // Execute and return the result...
        return executeCommand(serverDetails, command);
    }
64411
public Object invoke(Method method, Object[] args) throws Throwable {

        return MethodExecutionListenerUtils.invoke(new MethodExecutionListenerUtils.MethodExecutionCallback() {
            @Override
            public Object execute(Object proxyTarget, Method method, Object[] args) throws Throwable {
                return performQueryExecutionListener(method, args);
            }
        }, this.proxyConfig, this.statement, this.connectionInfo, method, args);

    }
317328
protected Object invoke(Method method, Object[] arguments)
	throws InvocationTargetException, IllegalAccessException {
		logger.trace("Lookup for call {}", method);
		Object bean = spring.getBean(beanType);

		try {
			return method.invoke(bean, arguments);
		} catch (IllegalArgumentException e) {
			StringBuilder msg = new StringBuilder(method.toGenericString());
			msg.append(" invoked with incompatible arguments:");
			for (Object a : arguments) {
				msg.append(' ');
				if (a == null)
					msg.append("null");
				else
					msg.append(a.getClass().getName());
			}
			logger.error(msg.toString());
			throw e;
		}
	}
442963
public Object methodMissing(String name, Object arg) {
        Object[] args = (Object[])arg;

        if(args.length == 0)
			throw new MissingMethodException(name,getClass(),args);

		if(args[0] instanceof Closure) {
            // abstract bean definition
            return invokeBeanDefiningMethod(name, args);
		}
		else if(args[0] instanceof Class || args[0] instanceof RuntimeBeanReference || args[0] instanceof Map) {
			return invokeBeanDefiningMethod(name, args);
		}
		else if (args.length > 1 && args[args.length -1] instanceof Closure) {
			return invokeBeanDefiningMethod(name, args);
		}
        WebApplicationContext ctx = springConfig.getUnrefreshedApplicationContext();
        MetaClass mc = DefaultGroovyMethods.getMetaClass(ctx);
        if(!mc.respondsTo(ctx, name, args).isEmpty()){
            return mc.invokeMethod(ctx,name, args);
        }
        return this;
	}
1098376
@Override
  public Object invokeMethod(String name, Object[] args) {
    ISlot slot = findSlot(name, args);
    PojoGestalt gestalt = createGestalt(slot.getType(), args);
    new Sculpturer().$form(gestalt);
    slot.write(gestalt.getSubject());
    return gestalt.getSubject();
  }
1188370
public MBeanOperationInfo[] getOperationsInfo(ObjectName name) throws JMException {
		checkClientConnected();
		try {
			return mbeanConn.getMBeanInfo(name).getOperations();
		} catch (Exception e) {
			throw createJmException("Problems getting bean information from " + name, e);
		}
	}