Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.syndication.propono.atom.server.impl
Class FileBasedCollection

    java.lang.Object
      com.sun.syndication.propono.atom.common.Collection
          com.sun.syndication.propono.atom.server.impl.FileBasedCollection

    public class FileBasedCollection

extends Collection

File based Atom collection implementation. This is the heart of the file-based Atom service implementation. It provides methods for adding, getting updating and deleting Atom entries and media entries.

Field Summary

Fields inherited from class com.sun.syndication.propono.atom.common.Collection
`ENTRY_TYPE`

Constructor Summary
`FileBasedCollection(String title, String handle, String collection, String singular, String accept, boolean inlineCats, String[] catNames, boolean relativeURIs, String contextURI, String contextPath, String servletPath, String baseDir)` Construct by providing title (plain text, no HTML), a workspace handle, a plural collection name (e.g.

Method Summary
`String` | `addEntry(Entry entry)` Add entry to collection.
`String` | `addMediaEntry(Entry entry, String slug, InputStream is)` Add media entry to collection.
`void` | `deleteEntry(String fsid)` Delete an entry and any associated media file.
`List` | `getCategories()` Get list of one Categories object containing categories allowed by collection, returns in-line categories if collection set to use in-line categories.
`List` | `getCategories(boolean inline)` Get list of one Categories object containing categories allowed by collection.
`Entry` | `getEntry(String fsid)` Get an entry from the collection.
`Feed` | `getFeedDocument()` Get feed document representing collection.
`AtomMediaResource` | `getMediaResource(String fileName)` Get media resource wrapping a file.
`void` | `updateEntry(Entry entry, String fsid)` Update an entry in the collection.
`Entry` | `updateMediaEntry(String fileName, String contentType, InputStream is)` Update media associated with a media-link entry.

Methods inherited from class com.sun.syndication.propono.atom.common.Collection
`accepts, addAccept, addCategories, collectionToElement, elementToCollection, getAccepts, getHref, getHrefResolved, getHrefResolved, getTitle, getTitleType, parseCollectionElement, setAccepts, setHref, setTitle, setTitleType`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FileBasedCollection

    public FileBasedCollection(String title,
                               String handle,
                               String collection,
                               String singular,
                               String accept,
                               boolean inlineCats,
                               String[] catNames,
                               boolean relativeURIs,
                               String contextURI,
                               String contextPath,
                               String servletPath,
                               String baseDir)

  Construct by providing title (plain text, no HTML), a workspace handle, a plural collection name (e.g. entries), a singular collection name (e.g. entry), the base directory for file storage, the content-type range accepted by the collection and the root Atom protocol URI for the service.

  Parameters:
    `title` - Title of collection (plain text, no HTML)
    `handle` - Workspace handle
    `collection` - Collection handle, plural
    `singular` - Collection handle, singular
    `accept` - Content type range accepted by collection
    `inlineCats` - True for inline categories
    `catNames` - Category names for this workspace
    `baseDir` - Base directory for file storage
    `relativeURIs` - True for relative URIs
    `contextURI` - Absolute URI of context that hosts APP service
    `contextPath` - Context path of APP service (e.g. "/sample-atomserver")
    `servletPath` - Servlet path of APP service (e.g. "/app")

Method Detail

### getFeedDocument

    public Feed getFeedDocument()
                         throws AtomException

  Get feed document representing collection.

  Returns:
    Atom Feed representing collection.
  Throws:
    `AtomException` - On error retrieving feed file.

### getCategories

    public List getCategories(boolean inline)

  Get list of one Categories object containing categories allowed by collection.

  Parameters:
    `inline` - True if Categories object should contain collection of in-line Categories objects or false if it should set the Href for out-of-line categories.

### getCategories

    public List getCategories()

  Get list of one Categories object containing categories allowed by collection, returns in-line categories if collection set to use in-line categories.

  Overrides:
    `getCategories` in class `Collection`
  Returns:
    Collection of `Categories` objects.

### addEntry

    public String addEntry(Entry entry)
                    throws Exception

  Add entry to collection.

  Parameters:
    `entry` - Entry to be added to collection. Entry will be saved to disk in a directory under the collection's directory and the path will follow the pattern [collection-plural]/[entryid]/entry.xml. The entry will be added to the collection's feed in [collection-plural]/feed.xml.
  Returns:
    Entry as it exists on the server.
  Throws:
    `Exception` - On error.

### addMediaEntry

    public String addMediaEntry(Entry entry,
                                String slug,
                                InputStream is)
                         throws Exception

  Add media entry to collection. Accepts a media file to be added to collection. The file will be saved to disk in a directory under the collection's directory and the path will follow the pattern `[collection-plural]/[entryid]/media/[entryid]`. An Atom entry will be created to store metadata for the entry and it will exist at the path `[collection-plural]/[entryid]/entry.xml`. The entry will be added to the collection's feed in [collection-plural]/feed.xml.

  Parameters:
    `entry` - Entry object
    `slug` - String to be used in file-name
    `is` - Source of media data
  Returns:
    Location URI of entry
  Throws:
    `Exception` - On Error

### getEntry

    public Entry getEntry(String fsid)
                   throws Exception

  Get an entry from the collection.

  Parameters:
    `fsid` - Internal ID of entry to be returned
  Returns:
    Entry specified by fileName/ID
  Throws:
    `Exception` - On error

### getMediaResource

    public AtomMediaResource getMediaResource(String fileName)
                                       throws Exception

  Get media resource wrapping a file.

  Throws:
    `Exception`

### updateEntry

    public void updateEntry(Entry entry,
                            String fsid)
                     throws Exception

  Update an entry in the collection.

  Parameters:
    `entry` - Updated entry to be stored
    `fsid` - Internal ID of entry
  Throws:
    `Exception` - On error

### updateMediaEntry

    public Entry updateMediaEntry(String fileName,
                                  String contentType,
                                  InputStream is)
                           throws Exception

  Update media associated with a media-link entry.

  Parameters:
    `fileName` - Internal ID of entry being updated
    `contentType` - Content type of data
    `is` - Source of updated data
  Returns:
    Updated Entry as it exists on server
  Throws:
    `Exception` - On error

### deleteEntry

    public void deleteEntry(String fsid)
                     throws Exception

  Delete an entry and any associated media file.

  Parameters:
    `fsid` - Internal ID of entry
  Throws:
    `Exception` - On error

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD