001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. The ASF licenses this file to You
004: * under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License. For additional information regarding
015: * copyright in this work, please see the NOTICE file in the top level
016: * directory of this distribution.
017: */
018: package org.apache.roller.webservices.atomprotocol;
019:
020: import java.io.InputStream;
021: import java.util.Date;
022:
023: import com.sun.syndication.feed.atom.Entry;
024: import com.sun.syndication.feed.atom.Feed;
025:
026: /**
027: * Interface to be supported by an Atom server, expected lifetime: one request.
028: * AtomServlet calls this generic interface instead of Roller specific APIs.
029: * <p />
030: * Based on: draft-ietf-atompub-protocol-08.txt + PaceMediaEntries5
031: * <p />
032: * Designed to be Roller independent.
033: */
034: public interface AtomHandler {
035: /** Get username of authenticated user */
036: public String getAuthenticatedUsername();
037:
038: /**
039: * Return introspection document
040: */
041: public AtomService getIntrospection() throws AtomException;
042:
043: /**
044: * Return collection
045: * @param pathInfo Used to determine which collection and range
046: */
047: public Feed getCollection(String[] pathInfo) throws AtomException;
048:
049: /**
050: * Create a new entry specified by pathInfo and posted entry.
051: * @param pathInfo Path info portion of URL
052: */
053: public Entry postEntry(String[] pathInfo, Entry entry)
054: throws AtomException;
055:
056: /**
057: * Get entry specified by pathInfo.
058: * @param pathInfo Path info portion of URL
059: */
060: public Entry getEntry(String[] pathInfo) throws AtomException;
061:
062: /**
063: * Update entry specified by pathInfo and posted entry.
064: * @param pathInfo Path info portion of URL
065: */
066: public Entry putEntry(String[] pathInfo, Entry entry)
067: throws AtomException;
068:
069: /**
070: * Delete entry specified by pathInfo.
071: * @param pathInfo Path info portion of URL
072: */
073: public void deleteEntry(String[] pathInfo) throws AtomException;
074:
075: /**
076: * Create a new media-link entry.
077: * @param pathInfo Path info portion of URL
078: * @param contentType MIME type of uploaded content
079: * @param data Binary data representing uploaded content
080: */
081: public Entry postMedia(String[] pathInfo, String title,
082: String slug, String contentType, InputStream is)
083: throws AtomException;
084:
085: /**
086: * Update the media file part of a media-link entry.
087: * @param pathInfo Path info portion of URL
088: */
089: public Entry putMedia(String[] pathInfo, String contentType,
090: InputStream is) throws AtomException;
091:
092: /**
093: * Return true if specified pathinfo represents URI of introspection doc.
094: */
095: public boolean isIntrospectionURI(String[] pathInfo);
096:
097: /**
098: * Return true if specified pathinfo represents URI of a collection.
099: */
100: public boolean isCollectionURI(String[] pathInfo);
101:
102: /**
103: * Return true if specified pathinfo represents URI of an Atom entry.
104: */
105: public boolean isEntryURI(String[] pathInfo);
106:
107: /**
108: * Return true if specified pathinfo represents media-edit URI.
109: */
110: public boolean isMediaEditURI(String[] pathInfo);
111: }
|