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 FileBasedAtomHandler

    java.lang.Object
      com.sun.syndication.propono.atom.server.impl.FileBasedAtomHandler

All Implemented Interfaces:
  AtomHandler

    public class FileBasedAtomHandler

extends Object
implements AtomHandler

File-based `AtomHandler` implementation that stores entries and media-entries to disk. Implemented using `FileBasedAtomService`.

Constructor Summary
`FileBasedAtomHandler(HttpServletRequest req)` Construct handler to handle one request.
`FileBasedAtomHandler(HttpServletRequest req, String uploaddir)` Contruct handler for one request, using specified file storage directory.

Method Summary
`String` | `authenticateBASIC(HttpServletRequest request)` BASIC authentication.
`void` | `deleteEntry(AtomRequest areq)` Delete entry specified by pathInfo.
`String` | `getAtomProtocolURL()` Get base URI of Atom protocol implementation.
`AtomService` | `getAtomService(AtomRequest areq)` Return introspection document
`String` | `getAuthenticatedUsername()` Get username of authenticated user
`Categories` | `getCategories(AtomRequest areq)` Returns null because we use in-line categories.
`Feed` | `getCollection(AtomRequest areq)` Get collection specified by pathinfo.
`Entry` | `getEntry(AtomRequest areq)` Get entry specified by pathInfo.
`AtomMediaResource` | `getMediaResource(AtomRequest areq)` Get media resource specified by request.
`boolean` | `isAtomServiceURI(AtomRequest areq)` Return true if specified pathinfo represents URI of service doc.
`boolean` | `isCategoriesURI(AtomRequest areq)` Return true if specified pathinfo represents URI of category doc.
`boolean` | `isCollectionURI(AtomRequest areq)` Return true if specified pathinfo represents URI of a collection.
`boolean` | `isEntryURI(AtomRequest areq)` Return true if specified pathinfo represents URI of an Atom entry.
`boolean` | `isMediaEditURI(AtomRequest areq)` Return true if specified pathinfo represents media-edit URI.
`String` | `postEntry(AtomRequest areq, Entry entry)` Create a new entry specified by pathInfo and posted entry.
`String` | `postMedia(AtomRequest areq, Entry entry)` Store media data in collection specified by pathInfo, create an Atom media-link entry to store metadata for the new media file and return that entry to the caller.
`void` | `putEntry(AtomRequest areq, Entry entry)` Update entry specified by pathInfo and posted entry.
`void` | `putMedia(AtomRequest areq)` Update the media file part of a media-link entry.
`boolean` | `validateUser(String login, String password)` Method used for validating user.

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

Constructor Detail

### FileBasedAtomHandler

    public FileBasedAtomHandler(HttpServletRequest req)

  Construct handler to handle one request.

  Parameters:
    `req` - Request to be handled.

### FileBasedAtomHandler

    public FileBasedAtomHandler(HttpServletRequest req,
                                String uploaddir)

  Contruct handler for one request, using specified file storage directory.

  Parameters:
    `req` - Request to be handled.
    `uploaddir` - File storage upload dir.

Method Detail

### validateUser

    public boolean validateUser(String login,
                                String password)

  Method used for validating user. Developers can overwrite this method and use credentials stored in Database or LDAP to confirm if the user is allowed to access this service.

  Parameters:
    `login` - user submitted login id
    `password` - user submitted password

### getAuthenticatedUsername

    public String getAuthenticatedUsername()

  Get username of authenticated user

  Specified by:
    `getAuthenticatedUsername` in interface `AtomHandler`
  Returns:
    User name.

### getAtomProtocolURL

    public String getAtomProtocolURL()

  Get base URI of Atom protocol implementation.

  Returns:
    Base URI of Atom protocol implemenation.

### getAtomService

    public AtomService getAtomService(AtomRequest areq)
                               throws AtomException

  Return introspection document

  Specified by:
    `getAtomService` in interface `AtomHandler`
  Returns:
    AtomService object with workspaces and collections.
  Throws:
    `AtomException` - Unexpected exception.

### getCategories

    public Categories getCategories(AtomRequest areq)
                             throws AtomException

  Returns null because we use in-line categories.

  Specified by:
    `getCategories` in interface `AtomHandler`
  Returns:
    Categories object
  Throws:
    `AtomException` - Unexpected exception.

### getCollection

    public Feed getCollection(AtomRequest areq)
                       throws AtomException

  Get collection specified by pathinfo.

  Specified by:
    `getCollection` in interface `AtomHandler`
  Parameters:
    `areq` - Details of HTTP request
  Returns:
    ROME feed representing collection.
  Throws:
    `AtomException` - Invalid collection or other exception.

### postEntry

    public String postEntry(AtomRequest areq,
                            Entry entry)
                     throws AtomException

  Create a new entry specified by pathInfo and posted entry. We save the submitted Atom entry verbatim, but we do set the id and reset the update time.

  Specified by:
    `postEntry` in interface `AtomHandler`
  Parameters:
    `entry` - Entry to be added to collection.
    `areq` - Details of HTTP request
  Returns:
    Entry as represented on server.
  Throws:
    `AtomException` - On invalid collection or other error.

### getEntry

    public Entry getEntry(AtomRequest areq)
                   throws AtomException

  Get entry specified by pathInfo.

  Specified by:
    `getEntry` in interface `AtomHandler`
  Parameters:
    `areq` - Details of HTTP request
  Returns:
    ROME Entry object.
  Throws:
    `AtomException` - On invalid pathinfo or other error.

### putEntry

    public void putEntry(AtomRequest areq,
                         Entry entry)
                  throws AtomException

  Update entry specified by pathInfo and posted entry.

  Specified by:
    `putEntry` in interface `AtomHandler`
  Parameters:
    `entry` -
    `areq` - Details of HTTP request
  Throws:
    `AtomException`

### deleteEntry

    public void deleteEntry(AtomRequest areq)
                     throws AtomException

  Delete entry specified by pathInfo.

  Specified by:
    `deleteEntry` in interface `AtomHandler`
  Parameters:
    `areq` - Details of HTTP request
  Throws:
    `AtomException`

### postMedia

    public String postMedia(AtomRequest areq,
                            Entry entry)
                     throws AtomException

  Store media data in collection specified by pathInfo, create an Atom media-link entry to store metadata for the new media file and return that entry to the caller.

  Specified by:
    `postMedia` in interface `AtomHandler`
  Parameters:
    `areq` - Details of HTTP request
    `entry` - New entry initialzied with only title and content type
  Returns:
    Location URL of new media entry
  Throws:
    `AtomException`

### putMedia

    public void putMedia(AtomRequest areq)
                  throws AtomException

  Update the media file part of a media-link entry.

  Specified by:
    `putMedia` in interface `AtomHandler`
  Parameters:
    `areq` - Details of HTTP request Assuming pathInfo of form /user-name/resource/name
  Throws:
    `AtomException`

### getMediaResource

    public AtomMediaResource getMediaResource(AtomRequest areq)
                                       throws AtomException

  Description copied from interface: `AtomHandler`
  Get media resource specified by request.

  Specified by:
    `getMediaResource` in interface `AtomHandler`
  Parameters:
    `areq` - Details of HTTP request
  Throws:
    `AtomException`

### isAtomServiceURI

    public boolean isAtomServiceURI(AtomRequest areq)

  Return true if specified pathinfo represents URI of service doc.

  Specified by:
    `isAtomServiceURI` in interface `AtomHandler`
  Parameters:
    `areq` - Details of HTTP request

### isCategoriesURI

    public boolean isCategoriesURI(AtomRequest areq)

  Return true if specified pathinfo represents URI of category doc.

  Specified by:
    `isCategoriesURI` in interface `AtomHandler`
  Parameters:
    `areq` - Details of HTTP request

### isCollectionURI

    public boolean isCollectionURI(AtomRequest areq)

  Return true if specified pathinfo represents URI of a collection.

  Specified by:
    `isCollectionURI` in interface `AtomHandler`
  Parameters:
    `areq` - Details of HTTP request

### isEntryURI

    public boolean isEntryURI(AtomRequest areq)

  Return true if specified pathinfo represents URI of an Atom entry.

  Specified by:
    `isEntryURI` in interface `AtomHandler`
  Parameters:
    `areq` - Details of HTTP request

### isMediaEditURI

    public boolean isMediaEditURI(AtomRequest areq)

  Return true if specified pathinfo represents media-edit URI.

  Specified by:
    `isMediaEditURI` in interface `AtomHandler`
  Parameters:
    `areq` - Details of HTTP request

### authenticateBASIC

    public String authenticateBASIC(HttpServletRequest request)

  BASIC authentication.

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