Example usage for org.apache.commons.collections MapUtils getString

List of usage examples for org.apache.commons.collections MapUtils getString

Introduction

In this page you can find the example usage for org.apache.commons.collections MapUtils getString.

Prototype

public static String getString(Map map, Object key, String defaultValue) 

Source Link

Document

Looks up the given key in the given map, converting the result into a string, using the default value if the the conversion fails.

Usage

From source file:org.eclipse.jubula.client.core.model.TestResult.java

/**
 * {@inheritDoc}
 */
public String getAutArguments() {
    return MapUtils.getString(getAutConfigMap(), AutConfigConstants.AUT_ARGUMENTS, StringConstants.EMPTY);
}

From source file:org.eclipse.jubula.client.core.model.TestResult.java

/**
 * {@inheritDoc}
 */
public String getAutConfigName() {
    return MapUtils.getString(getAutConfigMap(), AutConfigConstants.CONFIG_NAME, TestresultSummaryBP.AUTRUN);
}

From source file:org.eclipse.jubula.client.core.model.TestResult.java

/**
 * {@inheritDoc}
 */
public String getAutId() {
    return MapUtils.getString(getAutConfigMap(), AutConfigConstants.AUT_ID, TestresultSummaryBP.AUTRUN);
}

From source file:org.mule.transport.rmi.RmiConnector.java

/**
 * Helper method for Dispatchers and Receives to extract the correct method from
 * a Remote object/*w w w.  ja  v  a2s .  c o m*/
 *
 * @param remoteObject The remote object on which to invoke the method
 * @param event The current event being processed
 * @throws org.mule.api.MuleException
 * @throws NoSuchMethodException
 * @throws ClassNotFoundException
 */
public Method getMethodObject(Remote remoteObject, MuleEvent event, OutboundEndpoint outboundEndpoint)
        throws MuleException, NoSuchMethodException, ClassNotFoundException {
    EndpointURI endpointUri = outboundEndpoint.getEndpointURI();
    String methodName = MapUtils.getString(endpointUri.getParams(), MuleProperties.MULE_METHOD_PROPERTY, null);

    if (null == methodName) {
        methodName = (String) event.getMessage().removeProperty(MuleProperties.MULE_METHOD_PROPERTY,
                PropertyScope.INVOCATION);

        if (null == methodName) {
            throw new MessagingException(RmiMessages.messageParamServiceMethodNotSet(), event);
        }
    }

    Class[] argTypes = getArgTypes(
            event.getMessage().getInvocationProperty(RmiConnector.PROPERTY_SERVICE_METHOD_PARAM_TYPES), event);

    try {
        return remoteObject.getClass().getMethod(methodName, argTypes);
    } catch (NoSuchMethodException e) {
        throw new NoSuchMethodException(CoreMessages.methodWithParamsNotFoundOnObject(methodName,
                ArrayUtils.toString(argTypes), remoteObject.getClass()).toString());
    } catch (SecurityException e) {
        throw e;
    }
}

From source file:org.mule.transport.rmi.RmiMessageReceiver.java

@SuppressWarnings("unchecked")
@Override/*from www  . j a  v  a  2  s  .co  m*/
protected void doConnect() throws Exception {
    System.setProperty("java.security.policy", connector.getSecurityPolicy());

    // Set security manager
    if (System.getSecurityManager() == null) {
        System.setSecurityManager(new RMISecurityManager());
    }

    // Get methodName
    String methodName = MapUtils.getString(endpoint.getEndpointURI().getParams(),
            MuleProperties.MULE_METHOD_PROPERTY, null);
    if (null == methodName) {
        methodName = (String) endpoint.getProperty(MuleProperties.MULE_METHOD_PROPERTY);

        if (null == methodName) {
            throw new ConnectException(RmiMessages.messageParamServiceMethodNotSet(), this);
        }
    }

    // Get remoteObject
    remoteObject = connector.getRemoteObject(getEndpoint());

    // Set methodArguments
    List<Object> args = (List<Object>) endpoint.getProperty(RmiConnector.PROPERTY_SERVICE_METHOD_PARAMS_LIST);
    Class[] argTypes = new Class[] {};
    if (args == null) {
        logger.info(RmiConnector.PROPERTY_SERVICE_METHOD_PARAMS_LIST
                + " not set on endpoint, assuming method call has no arguments");
        methodArguments = ClassUtils.NO_ARGS;
    } else {
        argTypes = connector.getArgTypes(endpoint.getProperty(RmiConnector.PROPERTY_SERVICE_METHOD_PARAM_TYPES),
                RequestContext.getEvent());
        methodArguments = new Object[args.size()];
        methodArguments = args.toArray(methodArguments);
    }

    // Set invokeMethod
    invokeMethod = remoteObject.getClass().getMethod(methodName, argTypes);
}