net.sourceforge.java.feednread.backend.importer
Class NewsFeedFavoritesTreeOPMLImport

java.lang.Object
  extended bynet.sourceforge.java.feednread.backend.importer.OPMLImport
      extended bynet.sourceforge.java.feednread.backend.importer.NewsFeedFavoritesTreeOPMLImport

public class NewsFeedFavoritesTreeOPMLImport
extends OPMLImport

Imports a NewsFeedFavoritesTree from an extended OPML 1.1 File into an arbitrary Category.

Author:
Sebastian Machhausen
See Also:
NewsFeedFavoritesTreeOPMLExport

Field Summary
private  Map elements
           Maps guids to IMutableTreeElements
private  MainApplicationWindow mainWindow
           The Feed'n Read main window
private  IProgressMonitor monitor
           The IProgressMonitor to report the progress of the import to
private  ThreadPool pool
           The ThreadPool to use for synchronizing NewsFeeds associated to Favoites with cache and archive
 
Fields inherited from class net.sourceforge.java.feednread.backend.importer.OPMLImport
 
Constructor Summary
NewsFeedFavoritesTreeOPMLImport(Category targetCategory, MainApplicationWindow mainWindow)
           Creates a new NewsFeedFavoritesTreeOPMLImport bound to the specified Category.
NewsFeedFavoritesTreeOPMLImport(Category targetCategory, MainApplicationWindow mainWindow, IProgressMonitor monitor)
           Creates a new NewsFeedFavoritesTreeOPMLImport bound to the specified Category.
 
Method Summary
 void doImport(String fileName)
           Imports the OPML Document from the File with the specified fileName.
 Map getElements()
           Gets the imported IMutableTreeElements backed up by a Map.
private  int getFavoriteCount(Element element)
           Recursively determines the number of Favorites in the specified Element.
protected  NewsFeed getNewsFeedFromCache(String url)
           Gets the the cached NewsFeed or null if the NewsFeed is not in cache.
protected  void importCategory(Element outline, Category parent)
           Recursively imports the specified outline Element into the the specified Category.
private  void importExtendedCategorySettings(Element outline, Category category)
           Imports the extended settings from the specified outline Element into the specified Category.
private  void importExtendedFavoriteSettings(Element outline, Favorite favorite)
           Imports the extended settings from the specified outline Element into the specified Favorite.
protected  void importFavorite(Element outline, Category parent)
           Imports the specified outline Element as Favorite into the specified parent Category.
private  void reportProgress(String title)
           Reports progress of this import operation.
private  void scheduleFavoriteUpdate(Favorite favorite)
           Creates and schedules a ScheduledJob for the specified Favorite.
private  void synchronizeWithArchive(Favorite favorite)
           
 
Methods inherited from class net.sourceforge.java.feednread.backend.importer.OPMLImport
getCreationDate, getTitle, isCategory, parseDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mainWindow

private MainApplicationWindow mainWindow

The Feed'n Read main window


monitor

private IProgressMonitor monitor

The IProgressMonitor to report the progress of the import to


pool

private ThreadPool pool

The ThreadPool to use for synchronizing NewsFeeds associated to Favoites with cache and archive


elements

private Map elements

Maps guids to IMutableTreeElements

Constructor Detail

NewsFeedFavoritesTreeOPMLImport

public NewsFeedFavoritesTreeOPMLImport(Category targetCategory,
                                       MainApplicationWindow mainWindow)

Creates a new NewsFeedFavoritesTreeOPMLImport bound to the specified Category.

Parameters:
targetCategory - the Category to import into
mainWindow - the Feed'n Read main window

NewsFeedFavoritesTreeOPMLImport

public NewsFeedFavoritesTreeOPMLImport(Category targetCategory,
                                       MainApplicationWindow mainWindow,
                                       IProgressMonitor monitor)

Creates a new NewsFeedFavoritesTreeOPMLImport bound to the specified Category.

Parameters:
targetCategory - the Category to import into
mainWindow - the Feed'n Read main window
monitor - the progress monitor to report the progress of the import to
Method Detail

getElements

public Map getElements()

Gets the imported IMutableTreeElements backed up by a Map. A single IMutableTreeElement can be accessed in the Map via its guid.

Returns:
the imported IMutableTreeElements

doImport

public void doImport(String fileName)
              throws JDOMException,
                     IOException

Imports the OPML Document from the File with the specified fileName.

Overrides:
doImport in class OPMLImport
Parameters:
fileName - the name of the file to import from
Throws:
IOException - if the import failed due to an IO error
JDOMException

importCategory

protected void importCategory(Element outline,
                              Category parent)

Recursively imports the specified outline Element into the the specified Category.

Overrides:
importCategory in class OPMLImport
Parameters:
outline - the outline Element to import
parent - the Category to import into

importFavorite

protected void importFavorite(Element outline,
                              Category parent)

Imports the specified outline Element as Favorite into the specified parent Category.

Overrides:
importFavorite in class OPMLImport
Parameters:
outline - the outline Element to import
parent - the Category to import into

getNewsFeedFromCache

protected NewsFeed getNewsFeedFromCache(String url)

Gets the the cached NewsFeed or null if the NewsFeed is not in cache.

Parameters:
url - the url of the NewsFeed to get from the cache
Returns:
the cached NewsFeed or null if the NewsFeed is not in cache

synchronizeWithArchive

private void synchronizeWithArchive(Favorite favorite)
Parameters:
favorite -

importExtendedCategorySettings

private void importExtendedCategorySettings(Element outline,
                                            Category category)

Imports the extended settings from the specified outline Element into the specified Category.

Parameters:
outline - the outline Element to import
category - the target Category to import the extended settings in

importExtendedFavoriteSettings

private void importExtendedFavoriteSettings(Element outline,
                                            Favorite favorite)

Imports the extended settings from the specified outline Element into the specified Favorite.

Parameters:
outline - the outline Element to import
favorite - the target Favorite to import the extended settings in

scheduleFavoriteUpdate

private void scheduleFavoriteUpdate(Favorite favorite)

Creates and schedules a ScheduledJob for the specified Favorite.

Parameters:
favorite - the Favorite to schedule the update for

getFavoriteCount

private int getFavoriteCount(Element element)

Recursively determines the number of Favorites in the specified Element.

Parameters:
element - the Element to determine the Favorite count for
Returns:
the number of Favorites

reportProgress

private void reportProgress(String title)

Reports progress of this import operation.

Parameters:
title - the title of the Favorite or Category to report progress for