001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.cocoon.webapps.session;
018:
019: import org.apache.cocoon.ProcessingException;
020: import org.apache.cocoon.environment.Session;
021: import org.apache.cocoon.xml.XMLConsumer;
022: import org.w3c.dom.DocumentFragment;
023: import org.xml.sax.SAXException;
024:
025: /**
026: *
027: * This is the session manager component.
028: *
029: * The main purpose of this component is creating and termination sessions
030: *
031: * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
032: * @deprecated This block is deprecated and will be removed in future versions.
033: * @version CVS $Id: SessionManager.java 433543 2006-08-22 06:22:54Z crossley $
034: */
035: public interface SessionManager {
036:
037: /** Avalon role */
038: String ROLE = SessionManager.class.getName();;
039:
040: /**
041: * Create a new session for the user.
042: * A new session is created for this user. If the user has already a session,
043: * no new session is created and the old one is returned.
044: */
045: Session createSession();
046:
047: /**
048: * Get the session for the current user.
049: * If the user has no session right now, <CODE>null</CODE> is returned.
050: * If createFlag is true, the session is created if it does not exist.
051: */
052: Session getSession(boolean createFlag);
053:
054: /**
055: * Terminate the current session.
056: * If the user has a session, this session is terminated and all of its
057: * data is deleted.
058: * @param force If this is set to true the session is terminated, if
059: * it is set to false, the session is only terminated
060: * if no session context is available.
061: */
062: void terminateSession(boolean force) throws ProcessingException;
063:
064: /**
065: * Get information from the context.
066: * A document fragment containg the xml data stored in the session context
067: * with the given name is returned. If the information is not available,
068: * <CODE>null</CODE> is returned.
069: * @param contextName The name of the public context.
070: * @param path XPath expression specifying which data to get.
071: * @return A DocumentFragment containing the data or <CODE>null</CODE>
072: */
073: DocumentFragment getContextFragment(String contextName, String path)
074: throws ProcessingException;
075:
076: /**
077: * Stream public context data.
078: * The document fragment containing the data from a path in the
079: * given context is streamed to the consumer.
080: *
081: * @param contextName The name of the public context.
082: * @param path XPath expression specifying which data to get.
083: *
084: * @return If the data is available <code>true</code> is returned,
085: * otherwise <code>false</code> is returned.
086: */
087: boolean streamContextFragment(String contextName, String path,
088: XMLConsumer consumer) throws SAXException,
089: ProcessingException;
090:
091: /**
092: * Set data in a public context.
093: * The document fragment containing the data is set at the given path in the
094: * public session context.
095: *
096: * @param contextName The name of the public context.
097: * @param path XPath expression specifying where to set the data.
098: * @param fragment The DocumentFragment containing the data.
099: *
100: */
101: void setContextFragment(String contextName, String path,
102: DocumentFragment fragment) throws ProcessingException;
103:
104: /**
105: * Append data in a public context.
106: * The document fragment containing the data is appended at the given
107: * path in the public session context.
108: *
109: * @param contextName The name of the public context.
110: * @param path XPath expression specifying where to append the data.
111: * @param fragment The DocumentFragment containing the data.
112: *
113: */
114: void appendContextFragment(String contextName, String path,
115: DocumentFragment fragment) throws ProcessingException;
116:
117: /**
118: * Merge data in a public context.
119: * The document fragment containing the data is merged at the given
120: * path in the public session context.
121: *
122: * @param contextName The name of the public context.
123: * @param path XPath expression specifying where to merge the data.
124: * @param fragment The DocumentFragment containing the data.
125: *
126: */
127: void mergeContextFragment(String contextName, String path,
128: DocumentFragment fragment) throws ProcessingException;
129:
130: /**
131: * Remove data in a public context.
132: * The data specified by the path is removed from the public session context.
133: *
134: * @param contextName The name of the public context.
135: * @param path XPath expression specifying where to merge the data.
136: *
137: */
138: void removeContextFragment(String contextName, String path)
139: throws ProcessingException;
140:
141: }
|