Package org.foray.core

Examples of org.foray.core.FOraySession


     * {@inheritDoc}
     */
    public void renderXML(final File xmlFile, final File xslFile,
            final HttpServletResponse response) throws ServletException {
        try {
            final FOraySession session = setupSession(response);
            final FOrayDocument document = setupJAXPDocument(xmlFile, xslFile,
                    session);
            setupTarget(document);
            session.process();
            reportOK(response);
        } catch (final FOrayException ex) {
            throw new ServletException(ex);
        } catch (final TransformerConfigurationException ex) {
            throw new ServletException(ex);
View Full Code Here


     * {@inheritDoc}
     */
    public void renderFO(final InputSource inputSource,
            final HttpServletResponse response) throws ServletException {
        try {
            final FOraySession session = setupSession(response);
            final FOrayDocument document = setupSAXDocument(session,
                    inputSource);
            final FOrayTarget target = setupTarget(document);
            session.process();
            sendContentToResponse(response, target);
        } catch (final FOrayException ex) {
            throw new ServletException(ex);
        } catch (final IOException ex) {
            throw new ServletException(ex);
View Full Code Here

     * {@inheritDoc}
     */
    public void renderXML(final File xmlFile, final File xslFile,
            final HttpServletResponse response) throws ServletException {
        try {
            final FOraySession session = setupSession(response);
            final FOrayDocument document = setupJAXPDocument(xmlFile, xslFile,
                    session);
            final FOrayTarget target = setupTarget(document);
            session.process();
            sendContentToResponse(response, target);
        } catch (final FOrayException ex) {
            throw new ServletException(ex);
        } catch (final TransformerConfigurationException ex) {
            throw new ServletException(ex);
View Full Code Here

        if (this.task.getLogFiles()) {
            this.task.log(foFile + " -> " + outFile, Project.MSG_INFO);
        }

        try {
            final FOraySession session = FOraySpecific.makeFOraySession(
                    this.sessionConfig);
            final FOrayDocument document = new FOrayDocument(session,
                    inputSource, null);

            if (this.task.getRendererType() == OutputTargetType.XML) {
                this.outputConfig.setFineDetail(Boolean.TRUE, SessionConfig.PRECEDENCE_DEFAULT);
            }
            final OutputTarget outputTarget =
                    OutputTargetFactory.makeOutputTarget(
                    this.task.getRendererType(), this.outputConfig, out,
                    session.getLogger(), session.getGraphicServer());
            new FOrayTarget(document, outputTarget, null, out);

            session.process();
            out.close();
        } catch (final FOrayException ex) {
            throw new BuildException(ex);
        } catch (final IOException ex) {
            throw new BuildException(ex);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void run() throws FOrayException {
        final SessionConfig configuration = getOptions().getSessionConfig();
        final FOraySession session = FOraySpecific.makeFOraySession(
                configuration);

        final PrinterJob pj = PrinterJob.getPrinterJob();
        if (System.getProperty("dialog") != null) {
            if (! pj.printDialog()) {
                throw new FOrayException("Printing cancelled by operator");
            }
        }
        final int copies = getIntProperty("copies", 1);
        pj.setCopies(copies);
        pj.setJobName("FOray Document");

        session.process();
    }
View Full Code Here

        final AreaTreeFactory areaTreeFactory =
                FOraySpecific.makeAreaTreeFactory(logger);
        final LayoutFactory layoutFactory = FOraySpecific.makeLayoutFactory(
                logger);
        final SpeechServer speechServer = FOraySpecific.makeSpeechServer();
        final FOraySession session = new FOraySession(logger, sessionConfig,
                fontServer, hyphenServer, textServer, graphicServer,
                speechServer, foTreeServer, areaTreeFactory, layoutFactory);
        return session;
    }
View Full Code Here

         * who wish to embed FOray in other applications.
         */

        /* Instantiate the FOraySession. */
        final SessionConfig sessionConfig = getOptions().getSessionConfig();
        final FOraySession session = FOraySpecific.makeFOraySession(
                sessionConfig);

        /*
         * Instantiate and configure the FOrayDocument(s). The constructor
         * shown here is for regular SAX input.
         * There is also a constructor for a DOM document, and another for a
         * JAXP Transformer and Source.
         * Multiple documents can be instantiated, and they will be processed
         * in the order submitted.
         */
        FOrayDocument document = null;
        if (this.commandLineOptions.getInputMode()
                == CommandLineOptions.INPUT_FO) {
            document = new FOrayDocument(session, getInputSource(), null);
        } else {
            document = new FOrayDocument(session,
                    this.commandLineOptions.getXMLFile(),
                    this.commandLineOptions.getXSLFile());
        }

        /*
         * Instantiate and configure the OutputTarget. The makeOutputTarget()
         * method of FOrayTarget knows how to make most of the standard
         * OutputTargets, but you can create and use a non-standard OutputTarget
         * as well.
         */
        final OutputTargetType outputType =
                this.commandLineOptions.getOutputMode();
        final OutputConfig outputOptions = this.getOutputConfig();
        final FileOutputStream outputStream = getFileOutputStream();
        final OutputTarget outputTarget = OutputTargetFactory.makeOutputTarget(
                outputType, outputOptions, outputStream,
                session.getLogger(), session.getGraphicServer());

        /*
         * Instantiate and configure the FOrayTarget(s). Multiple targets can
         * be instantiated for each FOrayDocument, but right now only the first
         * one is actually processed.
         * LayoutStrategy is an optional parameter. Set it to null to have the
         * system use the default.
         * Targets that do not need an OutputStream should set that parameter
         * to null.
         */
        final LayoutStrategy layout = new PioneerLS(session.getLogger());
        final FOrayTarget target = new FOrayTarget(document, outputTarget,
                layout, outputStream);

        /*
         * Everything is now ready to go. There are two different processing
         * models possible here. The first is to let FOray manage and
         * complete the processing internally. The second is to manage that
         * process externally, e.g. those integrating with Cocoon or another
         * pipeline-type scheme. If you don't know which of those to use, you
         * should probably let FOray control the processing. The instructions
         * are separated below for the two models. IMPORTANT: Please note that
         * the instructions reunify below for some cleanup code that is common
         * to both.
         */


/* *****************************************************************************
* Start instructions for internal FOray control. Ignore this section
* if you are controlling externally.
* ****************************************************************************/
        /*
         * Just push the button, and let FOray do the rest ...
         */
        session.process();
/* *****************************************************************************
* End instructions for internal FOray control.
* ****************************************************************************/


 
View Full Code Here

TOP

Related Classes of org.foray.core.FOraySession

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.