|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.module.data.importer.ImportHandler info.magnolia.module.rssaggregator.importhandler.RSSFeedImportHandler
public class RSSFeedImportHandler
ImportHandler capable of importing RSS and Atom feeds over http for aggregate feeds defined in RSS Aggregator module.
Allows optional configuration with aRSSFeedFetcher
implementation of choice, by means of configuring the
content node:
/data/rssaggregator/If no custom implementation is configured, will fall back to using the default
SimpleRSSFeedFetcher
.
Field Summary |
---|
Fields inherited from class info.magnolia.module.data.importer.ImportHandler |
---|
activateImport, automatedExecution, backup, backupFile, deleteOldData, lockDuringImport, MILLI_2_HOUR, name, NODE_DATA_IMPORT_STATE, NODE_DATA_IMPORT_STATE_NEW, NODE_DATA_IMPORT_STATE_OLD, NODE_DATA_USED_IMPORTER_TARGET, repository, running, targets |
Constructor Summary | |
---|---|
RSSFeedImportHandler(RSSFeedFetcher feedFetcher)
Creates handler with default mappers AggregateFeedContentMapper and FilterPredicateContentMapper . |
Method Summary | |
---|---|
protected javax.jcr.Node |
createCategoriesNode(com.sun.syndication.feed.synd.SyndEntry entry,
javax.jcr.Node entryNode)
|
protected javax.jcr.Node |
createFeedChannelEntryNode(com.sun.syndication.feed.synd.SyndEntry entry,
String nodeName,
javax.jcr.Node channelNode)
Create a feed channel entry node under the given channelNode with the given nodeName
for the given entry . |
Set |
doImport(info.magnolia.module.data.importer.ImportTarget target,
info.magnolia.cms.core.Content parentNode,
Set newContentUUIDs)
|
protected String |
getEntryContent(com.sun.syndication.feed.synd.SyndEntry entry)
Retrieves the main content of an entry. |
protected javax.jcr.Node |
getOrCreateNode(javax.jcr.Node contentNode,
String name,
String itemType)
Behaves exactly like ContentUtil#getOrCreateContent(Content, String, ItemType) . |
protected void |
checkPreConditions()
|
AggregateFilter |
loadAggregateFilter(javax.jcr.Node aggregateNode)
Load the AggregateFilter for the AggregateFeed which is represented by the given
aggregateNode . |
Set<AggregateFeed> |
loadAggregates(javax.jcr.Node parentNode)
Load the aggregate feed definitions and their feed channels from the
Content Repository. |
protected javax.jcr.Node |
loadSingleAggregateNode(javax.jcr.Node parentNode,
String aggregateNodeName)
Load a single aggregate content node from the given parentNode with the given
aggregateName . |
protected javax.jcr.Node |
recreateFeedChannelNode(FeedChannel feedChannel,
javax.jcr.Node dataNode)
Recreate the feed channel content node the given feed channel in the Content Repository. |
protected Set<String> |
saveAggregates(Set<AggregateFeed> aggregateFeeds,
javax.jcr.Node parentNode)
Save the feed entry content contained in the feed channels of the
given aggregateFeeds as childs of the given parentNode . |
protected javax.jcr.Node |
saveFeedChannel(FeedChannel feedChannel,
AggregateFilter aggregateFilter,
javax.jcr.Node dataNode)
Save the entries contained in the given
FeedChannel that pass the given AggregateFilter in the provided dataNode . |
protected AggregateFeedContentMapper |
setAggregateFeedContentMapper(AggregateFeedContentMapper aggregateFeedMapper)
for testing. |
RSSFeedFetcher |
setFeedFetcher(RSSFeedFetcher rssFeedFetcher)
for testing. |
protected FilterPredicateContentMapper |
setFilterPredicateContentMapper(FilterPredicateContentMapper filterPredicateMapper)
for testing. |
Methods inherited from class info.magnolia.module.data.importer.ImportHandler |
---|
addTarget, backup, collectOldContent, destroy, doPostImport, execute, executeImport, getAutomatedExecution, getName, getParent, getRepository, getTargets, isActivateImport, isBackup, isDeleteOldData, isLockDuringImport, lock, restore, setActivateImport, setAutomatedExecution, setBackup, setDeleteOldData, setImportState, setLockDuringImport, setName, setRepository, setTargets, unlock |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
@Inject public RSSFeedImportHandler(RSSFeedFetcher feedFetcher)
AggregateFeedContentMapper
and FilterPredicateContentMapper
.
Method Detail |
---|
protected void checkPreConditions() throws info.magnolia.module.data.importer.ImportException
checkPreConditions
in class info.magnolia.module.data.importer.ImportHandler
info.magnolia.module.data.importer.ImportException
public Set doImport(info.magnolia.module.data.importer.ImportTarget target, info.magnolia.cms.core.Content parentNode, Set newContentUUIDs) throws info.magnolia.module.data.importer.ImportException
doImport
in class info.magnolia.module.data.importer.ImportHandler
info.magnolia.module.data.importer.ImportException
public Set<AggregateFeed> loadAggregates(javax.jcr.Node parentNode) throws javax.jcr.RepositoryException
aggregate feed
definitions and their feed channels
from the
Content Repository.
parentNode
- the parent content node that holds the aggregate feed nodes
javax.jcr.RepositoryException
- when an exception occurs accessing the Content Repositoryprotected Set<String> saveAggregates(Set<AggregateFeed> aggregateFeeds, javax.jcr.Node parentNode) throws javax.jcr.RepositoryException
feed entry
content contained in the feed channels
of the
given aggregateFeeds
as childs of the given parentNode
. If an AggregateFeed
has
AggregateFilter
defined, feed entries must pass the filter before they will be actually saved in the
Content Repository.
parentNode
- the parent content node of the aggregate feeds content to saveaggregateFeeds
- the aggregate feeds to save
javax.jcr.RepositoryException
- when an exception occurs accessing the Content Repositoryprotected javax.jcr.Node loadSingleAggregateNode(javax.jcr.Node parentNode, String aggregateNodeName) throws javax.jcr.RepositoryException
parentNode
with the given
aggregateName
. If no such aggregate could be found, null
is returned.
parentNode
- the parentNode to load the node fromaggregateNodeName
- the name of the aggregate content node to load
null
if no such node was found
IllegalStateException
- when multiple aggregate content nodes with the same name are found
javax.jcr.RepositoryException
protected javax.jcr.Node getOrCreateNode(javax.jcr.Node contentNode, String name, String itemType) throws javax.jcr.RepositoryException
ContentUtil#getOrCreateContent(Content, String, ItemType)
. This method exists for
testability.
contentNode
- the contentNode to (create if non-existant and then) getname
- the name of the nodeitemType
- the type of the content node
javax.jcr.RepositoryException
- when an exception occurs accessing the Content Repositorypublic AggregateFilter loadAggregateFilter(javax.jcr.Node aggregateNode) throws javax.jcr.RepositoryException
AggregateFilter
for the AggregateFeed
which is represented by the given
aggregateNode
. Only
aggregateNode
- the content node representing the AggregateFeed to load the AggregateFilter for
javax.jcr.RepositoryException
- when an exception occurs accessing the Content Repositoryprotected javax.jcr.Node saveFeedChannel(FeedChannel feedChannel, AggregateFilter aggregateFilter, javax.jcr.Node dataNode) throws javax.jcr.RepositoryException
entries
contained in
the given
FeedChannel
that pass the given AggregateFilter
in the provided dataNode
.
dataNode
- the content node to store the feed content underfeedChannel
- the feed channel to saveaggregateFilter
- the aggregate filter to apply to entries in the feed channel
javax.jcr.RepositoryException
- when an exception occurs accessing the Content Repositoryprotected javax.jcr.Node recreateFeedChannelNode(FeedChannel feedChannel, javax.jcr.Node dataNode) throws javax.jcr.RepositoryException
dataNode
- the node to store the feed channel underfeedChannel
- the feed channel to recreate
javax.jcr.RepositoryException
- when an exception occurs accessing the Content Repositoryprotected javax.jcr.Node createFeedChannelEntryNode(com.sun.syndication.feed.synd.SyndEntry entry, String nodeName, javax.jcr.Node channelNode) throws javax.jcr.RepositoryException
channelNode
with the given nodeName
for the given entry
.
entry
- the feed channel entry to savenodeName
- the name of the feed channel entry node to createchannelNode
- the feed channel content node to create the feed channel entry under
javax.jcr.RepositoryException
- when an exception occurs accessing the Content Repositoryprotected String getEntryContent(com.sun.syndication.feed.synd.SyndEntry entry)
entry
- Feed entry holding all data.
protected javax.jcr.Node createCategoriesNode(com.sun.syndication.feed.synd.SyndEntry entry, javax.jcr.Node entryNode) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected AggregateFeedContentMapper setAggregateFeedContentMapper(AggregateFeedContentMapper aggregateFeedMapper)
public RSSFeedFetcher setFeedFetcher(RSSFeedFetcher rssFeedFetcher)
protected FilterPredicateContentMapper setFilterPredicateContentMapper(FilterPredicateContentMapper filterPredicateMapper)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |