Package org.apache.commons.jelly

Examples of org.apache.commons.jelly.JellyContext


        return (ConfigProvider)configProvider;
    }

    private String renderContent(AbstractBuild<?, ?> build, InputStream inputStream, TaskListener listener)
            throws JellyException, IOException {
        JellyContext context = createContext(new ScriptContentBuildWrapper(build), build, listener);
        Script script = context.compileScript(new InputSource(inputStream));
        if (script != null) {
            return convert(build, context, script);
        }
        return null;
    }
View Full Code Here


        output.close();
        return output.toString(getCharset(build));
    }

    private JellyContext createContext(Object it, AbstractBuild<?, ?> build, TaskListener listener) {
        JellyContext context = new JellyContext();
        ExtendedEmailPublisherDescriptor descriptor = Jenkins.getInstance().getDescriptorByType(ExtendedEmailPublisherDescriptor.class);
        context.setVariable("it", it);
        context.setVariable("build", build);
        context.setVariable("project", build.getParent());
        context.setVariable("logger", listener.getLogger());
        context.setVariable("rooturl", descriptor.getHudsonUrl());
        return context;
    }
View Full Code Here

            public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException {
                try {
                    new DefaultScriptInvoker() {
                        @Override
                        protected JellyContext createContext(StaplerRequest req, StaplerResponse rsp, Script script, Object it) {
                            JellyContext context = super.createContext(req, rsp, script, it);
                            for (int i=bodyStack.length-1; i>0; i--) {// exclude bodyStack[0]
                                context = new JellyContext(context);
                                context.setVariable("org.apache.commons.jelly.body",bodyStack[i]);
                            }
                            return context;
                        }

                        @Override
                        protected void exportVariables(StaplerRequest req, StaplerResponse rsp, Script script, Object it, JellyContext context) {
                            super.exportVariables(req, rsp, script, it, context);
                            context.setVariables(variables);
                            req.setAttribute("currentDescriptorByNameUrl",currentDescriptorByNameUrl);
                        }
                    }.invokeScript(req,rsp,bodyStack[0],null);
                } catch (JellyTagException e) {
                    LOGGER.log(Level.WARNING, "Failed to evaluate the template closure", e);
View Full Code Here

     * to evaluate the script.
     *
     * @since 1.164
     */
    public static JellyContext getCurrentJellyContext() {
        JellyContext context = ExpressionFactory2.CURRENT_CONTEXT.get();
        assert context!=null;
        return context;
    }
View Full Code Here

                throws ProcessingException,SAXException,IOException {

        super.setup(resolver, objectModel, src, params);

        // Initialize the Jelly context
        this.jellyContext = new JellyContext();
       
        // Update JellyContext with sitemap parameters
        this.updateContext(params);
    }
View Full Code Here

        // We don't want any taglib references in the context or Jelly
        // gets confused. All we want are the variables for interpolation. We
        // can change this but I think we would like to avoid general Jelly
        // idiom in the POM anyway.
        JellyContext context = new JellyContext();
        JellyUtils.populateVariables( context, originalContext );

        // We don't want the context or the parent being written out into the XML which
        // is the interpolated POM.
        project.setContext( null );
View Full Code Here

    /**
     * Simple connection
     */
    public void connect() throws Exception {
  JellyContext context = new JellyContext();
  XMLOutput xmlOutput = XMLOutput.createXMLOutput(System.out);
  context.runScript(new File ("util/ldap-connect.jelly"), xmlOutput);
  xmlOutput.flush();
    }
View Full Code Here

    /**
     * Simple query
     */
    public void query() throws Exception {
  JellyContext context = new JellyContext();
  XMLOutput xmlOutput = XMLOutput.createXMLOutput(System.out);
  context.runScript(new File ("util/ldap-query.jelly"), xmlOutput);
  xmlOutput.flush();
    }
View Full Code Here

    /**
     * Simple insert
     */
    public void insert() throws Exception {
  JellyContext context = new JellyContext();
  XMLOutput xmlOutput = XMLOutput.createXMLOutput(System.out);
  context.runScript(new File ("util/ldap-insert.jelly"), xmlOutput);
  xmlOutput.flush();
    }
View Full Code Here

    /**
     * Simple update
     */
    public void update() throws Exception {
  JellyContext context = new JellyContext();
  XMLOutput xmlOutput = XMLOutput.createXMLOutput(System.out);
  context.runScript(new File ("util/ldap-update.jelly"), xmlOutput);
  xmlOutput.flush();
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jelly.JellyContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.