Example usage for java.util Arrays deepToString

List of usage examples for java.util Arrays deepToString

Introduction

In this page you can find the example usage for java.util Arrays deepToString.

Prototype

public static String deepToString(Object[] a) 

Source Link

Document

Returns a string representation of the "deep contents" of the specified array.

Usage

From source file:com.celements.web.plugin.CelementsWebPlugin.java

/**
 * /*from   ww w  .jav  a  2 s .  c  o  m*/
 * @param userToken
 * @param context
 * @return
 * @throws XWikiException
 * 
 * @deprecated since 2.14.0 use TokenLDAPAuthServiceImpl instead
 */
@Deprecated
public String getUsernameForToken(String userToken, XWikiContext context) throws XWikiException {

    String hashedCode = encryptString("hash:SHA-512:", userToken);
    String userDoc = "";

    if ((userToken != null) && (userToken.trim().length() > 0)) {

        String hql = ", BaseObject as obj, Classes.TokenClass as token where ";
        hql += "doc.space='XWiki' ";
        hql += "and obj.name=doc.fullName ";
        hql += "and token.tokenvalue=? ";
        hql += "and token.validuntil>=? ";
        hql += "and obj.id=token.id ";

        List<Object> parameterList = new Vector<Object>();
        parameterList.add(hashedCode);
        parameterList.add(new Date());

        XWikiStoreInterface storage = context.getWiki().getStore();
        List<String> users = storage.searchDocumentsNames(hql, 0, 0, parameterList, context);
        LOGGER.info("searching token and found " + users.size() + " with parameters "
                + Arrays.deepToString(parameterList.toArray()));
        if (users == null || users.size() == 0) {
            String db = context.getDatabase();
            context.setDatabase("xwiki");
            users = storage.searchDocumentsNames(hql, 0, 0, parameterList, context);
            if (users != null && users.size() == 1) {
                users.add("xwiki:" + users.remove(0));
            }
            context.setDatabase(db);
        }
        int usersFound = 0;
        for (String tmpUserDoc : users) {
            if (!tmpUserDoc.trim().equals("")) {
                usersFound++;
                userDoc = tmpUserDoc;
            }
        }
        if (usersFound > 1) {
            LOGGER.warn("Found more than one user for token '" + userToken + "'");
            return null;
        }
    } else {
        LOGGER.warn("No valid token given");
    }
    return userDoc;
}

From source file:org.wso2.carbon.event.formatter.core.config.EventFormatter.java

public void sendEventData(Object[] eventData) {

    Map<String, String> outputEventAdaptorMessageMap = new HashMap<String, String>(
            eventFormatterConfiguration.getToPropertyConfiguration().getOutputEventAdaptorMessageConfiguration()
                    .getOutputMessageProperties());
    OutputEventAdaptorMessageConfiguration outputEventAdaptorMessageConfiguration = new OutputEventAdaptorMessageConfiguration();
    outputEventAdaptorMessageConfiguration.setOutputMessageProperties(outputEventAdaptorMessageMap);

    Object outObject;/*from  w w w  .  j a v  a  2  s .  com*/
    if (traceEnabled) {
        trace.info(beforeTracerPrefix + Arrays.deepToString(eventData));
    }
    if (statisticsEnabled) {
        statisticsMonitor.incrementResponse();
    }
    try {
        if (customMappingEnabled) {
            outObject = outputMapper.convertToMappedInputEvent(eventData);
        } else {
            outObject = outputMapper.convertToTypedInputEvent(eventData);
        }
    } catch (EventFormatterConfigurationException e) {
        log.error("Cannot send event:" + Arrays.deepToString(eventData) + " from "
                + eventFormatterConfiguration.getEventFormatterName());
        return;
    }

    if (traceEnabled) {
        if (outObject instanceof Object[]) {
            trace.info(afterTracerPrefix + Arrays.deepToString((Object[]) outObject));
        } else {
            trace.info(afterTracerPrefix + outObject);
        }
    }

    if (dynamicMessagePropertyEnabled) {
        changeDynamicEventAdaptorMessageProperties(eventData, outputEventAdaptorMessageConfiguration);
    }

    OutputEventAdaptorService eventAdaptorService = EventFormatterServiceValueHolder
            .getOutputEventAdaptorService();
    eventAdaptorService.publish(outputEventAdaptorConfiguration, outputEventAdaptorMessageConfiguration,
            outObject, tenantId);

}

From source file:ome.services.blitz.fire.Ring.java

public void destroy() {
    try {// ww  w.ja v  a 2  s .c  o m
        Ice.Identity id = this.communicator.stringToIdentity("ClusterNode/" + uuid);
        registry.removeObjectSafely(id);
        redirector.handleRingShutdown(this, this.uuid);
        int count = closeSessionsForManager(uuid);
        log.info("Removed " + count + " entries for " + uuid);
        log.info("Disconnected from OMERO.cluster");
    } catch (Exception e) {
        log.error("Error stopping ring " + this, e);
    } finally {
        ClusterNodePrx[] nodes = null;
        try {
            // TODO this would be better served with a storm message!
            nodes = registry.lookupClusterNodes();
            if (nodes != null) {
                for (ClusterNodePrx clusterNodePrx : nodes) {
                    try {
                        clusterNodePrx = ClusterNodePrxHelper.uncheckedCast(clusterNodePrx.ice_oneway());
                        clusterNodePrx.down(this.uuid);
                    } catch (Exception e) {
                        String msg = "Error signaling down to " + clusterNodePrx;
                        log.warn(msg, e);
                    }
                }
            }
        } catch (Exception e) {
            log.error("Error signaling down to: " + Arrays.deepToString(nodes), e);
        }
    }
}

From source file:de.kopis.glacier.parsers.GlacierUploaderOptionParserTest.java

@Test
public void hasActionOptionCalculateHash() {
    final String[] newArgs = Arrays.copyOf(args, args.length + 2);
    newArgs[newArgs.length - 2] = "--calculate";
    newArgs[newArgs.length - 1] = "inventorylisting.txt";

    final OptionSet optionSet = optionsParser.parse(newArgs);
    assertTrue("Option 'calculate' not found in " + Arrays.deepToString(optionSet.specs().toArray()),
            optionSet.has("calculate"));
}

From source file:gda.device.scannable.component.UnitsComponent.java

private void userUnitStringIsNotAcceptable(String userUnitsString) throws DeviceException {
    String acceptableUnitsString = Arrays.deepToString(getAcceptableUnits());
    if (acceptableUnits.get(0) == ONE) {
        throw new DeviceException("User unit " + userUnitsString
                + " is not acceptable. The current hardware unit is at its dimensionless default of ONE (settable with an empty string ''). Make sure that a sensible hardware unit has been set.");
    }//from  ww w  .j  a v a 2 s .c  o m
    throw new DeviceException(
            "User unit " + userUnitsString + " is not acceptable. Try one of " + acceptableUnitsString);

}

From source file:com.celements.menu.MenuService.java

public List<BaseObject> getSubMenuItems(Integer headerId) {
    TreeMap<Integer, BaseObject> menuItemsMap = new TreeMap<Integer, BaseObject>();
    addMenuItems(menuItemsMap, headerId);
    getContext().setDatabase("celements2web");
    addMenuItems(menuItemsMap, headerId);
    getContext().setDatabase(getContext().getOriginalDatabase());
    ArrayList<BaseObject> resultList = new ArrayList<BaseObject>();
    resultList.addAll(menuItemsMap.values());
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("getSubMenuItems_internal returning: " + Arrays.deepToString(resultList.toArray()));
    }/*from  ww  w .j  a  va  2  s  . co m*/
    LOGGER.debug("getSubMenuItems_internal end");
    return resultList;
}

From source file:com.wholegroup.rally.Rally.java

/**
 * ?    JSON ?.//from  w ww  .j av  a  2 s  .  c om
 */
public String toJSON() {
    String strJSON = "";

    try {
        strJSON = new JSONObject().put("m_arrField", new JSONArray(Arrays.deepToString(m_arrField)))
                .put("m_iTypeGame", m_iTypeGame).put("m_iPlayerPos", m_iPlayerPos).put("m_iDensity", m_iDensity)
                .put("m_iLifeCount", m_iLifeCount).put("m_iScore", m_iScore).put("m_iSpeedMS", m_iSpeedMS)
                .toString();
    } catch (JSONException e) {
        e.printStackTrace();
    }

    return strJSON;
}

From source file:com.celements.payment.service.PayPalScriptService.java

private void addParamToStringBuffer(StringBuffer stringBuffer, String key, String[] values) {
    String valueStr = "";
    if (values.length == 1) {
        valueStr = values[0];// w  w  w  .  j a  va 2  s.  c  o  m
    } else {
        valueStr = Arrays.deepToString(values);
    }
    stringBuffer.append(key + "=" + valueStr + "\n");
}

From source file:org.apache.zeppelin.submarine.hadoop.YarnClient.java

public Map<String, Object> getAppServices(String appIdOrName) {
    Map<String, Object> mapStatus = new HashMap<>();
    String appUrl = this.yarnWebHttpAddr + "/app/v1/services/" + appIdOrName + "?_="
            + System.currentTimeMillis();

    InputStream inputStream = null;
    try {//from   ww  w.  j  ava  2 s .co  m
        HttpResponse response = callRestUrl(appUrl, principal, HTTP.GET);
        inputStream = response.getEntity().getContent();
        String result = new BufferedReader(new InputStreamReader(inputStream)).lines()
                .collect(Collectors.joining(System.lineSeparator()));
        if (response.getStatusLine().getStatusCode() != 200 /*success*/
                && response.getStatusLine().getStatusCode() != 404 /*Not found*/) {
            LOGGER.warn("Status code " + response.getStatusLine().getStatusCode());
            LOGGER.warn("message is :" + Arrays.deepToString(response.getAllHeaders()));
            LOGGER.warn("result\n" + result);
        }

        // parse app status json
        mapStatus = parseAppServices(result);
    } catch (Exception exp) {
        exp.printStackTrace();
    } finally {
        try {
            if (null != inputStream) {
                inputStream.close();
            }
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
    }

    return mapStatus;
}

From source file:org.graphwalker.machines.ExtendedFiniteStateMachine.java

/**
 * Walks the data space, and return the value of the data, if found.
 * //from   w  ww .j  ava  2s  .c  o m
 * @param dataName
 * @return
 * @throws InvalidDataException is thrown if the data is not found in the data space
 */
public String getDataValue(String dataName) {
    if (jsEngine != null) {
        return jsEngine.get(dataName).toString();
    } else if (beanShellEngine != null) {
        Hashtable<String, Object> dataTable = getCurrentBeanShellData();
        if (dataTable.containsKey(dataName)) {
            if (dataTable.get(dataName) instanceof Object[]) {
                return Arrays.deepToString((Object[]) dataTable.get(dataName));
            } else {
                return dataTable.get(dataName).toString();
            }
        }
    }
    return "";
}