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:com.ephesoft.dcma.batch.status.StatusConveyor.java

/**
 * Notifies any service event to fired on current server but needs to be handled by the server under which the service is
 * registered. It hits the particular server with the details required and registered server handles it respectively.
 * //  w w  w  .  j av a 2 s. c  o m
 * @param paramMap {@link Map<String, String>} details to be send to the server.
 * @param serviceType {@link ServiceType} type of service.
 */
public void notifyServiceEvent(final Map<String, String> paramMap, final ServiceType serviceType) {
    if (null != serviceType) {
        LOGGER.debug(EphesoftStringUtil.concatenate("Notifying server for service: ", serviceType.toString()));
        final String notifyWebServiceUrl = getNotifyWebServiceUrl(serviceType);
        if (null != notifyWebServiceUrl && !notifyWebServiceUrl.isEmpty()) {
            final HttpClient httpClient = new HttpClient();
            final PostMethod postMethod = new PostMethod(notifyWebServiceUrl);
            Part[] partArray = null;
            int index = 0;

            // If the details are to be send to web service
            if (null == paramMap || paramMap.isEmpty()) {
                partArray = new Part[1];
            } else {
                LOGGER.debug(EphesoftStringUtil.concatenate("Parameter passed are: ", paramMap.toString()));
                partArray = new Part[(paramMap.size() + 1)];
                final Iterator<String> keyIterator = paramMap.keySet().iterator();
                String key = null;
                while (keyIterator.hasNext()) {
                    key = keyIterator.next();
                    partArray[index] = new StringPart(key, paramMap.get(key));
                    index++;
                }
            }

            // Type of service which is a required parameter to be send
            partArray[index] = new StringPart(ICommonConstants.SERVICE_TYPE_PARAMETER,
                    String.valueOf(serviceType.getServiceType()));
            MultipartRequestEntity entity = new MultipartRequestEntity(partArray, postMethod.getParams());
            postMethod.setRequestEntity(entity);
            try {
                int statusCode = httpClient.executeMethod(postMethod);

                if (statusCode == STATUS_OK) {
                    LOGGER.debug(EphesoftStringUtil.concatenate(
                            "Server was notified successfully for service: ", serviceType.toString()));
                } else {
                    LOGGER.error(
                            EphesoftStringUtil.concatenate("Server was not able to be notified for service: ",
                                    serviceType.toString(), " and status code: ", statusCode));
                }
            } catch (HttpException httpException) {
                LOGGER.error(
                        EphesoftStringUtil.concatenate("Could not connect to server for notifying service: ",
                                serviceType.toString(), ICommonConstants.SPACE, httpException.getMessage()));
            } catch (IOException ioException) {
                LOGGER.error(
                        EphesoftStringUtil.concatenate("Could not connect to server for notifying service: ",
                                serviceType.toString(), ICommonConstants.SPACE, ioException.getMessage()));
            }
        }
    }
}

From source file:org.onehippo.repository.scxml.SCXMLWorkflowExecutor.java

/**
 * Invokes {@link SCXMLExecutor#triggerEvent(TriggerEvent)} with a {@link TriggerEvent#SIGNAL_EVENT}, the provided
 * action as event name and payload as event payload
 * <p>//from  w ww  .  ja v a2  s  . co m
 * The action will first be validated against the provided custom actions map which must
 * have this action defined with value Boolean.TRUE, otherwise a WorkflowException is thrown before even invoking
 * the state machine.
 * </p>
 * @return {@link SCXMLWorkflowContext#getResult()} if there's no exception.
 */
public Object triggerAction(String action, Map<String, Boolean> actionsMap, Map<String, Object> payload)
        throws WorkflowException {
    if (!started) {
        throw new WorkflowException("Workflow " + scxmlId + " not started");
    }
    if (terminated) {
        throw new WorkflowException("Workflow " + scxmlId + " already terminated");
    }
    try {
        Boolean allowed = actionsMap.get(action);
        if (allowed == null || !allowed) {
            throw new WorkflowException("Cannot invoke workflow " + scxmlId + " action " + action
                    + ": action not allowed or undefined");
        }
        TriggerEvent event = new TriggerEvent(action, TriggerEvent.SIGNAL_EVENT, payload);
        if (payload == null) {
            log.debug("Invoking workflow {} action {}", scxmlId, action);
        } else {
            log.debug("Invoking workflow {} action {} with payload {}", scxmlId, action, payload.toString());
        }
        // reset result
        context.setResult(null);
        executor.triggerEvent(event);
        if (executor.getCurrentStatus().isFinal()) {
            terminated = true;
        }
    } catch (Exception e) {
        handleException(e);
    }
    // only reached when no exception
    return context.getResult();
}

From source file:com.almende.eve.agent.Agent.java

@Override
@Access(AccessType.PUBLIC)/*from   w w w .j ava  2s  .co  m*/
public String toString() {
    final Map<String, Object> data = new HashMap<String, Object>();
    data.put("class", this.getClass().getName());
    data.put("id", getId());
    return data.toString();
}

From source file:com.osafe.services.sagepay.SagePayTokenServices.java

private static Map<String, String> buildSagePayProperties(Map<String, Object> context, Delegator delegator) {

    Map<String, String> sagePayConfig = new HashMap<String, String>();

    String paymentGatewayConfigId = (String) context.get("paymentGatewayConfigId");

    if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) {
        try {/*from  w  ww  .  ja va 2 s . co m*/
            GenericValue sagePay = delegator.findOne("PaymentGatewaySagePayToken",
                    UtilMisc.toMap("paymentGatewayConfigId", paymentGatewayConfigId), true);
            if (UtilValidate.isNotEmpty(sagePay)) {
                Map<String, Object> tmp = sagePay.getAllFields();
                Set<String> keys = tmp.keySet();
                for (String key : keys) {
                    Object keyValue = tmp.get(key);
                    String value = "";
                    if (UtilValidate.isNotEmpty(keyValue)) {
                        value = keyValue.toString();
                    }
                    sagePayConfig.put(key, value);
                }
            }
        } catch (GenericEntityException e) {
            Debug.logError(e, module);
        }
    }

    Debug.logInfo("SagePay Token Configuration : " + sagePayConfig.toString(), module);
    return sagePayConfig;
}

From source file:com.microsoftopentechnologies.azchat.web.services.LoginService.java

/**
 * This method populates the userBean from samlToken.
 * /*from   w  w  w  .j a  va 2  s . c  om*/
 * @param samplToken
 * @throws AzureChatSystemException
 */
private void populateSAMLTokenDetailsToUserBean(UserBean userBean) throws AzureChatSystemException {
    String samlToken = userBean.getSamplToken();
    LOGGER.debug("saml token : " + samlToken);
    XPath xPath = XPathFactory.newInstance().newXPath();
    try {
        Document assertionDoc = AzureChatUtils.getDocument(samlToken);
        String nameID = AzureChatUtils.getNameIDFromAssertion(xPath, assertionDoc);
        LOGGER.debug("   Name ID : " + nameID);
        userBean.setNameID(nameID);
        Map<String, String> claimMap = AzureChatUtils.getUserAttributeDetails(xPath, assertionDoc);
        if (claimMap != null && !claimMap.isEmpty()) {
            userBean.setIdProvider(claimMap.get(AzureChatConstants.ATTR_IDENTITY_PROVIDER));
            userBean.setEmail(claimMap.get(AzureChatConstants.ATTR_EMAIL_ADDRESS));
            if (claimMap.get(AzureChatConstants.ATTR_NAME) != null) {
                String[] userNameTokens = claimMap.get(AzureChatConstants.ATTR_NAME).split("\\s");
                if (userNameTokens != null) {
                    if (userNameTokens.length >= 2) {
                        userBean.setFirstName(userNameTokens[0]);
                        userBean.setLastName(userNameTokens[1]);
                    } else {
                        userBean.setFirstName(userNameTokens[0]);
                    }
                }

            }

        }
        LOGGER.debug("Claim Map : " + claimMap.toString());
    } catch (Exception e) {
        LOGGER.error("Exception occurred while parsing saml token : " + e.getMessage());
        throw new AzureChatSystemException("Exception occurred while parsing saml token : " + e.getMessage());
    }

}

From source file:org.ofbiz.webapp.event.RestEventHandler.java

/**
* @see org.ofbiz.webapp.event.EventHandler#invoke(ConfigXMLReader.Event, ConfigXMLReader.RequestMap, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*///from w w w .  j  ava 2  s  . c o m
public String invoke(Event event, RequestMap requestMap, HttpServletRequest request,
        HttpServletResponse response) throws EventHandlerException {
    LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
    Delegator delegator = (GenericDelegator) request.getAttribute("delegator");
    DispatchContext dctx = dispatcher.getDispatchContext();

    HttpSession session = request.getSession();

    Map<String, Object> serviceContext = FastMap.newInstance();

    Map<String, Object> parameterMap = null;
    List uploadedFileList = new ArrayList();
    String method = request.getMethod();
    if ("POST".equals(method) || "PUT".equals(method)) {
        // get the service name and parameters
        BufferedReader reader = null;
        StringBuilder buf = new StringBuilder();
        boolean isMultiPart = ServletFileUpload.isMultipartContent(request);
        try {
            Map<String, Object> multiPartMap = new HashMap<String, Object>();
            if (isMultiPart) {
                // get the http upload configuration
                String maxSizeStr = EntityUtilProperties.getPropertyValue("general.properties",
                        "http.upload.max.size", "-1", dctx.getDelegator());
                long maxUploadSize = -1;
                try {
                    maxUploadSize = Long.parseLong(maxSizeStr);
                } catch (NumberFormatException e) {
                    Debug.logError(e,
                            "Unable to obtain the max upload size from general.properties; using default -1",
                            module);
                    maxUploadSize = -1;
                }
                // get the http size threshold configuration - files bigger than this will be
                // temporarly stored on disk during upload
                String sizeThresholdStr = EntityUtilProperties.getPropertyValue("general.properties",
                        "http.upload.max.sizethreshold", "10240", dctx.getDelegator());
                int sizeThreshold = 10240; // 10K
                try {
                    sizeThreshold = Integer.parseInt(sizeThresholdStr);
                } catch (NumberFormatException e) {
                    Debug.logError(e,
                            "Unable to obtain the threshold size from general.properties; using default 10K",
                            module);
                    sizeThreshold = -1;
                }
                // directory used to temporarily store files that are larger than the configured size threshold
                String tmpUploadRepository = EntityUtilProperties.getPropertyValue("general.properties",
                        "http.upload.tmprepository", "runtime/tmp", dctx.getDelegator());
                String encoding = request.getCharacterEncoding();
                // check for multipart content types which may have uploaded items

                ServletFileUpload upload = new ServletFileUpload(
                        new DiskFileItemFactory(sizeThreshold, new File(tmpUploadRepository)));

                // create the progress listener and add it to the session
                FileUploadProgressListener listener = new FileUploadProgressListener();
                upload.setProgressListener(listener);
                session.setAttribute("uploadProgressListener", listener);

                if (encoding != null) {
                    upload.setHeaderEncoding(encoding);
                }
                upload.setSizeMax(maxUploadSize);

                List<FileItem> uploadedItems = null;
                try {
                    uploadedItems = UtilGenerics.<FileItem>checkList(upload.parseRequest(request));
                } catch (FileUploadException e) {
                    throw new EventHandlerException("Problems reading uploaded data", e);
                }
                if (uploadedItems != null) {
                    for (FileItem item : uploadedItems) {
                        String fieldName = item.getFieldName();
                        if (item.isFormField() || item.getName() == null) {
                            if (multiPartMap.containsKey(fieldName)) {
                                Object mapValue = multiPartMap.get(fieldName);
                                if (mapValue instanceof List<?>) {
                                    checkList(mapValue, Object.class).add(item.getString());
                                } else if (mapValue instanceof String) {
                                    List<String> newList = new LinkedList<String>();
                                    newList.add((String) mapValue);
                                    newList.add(item.getString());
                                    multiPartMap.put(fieldName, newList);
                                } else {
                                    Debug.logWarning(
                                            "Form field found [" + fieldName + "] which was not handled!",
                                            module);
                                }
                            } else {
                                if (encoding != null) {
                                    try {
                                        multiPartMap.put(fieldName, item.getString(encoding));
                                    } catch (java.io.UnsupportedEncodingException uee) {
                                        Debug.logError(uee, "Unsupported Encoding, using deafault", module);
                                        multiPartMap.put(fieldName, item.getString());
                                    }
                                } else {
                                    multiPartMap.put(fieldName, item.getString());
                                }
                            }
                        } else {
                            Map<String, Object> uploadedMap = FastMap.newInstance();
                            String fileName = item.getName();
                            if (fileName.indexOf('\\') > -1 || fileName.indexOf('/') > -1) {
                                // get just the file name IE and other browsers also pass in the local path
                                int lastIndex = fileName.lastIndexOf('\\');
                                if (lastIndex == -1) {
                                    lastIndex = fileName.lastIndexOf('/');
                                }
                                if (lastIndex > -1) {
                                    fileName = fileName.substring(lastIndex + 1);
                                }
                            }
                            uploadedMap.put("uploadedFile", ByteBuffer.wrap(item.get()));
                            uploadedMap.put("_uploadedFile_size", Long.valueOf(item.getSize()));
                            uploadedMap.put("_uploadedFile_fileName", fileName);
                            uploadedMap.put("_uploadedFile_contentType", item.getContentType());
                            uploadedFileList.add(uploadedMap);
                        }
                    }
                }
                request.setAttribute("multiPartMap", multiPartMap);
                Map<String, Object> rawParametersMap = UtilHttp.getParameterMap(request, null, null);
                Set<String> urlOnlyParameterNames = UtilHttp.getUrlOnlyParameterMap(request).keySet();
                Map<String, Object> requestBodyMap = null;
                try {
                    requestBodyMap = RequestBodyMapHandlerFactory.extractMapFromRequestBody(request);
                } catch (IOException ioe) {
                    Debug.logWarning(ioe, module);
                }
                if (requestBodyMap != null) {
                    rawParametersMap.putAll(requestBodyMap);
                }

            } else {
                //                      parameterMap = requestByMap(request, response);
                // read the inputstream buffer
                String line;
                //                      reader = new BufferedReader(new InputStreamReader(request.getInputStream(),"UTF-8"));  
                reader = new BufferedReader(new InputStreamReader(request.getInputStream()));
                while ((line = reader.readLine()) != null) {
                    buf.append(line).append("\n");
                }
            }

        } catch (Exception e) {
            throw new EventHandlerException(e.getMessage(), e);
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e) {
                    throw new EventHandlerException(e.getMessage(), e);
                }
            }
        }
        Debug.logInfo("json: " + buf.toString(), module);
        Map<String, Object> rawParametersMap = UtilHttp.getParameterMap(request, null, null);
        serviceContext.putAll(rawParametersMap);
        if (UtilValidate.isNotEmpty(rawParametersMap)) {
            serviceContext.putAll(rawParametersMap);
        } else if (buf.toString().length() > 0) {
            JSONObject json = JSONObject.fromObject(buf.toString());
            serviceContext.putAll(json);
        }
    }
    if ("GET".equals(method) || "DELETE".equals(method)) {
        Map<String, Object> rawParametersMap = UtilHttp.getParameterMap(request, null, null);
        serviceContext.putAll(rawParametersMap);

    }

    String serviceName = getOverrideViewUri(request.getPathInfo());
    String restIdValue = "";
    List<String> pathItemList = StringUtil.split(serviceName, "/");
    if (pathItemList.size() > 1) {
        serviceName = pathItemList.get(0);
        restIdValue = pathItemList.get(1);
    }
    Debug.log("serviceName:\n" + serviceName + "\n", module);
    GenericValue userLogin = null;

    try {
        ModelService model = dctx.getModelService(serviceName);

        if (model == null) {
            sendError(response, "Problem processing the service", serviceName);
            Debug.logError("Could not find Service [" + serviceName + "].", module);
            return null;
        }

        //                 if (!model.export) {
        //                     sendError(response, "Problem processing the service", serviceName);
        //                     Debug.logError("Trying to call Service [" + serviceName + "] that is not exported.", module);
        //                     return null;
        //                 }

        if (model.auth) {
            String username = request.getHeader("USERNAME");
            String password = request.getHeader("PASSWORD");
            if (UtilValidate.isNotEmpty(username) && UtilValidate.isNotEmpty(password)) {
                serviceContext.remove("USERNAME");
                serviceContext.remove("PASSWORD");
            } else {
                username = request.getParameter("USERNAME");
                password = request.getParameter("PASSWORD");
            }

            //                   GenericValue yuemeiUser = delegator.findOne("YuemeiUser", UtilMisc.toMap("userLoginId", username), true);
            //                   if(UtilValidate.isNotEmpty(yuemeiUser)){
            //                     String tenantId = yuemeiUser.getString("tenantId");
            //                     if(UtilValidate.isNotEmpty(tenantId)){
            //                         delegator = DelegatorFactory.getDelegator(delegator.getDelegatorBaseName() + "#" + tenantId);
            //                         dispatcher = GenericDispatcher.getLocalDispatcher(dispatcher.getName(), delegator);
            //                     }
            //                   }

            Map<String, Object> loginResult = dispatcher.runSync("userLogin",
                    UtilMisc.toMap("login.username", username, "login.password", password));//, "locale", Locale.CHINESE
            Debug.log(loginResult.toString(), module);
            if (ServiceUtil.isSuccess(loginResult)) {
                userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", username), false);
            }
            if (UtilValidate.isEmpty(userLogin)) {
                sendError(response, "Problem processing the service, check your USERNAME and PASSWORD.",
                        "serviceName");
            }
        }

        Locale locale = UtilHttp.getLocale(request);
        TimeZone timeZone = UtilHttp.getTimeZone(request);
        // get only the parameters for this service - converted to proper type
        // TODO: pass in a list for error messages, like could not convert type or not a proper X, return immediately with messages if there are any
        List<Object> errorMessages = FastList.newInstance();
        //              serviceContext = model.makeValid(serviceContext, ModelService.IN_PARAM, true, errorMessages, timeZone, locale);
        if (errorMessages.size() > 0) {

            sendError(response, "Problem processing the serviceContext Valid," + errorMessages, serviceName);
        }

        // include the UserLogin value object
        if (userLogin != null) {
            serviceContext.put("userLogin", userLogin);
        }

        // include the Locale object
        if (locale != null) {
            serviceContext.put("locale", locale);
        }

        // include the TimeZone object
        if (timeZone != null) {
            serviceContext.put("timeZone", timeZone);
        }
        if (UtilValidate.isNotEmpty(model.defaultEntityName)) {
            ModelEntity modelEntity = delegator.getModelEntity(model.defaultEntityName);
            if (UtilValidate.isNotEmpty(restIdValue) && modelEntity.getPksSize() == 1) {
                String pkFieldName = modelEntity.getPkFieldNames().get(0);
                serviceContext.put(pkFieldName, restIdValue);
            }
        }
    } catch (GenericServiceException e) {
        Debug.logError(e.getMessage(), module);
        sendError(response, "Problem processing the service, check ." + e.getMessage(), serviceName);
    } catch (GenericEntityException e) {
        Debug.logError(e.getMessage(), module);
        sendError(response, "Problem processing the service, check your ." + e.getMessage(), serviceName);
    }

    //response.setContentType("text/xml");
    response.setContentType("application/json");

    Debug.logVerbose("[Processing]: REST Event", module);

    try {
        if (UtilValidate.isNotEmpty(uploadedFileList))
            serviceContext.put("uploadedFileList", uploadedFileList);
        if (UtilValidate.isNotEmpty(serviceName) && !"updateOutsideExperts".equals(serviceName)
                && !"saveTgAndItemAndDse".equals(serviceName) && !"getMyFriends".equals(serviceName)) {
            serviceContext.remove("json");
        }
        Map<String, Object> serviceResults = dispatcher.runSync(serviceName, serviceContext);
        Debug.logVerbose("[EventHandler] : Service invoked", module);
        createAndSendRESTResponse(serviceResults, serviceName, response);
    } catch (GenericServiceException e) {

        if (e.getMessageList() == null) {
            sendError(response, e.getMessage(), serviceName);
        } else {
            sendError(response, e.getMessageList(), serviceName);
        }
        Debug.logError(e, module);
        return null;

    }

    return null;
}

From source file:com.urgoo.message.activities.MainActivity.java

/**
 * ?ID/*from   w  w w  .j  a v a  2  s  . co  m*/
 */
private void getUserIDs() {
    personUnionID = "";
    Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            Map responseMap = (Map) msg.obj;
            if (responseMap.get("returnCode").equals("000000")) {
                openID = responseMap.get("openID").toString();
                if (responseMap.get("personUnionID") != null) {
                    personUnionID = responseMap.get("personUnionID").toString();
                    android.util.Log.e("personUnionID:", personUnionID);
                }
                orderPay();
            }
            android.util.Log.e("responseMap:", responseMap.toString());
            android.util.Log.e("openID:", openID);
        }
    };

    HRSDK.Users.getUserIDs("1616646", handler);
}

From source file:com.moz.fiji.mapreduce.framework.JobHistoryFijiTable.java

/**
 * Writes details of a job into the JobHistoryFijiTable.
 *
 * @param jobId unique identifier for the job.
 * @param jobName name of the job./* w  ww.  ja  v a  2 s .c  om*/
 * @param startTime time in milliseconds since the epoch at which the job started.
 * @param endTime time in milliseconds since the epoch at which the job ended.
 * @param jobSuccess whether the job completed successfully.
 * @param counters map of counters from the job. Keys should be of the form 'group:name'.
 * @param conf Configuration of the job.
 * @param extendedInfo any additional information which should be stored about the job.
 * @throws IOException in case of an error writing to the table.
 */
// CSOFF: ParameterNumberCheck
public void recordJob(final String jobId, final String jobName, final long startTime, final long endTime,
        final boolean jobSuccess, final Configuration conf, final Map<String, Long> counters,
        final Map<String, String> extendedInfo) throws IOException {
    // CSON: ParameterNumberCheck
    final EntityId eid = mFijiTable.getEntityId(jobId);
    final AtomicFijiPutter putter = mFijiTable.getWriterFactory().openAtomicPutter();
    try {
        putter.begin(eid);
        putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_ID_QUALIFIER, startTime, jobId);
        putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_NAME_QUALIFIER, startTime, jobName);
        putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_START_TIME_QUALIFIER, startTime, startTime);
        putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_END_TIME_QUALIFIER, startTime, endTime);
        putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_END_STATUS_QUALIFIER, startTime,
                (jobSuccess) ? SUCCEEDED : FAILED);
        putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_COUNTERS_QUALIFIER, startTime, counters.toString());
        if (null != conf) {
            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
            conf.writeXml(baos);
            putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_CONFIGURATION_QUALIFIER, startTime,
                    baos.toString("UTF-8"));
        } else {
            putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_CONFIGURATION_QUALIFIER, startTime,
                    JOB_HISTORY_NO_CONFIGURATION_VALUE);
        }
        writeCounters(putter, startTime, counters);
        writeExtendedInfo(putter, startTime, extendedInfo);
        putter.commit();
    } finally {
        putter.close();
    }
}

From source file:org.kiji.mapreduce.framework.JobHistoryKijiTable.java

/**
 * Writes details of a job into the JobHistoryKijiTable.
 *
 * @param jobId unique identifier for the job.
 * @param jobName name of the job./* ww  w  .ja  v a  2  s.c  o  m*/
 * @param startTime time in milliseconds since the epoch at which the job started.
 * @param endTime time in milliseconds since the epoch at which the job ended.
 * @param jobSuccess whether the job completed successfully.
 * @param counters map of counters from the job. Keys should be of the form 'group:name'.
 * @param conf Configuration of the job.
 * @param extendedInfo any additional information which should be stored about the job.
 * @throws IOException in case of an error writing to the table.
 */
// CSOFF: ParameterNumberCheck
public void recordJob(final String jobId, final String jobName, final long startTime, final long endTime,
        final boolean jobSuccess, final Configuration conf, final Map<String, Long> counters,
        final Map<String, String> extendedInfo) throws IOException {
    // CSON: ParameterNumberCheck
    final EntityId eid = mKijiTable.getEntityId(jobId);
    final AtomicKijiPutter putter = mKijiTable.getWriterFactory().openAtomicPutter();
    try {
        putter.begin(eid);
        putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_ID_QUALIFIER, startTime, jobId);
        putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_NAME_QUALIFIER, startTime, jobName);
        putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_START_TIME_QUALIFIER, startTime, startTime);
        putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_END_TIME_QUALIFIER, startTime, endTime);
        putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_END_STATUS_QUALIFIER, startTime,
                (jobSuccess) ? SUCCEEDED : FAILED);
        putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_COUNTERS_QUALIFIER, startTime, counters.toString());
        if (null != conf) {
            final ByteArrayOutputStream baos = new ByteArrayOutputStream();
            conf.writeXml(baos);
            putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_CONFIGURATION_QUALIFIER, startTime,
                    baos.toString("UTF-8"));
        } else {
            putter.put(JOB_HISTORY_FAMILY, JOB_HISTORY_CONFIGURATION_QUALIFIER, startTime,
                    JOB_HISTORY_NO_CONFIGURATION_VALUE);
        }
        writeCounters(putter, startTime, counters);
        writeExtendedInfo(putter, startTime, extendedInfo);
        putter.commit();
    } finally {
        putter.close();
    }
}

From source file:dk.itst.oiosaml.sp.configuration.ConfigurationHandler.java

protected Map<String, Object> getStandardParameters(HttpServletRequest request) {
    String base = getBaseUrl(request);
    //      base = "https://pdurbin.pagekite.me/oiosaml.java-demo-8501-debug/saml/configure"; // pdurbin
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("artifactResponseUrl", base + "/SAMLAssertionConsumer");
    params.put("postResponseUrl", base + "/SAMLAssertionConsumer");
    params.put("logoutUrl", base + "/SAMLAssertionConsumer");
    params.put("logoutResponseUrl", base + "/LogoutServiceHTTPRedirectResponse");
    params.put("logoutRequestUrl", base + "/LogoutServiceHTTPRedirect");
    params.put("logoutSoapRequestUrl", base + "/LogoutServiceSOAP");
    params.put("logoutPostRequestUrl", base + "/LogoutServiceHTTPPost");
    params.put("home", getHome(servletContext));
    params.put("entityId", getEntityId(request));
    log.info("params dump: " + params.toString());
    return params;
}