Examples of InputModule


Examples of org.apache.cocoon.components.modules.input.InputModule

            Object[] values;
            String cname = getOutputName( tableConf, column.columnConf );

            // obtain input module and read values
            ComponentSelector inputSelector = null;
            InputModule input = null;
            try {
                inputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR);
                if (column.mode != null && inputSelector != null && inputSelector.hasComponent(column.mode)){
                    input = (InputModule) inputSelector.select(column.mode);
                }

                if ( column.isSet ){
                    if (getLogger().isDebugEnabled())
                        getLogger().debug( "Trying to set column " + cname +" from "+column.mode+" using getAttributeValues method");
                    values = input.getAttributeValues( cname, column.modeConf, objectModel );
                } else {
                    if (getLogger().isDebugEnabled())
                        getLogger().debug( "Trying to set column " + cname +" from "+column.mode+" using getAttribute method");
                    values = new Object[1];
                    values[0] = input.getAttribute( cname, column.modeConf, objectModel );
                }

                if ( values != null ) {
                    for ( int i = 0; i < values.length; i++ ) {
                        if (getLogger().isDebugEnabled())
View Full Code Here

Examples of org.apache.cocoon.components.modules.input.InputModule

     * Obtain values from the used InputModule.
     */
    private Object[] getValues(String name) {
        Object[] values = null;
        ComponentSelector iputSelector = null;
        InputModule iput = null;
        try {
            if (this.input != null) {
                // input module is thread safe
                // thus we still have a reference to it
                values = input.getAttributeValues(name,this.inputConf,objectModel);
                if (getLogger().isDebugEnabled())
                    getLogger().debug("cached module "+this.input+" attribute "+name+" returns "+values);
            } else {
                // input was not thread safe
                // so acquire it again
                iputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR);
                if (this.inputName != null
                    && iputSelector != null
                    && iputSelector.hasComponent(this.inputName)) {
                   
                    iput = (InputModule) iputSelector.select(this.inputName);
                }
                if (iput != null) {
                    values = iput.getAttributeValues(name, this.inputConf, objectModel);
                }          
                if (getLogger().isDebugEnabled())
                    getLogger().debug("fresh module "+iput+" attribute "+name+" returns "+values);
            }
        } catch (Exception e) {
View Full Code Here

Examples of org.apache.cocoon.components.modules.input.InputModule

        // 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 inputSelector = (ComponentSelector)sitemapManager
            .lookup(InputModule.ROLE + "Selector");
        InputModule input = (InputModule) inputSelector.select(type);
        Object result = null;
        try {
            result = input.getAttribute(attribute, null,
                                        this.environment.getObjectModel());
        } finally {
            inputSelector.release(input);
        }
        return result;
View Full Code Here

Examples of org.apache.cocoon.components.modules.input.InputModule

     * @exception RuntimeException if an error occurs
     */
    private Object get(int op, String name, String attr, Map objectModel, Configuration conf) throws RuntimeException {

        Object value = null;
        InputModule input = null;

        if (this.inputModules == null)
            this.inputModules = new HashMap();
        else
            if (this.inputModules.containsKey(name))
                input = (InputModule) this.inputModules.get(name);

        try {

            if (this.inputSelector == null)
                this.inputSelector = (ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR);
       
            if (input == null) {
                if (this.inputSelector.hasComponent(name)) {
                    input = (InputModule) this.inputSelector.select(name);
                    this.inputModules.put(name, input);
                } else {
                    throw new RuntimeException("No such InputModule: "+name);
                }
            }

            switch (op) {
            case OP_GET:   
                value = input.getAttribute(attr, conf, objectModel);
                break;
            case OP_VALUES:
                value = input.getAttributeValues(attr, conf, objectModel);
                break;
            case OP_NAMES:
                value = input.getAttributeNames(conf, objectModel);
                break;
            };

        } catch (Exception e) {
            throw new CascadingRuntimeException("A problem obtaining a value from "+name+" occurred: "+e,e);
View Full Code Here

Examples of org.apache.cocoon.components.modules.input.InputModule

            Object[] values;
            String cname = getOutputName( tableConf, column.columnConf );
           
            // obtain input module and read values
            ComponentSelector inputSelector = null;
            InputModule input = null;
            try {
                inputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR);
                if (column.mode != null && inputSelector != null && inputSelector.hasComponent(column.mode)){
                    input = (InputModule) inputSelector.select(column.mode);
                }

                if ( column.isSet ){
                    if (getLogger().isDebugEnabled())
                        getLogger().debug( "Trying to set column " + cname +" using getAttributeValues method");
                    values = input.getAttributeValues( cname, column.modeConf, request );
                } else {
                    if (getLogger().isDebugEnabled())
                        getLogger().debug( "Trying to set column " + cname +" using getAttribute method");
                    values = new Object[1];
                    values[0] = input.getAttribute( cname, column.modeConf, request );
                }

                if ( values != null ) {
                    for ( int i = 0; i < values.length; i++ ) {
                        if (getLogger().isDebugEnabled())
View Full Code Here

Examples of org.apache.cocoon.components.modules.input.InputModule

            }
        } else {
            // input was not thread safe
            // so acquire it again
            ComponentSelector iputSelector = null;
            InputModule iput = null;
            try {
                // obtain input module
                iputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR);
                if (inputName != null && iputSelector != null && iputSelector.hasComponent(inputName)){
                    iput = (InputModule) iputSelector.select(inputName);
                }
                if (iput != null) {
                    result = iput.getAttribute(paramName, this.inputConf, ObjectModelHelper.getRequest(objectModel));
                }
            } catch (Exception e) {
                if (getLogger().isWarnEnabled())
                    getLogger().warn("A problem occurred acquiring Parameter '" + paramName
                                     + "' from '" + inputName + "': " + e.getMessage());
View Full Code Here

Examples of org.apache.cocoon.components.modules.input.InputModule

            if (getLogger().isWarnEnabled())
                getLogger().warn("No input module given. FAILING");
            return null;
        }

        InputModule input = null;
        ComponentSelector inputSelector = null;
        Object result = null;

        // one could test whether the input module is ThreadSafe and
        // keep a reference for that instance. Then one would need
        // to implement Disposable in order to release it at EOL
        // That would probably speed up things a lot. Especially, since
        // matchers are invoked very often.
        // Perhaps a CachingWildcardMatcher ?

        try {
            // obtain input module
            inputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR);
            if (inputName != null && inputSelector != null && inputSelector.hasComponent(inputName)){
                input = (InputModule) inputSelector.select(inputName);
            }
            if (input != null) {
                result = input.getAttribute(paramName, this.inputConf,
                                                     ObjectModelHelper.getRequest(objectModel));
            }
        } catch (Exception e) {
            if (getLogger().isWarnEnabled())
                getLogger().warn("A problem occurred acquiring Parameter '" + paramName
View Full Code Here

Examples of org.apache.cocoon.components.modules.input.InputModule

     * Obtain values from the used InputModule.
     */
    private Object[] getValues(String name) {
        Object[] values = null;
        ServiceSelector iputSelector = null;
        InputModule iput = null;
        try {
            if (this.input != null) {
                // input module is thread safe
                // thus we still have a reference to it
                values = input.getAttributeValues(name, this.inputConf, objectModel);
                if (getLogger().isDebugEnabled())
                    getLogger().debug("cached module " + this.input
                                      + " attribute " + name
                                      + " returns " + values);
            } else {
                // input was not thread safe
                // so acquire it again
                iputSelector = (ServiceSelector)this.manager.lookup(INPUT_MODULE_SELECTOR);
                if (this.inputName != null
                    && iputSelector != null
                    && iputSelector.isSelectable(this.inputName)) {

                    iput = (InputModule) iputSelector.select(this.inputName);
                }
                if (iput != null) {
                    values = iput.getAttributeValues(name, this.inputConf, objectModel);
                }
                if (getLogger().isDebugEnabled())
                    getLogger().debug(
                        "fresh module " + iput + " attribute " + name + " returns " + values);
            }
View Full Code Here

Examples of org.apache.cocoon.components.modules.input.InputModule

            Object[] values;
            String cname = getOutputName( tableConf, column.columnConf );

            // obtain input module and read values
            ServiceSelector inputSelector = null;
            InputModule input = null;
            try {
                inputSelector = (ServiceSelector) this.manager.lookup(INPUT_MODULE_SELECTOR);
                if (column.mode != null && inputSelector != null && inputSelector.isSelectable(column.mode)){
                    input = (InputModule) inputSelector.select(column.mode);
                }

                if (column.isSet) {
                    if (getLogger().isDebugEnabled())
                        getLogger().debug( "Trying to set column " + cname +" from "+column.mode+" using getAttributeValues method");
                    values = input.getAttributeValues( cname, column.modeConf, objectModel );
                } else {
                    if (getLogger().isDebugEnabled())
                        getLogger().debug( "Trying to set column " + cname +" from "+column.mode+" using getAttribute method");
                    values = new Object[1];
                    values[0] = input.getAttribute( cname, column.modeConf, objectModel );
                }

                if ( values != null ) {
                    for ( int i = 0; i < values.length; i++ ) {
                        if (getLogger().isDebugEnabled())
View Full Code Here

Examples of org.apache.cocoon.components.modules.input.InputModule

                throw new PatternException("Cannot access input modules selector", ce);
            }
        }
       
        // Get the module
        InputModule module;
        try {
            module = (InputModule)this.selector.select(moduleName);
        } catch(ComponentException ce) {
            throw new PatternException("Cannot get InputModule named '" + moduleName +
                "' in expression '" + this.originalExpr + "'", ce);
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.