KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > transformation > helpers > IncludeCacheManager


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.transformation.helpers;
17
18 import java.io.IOException JavaDoc;
19
20 import org.apache.avalon.framework.parameters.Parameters;
21 import org.apache.cocoon.xml.XMLConsumer;
22 import org.apache.excalibur.source.SourceException;
23 import org.xml.sax.SAXException JavaDoc;
24
25 /**
26  * The include cache manager is a component that can manage included content.
27  * It can eiter load them in parallel or pre-emptive and cache the content
28  * for a given period of time.
29  *
30  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
31  * @version CVS $Id: IncludeCacheManager.java 30932 2004-07-29 17:35:38Z vgritsenko $
32  * @since 2.1
33  */

34 public interface IncludeCacheManager {
35
36     /** Avalon role */
37     String JavaDoc ROLE = IncludeCacheManager.class.getName();
38     
39     /**
40      * Create a session for this request.
41      * This should be invoked first and only one per request. It is required
42      * to terminate the session with {@link #terminateSession(IncludeCacheManagerSession)}
43      * @param pars The configuration
44      * @return CacheManagerSession The session that should be used with all other commands.
45      */

46     IncludeCacheManagerSession getSession(Parameters pars);
47     
48     /**
49      * This informs the manager that a URI should be "loaded".
50      * @param uri The URI to load (maybe relative)
51      * @param session The corresponding session created by {@link #getSession(Parameters)}
52      * @return String The absolute URI that must be used for {@link #stream(String, IncludeCacheManagerSession, XMLConsumer)}
53      * @throws IOException
54      * @throws SourceException
55      */

56     String JavaDoc load(String JavaDoc uri,
57                 IncludeCacheManagerSession session)
58     throws IOException JavaDoc, SourceException;
59               
60     /**
61      * Stream the content of the absolute URI.
62      * Depending on the configuration and state of the cache, the
63      * content is either taken from the cache, fetched etc.
64      * @param uri The absolute URI returned by {@link #load(String, IncludeCacheManagerSession)}
65      * @param session The current session
66      * @param handler The receiver of the SAX events
67      * @throws IOException
68      * @throws SourceException
69      * @throws SAXException
70      */

71     void stream(String JavaDoc uri,
72                  IncludeCacheManagerSession session,
73                  XMLConsumer handler)
74     throws IOException JavaDoc, SourceException, SAXException JavaDoc;
75                  
76     /**
77      * Terminate the session. This method must be executed at the end of the
78      * request.
79      * @param session The caching session.
80      */

81     void terminateSession(IncludeCacheManagerSession session);
82 }
83
Popular Tags