Example usage for java.util Map toString

List of usage examples for java.util Map toString

Introduction

In this page you can find the example usage for java.util Map toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.jasig.portlet.courses.dao.xml.HttpClientCoursesDaoImpl.java

protected TermsAndCourses getTermsAndCourses(CoursesCacheKey key, String url) {
    Map<String, String> params = key.getParams();

    if (log.isDebugEnabled()) {
        log.debug("Invoking uri '" + url + "' with the following parameters:  " + params.toString());
    }//w  w w  .  ja  v  a2s  .c om

    HttpEntity<?> requestEntity = getRequestEntity(key);
    HttpEntity<TermsAndCourses> response = restTemplate.exchange(url, HttpMethod.GET, requestEntity,
            TermsAndCourses.class, params);

    final TermsAndCourses termsAndCourses = response.getBody();
    return termsAndCourses;
}

From source file:org.eclipse.swordfish.core.configuration.ManagedServiceAdapter.java

public void updated(Dictionary properties) throws ConfigurationException {
    Assert.notNull(delegate, "The ConfigurationConsumer delegate must be supplied");
    if (properties == null) {
        delegate.onReceiveConfiguration(null);
        return;//from   w ww .j  a  v a 2  s.c om
    }
    Map configuration = new HashMap();
    Enumeration e = properties.keys();
    while (e.hasMoreElements()) {
        Object key = e.nextElement();
        configuration.put(key, properties.get(key));
    }
    LOG.info(String.format("Received configuration [%s] for the configurationConsumer with id = [%s] ",
            configuration.toString(), delegate.getId()));

    delegate.onReceiveConfiguration(configuration);

}

From source file:de.ub0r.android.websms.connector.sipgate.ConnectorSipgate.java

/**
 * {@inheritDoc}//  ww  w .j  av  a2  s.  co  m
 */
@SuppressWarnings("unchecked")
@Override
protected final void doUpdate(final Context context, final Intent intent) {
    Log.d(TAG, "doUpdate()");
    Map<String, Object> back = null;
    try {
        XMLRPCClient client = this.init(context);
        back = (Map<String, Object>) client.call("samurai.BalanceGet");
        Log.d(TAG, back.toString());
        if (back.get("StatusCode").equals(new Integer(HttpStatus.SC_OK))) {
            final String b = String.format("%.2f \u20AC",
                    ((Double) ((Map<String, Object>) back.get("CurrentBalance")).get("TotalIncludingVat")));
            this.getSpec(context).setBalance(b);
        }
    } catch (XMLRPCFault e) {
        Log.e(TAG, null, e);
        if (e.getFaultCode() == HttpStatus.SC_UNAUTHORIZED) {
            throw new WebSMSException(context, R.string.error_pw);
        }
        throw new WebSMSException(e);
    } catch (XMLRPCException e) {
        Log.e(TAG, null, e);
        throw new WebSMSException(e);
    }
}

From source file:org.jasig.portlet.degreeprogress.dao.xml.HttpDegreeProgressDaoImpl.java

@Override
public DegreeProgressReport getProgressReport(PortletRequest request) {
    Map<String, String> params = createParameters(request, urlParams);
    if (log.isDebugEnabled()) {
        log.debug("Invoking uri '" + degreeProgressUrlFormat + "' with the following parameters:  "
                + params.toString());
    }/*from   w ww  .ja  v a  2s . c om*/

    HttpEntity<?> requestEntity = getRequestEntity(request);
    HttpEntity<DegreeProgressReport> response = restTemplate.exchange(degreeProgressUrlFormat, HttpMethod.GET,
            requestEntity, DegreeProgressReport.class, params);

    DegreeProgressReport report = response.getBody();
    for (DegreeRequirementSection section : report.getDegreeRequirementSections()) {
        for (JAXBElement<? extends GeneralRequirementType> requirement : section.getGeneralRequirements()) {
            GeneralRequirementType req = requirement.getValue();
            if (req instanceof GpaRequirement) {
                section.setRequiredGpa(((GpaRequirement) req).getRequiredGpa());
            }
        }
        for (CourseRequirement req : section.getCourseRequirements()) {
            for (Course course : req.getCourses()) {
                StudentCourseRegistration registration = new StudentCourseRegistration();
                registration.setCredits(course.getCredits());
                registration.setSource(course.getSource());
                registration.setSemester(course.getSemester());
                registration.setCourse(course);
                Grade grade = new Grade();
                grade.setCode(course.getGrade().getCode());
                registration.setGrade(grade);
                req.getRegistrations().add(registration);
            }
        }
        report.addSection(section);
    }
    return report;
}

From source file:org.activiti.spring.components.aop.ProcessStartingMethodInterceptor.java

public Object invoke(MethodInvocation invocation) throws Throwable {

    Method method = invocation.getMethod();

    StartProcess startProcess = AnnotationUtils.getAnnotation(method, StartProcess.class);

    String processKey = startProcess.processKey();

    Assert.hasText(processKey, "you must provide the name of process to start");

    Object result;/*from   w w w  .  j av  a  2s .c  om*/
    try {
        result = invocation.proceed();
        Map<String, Object> vars = this.processVariablesFromAnnotations(invocation);

        String businessKey = this.processBusinessKey(invocation);

        log.info("variables for the started process: {}", vars.toString());

        RuntimeService runtimeService = this.processEngine.getRuntimeService();
        ProcessInstance pi;
        if (null != businessKey && StringUtils.hasText(businessKey)) {
            pi = runtimeService.startProcessInstanceByKey(processKey, businessKey, vars);
            log.info("the business key for the started process is '{}'", businessKey);
        } else {
            pi = runtimeService.startProcessInstanceByKey(processKey, vars);
        }

        String pId = pi.getId();

        if (invocation.getMethod().getReturnType().equals(void.class))
            return null;

        if (shouldReturnProcessInstance(startProcess, invocation, result))
            return pi;

        if (shouldReturnProcessInstanceId(startProcess, invocation, result))
            return pId;

        if (shouldReturnAsyncResultWithProcessInstance(startProcess, invocation, result)) {
            return new AsyncResult<ProcessInstance>(pi);
        }

    } catch (Throwable th) {
        throw new RuntimeException(th);
    }
    return result;
}

From source file:com.primitive.applicationmanager.BaseApplicationManager.java

/**
 * ??????/*from  www  .j  a v  a 2 s. com*/
 * @param argUrl
 * @param argParams
 * @return JSONObject
 * @throws ApplicationManagerException
 */
protected JSONObject requestToResponse(final String argUrl, Map<String, String> argParams)
        throws ApplicationManagerException {
    Logger.start();
    Logger.debug("argUrl:" + argUrl);
    if (argParams == null) {
        argParams = new HashMap<String, String>();
    }
    Logger.debug("argParams:" + argParams.toString());
    argParams.put("device", "android");
    if (BuildConfig.DEBUG) {
        argParams.put("mode", "debug");
    }
    argParams.put("protocolVersion", config.protocolVersion.version);

    final HttpClient httpClient = this.createHttpClient();
    String res = null;
    try {
        final HttpPost httpost = new HttpPost(argUrl);
        final JSONObject holder = BaseApplicationManager.getJsonObjectFromMap(argParams);
        final StringEntity se = new StringEntity(holder.toString());

        httpost.setEntity(se);
        httpost.setHeader("Accept", "application/json");
        httpost.setHeader("Content-type", "application/json");
        final BasicResponseHandler responseHandler = new BasicResponseHandler();
        res = httpClient.execute(httpost, responseHandler);
        Logger.debug(res);

        final JSONObject json = new JSONObject(res);
        return json;
    } catch (final Throwable ex) {
        Logger.err(ex);
        throw new ApplicationManagerException(ex);
    }

}

From source file:com.oneops.transistor.util.CloudUtil.java

private String getErrorMessage(Map<String, TreeSet<String>> cloudsMissingServices, String nsPath) {
    return String.format(
            "All services <%s> required for platform (%s) are not configured for clouds. Please contact your org. admin.",
            cloudsMissingServices.toString(), getNSWithoutManifest(nsPath));
}

From source file:name.richardson.james.maven.plugins.uploader.UploadMojo.java

private String getGameVersion() throws MojoExecutionException {
    final Map<String, String> remoteVersions = this.getRemoteBukkitVersions();
    final String localVersion = this.getLocalBukkitVersion();
    this.getLog().debug(remoteVersions.toString());
    final String gameVersion = remoteVersions.get("CB " + localVersion);
    if (gameVersion == null) {
        throw new MojoExecutionException("Unable to determine game version!");
    }//from  w  ww  .j av a 2 s. c  o  m
    this.getLog().debug("Internal game version id: " + gameVersion);
    return gameVersion;
}

From source file:org.codice.ddf.catalog.ui.forms.model.FilterNodeMapImpl.java

public FilterNodeMapImpl(final Map<String, Object> json) {
    notNull(json);/* ww  w . jav a2 s .  c o  m*/
    this.type = (String) json.get("type");

    notNull(type);
    this.json = json;

    if (!(isValidLogical(json) || isValidTerminal(json))) {
        throw new IllegalArgumentException("Filter node properties are invalid: " + json.toString());
    }
}

From source file:com.espertech.esper.epl.db.DatabasePollingViewableFactory.java

private static QueryMetaData getPreparedStmtMetadata(Connection connection, String[] parameters,
        String preparedStatementText, ColumnSettings metadataSetting) throws ExprValidationException {
    PreparedStatement prepared;//  w w  w .ja  v a 2s  .co  m
    try {
        if (log.isInfoEnabled()) {
            log.info(".getPreparedStmtMetadata Preparing statement '" + preparedStatementText + "'");
        }
        prepared = connection.prepareStatement(preparedStatementText);
    } catch (SQLException ex) {
        String text = "Error preparing statement '" + preparedStatementText + '\'';
        log.error(text, ex);
        throw new ExprValidationException(text + ", reason: " + ex.getMessage());
    }

    // Interrogate prepared statement - parameters and result
    List<String> inputParameters = new LinkedList<String>();
    try {
        ParameterMetaData parameterMetaData = prepared.getParameterMetaData();
        inputParameters.addAll(Arrays.asList(parameters).subList(0, parameterMetaData.getParameterCount()));
    } catch (Exception ex) {
        try {
            prepared.close();
        } catch (SQLException e) {
            // don't handle
        }
        String text = "Error obtaining parameter metadata from prepared statement, consider turning off metadata interrogation via configuration, for statement '"
                + preparedStatementText + '\'';
        log.error(text, ex);
        throw new ExprValidationException(text + ", please check the statement, reason: " + ex.getMessage());
    }

    Map<String, DBOutputTypeDesc> outputProperties;
    try {
        outputProperties = compileResultMetaData(prepared.getMetaData(), metadataSetting);
    } catch (SQLException ex) {
        try {
            prepared.close();
        } catch (SQLException e) {
            // don't handle
        }
        String text = "Error in statement '" + preparedStatementText
                + "', failed to obtain result metadata, consider turning off metadata interrogation via configuration";
        log.error(text, ex);
        throw new ExprValidationException(text + ", please check the statement, reason: " + ex.getMessage());
    }

    if (log.isDebugEnabled()) {
        log.debug(".createDBEventStream in=" + inputParameters.toString() + " out="
                + outputProperties.toString());
    }

    // Close statement
    try {
        prepared.close();
    } catch (SQLException e) {
        String text = "Error closing prepared statement";
        log.error(text, e);
        throw new ExprValidationException(text + ", reason: " + e.getMessage());
    }

    return new QueryMetaData(inputParameters, outputProperties);
}