Package org.apache.cocoon.sunshine.connector

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


                        Configuration child;

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

                        // base resource, type is optional
                        child = config.getChild("layout-base", false);
                        if (child == null) {
                            throw new ProcessingException("sunSpot: layout-base required for application '" + appName + "'");
                        }
                        result.put(Constants.CONF_LAYOUTBASE_RESOURCE, new Resource(this.resolver,
                                                                                    child.getAttribute("uri")));
                        child = config.getChild("sunlet-base", false);
                        if (child == null) {
                            throw new ProcessingException("sunSpot: sunlet-base required for application '" + appName + "'");
                        }
                        result.put(Constants.CONF_SUNLETBASE_RESOURCE, new Resource(this.resolver,
                                                                                    child.getAttribute("uri")));
                        child = config.getChild("type-base", false);
                        if (child != null) {
                            result.put(Constants.CONF_TYPEBASE_RESOURCE, new Resource(this.resolver,
                                                                                      child.getAttribute("uri")));
                        }

                        // sunlet base save (is optional)
                        child = config.getChild("sunlet-base-save", false);
                        if (child != null) {
                            result.put(Constants.CONF_SUNLETBASE_SAVE_RESOURCE, new Resource(this.resolver,
                                                                                             child.getAttribute("uri")));
                        }

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

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

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

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

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

                        // store the config in the session
                        session.setAttribute(Constants.ATTRIBUTE_CONFIGURATION + handlerName + ':' + appName, result);
View Full Code Here


        if (map == null) {
            throw new ProcessingException("sunSpot Configuration not found.");
        }

        // is the configuration build by using a own resource?
        Resource resource = (Resource)map.get(Constants.CONF_BUILD_RESOURCE);
        if (resource != null) {
            if (this.getLogger().isInfoEnabled() == true) {
                this.getLogger().info("Building sunSpot profile: " + resource.getResourceIdentifier());
            }
            this.getResourceConnector().loadXML(resource.getResourceType(),null,
                                       resource.getResourceIdentifier(),pars);
        } else {
            this.buildProfile(type, role, id, adminProfile);
        }

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

        DocumentFragment layoutFragment;
        DocumentFragment typeFragment;
        DocumentFragment profile;
        Document         profileDoc;
        Element          profileRoot;
        Resource         res;

        SourceParameters pars = new SourceParameters();
        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", "sunlet-base");

        // First load the base profiles: sunletProfile + layoutProfile
        res = (Resource)config.get(Constants.CONF_SUNLETBASE_RESOURCE);
        if (res == null) {
            throw new ProcessingException("No configuration for sunSpot-sunlet base profile found.");
        }
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("Loading sunLet base profile");
        }
        sunletsFragment = this.loadXML(res.getResourceType(), null,
                                       res.getResourceIdentifier(), pars,
                                       "Error loading sunLet base profile." + res.getResourceIdentifier());
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("sunLet base profile loaded");
        }
        res = (Resource)config.get(Constants.CONF_LAYOUTBASE_RESOURCE);
        if (res == null) {
            throw new ProcessingException("No configuration for sunSpot-layout base profile found.");
        }
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("loading layout base profile");
        }
        pars.setSingleParameterValue("profile", "layout-base");
        layoutFragment = this.loadXML(res.getResourceType(), null,
                                      res.getResourceIdentifier(), pars,
                                      "Error loading layout base profile " + res.getResourceIdentifier());
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("layout base profile loaded");
        }
        // now create the base profile containing the above profiles
        profileDoc = XMLUtil.createDocument();
        profile = profileDoc.createDocumentFragment();
        profileRoot = profileDoc.createElementNS(null, "profile");
        profile.appendChild(profileRoot);
        profileRoot.appendChild(profileDoc.importNode(XMLUtil.selectSingleNode(layoutFragment,
                                                                  "layout-profile"), true));
        profileRoot.appendChild(profileDoc.importNode(XMLUtil.selectSingleNode(sunletsFragment,
                                                                  "sunlets-profile"), true));

        // if avalailable append the type profile
        if (adminProfile == true) {
            res = (Resource)config.get(Constants.CONF_ADMIN_TYPE_BASE);
            pars.setSingleParameterValue("profile", "admin-type-base");
        } else {
            res = (Resource)config.get(Constants.CONF_TYPEBASE_RESOURCE);
            pars.setSingleParameterValue("profile", "type-base");
        }
        if (res != null) {
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("loading type base profile");
            }
            typeFragment = this.loadXML(res.getResourceType(), null,
                                        res.getResourceIdentifier(), pars,
                                        "Error loading type base profile " +res.getResourceIdentifier());
            profileRoot.appendChild(profileDoc.importNode(XMLUtil.selectSingleNode(typeFragment,
                              "type-profile"), true));

            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("type base profile loaded");
View Full Code Here

        // calling method is synced
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("BEGIN buildGlobalProfile profileRoot="+profileRoot+", config="+config+", adminProfile="+adminProfile);
        }
        DocumentFragment globalFragment;
        Resource res = (Resource)config.get(Constants.CONF_GLOBALDELTA_LOADRESOURCE);
        if (res == null) {
            throw new ProcessingException("No configuration for sunSpot-role delta profile found.");
        }
        SourceParameters pars = new SourceParameters();
        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", "global-delta");

        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("loading global profile");
        }
        globalFragment = this.loadXML(res.getResourceType(), null,
                                      res.getResourceIdentifier(), pars,
                                      "Error loading global profile " + res.getResourceIdentifier());
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("global profile loaded");
        }
        this.importProfileDelta(profileRoot, globalFragment, "global-delta", "layout-delta");
        this.importProfileDelta(profileRoot, globalFragment, "global-delta", "sunlets-delta");
        this.addProfilePart(profileRoot, globalFragment, "global-delta", "portal-profile");
        this.addProfilePart(profileRoot, globalFragment, "global-delta", "personal-profile");

        // types
        res = (Resource)config.get(Constants.CONF_GLOBALDELTA_TYPERESOURCE);
        if (adminProfile == false && res != null) {
            pars.setSingleParameterValue("profile", "global-type-delta");
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("loading global type profile");
            }
            globalFragment = this.loadXML(res.getResourceType(), null,
                                          res.getResourceIdentifier(), pars,
                                          "Error loading global type profile " + res.getResourceIdentifier());
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("global type profile loaded");
            }
            this.addProfilePart(profileRoot, globalFragment, "global-delta", "type-profile");
        }
View Full Code Here

        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", "role-delta");

        Resource res = (Resource)config.get(Constants.CONF_ROLEDELTA_LOADRESOURCE);
        if (res != null) {
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("loading role profile");
            }
            roleFragment = this.loadXML(res.getResourceType(), null,
                                        res.getResourceIdentifier(), pars,
                                        "Error loading role profile "  + res.getResourceIdentifier());
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("role profile loaded");
            }
            this.importProfileDelta(profileRoot, roleFragment, "role-delta", "layout-delta");
            this.importProfileDelta(profileRoot, roleFragment, "role-delta", "sunlets-delta");
            this.addProfilePart(profileRoot, roleFragment, "role-delta", "portal-profile");
            this.importProfileDelta(profileRoot, roleFragment, "role-delta", "personal-delta");
        }

        // types
        res = (Resource)config.get(Constants.CONF_ROLEDELTA_TYPERESOURCE);
        if (adminProfile == false && res != null) {
            pars.setSingleParameterValue("profile", "role-type-delta");
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("loading role type profile");
            }
            roleFragment = this.loadXML(res.getResourceType(), null,
                                        res.getResourceIdentifier(), pars,
                                        "Error loading role type profile " + res.getResourceIdentifier());
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("role type profile loaded");
            }
            this.addProfilePart(profileRoot, roleFragment, "role-delta", "type-profile");
        }
View Full Code Here

        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-delta");

        Resource res = (Resource)config.get(Constants.CONF_USERDELTA_LOADRESOURCE);
        if (res != null) {
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("loading user profile");
            }
            userFragment = this.loadXML(res.getResourceType(), null,
                                        res.getResourceIdentifier(), pars,
                                        "Error loading user profile " + res.getResourceIdentifier());
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("user profile loaded");
            }
            this.importProfileDelta(profileRoot, userFragment, "user-delta", "layout-delta");
            this.importProfileDelta(profileRoot, userFragment, "user-delta", "sunlets-delta");
            this.addProfilePart(profileRoot, userFragment, "user-delta", "portal-profile");
            this.importProfileDelta(profileRoot, userFragment, "user-delta", "personal-delta");
        }

        // types
        res = (Resource)config.get(Constants.CONF_USERDELTA_TYPERESOURCE);
        if (adminProfile == false && res != null) {
            pars.setSingleParameterValue("profile", "user-type-delta");
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("loading user type profile");
            }
            userFragment = this.loadXML(res.getResourceType(), null,
                                        res.getResourceIdentifier(), pars,
                                        "Error loading user type profile " + res.getResourceIdentifier());
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("user type profile loaded");
            }
            this.addProfilePart(profileRoot, userFragment, "user-delta", "type-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_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

        try {
            // Determine the resource to load
            // If the sunLet is customizable and has no customization info
            // the customization resource is loaded, otherwise the resource
            Resource resource = null;
            boolean showCustomizePage = p.getParameterAsBoolean(Constants.PARAMETER_CUSTOMIZE, false);
            if (showCustomizePage == true) {
                final String value = XMLUtil.getValueOf(sunletConf, "customization/@uri", null);
                if (value == null) {
                    this.logger.error("The sunLet '"+this.sunletID+"' is customizable but has no customization info.");
                }
                resource = new Resource(this.resolver, value);
            }
            if (resource == null) {
                resource = new Resource(this.resolver, XMLUtil.getValueOf(sunletConf, "resource/@uri"));
            }
            boolean handlesSizable = XMLUtil.getValueAsBooleanOf(sunletConf, "configuration/handlesSizable", false);

            if (handlesSizable == false && p.getParameter("size", "max").equals("max") == false) {
                // do nothing here
                loadedSunlet[0] = new byte[0];
            } else {

                compiler = (XMLSerializer)this.manager.lookup(XMLSerializer.ROLE);
                compiler.startDocument();

                XMLConsumer nextConsumer = compiler;
                NodeList transformations = XMLUtil.selectNodeList(sunletConf,
                                                        "transformation/stylesheet");
                Transformer xslT = null;
                ArrayList transformers = new ArrayList();
                ComponentSelector selector = null;
                Request request = ObjectModelHelper.getRequest(this.objectModel);

                try {
                    if (transformations != null && transformations.getLength() > 0) {
                        selector = (ComponentSelector) this.manager.lookup(Transformer.ROLE + "Selector");
                        nextConsumer = new IncludeXMLConsumer(nextConsumer);
                        for(int k = transformations.getLength()-1; k >=0; k--) {
                            xslT = (Transformer)selector.select("xslt");
                            transformers.add(xslT);
                            xslT.setup(resolver,
                                       objectModel,
                                       XMLUtil.getValueOfNode(transformations.item(k)),
                                       new Parameters());
                            xslT.setConsumer(nextConsumer);
                            nextConsumer = xslT;
                        }
                        nextConsumer.startDocument();
                    }
                    switch (resource.getResourceType()) {
                        case ResourceConnector.RESOURCE_TYPE_CLASS: {
                             Sunlet theSunlet;
                             try {
                                 Class loaderClass = Class.forName(resource.getResourceIdentifier());
                                 theSunlet = (Sunlet)loaderClass.newInstance();
                             } catch (ClassNotFoundException cnfException) {
                                 throw new ProcessingException("getSunlet: Class not found: " + resource.getResourceIdentifier(), cnfException);
                             } catch (IllegalAccessException iaException) {
                                 throw new ProcessingException("getSunlet: Illegal Access: " + resource.getResourceIdentifier(), iaException);
                             } catch (InstantiationException iException) {
                                 throw new ProcessingException("getSunlet: Instantion exception: " + resource.getResourceIdentifier(), iException);
                             }
                             theSunlet.init(objectModel, p);
                             theSunlet.execute(nextConsumer, nextConsumer, objectModel, p);
                             break;
                        }
                        default: {
                            boolean includeFragment = true;
                            boolean handlesParameters = XMLUtil.getValueAsBooleanOf(sunletConf, "configuration/handlesParameters", true);
                            String size = p.getParameter("size", "max");
                            if (resource.getResourceType() == ResourceConnector.RESOURCE_TYPE_FILE) {
                                // files have no possibility to evaluate minimized, so if they are not maximized
                                // they will be neglected
                                includeFragment = size.equals("max");

                            } else {
                                includeFragment = size.equals("max");
                                if (includeFragment == false) {
                                    if (this.logger.isWarnEnabled() == true) {
                                        this.logger.warn("Minimized sunlet '"+sunletID+"' not handled correctly.");
                                    }
                                }
                            }
                            if ( includeFragment == true) {
                                String res;

                                if (resource.getResourceType() == ResourceConnector.RESOURCE_TYPE_URI) {
                                     if (this.response != null) {
                                         res = this.response.encodeURL(resource.getResourceIdentifier());
                                     } else {
                                         res = resource.getResourceIdentifier();
                                     }
                                } else {
                                     res = resource.getResourceIdentifier();
                                }
                                if (this.logger.isDebugEnabled() == true) {
                                    this.logger.debug("sunSpot Loading sunlet " + sunletID);
                                }
                                // add the parameters to the request attributes
                                Map info = new HashMap(3);
                                SessionContextImpl.sunLetInfo.set(info);
                                info.put(Constants.SUNLETINFO_PARAMETERS, p);
                                info.put(Constants.SUNLETINFO_PORTALURI, request.getRequestURI());
                                info.put(Constants.SUNLETINFO_STATUSPROFILE, loadedSunlet[7]);
                                this.resourceConnector.streamXML(resource.getResourceType(), null,
                                           res, (handlesParameters == true ? p : null),
                                             new IncludeXMLConsumer(nextConsumer), null);
                                if (this.logger.isDebugEnabled() == true) {
                                    this.logger.debug("sunSpot: Loaded sunlet " + sunletID);
                                }
View Full Code Here

        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-delta");

        Resource res = (Resource)config.get(Constants.CONF_USERDELTA_LOADRESOURCE);
        if (res != null) {
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("loading user profile");
            }
            userFragment = this.loadXML(res.getResourceType(), null,
                                        res.getResourceIdentifier(), pars,
                                        "Error loading user profile " + res.getResourceIdentifier());
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("user profile loaded");
            }
            this.importProfileDelta(profileRoot, userFragment, "user-delta", "layout-delta");
            this.importProfileDelta(profileRoot, userFragment, "user-delta", "sunlets-delta");
            this.addProfilePart(profileRoot, userFragment, "user-delta", "portal-profile");
            this.importProfileDelta(profileRoot, userFragment, "user-delta", "personal-delta");
        }

        // types
        res = (Resource)config.get(Constants.CONF_USERDELTA_TYPERESOURCE);
        if (adminProfile == false && res != null) {
            pars.setSingleParameterValue("profile", "user-type-delta");
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("loading user type profile");
            }
            userFragment = this.loadXML(res.getResourceType(), null,
                                        res.getResourceIdentifier(), pars,
                                        "Error loading user type profile " + res.getResourceIdentifier());
            if (this.getLogger().isDebugEnabled() == true) {
                this.getLogger().debug("user type profile loaded");
            }
            this.addProfilePart(profileRoot, userFragment, "user-delta", "type-profile");
        }
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.