// into a more usable api for the cajoler
public CajolingServiceResult cajole(
String base, String url, String input,
boolean debugMode, String opt_idClass) {
MessageContext mc = new MessageContext();
MessageQueue mq = new SimpleMessageQueue();
ParseTreeNode outputJs;
Node outputHtml;
Map<InputSource, ? extends CharSequence> originalSources
= Collections.singletonMap(new InputSource(guessURI(base, url)), input);
PluginMeta meta = new PluginMeta(fetcher, null);
if (opt_idClass != null && opt_idClass.length() != 0) {
meta.setIdClass(opt_idClass);
}
PluginCompiler compiler = makePluginCompiler(meta, mq);
compiler.setJobCache(new AppEngineJobCache());
compiler.setMessageContext(mc);
URI uri = guessURI(base, url);
InputSource is = new InputSource(uri);
CharProducer cp = CharProducer.Factory.fromString(input, is);
boolean okToContinue = true;
Dom inputNode = null;
try {
DomParser p = new DomParser(new HtmlLexer(cp), false, is, mq);
inputNode = new Dom(p.parseFragment());
p.getTokenQueue().expectEmpty();
} catch (ParseException e) {
mq.addMessage(e.getCajaMessage());
okToContinue = false;
}
if (okToContinue && inputNode != null) {
compiler.addInput(inputNode, uri);