KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > presentation > atomapi > AtomHandler


1 /*
2  * Copyright 2005 David M Johnson (For RSS and Atom In Action)
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.roller.presentation.atomapi;
17
18 import java.io.InputStream JavaDoc;
19 import java.util.Date JavaDoc;
20
21 import com.sun.syndication.feed.atom.Entry;
22
23 /**
24  * Interface to be supported by an Atom server, expected lifetime: one request.
25  * AtomServlet calls this generic interface instead of Roller specific APIs.
26  * Does not impose any specific set of collections, just three collection types:
27  * entries, resources and categories. Implementations determine what collections
28  * of each type exist and what URIs are used to get and edit them.
29  * <p />
30  * Designed to be Roller independent.
31  *
32  * @author David M Johnson
33  */

34 public interface AtomHandler
35 {
36     /** Get username of authenticated user */
37     public String JavaDoc getAuthenticatedUsername();
38
39     /**
40      * Return introspection document
41      */

42     public AtomService getIntrospection(String JavaDoc[] pathInfo) throws Exception JavaDoc;
43     
44     /**
45      * Return collection
46      * @param pathInfo Used to determine which collection
47      */

48     public AtomCollection getCollection(String JavaDoc[] pathInfo) throws Exception JavaDoc;
49     
50     /**
51      * Return collection restricted by date range
52      * @param pathInfo Used to determine which collection
53      * @param start Start date or null if none
54      * @param end End date or null of none
55      * @param offset Offset into query results (or -1 if none)
56      */

57     public AtomCollection getCollection(
58             String JavaDoc[] pathInfo, Date JavaDoc start, Date JavaDoc end, int offset)
59         throws Exception JavaDoc;
60     
61     /**
62      * Create a new entry specified by pathInfo and posted entry.
63      * @param pathInfo Path info portion of URL
64      */

65     public Entry postEntry(String JavaDoc[] pathInfo, Entry entry) throws Exception JavaDoc;
66
67     /**
68      * Get entry specified by pathInfo.
69      * @param pathInfo Path info portion of URL
70      */

71     public Entry getEntry(String JavaDoc[] pathInfo) throws Exception JavaDoc;
72     
73     /**
74      * Update entry specified by pathInfo and posted entry.
75      * @param pathInfo Path info portion of URL
76      */

77     public Entry putEntry(String JavaDoc[] pathInfo, Entry entry) throws Exception JavaDoc;
78
79     /**
80      * Delete entry specified by pathInfo.
81      * @param pathInfo Path info portion of URL
82      */

83     public void deleteEntry(String JavaDoc[] pathInfo) throws Exception JavaDoc;
84     
85     /**
86      * Create a new resource specified by pathInfo, contentType, and binary data
87      * @param pathInfo Path info portion of URL
88      * @param contentType MIME type of uploaded content
89      * @param data Binary data representing uploaded content
90      */

91     public String JavaDoc postResource(String JavaDoc[] pathInfo, String JavaDoc name, String JavaDoc contentType,
92             InputStream JavaDoc is) throws Exception JavaDoc;
93
94     /**
95      * Update a resource.
96      * @param pathInfo Path info portion of URL
97      */

98     public void putResource(String JavaDoc[] pathInfo, String JavaDoc contentType,
99             InputStream JavaDoc is) throws Exception JavaDoc;
100     
101     /**
102      * Delete resource specified by pathInfo.
103      * @param pathInfo Path info portion of URL
104      */

105     public void deleteResource(String JavaDoc[] pathInfo) throws Exception JavaDoc;
106     
107     /**
108      * Get resource file path (so Servlet can determine MIME type).
109      * @param pathInfo Path info portion of URL
110      */

111     public String JavaDoc getResourceFilePath(String JavaDoc[] pathInfo) throws Exception JavaDoc;
112     
113     public boolean isIntrospectionURI(String JavaDoc [] pathInfo);
114  
115     public boolean isCollectionURI(String JavaDoc [] pathInfo);
116     public boolean isEntryCollectionURI(String JavaDoc [] pathInfo);
117     public boolean isResourceCollectionURI(String JavaDoc [] pathInfo);
118     public boolean isCategoryCollectionURI(String JavaDoc [] pathInfo);
119     
120     public boolean isEntryURI(String JavaDoc[] pathInfo);
121     public boolean isResourceURI(String JavaDoc[] pathInfo);
122     public boolean isCategoryURI(String JavaDoc[] pathInfo);
123 }
124
125
Popular Tags