List of usage examples for org.apache.hadoop.util StringUtils unEscapeString
public static String unEscapeString(String str, char escapeChar, char[] charsToEscape)
From source file:com.chinamobile.bcbsp.bspcontroller.Counters.java
License:Apache License
/** * Unescapes all the delimiters for counters i.e {,[,(,),],} * @param string//www . jav a2s . com * counter record to unescape * @return unescaped counter record. */ private static String unescape(String string) { return StringUtils.unEscapeString(string, StringUtils.ESCAPE_CHAR, charsToEscape); }
From source file:org.apache.ambari.log4j.hadoop.mapreduce.jobhistory.MapReduceJobHistoryUpdater.java
License:Apache License
public static WorkflowContext buildWorkflowContext(JobSubmittedEvent historyEvent) { String workflowId = historyEvent.getWorkflowId().replace("\\", ""); if (workflowId.isEmpty()) return generateWorkflowContext(historyEvent); String workflowName = historyEvent.getWorkflowName().replace("\\", ""); String workflowNodeName = historyEvent.getWorkflowNodeName().replace("\\", ""); String workflowAdjacencies = StringUtils.unEscapeString(historyEvent.getWorkflowAdjacencies(), StringUtils.ESCAPE_CHAR, new char[] { '"', '=', '.' }); WorkflowContext context = new WorkflowContext(); context.setWorkflowId(workflowId);//w ww .j ava 2 s .com context.setWorkflowName(workflowName); context.setWorkflowEntityName(workflowNodeName); WorkflowDag dag = new WorkflowDag(); Matcher matcher = adjPattern.matcher(workflowAdjacencies); while (matcher.find()) { WorkflowDagEntry dagEntry = new WorkflowDagEntry(); dagEntry.setSource(matcher.group(1).replace("\\", "")); String[] values = StringUtils.getStrings(matcher.group(2).replace("\\", "")); if (values != null) { for (String target : values) { dagEntry.addTarget(target); } } dag.addEntry(dagEntry); } if (dag.getEntries().isEmpty()) { WorkflowDagEntry wfDagEntry = new WorkflowDagEntry(); wfDagEntry.setSource(workflowNodeName); dag.addEntry(wfDagEntry); } context.setWorkflowDag(dag); return context; }
From source file:org.apache.hama.bsp.Counters.java
License:Apache License
private static String unescape(String string) { return StringUtils.unEscapeString(string, StringUtils.ESCAPE_CHAR, charsToEscape); }