private static void dumpPipelineTree(StringBuffer sb, PipelineTreeConfig pipelineTree) { List elements = pipelineTree.getHandlerOrChain(); for (Object element : elements) { if (element instanceof HandlerConfig) { dumpHandler(sb, (HandlerConfig) element, ""); } else if (element instanceof ChainConfig) { ChainConfig chain = (ChainConfig) element; sb.append("\tChain=" + chain.getName()); if (chain.getPresence() != null) sb.append(" presence=" + chain.getPresence().toString()); sb.append(NL); for (HandlerConfig handler : chain.getHandler()) { sb.append("\t"); dumpHandler(sb, handler, ""); } } } }
// TODO - it's possible to have "incomplete" handlers/chains from the group level entry. Check // for these and remove or error out. private static ArrayList<HandlerConfig> flattenTree(PipelineTreeConfig pipelineTree) { ArrayList<HandlerConfig> outList = new ArrayList<HandlerConfig>(); if (pipelineTree == null) { return outList; } List elements = pipelineTree.getHandlerOrChain(); for (Object element : elements) { if (element instanceof HandlerConfig) { outList.add((HandlerConfig) element); } else if (element instanceof ChainConfig) { ChainConfig chain = (ChainConfig) element; for (HandlerConfig handler : chain.getHandler()) { outList.add(handler); } } } return outList; }