Package org.apache.cocoon.components.pipeline

Examples of org.apache.cocoon.components.pipeline.StreamPipeline


   */
  public Value generate(Value scm, Value senv, Value sargs)
    throws Exception
  {
    SchemeSitemap sitemap = schemeSitemap(scm);
    StreamPipeline pipeline = sitemap.getStreamPipeline();
    EventPipeline eventPipeline = pipeline.getEventPipeline();

    // Obtain the 'type' attribute
    Value stype = assq(sargs, Symbol.get("type"));
    String type;
    if (!stype.eq(FALSE))
View Full Code Here


   */
  public Value aggregate(Value scm, Value senv, Value sargs)
    throws Exception
  {
    SchemeSitemap sitemap = schemeSitemap(scm);
    StreamPipeline pipeline = sitemap.getStreamPipeline();
    EventPipeline eventPipeline = pipeline.getEventPipeline();

    // We have an <aggregate> as the generator
    eventPipeline.setGenerator ("!content-aggregator!",
                                null, Parameters.EMPTY_PARAMETERS);
    // Get the element name of the top level element
View Full Code Here

   */
  public Value part(Value scm, Value senv, Value sargs, Value spipeline)
    throws Exception
  {
    SchemeSitemap sitemap = schemeSitemap(scm);
    StreamPipeline pipeline = sitemap.getStreamPipeline();
    EventPipeline eventPipeline = pipeline.getEventPipeline();

    // Get the element for the top level element
    String src = "";
    Value ssrc = assq(sargs, Symbol.get("src"));
    if (!ssrc.eq(FALSE))
View Full Code Here

   */
  public Value read(Value scm, Value senv, Value sargs)
    throws Exception
  {
    SchemeSitemap sitemap = schemeSitemap(scm);
    StreamPipeline pipeline = sitemap.getStreamPipeline();
    EventPipeline eventPipeline = pipeline.getEventPipeline();

    // Obtain the 'src' attribute
    Value ssrc = assq(sargs, Symbol.get("src"));
    if (ssrc.eq(FALSE))
      throw new RuntimeException("No 'src' attribute specified for 'read'!");
    String src = string(pair(ssrc).cdr);

    // Obtain the 'mime-type' attribute
    Value smimeType = assq(sargs, Symbol.get("mime-type"));
    String mimeType = null;
    if (!smimeType.eq(FALSE))
      mimeType = string(pair(smimeType).cdr);

    // Obtain the 'type' attribute
    Value stype = assq(sargs, Symbol.get("type"));
    String type;
    if (!stype.eq(FALSE))
      type = string(pair(stype).cdr);
    else
      type = sitemap.getDefaultReaderType();

    // Obtain the parameters
    Value sparams = assq(sargs, Symbol.get("params"));
    Parameters params = getParameters(sparams);

    pipeline.setReader(type, src, params, mimeType);

    return new J2S.JavaObject(pipeline);
  }
View Full Code Here

   */
  public Value transform(Value scm, Value senv, Value sargs, Value spipeline)
    throws Exception
  {
    SchemeSitemap sitemap = schemeSitemap(scm);
    StreamPipeline pipeline = streamPipeline(spipeline);
    EventPipeline eventPipeline = pipeline.getEventPipeline();

    // Obtain the 'src' attribute
    Value ssrc = assq(sargs, Symbol.get("src"));
    if (ssrc.eq(FALSE))
      throw new RuntimeException("No 'src' attribute specified for 'transform'!");
View Full Code Here

   */
  public Value serialize(Value scm, Value senv, Value sargs, Value spipeline)
    throws Exception
  {
    SchemeSitemap sitemap = schemeSitemap(scm);
    StreamPipeline pipeline = streamPipeline(spipeline);

    // Obtain the 'type' attribute
    Value stype = assq(sargs, Symbol.get("type"));
    String type;
    if (!stype.eq(FALSE))
      type = string(pair(stype).cdr);
    else
      type = sitemap.getDefaultSerializerType();

    // Obtain the 'mime-type' attribute
    Value smimeType = assq(sargs, Symbol.get("mime-type"));
    String mimeType = null;
    if (!smimeType.eq(FALSE))
      mimeType = string(pair(smimeType).cdr);

    // Obtain the parameters
    Value sparams = assq(sargs, Symbol.get("params"));
    Parameters params = getParameters(sparams);

//     System.out.println("serialize type " + type
//                        + " params " + params + " mime-type " + mimeType);
   
    pipeline.setSerializer(type, null, params, mimeType);

    return spipeline;
  }
View Full Code Here

  public Value process(Value scm, Value senv, Value sargs, Value spipeline)
    throws Exception
  {
    SchemeSitemap sitemap = schemeSitemap(scm);
    Environment env = environment(senv);
    StreamPipeline pipeline = streamPipeline(spipeline);

    pipeline.process(env);

    sitemap.releasePipeline(pipeline);

    return null;
  }
View Full Code Here

  {
    EventPipeline eventPipeline
      = (EventPipeline)manager.lookup(EventPipeline.ROLE);
    eventPipeline.recompose(manager);

    StreamPipeline pipeline
      = (StreamPipeline)manager.lookup(StreamPipeline.ROLE);
    pipeline.setEventPipeline(eventPipeline);
    pipeline.recompose(manager);

    return pipeline;
  }
View Full Code Here

  {
    EventPipeline eventPipeline
      = (EventPipeline)manager.lookup(EventPipeline.ROLE);
    eventPipeline.recompose(manager);

    StreamPipeline pipeline
      = (StreamPipeline)manager.lookup(StreamPipeline.ROLE);
    pipeline.setEventPipeline(eventPipeline);
    pipeline.recompose(manager);

    return pipeline;
  }
View Full Code Here

    public final boolean invoke(Environment env,  InvokeContext context)
      throws Exception {

        List mapStack = context.getMapStack();

        StreamPipeline pipeline = context.getStreamPipeline();

        if (this.mimeType == null) {
            // No mime-type set on node
            pipeline.setReader(
                this.readerName,
                source.resolve(mapStack),
                MapStackResolver.buildParameters(this.parameters, mapStack)
            );

        } else {
            // mime-type set on node
            pipeline.setReader(
                this.readerName,
                source.resolve(mapStack),
                MapStackResolver.buildParameters(this.parameters, mapStack),
                this.mimeType
            );
        }

        // Set status code if there is one
        if (this.statusCode >= 0) {
            env.setStatus(this.statusCode);
        }

        if (! context.isInternalRequest()) {
            // Process pipeline
            return pipeline.process(env);

        } else {
            // Return true : pipeline is finished.
            return true;
        }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.pipeline.StreamPipeline

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.