Package org.apache.cocoon

Examples of org.apache.cocoon.ProcessingException


            String searchName = deltaRoot.getNodeName().substring(0, deltaRoot.getNodeName().lastIndexOf("-delta"));
            searchName = searchName + "-profile";

            profileRoot = (Element)DOMUtil.getFirstNodeFromPath(profileRoot, new String[] {searchName}, false);
            if (profileRoot == null) {
                throw new ProcessingException("Importing Delta: Tag " + searchName + " not found in profile.");
            }

            // now import it
            this.importNode(profileRoot, (Element)deltaRoot);
        }
View Full Code Here


                if ( mode.equals("immediately") == true) {
                    sessionManager.terminateSession(true);
                } else if ( mode.equals("if-unused") == true ) {
                    sessionManager.terminateSession(false);
                } else {
                    throw new ProcessingException("Unknown mode " + mode + " for action " + action);
                }
            } else {
                throw new ProcessingException("Unknown action: " + action);
            }
        } catch (ComponentException ce) {
            throw new ProcessingException("Error during lookup of sessionManager component.", ce);
        } finally {
            this.manager.release( sessionManager );
        }

        return EMPTY_MAP;
View Full Code Here

                    try {
                        interpreter = (XMLDeserializer)this.manager.lookup(XMLDeserializer.ROLE);
                        interpreter.setConsumer(new IncludeXMLConsumer(consumer, consumer));
                        interpreter.deserialize(content);
                    } catch (ComponentException e) {
                        throw new ProcessingException("Component for XMLDeserializer not found." + e, e);
                    } finally {
                        if (interpreter != null) this.manager.release(interpreter);
                    }
                }
            } else {
View Full Code Here

                    try {
                        Configuration config;

                        Configuration conf = this.getAuthenticationManager().getModuleConfiguration(PortalConstants.AUTHENTICATION_MODULE_NAME);
                        if (conf == null) {
                            throw new ProcessingException("portal: Configuration for application '" + appName + "' not found.");
                        }
                        result = new HashMap(10, 2);
                        // auth-redirect (optional)
                        config = conf.getChild("auth-redirect", false);
                        if (config != null) {
                            result.put(PortalConstants.CONF_AUTH_REDIRECT, config.getValue());
                        }

                        // portal-uri (required)
                        config = conf.getChild("portal-uri", false);
                        if (config == null) {
                            throw new ProcessingException("portal: portal-uri required for application '"+appName+"'");
                        }
                        result.put(PortalConstants.CONF_PORTAL_URI, config.getValue());

                        // profile-cache (optional)
                        config = conf.getChild("profile-cache", false);
                        if (config != null && config.getValueAsBoolean() == true) {
                            result.put(PortalConstants.CONF_PROFILE_CACHE, appName);
                        }

                        // parallel coplets
                        config = conf.getChild("process-coplets-parallel", false);
                        if (config != null) {
                            result.put(PortalConstants.CONF_PARALLEL_COPLETS, new Boolean(config.getValueAsBoolean(false)));
                        } else {
                            result.put(PortalConstants.CONF_PARALLEL_COPLETS, new Boolean(false));
                        }

                        // timeout
                        config = conf.getChild("default-coplet-timeout", false);
                        if (config != null) {
                            result.put(PortalConstants.CONF_COPLET_TIMEOUT, new Long(config.getValueAsLong(600000)));
                        } else {
                            result.put(PortalConstants.CONF_COPLET_TIMEOUT, new Long(600000));
                        }

                        // and now the profile
                        config = conf.getChild("profile", false);
                        if (config == null) throw new ProcessingException("portal: profile configuration required for application '" + appName + "'");
                        Configuration child;

                        // build resource (optional)
                        child = config.getChild("buildprofile", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_BUILD_RESOURCE, child.getAttribute("uri"));
                        }

                        // base resource, type is optional
                        child = config.getChild("layout-base", false);
                        if (child == null) {
                            throw new ProcessingException("portal: layout-base required for application '" + appName + "'");
                        }
                        result.put(PortalConstants.CONF_LAYOUTBASE_RESOURCE, child.getAttribute("uri"));
                        child = config.getChild("coplet-base", false);
                        if (child == null) {
                            throw new ProcessingException("portal: coplet-base required for application '" + appName + "'");
                        }
                        result.put(PortalConstants.CONF_COPLETBASE_RESOURCE, child.getAttribute("uri"));
                        child = config.getChild("type-base", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_TYPEBASE_RESOURCE, child.getAttribute("uri"));
                        }

                        // coplet base save (is optional)
                        child = config.getChild("coplet-base-save", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_COPLETBASE_SAVE_RESOURCE, child.getAttribute("uri"));
                        }

                        // global delta (load required)
                        child = config.getChild("global-delta-load", false);
                        if (child == null) {
                            throw new ProcessingException("portal: global-delta-load required for application '" + appName + "'");
                        }
                        result.put(PortalConstants.CONF_GLOBALDELTA_LOADRESOURCE, child.getAttribute("uri"));
                        child = config.getChild("global-delta-save", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_GLOBALDELTA_SAVERESOURCE, child.getAttribute("uri"));
                        }
                        child = config.getChild("global-type-delta", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_GLOBALDELTA_TYPERESOURCE, child.getAttribute("uri"));
                        }

                        // role delta (optional)
                        child = config.getChild("role-delta-load", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_ROLEDELTA_LOADRESOURCE, child.getAttribute("uri"));
                        }
                        child = config.getChild("role-delta-save", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_ROLEDELTA_SAVERESOURCE, child.getAttribute("uri"));
                        }
                        child = config.getChild("role-type-delta", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_ROLEDELTA_TYPERESOURCE, child.getAttribute("uri"));
                        }

                        // User delta
                        child = config.getChild("user-delta-load", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_USERDELTA_LOADRESOURCE, child.getAttribute("uri"));
                        }
                        child = config.getChild("user-delta-save", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_USERDELTA_SAVERESOURCE, child.getAttribute("uri"));
                        }
                        child = config.getChild("user-type-delta", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_USERDELTA_TYPERESOURCE, child.getAttribute("uri"));
                        }

                        // Personal information
                        child = config.getChild("user-status-load", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_STATUS_LOADRESOURCE, child.getAttribute("uri"));
                        }
                        child = config.getChild("user-status-save", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_STATUS_SAVERESOURCE, child.getAttribute("uri"));
                        }

                        // Admin Type profil
                        child = config.getChild("admin-type-base", false);
                        if (child != null) {
                            result.put(PortalConstants.CONF_ADMIN_TYPE_BASE, child.getAttribute("uri"));
                        }

                        // store the config in the session
                        session.setAttribute(PortalConstants.ATTRIBUTE_CONFIGURATION + handlerName + ':' + appName, result);
                    } catch (ConfigurationException conf) {
                        throw new ProcessingException("ConfigurationException: " + conf, conf);
                    }
                }
            }

        }
View Full Code Here

            role = pars.getParameter("role", null);
        }

        Map map = this.getConfiguration();
        if (map == null) {
            throw new ProcessingException("portal Configuration not found.");
        }

        // is the configuration build by using a own resource?
        String resource = (String)map.get(PortalConstants.CONF_BUILD_RESOURCE);
        if (resource != null) {
View Full Code Here

        pars.setSingleParameterValue("profile", "coplet-base");

        // First load the base profiles: copletProfile + layoutProfile
        res = (String)config.get(PortalConstants.CONF_COPLETBASE_RESOURCE);
        if (res == null) {
            throw new ProcessingException("No configuration for portal-coplet base profile found.");
        }
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("Loading coplet base profile");
        }
        copletsFragment = SourceUtil.readDOM(res,
                               null,
                               pars,
                               this.resolver);

        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("coplet base profile loaded");
        }
        res = (String)config.get(PortalConstants.CONF_LAYOUTBASE_RESOURCE);
        if (res == null) {
            throw new ProcessingException("No configuration for portal-layout base profile found.");
        }
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("loading layout base profile");
        }
        pars.setSingleParameterValue("profile", "layout-base");
View Full Code Here

            this.getLogger().debug("BEGIN buildGlobalProfile profileRoot="+profileRoot+", config="+config+", adminProfile="+adminProfile);
        }
        DocumentFragment globalFragment;
        String res = (String)config.get(PortalConstants.CONF_GLOBALDELTA_LOADRESOURCE);
        if (res == null) {
            throw new ProcessingException("No configuration for portal-role delta profile found.");
        }
        SourceParameters pars = new SourceParameters();
        pars.setSingleParameterValue("application", this.getAuthenticationManager().getApplicationName());
        pars.setSingleParameterValue("handler", this.getAuthenticationManager().getHandlerName());
        pars.setSingleParameterValue("profile", "global-delta");
View Full Code Here

     */
    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
            throws ProcessingException, SAXException, IOException {

        if (src == null) {
            throw new ProcessingException("I need the paginate instructions (pagesheet) to continue. Set the 'src' attribute.");
        }

        try {
            this.level = 0;
            this.prefixMapping = false;
            this.inputSource = resolver.resolveURI(src);
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Using pagesheet: '" + this.inputSource.getURI()
                                  + "' in " + this + ", last modified: " + this.inputSource.getLastModified());
            }
            this.page = par.getParameterAsInteger("page", 1);
            this.item = par.getParameterAsInteger("item", 0);
            this.itemGroup = par.getParameter("item-group", "");
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Paginating with [page = " + this.page
                                  + ", item = " + this.item + ", item-group = " + this.itemGroup + "]");
            }

            this.request = ObjectModelHelper.getRequest(objectModel);
            this.requestURI = request.getRequestURI();

            // Get the pagesheet factory from the Store if available,
            // otherwise load it and put it into the store for further request
            if (store != null) {
                pagesheet = (Pagesheet) store.get(src);
            }

            // If not in the store or if pagesheet has changed, loads and stores it
            if (pagesheet == null || pagesheet.modifiedSince(inputSource.getLastModified())) {
                pagesheet = new Pagesheet();
                pagesheet.setLastModified(inputSource.getLastModified());
                parser.parse(new InputSource(inputSource.getInputStream()), pagesheet);
                if (store != null) {
                    store.store(src,pagesheet);
                }
            }

            // Clone it in order to avoid concurrency collisions since the
            // implementation is not reentrant.
            this.pagesheet = (Pagesheet) this.pagesheet.clone();
        } catch (SourceException se) {
            throw new ProcessingException("Could not retrieve source '"+src+"'", se);
        }
    }
View Full Code Here

                        throws ProcessingException, SAXException,
                               IOException {
        super.setup(resolver, objectModel, src, par);
        if (request==null) {
            getLogger().debug("no request object");
            throw new ProcessingException("no request object");
        }

        // set the XMLForm namespace as the one
        // this transformer is interested to work on
        namespaceURI = NS;
View Full Code Here

        this.handler = handler;
        this.name = name;
        if (name.indexOf('_') != -1
            || name.indexOf(':') != -1
            || name.indexOf('/') != -1) {
           throw new ProcessingException("application name must not contain one of the characters ':','_' or '/'.");
        }
        this.configurations = new HashMap(3, 2);
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.ProcessingException

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.