/** * Return a stringified version of the array. * @param array the array * @param delim the delimiter to use between array components * @return the string form of the array */ public static String toString( final Object[] array, final String delim ) { return toString(array, delim, true); }
/** * Return a stringified version of the array, using a ',' as a delimiter * @param array the array * @return the string form of the array * @see #toString(Object[], String) */ public static String toString( final Object[] array ) { return toString(array, ",", true); //$NON-NLS-1$ }
/** * Return a stringified version of the array, using a ',' as a delimiter * @param array the array * @return the string form of the array * @see #toString(Object[], String) */ public static String toString( final Object[] array ) { return toString(array, ",", true); //$NON-NLS-1$ }
/** * Return a stringified version of the array. * @param array the array * @param delim the delimiter to use between array components * @return the string form of the array */ public static String toString( final Object[] array, final String delim ) { return toString(array, delim, true); }
@Override public String toString() { return StringUtil.toString(this.parts, ".", false); //$NON-NLS-1$ }
@Override public String toString() { return StringUtil.toString(this.parts, ".", false); //$NON-NLS-1$ }
@Override public String toString() { return StringUtil.toString(this.parts, ".", false); //$NON-NLS-1$ }
static Map<Integer, String>[] loadPartialMetadata(String[] columnNames, String[] columnTypes) { if(columnNames == null || columnTypes == null || columnNames.length != columnTypes.length) { Object[] params = new Object[] { StringUtil.toString(columnNames), StringUtil.toString(columnTypes) }; throw new IllegalArgumentException(JDBCPlugin.Util.getString("DeferredMetadataProvider.Invalid_data", params)); //$NON-NLS-1$ } Map<Integer, String>[] columnMetadata = new Map[columnNames.length]; for(int i=0; i<columnNames.length; i++) { columnMetadata[i] = new HashMap<Integer, String>(); columnMetadata[i].put(ResultsMetadataConstants.ELEMENT_LABEL, columnNames[i]); columnMetadata[i].put(ResultsMetadataConstants.DATA_TYPE, columnTypes[i]); } return columnMetadata; }
static Map<Integer, String>[] loadPartialMetadata(String[] columnNames, String[] columnTypes) { if(columnNames == null || columnTypes == null || columnNames.length != columnTypes.length) { Object[] params = new Object[] { StringUtil.toString(columnNames), StringUtil.toString(columnTypes) }; throw new IllegalArgumentException(JDBCPlugin.Util.getString("DeferredMetadataProvider.Invalid_data", params)); //$NON-NLS-1$ } Map<Integer, String>[] columnMetadata = new Map[columnNames.length]; for(int i=0; i<columnNames.length; i++) { columnMetadata[i] = new HashMap<Integer, String>(); columnMetadata[i].put(ResultsMetadataConstants.ELEMENT_LABEL, columnNames[i]); columnMetadata[i].put(ResultsMetadataConstants.DATA_TYPE, columnTypes[i]); } return columnMetadata; }
public void log(int level, String context, Throwable t, Object... msg) { Logger logger = getLogger(context); Level javaLevel = convertLevel(level); if (msg.length == 0) { logger.log(javaLevel, null, t); } else if (msg.length == 1 && !(msg[0] instanceof String)) { String msgStr = StringUtil.toString(msg, " ", false); //$NON-NLS-1$ LogRecord record = new LogRecord(javaLevel, msgStr); record.setParameters(msg); record.setThrown(t); record.setLoggerName(context); logger.log(record); } else { logger.log(javaLevel, StringUtil.toString(msg, " ", false), t); //$NON-NLS-1$ } }
public String toString() { if (!source) { if (event == Event.NEW) { return "\tSTART USER COMMAND:\tstartTime=" + new Timestamp(timestamp) + "\trequestID=" + requestID + "\ttxID=" + transactionID + "\tsessionID=" + sessionID + "\tapplicationName=" + applicationName + "\tprincipal=" + principal + "\tvdbName=" + vdbName + "\tvdbVersion=" + vdbVersion + "\tsql=" + sql; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ } return "\t"+ event +" USER COMMAND:\tendTime=" + new Timestamp(timestamp) + "\trequestID=" + requestID + "\ttxID=" + transactionID + "\tsessionID=" + sessionID + "\tprincipal=" + principal + "\tvdbName=" + vdbName + "\tvdbVersion=" + vdbVersion + "\tfinalRowCount=" + rowCount+ ((plan!=null)?"\tplan=" + plan.toYaml():"") + ((cpuTime!=null)?"\tcpuTime(ns)=" + cpuTime:""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ } if (event == Event.NEW) { return "\tSTART DATA SRC COMMAND:\tstartTime=" + new Timestamp(timestamp) + "\trequestID=" + requestID + "\tsourceCommandID="+ sourceCommandID + "\texecutionID="+ executionContext.getExecutionCountIdentifier() + "\ttxID=" + transactionID + "\tmodelName="+ modelName + "\ttranslatorName=" + translatorName + "\tsessionID=" + sessionID + "\tprincipal=" + principal + "\tsql=" + sql; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ } return "\t"+ event +" SRC COMMAND:\tendTime=" + new Timestamp(timestamp) + "\trequestID=" + requestID + "\tsourceCommandID="+ sourceCommandID + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ "\texecutionID="+ executionContext.getExecutionCountIdentifier() + "\ttxID=" + transactionID + "\tmodelName="+ modelName + "\ttranslatorName=" + translatorName + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ "\tsessionID=" + sessionID + "\tprincipal=" + principal + ((sourceCommand != null)?"\tsourceCommand=" + StringUtil.toString(sourceCommand, " "):"") + ((rowCount != null)?"\tfinalRowCount=" + rowCount:"") + ((cpuTime!=null)?"\tcpuTime(ns)=" + cpuTime:""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ }
@Override public void log(int level, String context, Throwable t, Object... msg) { Logger logger = getLogger(context); Level jbossLevel = convert2JbossLevel(level); if (msg.length == 0) { logger.log(jbossLevel, null, t); } else if (msg.length == 1 && !(msg[0] instanceof String)) { String msgStr = StringUtil.toString(msg, " ", false); //$NON-NLS-1$ if (msgStr.indexOf('%') > -1) { msgStr = StringUtil.replaceAll(msgStr, "%", "%%"); //$NON-NLS-1$ //$NON-NLS-2$ } logger.logf(jbossLevel, t, msgStr, msg); } else { logger.log(jbossLevel, StringUtil.toString(msg, " ", false), t); //$NON-NLS-1$ } }
@Test public void testToString() { final String[] input = new String[]{"string1","string2","string3"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ final String output = StringUtil.toString(input); assertEquals("[string1,string2,string3]", output); //$NON-NLS-1$ }
public AuditEnitity(AuditMessage msg) { this.context = msg.getContext(); this.activity = msg.getActivity(); this.resources = StringUtil.toString(msg.getResources()); if (msg.getCommandContext() != null) { this.requestId = msg.getCommandContext().getRequestId(); this.principal = msg.getCommandContext().getUserName(); this.vdbName = msg.getCommandContext().getVdbName(); this.vdbVersion = msg.getCommandContext().getVdbVersion(); this.sessionId = msg.getCommandContext().getSession().getSessionId(); this.applicationName = msg.getCommandContext().getSession().getApplicationName(); } else if (msg.getLogonInfo() != null) { this.authType = msg.getLogonInfo().getAuthType(); this.userName = msg.getLogonInfo().getUserName(); this.clientHostName = msg.getLogonInfo().getClientHostName(); this.clientIpAddress = msg.getLogonInfo().getClientIpAddress(); this.clientMac = msg.getLogonInfo().getClientMac(); this.passThrough = msg.getLogonInfo().isPassThrough(); } }