Package org.apache.cocoon.sunshine.context

Examples of org.apache.cocoon.sunshine.context.SessionContext


        }
        if (path == null) {
            throw new IllegalArgumentException("sunShine.streamContextFragment: Path is required");
        }

        SessionContext context = this.getContext(contextName);
        if (context == null) {
            throw new IllegalArgumentException("sunShine.streamContextFragment: Context '" + contextName + "' not found.");
        }

        streamed = context.streamXML(path, consumer, consumer);

        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("END streamContextFragment streamed=" + streamed);
        }
        return streamed;
View Full Code Here


        if (fragment == null) {
            throw new IllegalArgumentException("sunShine.setContextFragment: Fragment is required");
        }

        // get context
        SessionContext context = this.getContext(contextName);

        // check context
        if (context == null) {
            throw new IllegalArgumentException("sunShine.setContextFragment: Context '" + contextName + "' not found.");
        }

        context.setXML(path, fragment);

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

        if (fragment == null) {
            throw new IllegalArgumentException("sunShine.appendContextFragment: Fragment is required");
        }

        // get context
        SessionContext context = this.getContext(contextName);

        // check context
        if (context == null) {
            throw new IllegalArgumentException("sunShine.appendContextFragment: Context '" + contextName + "' not found.");
        }

        context.appendXML(path, fragment);

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

        if (fragment == null) {
            throw new IllegalArgumentException("sunShine.mergeContextFragment: Fragment is required");
        }

        // get context
        SessionContext context = this.getContext(contextName);

        // check context
        if (context == null) {
            throw new IllegalArgumentException("sunShine.mergeContextFragment: Context '" + contextName + "' not found.");
        }

        Node contextNode = context.getSingleNode(path);
        if (contextNode == null) {
            // no merge required
            context.setXML(path, fragment);
        } else {
            this.importNode(contextNode, fragment, false);
            context.setNode(path, contextNode);
        }

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

        if (path == null) {
            throw new IllegalArgumentException("sunShine.removeContextFragment: Path is required");
        }

        // get context
        SessionContext context = this.getContext(contextName);

        // check context
        if (context == null) {
            throw new IllegalArgumentException("sunShine.removeContextFragment: Context '" + contextName + "' not found.");
        }

        context.removeXML(path);

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

        if (formName == null) {
            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);
        }

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

                            currentKey = (String)keys.nextElement();
                            if (inputFields.containsKey(currentKey) == true) {
                                contextAndPath = (Object[])inputFields.get(currentKey);
                                inputFields.remove(currentKey);

                                SessionContext context = (SessionContext)contextAndPath[0];
                                String path            = (String)contextAndPath[1];

                                if (formName.equals(contextAndPath[2]) == true) {
                                    context.setXML(path,
                                                 this.getContextFragment(SunShineConstants.REQUEST_CONTEXT, "/parameter/"+currentKey));
                                }
                            }
                        }
                    }
View Full Code Here

     *  The session context with the given name is returned. If the context does
     *  not exist <CODE>null</CODE> is returned.
     */
    public synchronized SessionContext getContext(String name)
    throws ProcessingException {
        SessionContext context;
        if (SunShine.isReservedContextName(name) == true) {
            context = this.getReservedContext(name);
        } else {
            Session session = this.getSession(false);
            if (session == null) {
View Full Code Here

    public SessionContext getSessionContext(String name,
                                            Map objectModel,
                                            SourceResolver   resolver,
                                            ComponentManager manager)
    throws ProcessingException {
        SessionContext context = null;
        if (name.equals(Constants.SESSION_CONTEXT_NAME) == true) {
            Request req = ObjectModelHelper.getRequest(objectModel);
            Session session = req.getSession(false);
            if (session != null) {
View Full Code Here

    throws ProcessingException, IOException, SAXException {
        // synchronized
        if (this.getLogger().isDebugEnabled() == true) {
            this.getLogger().debug("BEGIN getContext create="+create);
        }
        SessionContext context = null;

        final Session session = this.getSunShineComponent().getSession(false);
        if (session != null) {
            synchronized(session) {
                String appName = (String)this.request.getAttribute(org.apache.cocoon.sunshine.sunrise.Constants.REQUEST_ATTRIBUTE_APPLICATION_NAME);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.sunshine.context.SessionContext

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.