Package org.apache.excalibur.source

Examples of org.apache.excalibur.source.SourceParameters


    public SourceParameters createParameters(SourceParameters parameters,
                                               String             myHandler,
                                               String             path,
                                               String             appName)
    throws ProcessingException {
        if (parameters == null) parameters = new SourceParameters();

        // add all elements from inside the handler data
        this.addParametersFromAuthenticationXML(myHandler,
                                                "/data",
                                                parameters);
View Full Code Here


        // Element: loadxml
        } else if (name.equals(LOADCONTEXT_ELEMENT) == true) {
            String path       = (String)stack.pop();
            String contextName = (String)stack.pop();
            SourceParameters pars = this.endParametersRecording((SourceParameters)null);
            pars.setSingleParameterValue("contextname", contextName);
            pars.setSingleParameterValue("path", path);

            this.getSessionManager().getContext(contextName).loadXML(path,
                                                                        pars,
                                                                        this.objectModel,
                                                                        this.resolver,
View Full Code Here

        if (this.handler != null) {
            isAuthenticated = this.isAuthenticated(this.handlerName);

            if (isAuthenticated == false) {
                // create parameters
                SourceParameters parameters = handler.getRedirectParameters();
                if (parameters == null) parameters = new SourceParameters();
                String resource = this.request.getRequestURI();
                if (this.request.getQueryString() != null) {
                    resource += '?' + this.request.getQueryString();
                }

                parameters.setSingleParameterValue("resource", resource);
                final String redirectURI = handler.getRedirectURI();
                redirector.globalRedirect(false, SourceUtil.appendParameters(redirectURI, parameters));
            } else {
                // load application data if we are not inside a resource loading of authentication
                this.checkLoaded((SessionContextImpl)this.getSessionManager().getContext(AuthenticationConstants.SESSION_CONTEXT_NAME),
View Full Code Here

            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("start authentication");
            }

            final String   authenticationResourceName = myHandler.getAuthenticationResource();
            final SourceParameters authenticationParameters = myHandler.getAuthenticationResourceParameters();
            if (parameters != null) {
                parameters.add(authenticationParameters);
            } else {
                parameters = authenticationParameters;
            }
View Full Code Here

        synchronized(o) {

            if (appHandler.getIsLoaded() == false) {

                final String   loadResourceName = appHandler.getLoadResource();
                SourceParameters parameters = appHandler.getLoadResourceParameters();
                if (parameters != null) parameters = (SourceParameters)parameters.clone();
                parameters = this.createParameters(parameters,
                                                   appHandler.getHandler().getName(),
                                                   path,
                                                   appHandler.getName());
                DocumentFragment fragment;
View Full Code Here

     */
    public SourceParameters createParameters(String path)
    throws ProcessingException {
        // synchronized
        if (this.handler == null) {
            return new SourceParameters();
        }
        if (path == null) {
            SessionContext context = this.getAuthenticationSessionContext(false);
            SourceParameters pars = (SourceParameters)context.getAttribute("cachedparameters_" + this.handler.getName());
            if (pars == null) {
                 pars = this.createParameters(null, this.handlerName, path, this.applicationName);
                 context.setAttribute("cachedparameters_" + this.handler.getName(), pars);
            }
            return pars;
View Full Code Here

        // Element: savexml
        } else if (name.equals(SAVECONTEXT_ELEMENT) == true) {
            String path        = (String)stack.pop();
            String contextName = (String)stack.pop();
            SourceParameters pars = this.endParametersRecording((SourceParameters)null);
            pars.setSingleParameterValue("contextname", contextName);
            pars.setSingleParameterValue("path", path);

            this.getSessionManager().getContext(contextName).saveXML(path,
                                                                        pars,
                                                                        this.objectModel,
                                                                        this.resolver,
View Full Code Here

            }

            if (state.equals("addrole") == true) {
                String role = request.getParameter(REQ_PARAMETER_ROLE);
                if (role != null && role.trim().length() > 0) {
                    SourceParameters pars = new SourceParameters();
                    // first include all request parameters
                    Enumeration requestParameters = request.getParameterNames();
                    String current;
                    while (requestParameters.hasMoreElements() == true) {
                        current = (String)requestParameters.nextElement();
                        pars.setParameter(current, request.getParameter(current));
                    }
                    this.addRole(role, pars, handler);
                } else {
                    role = null;
                }
                session.removeAttribute(SESSION_CONTEXT_ATTRIBUTE_ADMIN_ROLE);
            }

            if (state.equals("delrole") == true) {
                try {
                    String role = request.getParameter(REQ_PARAMETER_ROLE);
                    if (role != null) {
                        // first delete user
                        Document userDF = this.getUsers(role, null, handler);
                        NodeList users   = null;
                        if (userDF != null) users = DOMUtil.selectNodeList(userDF, "users/user");
                        if (users != null) {
                            for(int i = 0; i < users.getLength(); i++) {
                                this.deleteUser(role, DOMUtil.getValueOf(users.item(i), "ID"), null, handler);
                            }
                        }
                        this.deleteRole(role, null, handler);
                    }
                    session.removeAttribute(SESSION_CONTEXT_ATTRIBUTE_ADMIN_ROLE);
                } catch (javax.xml.transform.TransformerException local) {
                    throw new ProcessingException("TransformerException: " + local, local);
                }
            }


            if (state.equals("chguser") == true) {
                String role;
                String id;
                String user;

                if (isAdmin == false) {
                    SourceParameters pars = authManager.createParameters(null);
                    id = pars.getParameter("ID", null);
                    role = pars.getParameter("role", null);
                    user = "old";
                } else {
                    role = request.getParameter(REQ_PARAMETER_ROLE);
                    id   = request.getParameter(REQ_PARAMETER_ID);
                    user = request.getParameter(REQ_PARAMETER_USER);
                }

                boolean addingNewUserFailed = false;
                if (role != null && id != null && user != null) {
                    if (user.equals("new") == true) {
                        SourceParameters pars = new SourceParameters();
                        // first include all request parameters
                        Enumeration requestParameters = request.getParameterNames();
                        String current;
                        while (requestParameters.hasMoreElements() == true) {
                            current = (String)requestParameters.nextElement();
                            pars.setParameter(current, request.getParameter(current));
                        }
                        addingNewUserFailed = !this.addUser(role, id, pars, handler);
                        if (addingNewUserFailed == false) {
                            consumer.startElement("", "addeduser", "addeduser", attr);
                            consumer.characters(id.toCharArray(), 0, id.length());
                            consumer.endElement("", "addeduser", "addeduser");
                        }
                    } else {
                        String delete = request.getParameter("authdeluser");
                        if (delete != null && delete.equals("true") == true) {
                            this.deleteUser(role, id, null, handler);
                        } else {
                            SourceParameters pars = new SourceParameters();
                            // first include all request parameters
                            Enumeration requestParameters = request.getParameterNames();
                            String current;
                            while (requestParameters.hasMoreElements() == true) {
                                current = (String)requestParameters.nextElement();
                                pars.setParameter(current, request.getParameter(current));
                            }
                            this.changeUser(role, id, pars, handler);
                        }
                    }
                    session.removeAttribute(SESSION_CONTEXT_ATTRIBUTE_ADMIN_ROLE);
                }
                if (addingNewUserFailed == false) {
                    state = (isAdmin == true ? "adduser" : "seluser");
                } else {
                    state = "erruser";
                }
            }

            if (state.equals("seluser") == true) {
                String role;
                String id;

                if (isAdmin == false) {
                    SourceParameters pars = authManager.createParameters(null);
                    id = pars.getParameter("ID", null);
                    role = pars.getParameter("role", null);
                } else {
                    role = request.getParameter(REQ_PARAMETER_ROLE);
                    id   = request.getParameter(REQ_PARAMETER_ID);
                }
                if (role != null && id != null) {
                    session.setAttribute(SESSION_CONTEXT_ATTRIBUTE_ADMIN_ROLE, role);

                    // include users
                    Document userDF = this.getUsers(role, id, handler);
                    Element  users   = null;
                    try {
                        if (userDF != null) users = (Element)DOMUtil.getSingleNode(userDF, "users/user");
                    } catch (javax.xml.transform.TransformerException local) {
                        throw new ProcessingException("TransformerException: " + local, local);
                    }
                    consumer.startElement("", "uservalues", "uservalues", attr);
                    if (users != null && users.hasChildNodes() == true) {
                        NodeList childs = users.getChildNodes();
                        for(int i = 0; i < childs.getLength(); i++) {
                            if (childs.item(i).getNodeType() == Node.ELEMENT_NODE)
                                IncludeXMLConsumer.includeNode(childs.item(i), consumer, consumer);
                        }
                    }
                    consumer.endElement("", "uservalues", "uservalues");
                }
                consumer.startElement("", "user", "user", attr);
                consumer.characters("old".toCharArray(), 0, 3);
                consumer.endElement("", "user", "user");
                if (isAdmin == false) {
                    consumer.startElement("", "role", "role", attr);
                    consumer.characters(role.toCharArray(), 0, role.length());
                    consumer.endElement("", "role", "role");
               }
            }

            if (state.equals("erruser") == true) {
                String role;
                String id;

                if (isAdmin == false) {
                    SourceParameters pars = authManager.createParameters(null);
                    id = pars.getParameter("ID", null);
                    role = pars.getParameter("role", null);
                } else {
                    role = request.getParameter(REQ_PARAMETER_ROLE);
                    id   = request.getParameter(REQ_PARAMETER_ID);
                }
                if (role != null && id != null) {
View Full Code Here

        }
        Document frag = null;

        if (handler.getLoadUsersResource() != null) {
            final String loadUsersResource = handler.getLoadUsersResource();
            final SourceParameters loadParameters = handler.getLoadUsersResourceParameters();
            SourceParameters parameters = (loadParameters == null) ? new SourceParameters()
                                                                     : (SourceParameters)loadParameters;
            if (handler.getApplicationName() != null) {
                parameters.setSingleParameterValue("application", handler.getApplicationName());
            }
            if (ID != null) {
                parameters.setSingleParameterValue("type", "user");
                parameters.setSingleParameterValue("ID", ID);
            } else {
                parameters.setSingleParameterValue("type", "users");
            }
            if (role != null) parameters.setSingleParameterValue("role", role);
            frag = this.loadResource(loadUsersResource, parameters);

        }

        if (this.getLogger().isDebugEnabled() == true) {
View Full Code Here

        }
        Document frag = null;

        if (handler.getLoadRolesResource() != null) {
            final String loadRolesResource = handler.getLoadRolesResource();
            final SourceParameters loadParameters = handler.getLoadRolesResourceParameters();
            SourceParameters parameters = (loadParameters == null) ? new SourceParameters()
                                                                     : (SourceParameters)loadParameters.clone();
            if (handler.getApplicationName() != null)
                parameters.setSingleParameterValue("application", handler.getApplicationName());
            parameters.setSingleParameterValue("type", "roles");
            frag = this.loadResource(loadRolesResource, parameters);
        }

        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("END getRoles fragment="+frag);
View Full Code Here

TOP

Related Classes of org.apache.excalibur.source.SourceParameters

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.