org.olat.modules.webFeed.managers
Class FeedManager

java.lang.Object
  extended by org.olat.core.logging.LogDelegator
      extended by org.olat.core.manager.BasicManager
          extended by org.olat.modules.webFeed.managers.FeedManager
Direct Known Subclasses:
FeedManagerImpl

public abstract class FeedManager
extends BasicManager

The FeedManager singleton is responsible for dealing with feed resources.

Initial Date: Feb 11, 2009

Author:
gwassmann

Field Summary
static java.lang.String KIND_BLOG
           
static java.lang.String KIND_PODCAST
           
static java.lang.String RESOURCE_NAME
           
static java.lang.String RSS_FEED_NAME
           
 
Constructor Summary
FeedManager()
           
 
Method Summary
abstract  LockResult acquireLock(OLATResourceable feed, Identity identity)
          Acquires the lock on the specified feed
abstract  LockResult acquireLock(OLATResourceable feed, Item item, Identity identity)
          Acquires the lock of an item
abstract  void addItem(Item item, FileElement file, Feed feed)
          Adds the given Item to the Feed.
abstract  OLATResourceable copy(OLATResourceable feed)
          Copies a given feed resourcable
abstract  OLATResourceable createBlogResource()
          Creates an OLAT blog resource
abstract  MediaResource createFeedFile(OLATResourceable feed, Identity identity, java.lang.Long courseId, java.lang.String nodeId)
          Creates the RSS feed resource.
abstract  MediaResource createFeedMediaFile(OLATResourceable feed, java.lang.String fileName)
          Returns the media file of the feed
abstract  VFSContainer createItemContainer(Feed feed, Item currentItem)
          Prepare the filesystem for a new item, create the item container and all necessary sub container, e.g.
abstract  MediaResource createItemMediaFile(OLATResourceable feed, java.lang.String itemId, java.lang.String fileName)
          Returns the media file of the item
abstract  OLATResourceable createPodcastResource()
          Creates an OLAT podcast resource
abstract  void delete(OLATResourceable feed)
          Deletes a given feed.
abstract  void deleteImage(Feed feed)
          Delete the image of the feed
abstract  VFSLeaf getFeedArchive(OLATResourceable ores)
          Create and returns a zip-file as VFSLeaf of the given feed resourue
abstract  MediaResource getFeedArchiveMediaResource(OLATResourceable resource)
          Creates and returns a zip-file media resource of the given feed resource
abstract  java.lang.String getFeedBaseUri(Feed feed, Identity identity, java.lang.Long courseId, java.lang.String nodeId)
          Returns the base URI of the feed including user identity key and token if necessary.
abstract  VFSContainer getFeedContainer(OLATResourceable feed)
          Returns the container of the feed
 java.lang.String getFeedKind(OLATResourceable ores)
          There are different kinds of web feeds, e.g.
abstract  Feed getFeedLigth(OLATResourceable feed)
          Returns the feed with the provided id or null.
static FeedManager getInstance()
          Use this method instead of any constructor to get the singelton object.
abstract  VFSContainer getItemContainer(Item item, Feed feed)
          Returns the container of the item which belongs to the feed
abstract  java.io.File getItemEnclosureFile(Item item, Feed feed)
          Returns the File of the item's enclosure if it exists or null
abstract  VFSContainer getItemMediaContainer(Item item, Feed feed)
          Returns the media container of the item of feed
 boolean isLocked(OLATResourceable feed)
           
abstract  java.util.List<Item> loadItems(Feed feed)
          Load all items of the feed (from file system or the external feed)
abstract  Feed readFeed(OLATResourceable ores)
          Reads a feed resource by the resource id and returns the feed object.
abstract  void releaseLock(LockResult lock)
          Releases a lock
abstract  void remove(Item item, Feed feed)
          Removes the given Item from the Feed.
abstract  void setImage(FileElement image, Feed feed)
          Set the image of the feed (update handled separately)
abstract  Feed updateFeedMetadata(Feed feed)
          Update the feed metadata from the given feed object
abstract  Feed updateFeedMode(java.lang.Boolean external, Feed feed)
          Update the feed source mode
abstract  void updateItem(Item modifiedItem, FileElement file, Feed feed)
           
abstract  ValidatedURL validateFeedUrl(java.lang.String url, java.lang.String type)
          Validates a feed url.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RSS_FEED_NAME

public static final java.lang.String RSS_FEED_NAME
See Also:
Constant Field Values

RESOURCE_NAME

public static final java.lang.String RESOURCE_NAME
See Also:
Constant Field Values

KIND_PODCAST

public static final java.lang.String KIND_PODCAST
See Also:
Constant Field Values

KIND_BLOG

public static final java.lang.String KIND_BLOG
See Also:
Constant Field Values
Constructor Detail

FeedManager

public FeedManager()
Method Detail

getInstance

public static final FeedManager getInstance()
Use this method instead of any constructor to get the singelton object.

Returns:
INSTANCE

createPodcastResource

public abstract OLATResourceable createPodcastResource()
Creates an OLAT podcast resource

Returns:
The resource

createBlogResource

public abstract OLATResourceable createBlogResource()
Creates an OLAT blog resource

Returns:
The resource

readFeed

public abstract Feed readFeed(OLATResourceable ores)
Reads a feed resource by the resource id and returns the feed object.

Parameters:
ores -
Returns:
The feed

delete

public abstract void delete(OLATResourceable feed)
Deletes a given feed.

Parameters:
feed -

copy

public abstract OLATResourceable copy(OLATResourceable feed)
Copies a given feed resourcable

Parameters:
feed -

addItem

public abstract void addItem(Item item,
                             FileElement file,
                             Feed feed)
Adds the given Item to the Feed.

Parameters:
item -
feed -

remove

public abstract void remove(Item item,
                            Feed feed)
Removes the given Item from the Feed. Its content will be deleted.

Parameters:
item -
feed -

updateItem

public abstract void updateItem(Item modifiedItem,
                                FileElement file,
                                Feed feed)
Parameters:
modifiedItem -
feed -

updateFeedMode

public abstract Feed updateFeedMode(java.lang.Boolean external,
                                    Feed feed)
Update the feed source mode

Parameters:
external - True: set to be an external feed; false: this is an internal feed; null=undefined
feed -
Returns:
Feed the updated feed object

updateFeedMetadata

public abstract Feed updateFeedMetadata(Feed feed)
Update the feed metadata from the given feed object

Parameters:
feed -
Returns:

loadItems

public abstract java.util.List<Item> loadItems(Feed feed)
Load all items of the feed (from file system or the external feed)

Parameters:
feed -

getFeedLigth

public abstract Feed getFeedLigth(OLATResourceable feed)
Returns the feed with the provided id or null. This is thought to get the feed information in an efficient way and without the necessity of loading any items.

Parameters:
feed - The feed to be re-read
Returns:
The newly read feed (without items)

createItemMediaFile

public abstract MediaResource createItemMediaFile(OLATResourceable feed,
                                                  java.lang.String itemId,
                                                  java.lang.String fileName)
Returns the media file of the item

Parameters:
id -
resourceTypeName -
itemId -
fileName -
Returns:
The media resource (audio or video file of the feed item)

createFeedMediaFile

public abstract MediaResource createFeedMediaFile(OLATResourceable feed,
                                                  java.lang.String fileName)
Returns the media file of the feed

Parameters:
id -
resourceTypeName -
fileName -
Returns:
The media file of the feed

getFeedBaseUri

public abstract java.lang.String getFeedBaseUri(Feed feed,
                                                Identity identity,
                                                java.lang.Long courseId,
                                                java.lang.String nodeId)
Returns the base URI of the feed including user identity key and token if necessary.

Parameters:
feed -
idKey -
Returns:
The base URI of the (RSS) feed

createFeedFile

public abstract MediaResource createFeedFile(OLATResourceable feed,
                                             Identity identity,
                                             java.lang.Long courseId,
                                             java.lang.String nodeId)
Creates the RSS feed resource.

Parameters:
feedId -
type - The resource type name
identityKey -
Returns:
The RSS feed as a MediaResource

getFeedArchiveMediaResource

public abstract MediaResource getFeedArchiveMediaResource(OLATResourceable resource)
Creates and returns a zip-file media resource of the given feed resource

Parameters:
resource -
Returns:
A zip-file media resource

getFeedArchive

public abstract VFSLeaf getFeedArchive(OLATResourceable ores)
Create and returns a zip-file as VFSLeaf of the given feed resourue

Parameters:
ores - the resource
Returns:
The VFSLeaf

getItemContainer

public abstract VFSContainer getItemContainer(Item item,
                                              Feed feed)
Returns the container of the item which belongs to the feed

Parameters:
item -
feed -
Returns:
The container of the item

getItemMediaContainer

public abstract VFSContainer getItemMediaContainer(Item item,
                                                   Feed feed)
Returns the media container of the item of feed

Parameters:
item -
feed -
Returns:
The media container of the item

getItemEnclosureFile

public abstract java.io.File getItemEnclosureFile(Item item,
                                                  Feed feed)
Returns the File of the item's enclosure if it exists or null

Parameters:
item -
feed -
Returns:
The enclosure media file

getFeedContainer

public abstract VFSContainer getFeedContainer(OLATResourceable feed)
Returns the container of the feed

Parameters:
feed -
Returns:
The feed container

validateFeedUrl

public abstract ValidatedURL validateFeedUrl(java.lang.String url,
                                             java.lang.String type)
Validates a feed url.

Parameters:
url -
Returns:
valid url (rss, atom etc.)

releaseLock

public abstract void releaseLock(LockResult lock)
Releases a lock

Parameters:
lock - The lock to be released

acquireLock

public abstract LockResult acquireLock(OLATResourceable feed,
                                       Identity identity)
Acquires the lock on the specified feed

Parameters:
feed - The feed to be locked
identity - The person who is locking the resource
Returns:
The lock result

acquireLock

public abstract LockResult acquireLock(OLATResourceable feed,
                                       Item item,
                                       Identity identity)
Acquires the lock of an item

Parameters:
feed - The item's feed
item - The item to be locked
identity - The person who is locking the resource
Returns:
The lock result

isLocked

public boolean isLocked(OLATResourceable feed)
Parameters:
feed -
Returns:
True if the feed is locked

getFeedKind

public java.lang.String getFeedKind(OLATResourceable ores)
There are different kinds of web feeds, e.g. podcasts, blogs etc. This method returns the kind of a resourceType. In contrast to the resource type name, the kind is a single noun designating the feed. It might be used to get a comprehensible expression for folder or file names.

Parameters:
ores -
Returns:
The kind of the resource type

setImage

public abstract void setImage(FileElement image,
                              Feed feed)
Set the image of the feed (update handled separately)

Parameters:
image -
feed -

deleteImage

public abstract void deleteImage(Feed feed)
Delete the image of the feed

Parameters:
feed -

createItemContainer

public abstract VFSContainer createItemContainer(Feed feed,
                                                 Item currentItem)
Prepare the filesystem for a new item, create the item container and all necessary sub container, e.g. the media container

Parameters:
feed -
currentItem -
Returns:
the container for the item