Examples of XProcRuntime


Examples of com.xmlcalabash.core.XProcRuntime

   @Override
   public Pipeline build(String pipelineUri) {
      try {
         XProcConfiguration config = new XProcConfiguration(schemaAware);
         XProcRuntime runtime = new XProcRuntime(config);
         if (messageListener != null) {
             runtime.setMessageListener(messageListener);
         }

         InputStreamUriParameterResolver resolver = new InputStreamUriParameterResolver(new XProcURIResolver(runtime));
         resolver.addResolver(new ClassPathUriResolver());
         runtime.setURIResolver(resolver);
         XPipeline pipeline = runtime.load(new Input(pipelineUri));
         return new CalabashPipeline(pipeline, runtime, resolver, legacySourceOutput);
      } catch (SaxonApiException ex) {
         // TODO: Should we log the exception here?
         throw new PipelineException(ex);
      }
View Full Code Here

Examples of com.xmlcalabash.core.XProcRuntime

  
   @Override
   public Pipeline build(String pipelineUri, URIResolver... resolvers) {
      try {
         XProcConfiguration config = new XProcConfiguration(schemaAware);
         XProcRuntime runtime = new XProcRuntime(config);
         InputStreamUriParameterResolver streamResolver = new InputStreamUriParameterResolver(new XProcURIResolver(runtime));
         streamResolver.addResolver(new ClassPathUriResolver());
         for (URIResolver resolver: resolvers) {
            streamResolver.addResolver(resolver);
         }
         runtime.setURIResolver(streamResolver);
         XPipeline pipeline = runtime.load(new Input(pipelineUri));
         return new CalabashPipeline(pipeline, runtime, streamResolver);
      } catch (SaxonApiException ex) {
         // TODO: Should we log the exception here?
         throw new PipelineException(ex);
      }
View Full Code Here

Examples of com.xmlcalabash.core.XProcRuntime

  XProcRuntime runtime = null;
 
  public PipelineRunner(InputStream xslSheet) {
    XProcConfiguration config = new XProcConfiguration();
    config.debug = true;
    this.runtime = new XProcRuntime(config);
    //GenericConfig config = new GenericConfig();
    //this.runtime = new XProcRuntime(config);
    Processor proc = runtime.getProcessor();
    this.builder = proc.newDocumentBuilder();
    XsltCompiler comp = proc.newXsltCompiler();
View Full Code Here

Examples of com.xmlcalabash.core.XProcRuntime

   protected XProcConfiguration config;
   protected XProcRuntime runtime;
  
   public XProcCache() {
      config = new XProcConfiguration();
      runtime = new XProcRuntime(config);
      instances = new TreeMap<URI,PipelineInfo>();
   }
View Full Code Here

Examples of com.xmlcalabash.core.XProcRuntime

        super.run();

        XdmNode pipedoc = pipeline.read();
        XdmNode piperoot = S9apiUtils.getDocumentElement(pipedoc);

        XProcRuntime innerRuntime = new XProcRuntime(runtime);
        innerRuntime.resetExtensionFunctions();

        QName stepName = getOption(_step, (QName) null);
        XPipeline pipeline = null;
        if (XProcConstants.p_pipeline.equals(piperoot.getNodeName())
                || XProcConstants.p_declare_step.equals(piperoot.getNodeName())) {
            if (stepName != null) {
                throw new XProcException(step.getNode(), "Step option can only be used when loading a p:library");
            }
            pipeline = innerRuntime.use(pipedoc);
        } else if (XProcConstants.p_library.equals(piperoot.getNodeName())) {
            XLibrary library = innerRuntime.useLibrary(piperoot);
            if (stepName == null) {
                pipeline = library.getFirstPipeline();
            } else {
                pipeline = library.getPipeline(stepName);
            }
View Full Code Here

Examples of com.xmlcalabash.core.XProcRuntime

            expires.setTimeInMillis(extime);
        } else {
            expires.setTimeInMillis(Long.MAX_VALUE);
        }

        XProcRuntime runtime = new XProcRuntime(getConfiguration());

        try {
            InputSource is = new InputSource(entity.getStream());
            String base = getHostRef().toString();
            is.setSystemId(base + "/" + name);

            XdmNode doc = runtime.parse(is);
            XPipeline pipeline = runtime.use(doc);
            getPipelines().put(id, new PipelineConfiguration(runtime, pipeline, expires));
        } catch (Exception e) {
            throw new XProcException(e);
        }
View Full Code Here

Examples of com.xmlcalabash.core.XProcRuntime

            }
        }
    }

    boolean run(UserArgs userArgs, XProcConfiguration config) throws SaxonApiException, IOException, URISyntaxException {
        runtime = new XProcRuntime(config);
        debug = config.debug;

        if (userArgs.isShowVersion()) {
            XProcConfiguration.showVersion(runtime);
        }
View Full Code Here

Examples of com.xmlcalabash.core.XProcRuntime

            }
        }
    }

    public void setup() {
        XProcRuntime runtime = this.runtime;
        DeclareStep decl = this;
        boolean debug = runtime.getDebug();

        if (decl.psviRequired && !runtime.getPSVISupported()) {
            throw XProcException.dynamicError(22);
        }

        if (debug) {
            logger.trace("=====================================================================================");
View Full Code Here

Examples of com.xmlcalabash.core.XProcRuntime

            return badRequest(Status.CLIENT_ERROR_NOT_FOUND, "no pipeline: " + pipelineUri(id), variant.getMediaType());
        }

        PipelineConfiguration pipeconfig = getPipelines().get(id);
        XPipeline xpipeline = pipeconfig.pipeline;
        XProcRuntime runtime = pipeconfig.runtime;

        if (pipeconfig.ran) {
            pipeconfig.reset();
            xpipeline.reset();
        }

        try {
            if (MediaType.MULTIPART_FORM_DATA.equals(entity.getMediaType(), true)) {
                processMultipartForm(pipeconfig, entity, variant);
            } else {
                if (pipeconfig.definput == null) {
                    return badRequest(Status.CLIENT_ERROR_BAD_REQUEST, "No primary input port", variant.getMediaType());
                }
                if (pipeconfig.documentCount(pipeconfig.definput) == 0) {
                    xpipeline.clearInputs(pipeconfig.definput);
                }
                pipeconfig.writeTo(pipeconfig.definput);

                XdmNode doc = null;

                if (isXml(entity.getMediaType())) {
                    doc = runtime.parse(new InputSource(entity.getStream()));
                    logger.debug("Posting XML document to " + pipeconfig.definput + " for " + id);
                } else {
                    ReadablePipe pipe = null;
                    pipe = new ReadableData(runtime, XProcConstants.c_data, entity.getStream(), entity.getMediaType().toString());
                    doc = pipe.read();
View Full Code Here

Examples of com.xmlcalabash.core.XProcRuntime

            System.err.println(xe.getMessage());
            System.exit(-1);
        }

        XProcConfiguration config = null;
        XProcRuntime runtime = null;

        try {
            config = userArgs.createConfiguration();
            runtime = new XProcRuntime(config);
        } catch (SaxonApiException e) {
            System.err.println(e.getMessage());
            System.exit(-1);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.