Package org.mc4j.ems.connection.bean.parameter

Examples of org.mc4j.ems.connection.bean.parameter.EmsParameter


            if (operationParameters.size() != parameterTypeNames.length || !operation.getName().equals(name))
                // Different name or number of params than what we are looking for - move on...
                continue;
            // At this point, name and number of params match. Now compare the parameter types...
            for (int i = 0; i < operationParameters.size(); i++) {
                EmsParameter operationParameter = operationParameters.get(i);
                if (!operationParameter.getType().equals(parameterTypeNames[i]))
                    // One of the params doesn't match - move on...
                    continue operationsLoop;
            }
            // If we made it here, we have a match.
            return operation;
View Full Code Here


            if (operationParameters.size() != parameterTypes.length || !operation.getName().equals(name))
                // Different name or number of params than what we are looking for - move on...
                continue;
            // At this point, name and number of params match. Now compare the parameter types...
            for (int i = 0; i < operationParameters.size(); i++) {
                EmsParameter operationParameter = operationParameters.get(i);
                if (!operationParameter.getType().equals(parameterTypes[i].getName()))
                    // One of the params doesn't match - move on...
                    continue operationsLoop;
            }
            // If we made it here, we have a match.
            return operation;
View Full Code Here

        }

        List<EmsParameter> emsParams = operation.getParameters();
        Map<String, Integer> emsParamIndexesByName = new HashMap<String, Integer>();
        for (int i = 0, emsParamsSize = emsParams.size(); i < emsParamsSize; i++) {
            EmsParameter emsParam = emsParams.get(i);
            if (emsParam.getName() != null) {
                emsParamIndexesByName.put(emsParam.getName(), i);
            }
        }

        Object[] paramValues = new Object[operation.getParameters().size()];

        for (String propName : paramProps.keySet()) {
            Integer paramIndex;
            if (propName.matches("\\[\\d+\\]")) {
                paramIndex = Integer.valueOf(propName.substring(propName.indexOf('[') + 1, propName.indexOf(']')));
                if (paramIndex < 0 || paramIndex >= emsParams.size()) {
                    throw new IllegalStateException("Index [" + paramIndex + "] specified for parameter of operation ["
                        + name + "] on MBean [" + emsBean.getBeanName() + "] is invalid. The MBean operation takes "
                        + emsParams.size() + " parameters.");
                }
            } else {
                paramIndex = emsParamIndexesByName.get(propName);
                if (paramIndex == null) {
                    throw new IllegalStateException("Name [" + propName + "] specified for parameter of operation ["
                        + name + "] on MBean [" + emsBean.getBeanName()
                        + "] is invalid. The MBean operation does not take a parameter by that name.");
                }
            }
            EmsParameter emsParam = emsParams.get(paramIndex);

            PropertySimple paramProp = paramProps.get(propName);
            String emsParamType = emsParam.getType();
            Object paramValue = getPropertyValueAsType(paramProp, emsParamType);
            paramValues[paramIndex] = paramValue;
        }

        Object resultObject = operation.invoke(paramValues);
View Full Code Here

TOP

Related Classes of org.mc4j.ems.connection.bean.parameter.EmsParameter

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.