Package org.apache.cocoon.sunshine.connector

Examples of org.apache.cocoon.sunshine.connector.Resource


                                        String role,
                                        String id,
                                        boolean adminProfile)
    throws ProcessingException, SAXException, javax.xml.transform.TransformerException {
        // calling method is synced
        Resource res = (Resource)config.get(Constants.CONF_STATUS_LOADRESOURCE);

        // remove the old status profile
        Node statusProfile = XMLUtil.getFirstNodeFromPath(profileRoot, new String[] {"status-profile"}, false);
        if (statusProfile != null) {
            profileRoot.removeChild(statusProfile);
        }

        if (res != null) {
            DocumentFragment userFragment;
            SourceParameters pars;
            pars = new SourceParameters();
            pars.setSingleParameterValue("ID", id);
            pars.setSingleParameterValue("role", role);
            pars.setSingleParameterValue("application", (String)this.request.getAttribute(org.apache.cocoon.sunshine.sunrise.Constants.REQUEST_ATTRIBUTE_APPLICATION_NAME));
            pars.setSingleParameterValue("handler", (String)this.request.getAttribute(org.apache.cocoon.sunshine.sunrise.Constants.REQUEST_ATTRIBUTE_HANDLER_NAME));
            pars.setSingleParameterValue("profile", "user-status");
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("loading user status profile");
            }
            userFragment = this.loadXML(res.getResourceType(), null,
                                        res.getResourceIdentifier(), pars,
                                        "Error loading user status profile " + res.getResourceIdentifier());
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("user status profile loaded");
            }
            this.addProfilePart(profileRoot, userFragment, null, "status-profile");
        }
View Full Code Here


                                       String role,
                                       String id,
                                       boolean adminProfile)
    throws ProcessingException, SAXException, javax.xml.transform.TransformerException {
        // calling method is synced
        Resource res = (Resource)config.get(Constants.CONF_STATUS_SAVERESOURCE);
        Element statusProfile = (Element)XMLUtil.getFirstNodeFromPath((DocumentFragment)profile.get(Constants.PROFILE_PROFILE),
                         new String[] {"profile","status-profile"}, false);
        if (res != null && statusProfile != null) {
            DocumentFragment userFragment = statusProfile.getOwnerDocument().createDocumentFragment();
            Element oldParent = (Element)statusProfile.getParentNode();
            Element saveStatus = (Element)statusProfile.cloneNode(true);
            userFragment.appendChild(saveStatus);
            // now filter all not persistent sunlets!
            NodeList list = XMLUtil.getNodeListFromPath(saveStatus, new String[] {"customization","sunlet"});
            String sunletID;
            String sunletNumber;
            Element sunlet;
            Element sunletConfig;
            Map sunletConfigs = (Map)profile.get(Constants.PROFILE_DEFAULT_SUNLETS);
            Map mediaSunletConfigs = (Map)profile.get(Constants.PROFILE_MEDIA_SUNLETS);
            boolean isPersistent;
            for(int i = 0; i < list.getLength(); i++) {
                sunlet = (Element)list.item(i);
                sunletID = sunlet.getAttributeNS(null, "id");
                sunletNumber = sunlet.getAttributeNS(null, "number");
                sunletConfig = this.getSunletConfiguration(sunletID, sunletConfigs, mediaSunletConfigs);
                isPersistent = XMLUtil.getValueAsBooleanOf(sunletConfig, "configuration/persistent", false);
                if (isPersistent == false) {
                    sunlet.getParentNode().removeChild(sunlet);
                }
            }

            try {

                SourceParameters pars;
                pars = new SourceParameters();
                pars.setSingleParameterValue("ID", id);
                pars.setSingleParameterValue("role", role);
                pars.setSingleParameterValue("application", (String)this.request.getAttribute(org.apache.cocoon.sunshine.sunrise.Constants.REQUEST_ATTRIBUTE_APPLICATION_NAME));
                pars.setSingleParameterValue("handler", (String)this.request.getAttribute(org.apache.cocoon.sunshine.sunrise.Constants.REQUEST_ATTRIBUTE_HANDLER_NAME));
                pars.setSingleParameterValue("profile", "user-status");

                this.getResourceConnector().saveXML(res.getResourceType(), null,
                              res.getResourceIdentifier(), pars,
                              userFragment);
            } finally {
                userFragment.removeChild(saveStatus);
            }
        }
View Full Code Here

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

            final Resource authenticationResource = myHandler.getAuthenticationResource();
            final String   authenticationResourceName = authenticationResource.getResourceIdentifier();
            final int      authenticationResourceType = authenticationResource.getResourceType();
            final SourceParameters authenticationParameters = authenticationResource.getResourceParameters();
            if (parameters != null) {
                parameters.add(authenticationParameters);
            } else {
                parameters = authenticationParameters;
            }
View Full Code Here

            this.getLogger().debug("BEGIN getUsers role="+role+", ID="+ID);
        }
        DocumentFragment frag = null;

        if (this.handler != null && this.handler.getLoadUsersResource() != null) {
            final Resource loadUsersResource = this.handler.getLoadUsersResource();
            final SourceParameters loadParameters = loadUsersResource.getResourceParameters();
            SourceParameters parameters = (loadParameters == null) ? new SourceParameters()
                                                                     : (SourceParameters)loadParameters.clone();
            if (this.applicationName != null)
                parameters.setSingleParameterValue("application", this.applicationName);
            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.getResourceConnector().loadXML(loadUsersResource.getResourceType(), null,
                                                       loadUsersResource.getResourceIdentifier(), parameters);
        }

        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("END getUsers fragment="+(frag == null ? "null" : XMLUtils.serializeNodeToXML(frag)));
        }
View Full Code Here

            this.getLogger().debug("BEGIN getRoles");
        }
        DocumentFragment frag = null;

        if (this.handler != null && this.handler.getLoadRolesResource() != null) {
            final Resource loadRolesResource = this.handler.getLoadRolesResource();
            final SourceParameters loadParameters = loadRolesResource.getResourceParameters();
            SourceParameters parameters = (loadParameters == null) ? new SourceParameters()
                                                                     : (SourceParameters)loadParameters.clone();
            if (this.applicationName != null)
                parameters.setSingleParameterValue("application", this.applicationName);
            parameters.setSingleParameterValue("type", "roles");
            frag = this.getResourceConnector().loadXML(loadRolesResource.getResourceType(), null,
                                                       loadRolesResource.getResourceIdentifier(), parameters);
        }

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

        // calling method is syned
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("BEGIN addRole role="+name+", parameters="+parameters);
        }
        if (this.handler != null && this.handler.getNewRoleResource() != null) {
            final Resource newRoleResource = this.handler.getNewRoleResource();
            final SourceParameters handlerPars = newRoleResource.getResourceParameters();
            if (parameters == null) parameters = new SourceParameters();
            parameters.add(handlerPars);

            if (this.applicationName != null)
                parameters.setSingleParameterValue("application", this.applicationName);
            parameters.setSingleParameterValue("type", "role");
            parameters.setSingleParameterValue("role", name);

            this.getResourceConnector().loadXML(newRoleResource.getResourceType(), null,
                                                newRoleResource.getResourceIdentifier(), parameters);
        }

        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("END addRole");
        }
View Full Code Here

                } catch (javax.xml.transform.TransformerException local) {
                    throw new ProcessingException("Transformer exception: " + local, local);
                }
            }
            if (user == null || node == null) {
                final Resource newUserResource = this.handler.getNewUserResource();
                final SourceParameters newUsersPars = newUserResource.getResourceParameters();
                if (parameters == null) parameters = new SourceParameters();
                parameters.add(newUsersPars);

                if (this.applicationName != null)
                    parameters.setSingleParameterValue("application", this.applicationName);
                parameters.setSingleParameterValue("type", "user");
                parameters.setSingleParameterValue("role", role);
                parameters.setSingleParameterValue("ID", ID);

                this.getResourceConnector().loadXML(newUserResource.getResourceType(), null,
                                                    newUserResource.getResourceIdentifier(), parameters);
                result = true;
            }
        }

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

        // calling method is syned
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("BEGIN deleteRole role="+name+", parameters="+parameters);
        }
        if (this.handler != null && this.handler.getDeleteRoleResource() != null) {
            final Resource deleteRoleResource = this.handler.getDeleteRoleResource();
            final SourceParameters handlerPars = deleteRoleResource.getResourceParameters();
            if (parameters == null) parameters = new SourceParameters();
            parameters.add(handlerPars);

            if (this.applicationName != null)
                parameters.setSingleParameterValue("application", this.applicationName);
            parameters.setSingleParameterValue("type", "role");
            parameters.setSingleParameterValue("role", name);

            this.getResourceConnector().loadXML(deleteRoleResource.getResourceType(), null,
                                                deleteRoleResource.getResourceIdentifier(), parameters);
        }

        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("END deleteRole");
        }
View Full Code Here

        // calling method is syned
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("BEGIN deleteUser role="+role+", ID="+name+", parameters="+parameters);
        }
        if (this.handler != null && this.handler.getDeleteUserResource() != null) {
            final Resource deleteUserResource = this.handler.getDeleteUserResource();
            final SourceParameters handlerPars = deleteUserResource.getResourceParameters();
            if (parameters == null) parameters = new SourceParameters();
            parameters.add(handlerPars);

            if (this.applicationName != null)
                parameters.setSingleParameterValue("application", this.applicationName);
            parameters.setSingleParameterValue("type", "user");
            parameters.setSingleParameterValue("role", role);
            parameters.setSingleParameterValue("ID", name);

            this.getResourceConnector().loadXML(deleteUserResource.getResourceType(), null,
                                                deleteUserResource.getResourceIdentifier(), parameters);
        }

        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("END deleteUser");
        }
View Full Code Here

        // calling method is syned
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("BEGIN changeUser role="+role+", ID="+name+", parameters="+parameters);
        }
        if (this.handler != null && this.handler.getChangeUserResource() != null) {
            final Resource changeUserResource = this.handler.getChangeUserResource();
            final SourceParameters handlerPars = changeUserResource.getResourceParameters();
            if (parameters == null) parameters = new SourceParameters();
            parameters.add(handlerPars);

            if (this.applicationName != null)
                parameters.setSingleParameterValue("application", this.applicationName);
            parameters.setSingleParameterValue("type", "user");
            parameters.setSingleParameterValue("role", role);
            parameters.setSingleParameterValue("ID", name);

            this.getResourceConnector().loadXML(changeUserResource.getResourceType(), null,
                                                changeUserResource.getResourceIdentifier(), parameters);
        }

        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("END changeUser");
        }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.sunshine.connector.Resource

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.