This repository has been archived by the owner on Oct 29, 2019. It is now read-only.
/
NewsService.java
103 lines (92 loc) · 3.26 KB
/
NewsService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/**********************************************************************************
* $URL$
* $Id$
***********************************************************************************
*
* Copyright (c) 2003, 2004, 2005, 2006, 2008 The Sakai Foundation
*
* Licensed under the Educational Community License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.osedu.org/licenses/ECL-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************************/
package org.sakaiproject.news.api;
import java.util.List;
import org.sakaiproject.javax.Filter;
import org.sakaiproject.entity.api.EntityProducer;
/**
* <p>
* NewsService is the interface for retrieving and caching news items from a rss news feed.
* </p>
*/
public interface NewsService extends EntityProducer
{
/** This string can be used to find the service in the service manager. */
public static final String SERVICE_NAME = NewsService.class.getName();
/** This string starts the references to resources in this service. */
public static final String REFERENCE_ROOT = "/news";
/**
* Retrieves a list of rss feeds that are being used.
*
* @return A list of NewsChannel objects (possibly empty).
*/
public List getChannels();
/**
* Retrieves a NewsChannel object indexed by a URL.
*
* @param source
* The url for the channel.
* @return A NewsChannel object (possibly null).
* @throws NewsConnectionException
* @throws NewsFormatException
*/
public NewsChannel getChannel(String source) throws NewsConnectionException, NewsFormatException;
/**
* Retrieves a list of rss feeds that are being used.
*
* @return A list of NewsChannel objects (possibly empty).
* @throws ?
* if param channel is not a valid url.
*/
public void removeChannel(String channel);
/**
* Retrieves a list of items from an rss feed.
*
* @param channel
* The url for the feed.
* @return A list of NewsItem objects retrieved from the feed.
* @throws ?
* if param feed is not a valid url.
*/
public List getNewsitems(String channel) throws NewsConnectionException, NewsFormatException;
/**
* Retrieves a list of items from an rss feed.
*
* @param channel
* The url for the feed.
* @param filter
* A filtering object to accept NewsItems, or null if no filtering is desired.
* @return A list of NewsItem objects retrieved from the feed.
* @throws ?
* if param feed is not a valid url.
*/
public List getNewsitems(String channel, Filter filter) throws NewsConnectionException, NewsFormatException;
/**
* Checks whether an update is available for the rss news feed.
*
* @param feed
* The url for the feed.
* @return true if update is available, false otherwise
* @throws ?
* if param feed is not a valid url.
*/
public boolean isUpdateAvailable(String channel);
}