package jenkins.python.expoint; import hudson.ExtensionPoint; import hudson.model.AbstractDescribableImpl; import hudson.util.HttpResponses; import jenkins.model.Jenkins; import org.kohsuke.stapler.HttpResponse; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; import javax.servlet.ServletException; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import hudson.markup.*; import hudson.markup.MarkupFormatter.*; import hudson.model.*; import hudson.model.AbstractDescribableImpl.*; import jenkins.python.DataConvertor; import jenkins.python.PythonExecutor; /** * This class was automatically generated by the PWM tool on 2014/03/21. * @see hudson.markup.MarkupFormatter */ public abstract class MarkupFormatterPW extends MarkupFormatter { private transient PythonExecutor pexec; private void initPython() { if (pexec == null) { pexec = new PythonExecutor(this); String[] jMethods = new String[1]; jMethods[0] = "translate"; String[] pFuncs = new String[1]; pFuncs[0] = "translate"; Class[][] argTypes = new Class[1][]; argTypes[0] = new Class[2]; argTypes[0][0] = String.class; argTypes[0][1] = Writer.class; pexec.checkAbstrMethods(jMethods, pFuncs, argTypes); String[] functions = new String[3]; functions[0] = "get_help_url"; functions[1] = "get_descriptor"; functions[2] = "do_preview_description"; int[] argsCount = new int[3]; argsCount[0] = 0; argsCount[1] = 0; argsCount[2] = 1; pexec.registerFunctions(functions, argsCount); } } @Override public void translate(String markup, Writer output) throws IOException { initPython(); pexec.execPythonVoid("translate", markup, output); } @Override public String getHelpUrl() { initPython(); if (pexec.isImplemented(0)) { return (String) pexec.execPython("get_help_url"); } else { return super.getHelpUrl(); } } @Override public MarkupFormatterDescriptor getDescriptor() { initPython(); if (pexec.isImplemented(1)) { return (MarkupFormatterDescriptor) pexec.execPython("get_descriptor"); } else { return super.getDescriptor(); } } @Override public HttpResponse doPreviewDescription(@QueryParameter String text) throws IOException { initPython(); if (pexec.isImplemented(2)) { return (HttpResponse) pexec.execPython("do_preview_description", text); } else { return super.doPreviewDescription(text); } } public String superGetHelpUrl() { return super.getHelpUrl(); } public MarkupFormatterDescriptor superGetDescriptor() { return super.getDescriptor(); } public HttpResponse superDoPreviewDescription(@QueryParameter String text) throws IOException { return super.doPreviewDescription(text); } public Object execPython(String function, Object... params) { initPython(); return pexec.execPython(function, params); } public byte execPythonByte(String function, Object... params) { initPython(); return pexec.execPythonByte(function, params); } public short execPythonShort(String function, Object... params) { initPython(); return pexec.execPythonShort(function, params); } public char execPythonChar(String function, Object... params) { initPython(); return pexec.execPythonChar(function, params); } public int execPythonInt(String function, Object... params) { initPython(); return pexec.execPythonInt(function, params); } public long execPythonLong(String function, Object... params) { initPython(); return pexec.execPythonLong(function, params); } public float execPythonFloat(String function, Object... params) { initPython(); return pexec.execPythonFloat(function, params); } public double execPythonDouble(String function, Object... params) { initPython(); return pexec.execPythonDouble(function, params); } public boolean execPythonBool(String function, Object... params) { initPython(); return pexec.execPythonBool(function, params); } public void execPythonVoid(String function, Object... params) { initPython(); pexec.execPythonVoid(function, params); } }