Package org.apache.cocoon.environment

Examples of org.apache.cocoon.environment.Session


            throw new IllegalArgumentException("sunShine.registerInputField: Form is required");
        }

        DocumentFragment value = null;
        SessionContext context = this.getContext(contextName);
        Session session = this.getSession(false);
        if (session == null) {
            throw new IllegalArgumentException("sunShine.registerInputField: Session is required for context " + contextName);
        }

        synchronized(session) {
            Map inputFields = (Map)session.getAttribute(SunShine.ATTRIBUTE_INPUTXML_STORAGE);
            if (inputFields == null) {
                inputFields = new HashMap(10);
                session.setAttribute(SunShine.ATTRIBUTE_INPUTXML_STORAGE, inputFields);
            }
            inputFields.put(name, new Object[] {context, path, formName});
            value = context.getXML(path);
        }
View Full Code Here


            this.getLogger().debug("BEGIN processInputFields");
        }

        final String formName = this.request.getParameter(SunShineConstants.SUNSHINE_FORM_PARAMETER);
        if ( null != formName ) {
            final Session session = this.getSession(false);
            if (session != null) {
                synchronized(session) {
                    final Map inputFields = (Map)session.getAttribute(SunShine.ATTRIBUTE_INPUTXML_STORAGE);
                    if (inputFields != null) {
                        final Enumeration keys = this.request.getParameterNames();
                        String   currentKey;
                        Object[] contextAndPath;
View Full Code Here

    throws ProcessingException {
        SessionContext context;
        if (SunShine.isReservedContextName(name) == true) {
            context = this.getReservedContext(name);
        } else {
            Session session = this.getSession(false);
            if (session == null) {
                throw new IllegalArgumentException("sunShine.getContext: Session is required.");
            }
            synchronized (session) {
                final Map contexts = this.getSessionContexts();
View Full Code Here

    /**
     * Check if a context exists
     */
    public synchronized boolean hasSessionContext() {
        Session session = this.getSession(false);
        if (session == null) {
            throw new IllegalArgumentException("sunShine.hasSessionContext: Session is required.");
        }
        synchronized (session) {
            final Map contexts = this.getSessionContexts();
View Full Code Here

     *  Check if a public context exists.
     *  If the session context with the given name exists, <CODE>true</CODE> is
     *  returned.
     */
    public synchronized boolean existsContext(String name) {
        Session session = this.getSession(false);
        if (session == null) {
            throw new IllegalArgumentException("sunShine.existsContext: Session is required.");
        }
        synchronized (session) {
            final Map contexts = this.getSessionContexts();
View Full Code Here

        // synchronized
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("BEGIN storeProfile id="+profileID+", profile="+profile);
        }

        Session session = this.getSunShineComponent().getSession(true);
        synchronized(session) {
            session.setAttribute(profileID, profile);
        }

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

    throws ProcessingException {
        // synchronized
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("BEGIN retrieveProfile id="+profileID);
        }
        Session session = this.getSunShineComponent().getSession(true);
        Map result;
        synchronized(session) {
            result = (Map)session.getAttribute(profileID);
        }

        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("END retrieveProfile profile="+(result != null ? "**PROFILE**" : "null"));
        }
View Full Code Here

            this.getLogger().debug("BEGIN getConfiguration");
        }
        Map result = null;
        String appName = (String)this.request.getAttribute(org.apache.cocoon.sunshine.sunrise.Constants.REQUEST_ATTRIBUTE_APPLICATION_NAME);
        String handlerName = (String)this.request.getAttribute(org.apache.cocoon.sunshine.sunrise.Constants.REQUEST_ATTRIBUTE_HANDLER_NAME);
        Session session = this.getSunShineComponent().getSession(false);
        if (session != null && appName != null && handlerName != null) {

            synchronized (session) {
                result = (Map)session.getAttribute(Constants.ATTRIBUTE_CONFIGURATION + handlerName + ':' + appName);
                if (result == null) {

                    try {
                        Configuration config;

                        Configuration conf = this.getSunRise().getModuleConfiguration(Constants.SUNRISE_MODULE_NAME);
                        if (conf == null) {
                            throw new ProcessingException("sunSpot: 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(Constants.CONF_AUTH_REDIRECT, config.getValue());
                        }

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

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

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

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

                        // and now the profile
                        config = conf.getChild("profile", false);
                        if (config == null) throw new ProcessingException("sunSpot: profile configuration required for application '" + appName + "'");
                        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);
                    } catch (ConfigurationException conf) {
                        throw new ProcessingException("ConfigurationException: " + conf, conf);
                    }
                }
            }
View Full Code Here

      Request request =(Request)objectmodel.get(Constants.REQUEST_OBJECT);
      Context context = (Context)objectmodel.get(Constants.CONTEXT_OBJECT);
      if(context != null)
        request.setAttribute("Wale",new  TestBean("Wale in the big sea","context"));

      Session session =request.getSession(true);
      session.setAttribute("Mouse",new  TestBean("Liveing in the session","session"));
      objectmodel.put("Lion", new TestBean("Lion:walking on the sitemap","sitemap") );
      request.setAttribute("Hamster",new TestBean("Hamster:Wer hat nach mir gefragt","request")  );
      session.setAttribute("Elefant",new  TestBean("Elefant:from Africa","session"));
      request.setAttribute("Elefant",new  TestBean("Elefant:from India","request"));


      return objectmodel;
View Full Code Here

            }
          }
          if(sourcemap == null || VALUE_SESSION.equals(sourcemap)){
            //System.out.println("Searching bean " + name+ " in "+VALUE_SESSION);

            Session session =request.getSession(false);
            if(session != null){
              toInsert=session.getAttribute(name);
              if(toInsert != null){
                insertBean(toInsert,mapping);
                return;
              }
            }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.environment.Session

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.