Examples of OutputModule


Examples of org.apache.cocoon.components.modules.output.OutputModule

        // since no new components can be declared on sitemap we could
        // very well use the 'other' one here. Anyway, since it's there...
        ComponentManager sitemapManager = CocoonComponentManager.getSitemapComponentManager();
        ComponentSelector outputSelector = (ComponentSelector)sitemapManager
            .lookup(OutputModule.ROLE + "Selector");
        OutputModule output = (OutputModule) outputSelector.select(type);
        try {
            output.commit(null, this.environment.getObjectModel());
        } finally {
            outputSelector.release(output);
        }
    }
View Full Code Here

Examples of org.apache.cocoon.components.modules.output.OutputModule

        // since no new components can be declared on sitemap we could
        // very well use the 'other' one here. Anyway, since it's there...
        ComponentManager sitemapManager = CocoonComponentManager.getSitemapComponentManager();
        ComponentSelector outputSelector = (ComponentSelector)sitemapManager
            .lookup(OutputModule.ROLE + "Selector");
        OutputModule output = (OutputModule) outputSelector.select(type);
        try {
            output.rollback(null, this.environment.getObjectModel(), null);
        } finally {
            outputSelector.release(output);
        }
    }
View Full Code Here

Examples of org.apache.cocoon.components.modules.output.OutputModule

     * @param doc a <code>Document</code> value
     */
    public void handleExtractedDocument(Document doc) {
       
        ServiceSelector outputSelector = null;
        OutputModule output = null;

        try {
            if (getLogger().isDebugEnabled())
                getLogger().debug("wrote ['"+this.instanceName+"'] to "+output+" using "+outputConf);
            outputSelector = (ServiceSelector) this.manager.lookup(OUTPUT_MODULE_SELECTOR);
            if (outputSelector.isSelectable(this.outputModuleName)) {
                output = (OutputModule) outputSelector.select(this.outputModuleName);
            }
            output.setAttribute(outputConf, this.objectModel, this.instanceName, new DocumentWrapper(doc));
            output.commit(outputConf, this.objectModel);
            if (getLogger().isDebugEnabled())
                getLogger().debug("wrote ['"+this.instanceName+"'] to "+output+" using "+outputConf);

        } catch (Exception e) {
            if (getLogger().isWarnEnabled())
View Full Code Here

Examples of org.apache.cocoon.components.modules.output.OutputModule

     * with the name of this class to prevent potential name collisions.
     */
    protected void setOutputAttribute(Map objectModel, String outputMode, String key, Object value) {

        ServiceSelector outputSelector = null;
        OutputModule output = null;
        try {
            outputSelector = (ServiceSelector) this.manager.lookup(OUTPUT_MODULE_SELECTOR);
            if (outputMode != null && outputSelector != null && outputSelector.isSelectable(outputMode)){
                output = (OutputModule) outputSelector.select(outputMode);
            }
            output.setAttribute( null, objectModel, key, value );
        } catch (Exception e) {
                if (getLogger().isWarnEnabled()) {
                    getLogger().warn("Could not select output mode "
                                     + outputMode + ":" + e.getMessage());
                }
View Full Code Here

Examples of org.apache.cocoon.components.modules.output.OutputModule

            if (conn.getAutoCommit()==false)
                conn.commit();

            // obtain output mode module and rollback output
            ServiceSelector outputSelector = null;
            OutputModule output = null;
            try {
                outputSelector = (ServiceSelector) this.manager.lookup(OUTPUT_MODULE_SELECTOR);
                if (outputMode != null && outputSelector != null && outputSelector.isSelectable(outputMode)){
                    output = (OutputModule) outputSelector.select(outputMode);
                }
                output.commit(null, objectModel);
            } catch (Exception e) {
                if (getLogger().isWarnEnabled()) {
                    getLogger().warn("Could not select output mode "
                                     + outputMode + ":" + e.getMessage());
                }
            } finally {
                if (outputSelector != null) {
                    if (output != null)
                        outputSelector.release(output);
                    this.manager.release(outputSelector);
                }
            }

        } catch (Exception e) {
            failed = true;
            if ( conn != null ) {
                try {
                    if (getLogger().isDebugEnabled()) {
                        getLogger().debug( "Rolling back transaction. Caused by " + e.getMessage() );
                        e.printStackTrace();
                    }
                    conn.rollback();
                    results = null;

                    // obtain output mode module and commit output
                    ServiceSelector outputSelector = null;
                    OutputModule output = null;
                    try {
                        outputSelector = (ServiceSelector) this.manager.lookup(OUTPUT_MODULE_SELECTOR);
                        if (outputMode != null && outputSelector != null && outputSelector.isSelectable(outputMode)){
                            output = (OutputModule) outputSelector.select(outputMode);
                        }
                        output.rollback( null, objectModel, e);
                    } catch (Exception e2) {
                        if (getLogger().isWarnEnabled()) {
                            getLogger().warn("Could not select output mode "
                                       + outputMode + ":" + e2.getMessage());
                        }
View Full Code Here

Examples of org.apache.cocoon.components.modules.output.OutputModule

    String source,
    Parameters parameters)
    throws Exception {

    // general setup
    OutputModule output = null;
    ServiceSelector outputSelector = null;

    // I don't like this. Have a better idea to return two values.   
    Object[] obj = this.readParameters(parameters);
    String outputName = (String) obj[0];
    boolean storeEmpty = ((Boolean) obj[1]).booleanValue();

    Configuration outputConf = null;
    if (outputName == null) {
      outputName = this.outputName;
      outputConf = this.outputConf;
    }

    Map actionMap = new HashMap();

    try {
      outputSelector =
        (ServiceSelector) this.manager.lookup(OUTPUT_MODULE_SELECTOR);
      if (outputName != null
        && outputSelector != null
        && outputSelector.isSelectable(outputName)) {

        output = (OutputModule) outputSelector.select(outputName);

        String[] names = parameters.getNames();

        // parameters
        for (int i = 0; i < names.length; i++) {
          String sessionParamName = names[i];
          String value = parameters.getParameter(sessionParamName);
          if (storeEmpty || (value != null && !value.equals(""))) {
            if (getLogger().isDebugEnabled()) {
              getLogger().debug(
                "Propagating value "
                  + value
                  + " to output module"
                  + sessionParamName);
            }
            output.setAttribute(
              outputConf,
              objectModel,
              sessionParamName,
              value);
            actionMap.put(sessionParamName, value);
          }
        }

        // defaults, that are not overridden
        for (Iterator i = defaults.iterator(); i.hasNext();) {
          Entry entry = (Entry) i.next();
          if (!actionMap.containsKey(entry.key)) {
            if (getLogger().isDebugEnabled()) {
              getLogger().debug(
                "Propagating default value "
                  + entry.value
                  + " to session attribute "
                  + entry.key);
            }
            output.setAttribute(
              outputConf,
              objectModel,
              entry.key,
              entry.value);
            actionMap.put(entry.key, entry.value);
          }
        }

        output.commit(outputConf, objectModel);
      }
    } catch (Exception e) {
      if (output != null) {
        output.rollback(outputConf, objectModel, e);
      }
      throw e;
    } finally {
      if (outputSelector != null) {
        if (output != null)
View Full Code Here

Examples of org.apache.cocoon.components.modules.output.OutputModule

        }

        // Action results map
        final Map results = new HashMap();

        OutputModule output = null;
        ServiceSelector selector = null;
        try {
            selector = (ServiceSelector) this.manager.lookup(OutputModule.ROLE + "Selector");
            if (outputName != null
                && selector != null
                && selector.isSelectable(outputName)) {

                output = (OutputModule) selector.select(outputName);

                String[] names = parameters.getNames();
                for (int i = 0; i < names.length; i++) {
                    String name = names[i];
                    String value = parameters.getParameter(name);
                    if (storeEmpty || (value != null && !value.equals(""))) {
                        if (getLogger().isDebugEnabled()) {
                            getLogger().debug("Propagating <" + name + "> value <" + value + ">");
                        }
                        output.setAttribute(outputConf,
                                            objectModel,
                                            name,
                                            value);
                        results.put(name, value);
                    }
                }

                // Defaults, that are not overridden
                for (Iterator i = defaults.iterator(); i.hasNext();) {
                    Entry entry = (Entry) i.next();
                    if (!results.containsKey(entry.key)) {
                        if (getLogger().isDebugEnabled()) {
                            getLogger().debug("Propagating default <" + entry.key + "> value <" + entry.value + ">");
                        }
                        output.setAttribute(outputConf,
                                            objectModel,
                                            entry.key,
                                            entry.value);
                        results.put(entry.key, entry.value);
                    }
                }

                output.commit(outputConf, objectModel);
            }
        } catch (Exception e) {
            if (output != null) {
                output.rollback(outputConf, objectModel, e);
            }
            throw e;
        } finally {
            if (selector != null) {
                if (output != null) {
View Full Code Here

Examples of org.apache.cocoon.components.modules.output.OutputModule

     * @param doc a <code>Document</code> value
     */
    public void handleExtractedDocument(Document doc) {
       
        ServiceSelector outputSelector = null;
        OutputModule output = null;

        try {
            if (getLogger().isDebugEnabled())
                getLogger().debug("wrote ['"+this.instanceName+"'] to "+output+" using "+outputConf);
            outputSelector = (ServiceSelector) this.manager.lookup(OUTPUT_MODULE_SELECTOR);
            if (outputSelector.isSelectable(this.outputModuleName)) {
                output = (OutputModule) outputSelector.select(this.outputModuleName);
            }
            output.setAttribute(outputConf, this.objectModel, this.instanceName, new DocumentWrapper(doc));
            output.commit(outputConf, this.objectModel);
            if (getLogger().isDebugEnabled())
                getLogger().debug("wrote ['"+this.instanceName+"'] to "+output+" using "+outputConf);

        } catch (Exception e) {
            if (getLogger().isWarnEnabled())
View Full Code Here

Examples of org.apache.cocoon.components.modules.output.OutputModule

    private void setOutputAttribute( String outputModuleName,
                                     String attributeName, Object value )
        throws SAXException{
        ServiceSelector selector = null;
        OutputModule outputModule = null;
        try {
            selector = (ServiceSelector) this.manager.lookup( OutputModule.ROLE + "Selector" );
            outputModule = (OutputModule) selector.select( outputModuleName );
            outputModule.setAttribute( null, this.objectModel, attributeName, value );
            outputModule.commit( null, this.objectModel );

        } catch ( ServiceException e ) {
            throw new SAXException( "Could not find an OutputModule of the type " +
                                    outputModuleName , e );
        } finally {
View Full Code Here

Examples of org.apache.cocoon.components.modules.output.OutputModule

    private void setOutputAttribute( String outputModuleName,
                                     String attributeName, Object value )
        throws SAXException{
        ServiceSelector selector = null;
        OutputModule outputModule = null;
        try {
            selector = (ServiceSelector) this.manager.lookup( OutputModule.ROLE + "Selector" );
            outputModule = (OutputModule) selector.select( outputModuleName );
            outputModule.setAttribute( null, this.objectModel, attributeName, value );
            outputModule.commit( null, this.objectModel );

        } catch ( ServiceException e ) {
            throw new SAXException( "Could not find an OutputModule of the type " +
                                    outputModuleName , e );
        } finally {
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.