The IChannelEntryProvider interface provides the following method to retrieve the entries from a specific channel:
public IChannelEntries getChannelEntries(IChannel channel, Object user, Locale locale, Map<Object, Object> additionalParams);
The following example shows how to implement a channel entry provider that returns a single entry.
public class MyChannelEntryProvider implements IChannelEntryProvider{ public IChannelEntries getChannelEntries( IChannel channel, Object user, Locale locale, Map <Object, Object> additionalParams) { String myChannelAttribute_1 = channel.getAttribute("myChannelAttribute_1"); String myChannelAttribute_2 = channel.getAttribute("myChannelAttribute_2"); IChannelEntries result = null; try { /** * Business logic that determines the parameter values of an entry for the current channel instance */ /** The type of the entry must match the type of the channel **/ String type = channel.getType(); IFeedEntry myEntry = new MyFeedEntry(id, title, description, link, date, iconURI, customAttributes, type); List<IFeedEntry> entries = new LinkedList<IFeedEntry>(); entries.add(myEntry); result = new MyChannelEntries(entries); } catch (Exception e) { /** * We recommend returning the exception within the IChannelEntries object */ List<ChannelException> errors = new LinkedList<ChannelException>(); errors.add(new ChannelException(channel.getID(), e.getMessage(), e)); result = new MyChannelEntries(null, errors); } return result; } public class MyFeedEntry implements IFeedEntry { /** * Default implementation of IFeedEntry */ } public class MyChannelEntries implements IChannelEntries { /** * Default implementation of IChannelEntries */ } }