Formatted and cleaned up code

Fixed Java warnings
This commit is contained in:
Patrick Gotthard 2014-04-12 15:02:38 +02:00
parent d100aca9bb
commit 372e2581ce
40 changed files with 244 additions and 168 deletions

View file

@ -19,11 +19,13 @@
package org.rometools.certiorem; package org.rometools.certiorem;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class HttpStatusCodeException extends RuntimeException { public class HttpStatusCodeException extends RuntimeException {
private static final long serialVersionUID = 1L;
private final int status; private final int status;
public HttpStatusCodeException(final int status, final String message, final Throwable cause) { public HttpStatusCodeException(final int status, final String message, final Throwable cause) {

View file

@ -10,9 +10,10 @@ import org.rometools.fetcher.impl.FeedFetcherCache;
import org.rometools.fetcher.impl.SyndFeedInfo; import org.rometools.fetcher.impl.SyndFeedInfo;
/** /**
* Wrapper FeedFetcherCache that wraps a backing FeedFetcherCache and makes sure that any SyndFeedInfo used within it are replaced with a DeltaSyndFeedInfo * Wrapper FeedFetcherCache that wraps a backing FeedFetcherCache and makes sure
* that any SyndFeedInfo used within it are replaced with a DeltaSyndFeedInfo
* which is capable of tracking changes to entries in the underlying feed. * which is capable of tracking changes to entries in the underlying feed.
* *
* @author najmi * @author najmi
*/ */
public class DeltaFeedInfoCache implements FeedFetcherCache { public class DeltaFeedInfoCache implements FeedFetcherCache {

View file

@ -18,18 +18,21 @@ import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed; import com.sun.syndication.feed.synd.SyndFeed;
/** /**
* Extends SyndFeedInfo to also track etags for individual entries. This may be used with DeltaFeedInfoCache to only return feed with a subset of entries that * Extends SyndFeedInfo to also track etags for individual entries. This may be
* have changed since last fetch. * used with DeltaFeedInfoCache to only return feed with a subset of entries
* * that have changed since last fetch.
*
* @author najmi * @author najmi
*/ */
public class DeltaSyndFeedInfo extends SyndFeedInfo { public class DeltaSyndFeedInfo extends SyndFeedInfo {
/**
*
*/
private static final long serialVersionUID = 1L;
Map<String, String> entryTagsMap = new HashMap<String, String>(); Map<String, String> entryTagsMap = new HashMap<String, String>();
Map<String, Boolean> changedMap = new HashMap<String, Boolean>(); Map<String, Boolean> changedMap = new HashMap<String, Boolean>();
private DeltaSyndFeedInfo() {
}
public DeltaSyndFeedInfo(final SyndFeedInfo backingFeedInfo) { public DeltaSyndFeedInfo(final SyndFeedInfo backingFeedInfo) {
setETag(backingFeedInfo.getETag()); setETag(backingFeedInfo.getETag());
setId(backingFeedInfo.getId()); setId(backingFeedInfo.getId());
@ -38,8 +41,9 @@ public class DeltaSyndFeedInfo extends SyndFeedInfo {
} }
/** /**
* Gets a filtered version of the SyndFeed that only has entries that were changed in the last setSyndFeed() call. * Gets a filtered version of the SyndFeed that only has entries that were
* * changed in the last setSyndFeed() call.
*
* @return * @return
*/ */
@Override @Override
@ -65,8 +69,9 @@ public class DeltaSyndFeedInfo extends SyndFeedInfo {
} }
/** /**
* Overrides super class method to update changedMap and entryTagsMap for tracking changed entries. * Overrides super class method to update changedMap and entryTagsMap for
* * tracking changed entries.
*
* @param feed * @param feed
*/ */
@Override @Override
@ -89,9 +94,12 @@ public class DeltaSyndFeedInfo extends SyndFeedInfo {
private String computeEntryTag(final SyndEntry entry) { private String computeEntryTag(final SyndEntry entry) {
// Following hash algorithm suggested by Robert Cooper needs to be evaluated in future. // Following hash algorithm suggested by Robert Cooper needs to be
// int hash = ( entry.getUri() != null ? entry.getUri().hashCode() : entry.getLink().hashCode() ) ^ // evaluated in future.
// (entry.getUpdatedDate() != null ? entry.getUpdatedDate().hashCode() : entry.getPublishedDate().hashCode()) ^ // int hash = ( entry.getUri() != null ? entry.getUri().hashCode() :
// entry.getLink().hashCode() ) ^
// (entry.getUpdatedDate() != null ? entry.getUpdatedDate().hashCode() :
// entry.getPublishedDate().hashCode()) ^
// entry.getTitle().hashCode() ^ // entry.getTitle().hashCode() ^
// entry.getDescription().hashCode(); // entry.getDescription().hashCode();
@ -102,7 +110,9 @@ public class DeltaSyndFeedInfo extends SyndFeedInfo {
if (publishedDate != null) { if (publishedDate != null) {
updateDate = publishedDate; updateDate = publishedDate;
} else { } else {
// For misbehaving feeds that do not set updateDate or publishedDate we use current tiem which pretty mucg assures that it will be viewed as // For misbehaving feeds that do not set updateDate or
// publishedDate we use current tiem which pretty mucg assures
// that it will be viewed as
// changed even when it is not // changed even when it is not
updateDate = new Date(); updateDate = new Date();
} }

View file

@ -39,9 +39,10 @@ import org.rometools.fetcher.FeedFetcher;
import com.sun.syndication.feed.synd.SyndFeed; import com.sun.syndication.feed.synd.SyndFeed;
/** /**
* The basic business logic controller for the Hub implementation. It is intended to be usable under a very thin servlet wrapper, or other, non-HTTP * The basic business logic controller for the Hub implementation. It is
* intended to be usable under a very thin servlet wrapper, or other, non-HTTP
* notification methods you might want to use. * notification methods you might want to use.
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class Hub { public class Hub {
@ -62,7 +63,7 @@ public class Hub {
/** /**
* Constructs a new Hub instance * Constructs a new Hub instance
* *
* @param dao The persistence HubDAO to use * @param dao The persistence HubDAO to use
* @param verifier The verification strategy to use. * @param verifier The verification strategy to use.
*/ */
@ -72,18 +73,21 @@ public class Hub {
this.notifier = notifier; this.notifier = notifier;
this.fetcher = fetcher; this.fetcher = fetcher;
validSchemes = STANDARD_SCHEMES; validSchemes = STANDARD_SCHEMES;
validPorts = Collections.EMPTY_SET; validPorts = Collections.emptySet();
validTopics = Collections.EMPTY_SET; validTopics = Collections.emptySet();
} }
/** /**
* Constructs a new Hub instance. * Constructs a new Hub instance.
* *
* @param dao The persistence HubDAO to use * @param dao The persistence HubDAO to use
* @param verifier The verification strategy to use * @param verifier The verification strategy to use
* @param validSchemes A list of valid URI schemes for callbacks (default: http, https) * @param validSchemes A list of valid URI schemes for callbacks (default:
* @param validPorts A list of valid port numbers for callbacks (default: any) * http, https)
* @param validTopics A set of valid topic URIs which can be subscribed to (default: any) * @param validPorts A list of valid port numbers for callbacks (default:
* any)
* @param validTopics A set of valid topic URIs which can be subscribed to
* (default: any)
*/ */
public Hub(final HubDAO dao, final Verifier verifier, final Notifier notifier, final FeedFetcher fetcher, final Set<String> validSchemes, public Hub(final HubDAO dao, final Verifier verifier, final Notifier notifier, final FeedFetcher fetcher, final Set<String> validSchemes,
final Set<Integer> validPorts, final Set<String> validTopics) { final Set<Integer> validPorts, final Set<String> validTopics) {
@ -96,18 +100,29 @@ public class Hub {
this.validSchemes = readOnlySchemes == null ? STANDARD_SCHEMES : readOnlySchemes; this.validSchemes = readOnlySchemes == null ? STANDARD_SCHEMES : readOnlySchemes;
final Set<Integer> readOnlyPorts = Collections.unmodifiableSet(validPorts); final Set<Integer> readOnlyPorts = Collections.unmodifiableSet(validPorts);
this.validPorts = readOnlyPorts == null ? Collections.EMPTY_SET : readOnlyPorts; if (readOnlyPorts == null) {
this.validPorts = Collections.emptySet();
} else {
this.validPorts = readOnlyPorts;
}
final Set<String> readOnlyTopics = Collections.unmodifiableSet(validTopics); final Set<String> readOnlyTopics = Collections.unmodifiableSet(validTopics);
this.validTopics = readOnlyTopics == null ? Collections.EMPTY_SET : readOnlyTopics; if (validTopics == null) {
this.validTopics = Collections.emptySet();
} else {
this.validTopics = readOnlyTopics;
}
} }
/** /**
* Sends a notification to the subscribers * Sends a notification to the subscribers
* *
* @param requestHost the host name the hub is running on. (Used for the user agent) * @param requestHost the host name the hub is running on. (Used for the
* user agent)
* @param topic the URL of the topic that was updated. * @param topic the URL of the topic that was updated.
* @throws HttpStatusCodeException a wrapper exception with a recommended status code for the request. * @throws HttpStatusCodeException a wrapper exception with a recommended
* status code for the request.
*/ */
public void sendNotification(final String requestHost, final String topic) { public void sendNotification(final String requestHost, final String topic) {
assert validTopics.isEmpty() || validTopics.contains(topic) : "That topic is not supported by this hub. " + topic; assert validTopics.isEmpty() || validTopics.contains(topic) : "That topic is not supported by this hub. " + topic;
@ -120,7 +135,7 @@ public class Hub {
return; return;
} }
final List<SubscriptionSummary> summaries = (List<SubscriptionSummary>) dao.summariesForTopic(topic); final List<? extends SubscriptionSummary> summaries = dao.summariesForTopic(topic);
int total = 0; int total = 0;
final StringBuilder hosts = new StringBuilder(); final StringBuilder hosts = new StringBuilder();
@ -135,7 +150,7 @@ public class Hub {
.append(" subscribers)").append(hosts); .append(" subscribers)").append(hosts);
final SyndFeed feed = fetcher.retrieveFeed(userAgent.toString(), new URL(topic)); final SyndFeed feed = fetcher.retrieveFeed(userAgent.toString(), new URL(topic));
Logger.getLogger(Hub.class.getName()).log(Level.FINE, "Got feed for {0} Sending to {1} subscribers.", new Object[] { topic, subscribers.size() }); Logger.getLogger(Hub.class.getName()).log(Level.FINE, "Got feed for {0} Sending to {1} subscribers.", new Object[] { topic, subscribers.size() });
notifier.notifySubscribers((List<Subscriber>) subscribers, feed, new SubscriptionSummaryCallback() { notifier.notifySubscribers(subscribers, feed, new SubscriptionSummaryCallback() {
@Override @Override
public void onSummaryInfo(final SubscriptionSummary summary) { public void onSummaryInfo(final SubscriptionSummary summary) {
dao.handleSummary(topic, summary); dao.handleSummary(topic, summary);
@ -149,16 +164,18 @@ public class Hub {
/** /**
* Subscribes to a topic. * Subscribes to a topic.
* *
* @param callback Callback URI * @param callback Callback URI
* @param topic Topic URI * @param topic Topic URI
* @param verify Verification Type * @param verify Verification Type
* @param lease_seconds Duration of the lease * @param lease_seconds Duration of the lease
* @param secret Secret value * @param secret Secret value
* @param verify_token verify_token; * @param verify_token verify_token;
* @return Boolean.TRUE if the subscription succeeded synchronously, Boolean.FALSE if the subscription failed synchronously, or null if the request is * @return Boolean.TRUE if the subscription succeeded synchronously,
* asynchronous. * Boolean.FALSE if the subscription failed synchronously, or null
* @throws HttpStatusCodeException a wrapper exception with a recommended status code for the request. * if the request is asynchronous.
* @throws HttpStatusCodeException a wrapper exception with a recommended
* status code for the request.
*/ */
public Boolean subscribe(final String callback, final String topic, final String verify, final long lease_seconds, final String secret, public Boolean subscribe(final String callback, final String topic, final String verify, final long lease_seconds, final String secret,
final String verify_token) { final String verify_token) {

View file

@ -26,25 +26,27 @@ import org.rometools.certiorem.hub.data.SubscriptionSummary;
import com.sun.syndication.feed.synd.SyndFeed; import com.sun.syndication.feed.synd.SyndFeed;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public interface Notifier { public interface Notifier {
/** /**
* Instructs the notifier to begin sending notifications to the list of subscribers * Instructs the notifier to begin sending notifications to the list of
* * subscribers
*
* @param subscribers Subscribers to notify * @param subscribers Subscribers to notify
* @param value The SyndFeed to send them * @param value The SyndFeed to send them
* @param callback A callback that is invoked each time a subscriber is notified. * @param callback A callback that is invoked each time a subscriber is
* notified.
*/ */
public void notifySubscribers(List<Subscriber> subscribers, SyndFeed value, SubscriptionSummaryCallback callback); public void notifySubscribers(List<? extends Subscriber> subscribers, SyndFeed value, SubscriptionSummaryCallback callback);
/** /**
* A callback that is invoked each time a subscriber is notified. * A callback that is invoked each time a subscriber is notified.
*/ */
public static interface SubscriptionSummaryCallback { public static interface SubscriptionSummaryCallback {
/** /**
* *
* @param summary A summary of the data received from the subscriber * @param summary A summary of the data received from the subscriber
*/ */
public void onSummaryInfo(SubscriptionSummary summary); public void onSummaryInfo(SubscriptionSummary summary);

View file

@ -22,7 +22,7 @@ import org.rometools.certiorem.hub.data.Subscriber;
/** /**
* A strategy interface for verification of subscriptions. * A strategy interface for verification of subscriptions.
* *
* @author robert.cooper * @author robert.cooper
*/ */
public interface Verifier { public interface Verifier {
@ -38,7 +38,7 @@ public interface Verifier {
/** /**
* Verifies a subscriber (possibly) asyncronously * Verifies a subscriber (possibly) asyncronously
* *
* @param subscriber the Subscriber to verify * @param subscriber the Subscriber to verify
* @param callback a callback with the result of the verification. * @param callback a callback with the result of the verification.
*/ */
@ -46,7 +46,7 @@ public interface Verifier {
/** /**
* Verifies a subscriber syncronously * Verifies a subscriber syncronously
* *
* @param subscriber The subscriber data * @param subscriber The subscriber data
* @return boolean result; * @return boolean result;
*/ */
@ -54,7 +54,7 @@ public interface Verifier {
/** /**
* Verifies am unsubscribe (possibly) asyncronously * Verifies am unsubscribe (possibly) asyncronously
* *
* @param subscriber The subscriber data * @param subscriber The subscriber data
* @param callback result * @param callback result
*/ */
@ -62,18 +62,19 @@ public interface Verifier {
/** /**
* Verifies an unsubscribe syncronously * Verifies an unsubscribe syncronously
* *
* @param subscriber The subscriber data * @param subscriber The subscriber data
* @return boolean result; * @return boolean result;
*/ */
public boolean verifyUnsubcribeSyncronously(Subscriber subscriber); public boolean verifyUnsubcribeSyncronously(Subscriber subscriber);
/** /**
* An interface for capturing the result of a verification (subscribe or unsubscribe) * An interface for capturing the result of a verification (subscribe or
* unsubscribe)
*/ */
public static interface VerificationCallback { public static interface VerificationCallback {
/** /**
* *
* @param verified success state of the verification * @param verified success state of the verification
*/ */
public void onVerify(boolean verified); public void onVerify(boolean verified);

View file

@ -21,7 +21,7 @@ package org.rometools.certiorem.hub.data;
import java.util.List; import java.util.List;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public interface HubDAO { public interface HubDAO {

View file

@ -21,10 +21,14 @@ package org.rometools.certiorem.hub.data;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class Subscriber implements Serializable { public class Subscriber implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
public static final String VERIFY_SYNC = "sync"; public static final String VERIFY_SYNC = "sync";
public static final String VERIFY_ASYNC = "async"; public static final String VERIFY_ASYNC = "async";
private String callback; private String callback;
@ -37,7 +41,7 @@ public class Subscriber implements Serializable {
/** /**
* Set the value of callback * Set the value of callback
* *
* @param newcallback new value of callback * @param newcallback new value of callback
*/ */
public void setCallback(final String newcallback) { public void setCallback(final String newcallback) {
@ -46,7 +50,7 @@ public class Subscriber implements Serializable {
/** /**
* Get the value of callback * Get the value of callback
* *
* @return the value of callback * @return the value of callback
*/ */
public String getCallback() { public String getCallback() {
@ -55,7 +59,7 @@ public class Subscriber implements Serializable {
/** /**
* Set the value of creationTime * Set the value of creationTime
* *
* @param newcreationTime new value of creationTime * @param newcreationTime new value of creationTime
*/ */
public void setCreationTime(final long newcreationTime) { public void setCreationTime(final long newcreationTime) {
@ -64,7 +68,7 @@ public class Subscriber implements Serializable {
/** /**
* Get the value of creationTime * Get the value of creationTime
* *
* @return the value of creationTime * @return the value of creationTime
*/ */
public long getCreationTime() { public long getCreationTime() {
@ -73,7 +77,7 @@ public class Subscriber implements Serializable {
/** /**
* Set the value of leaseSeconds * Set the value of leaseSeconds
* *
* @param newleaseSeconds new value of leaseSeconds * @param newleaseSeconds new value of leaseSeconds
*/ */
public void setLeaseSeconds(final long newleaseSeconds) { public void setLeaseSeconds(final long newleaseSeconds) {
@ -82,7 +86,7 @@ public class Subscriber implements Serializable {
/** /**
* Get the value of leaseSeconds * Get the value of leaseSeconds
* *
* @return the value of leaseSeconds * @return the value of leaseSeconds
*/ */
public long getLeaseSeconds() { public long getLeaseSeconds() {
@ -91,7 +95,7 @@ public class Subscriber implements Serializable {
/** /**
* Set the value of secret * Set the value of secret
* *
* @param newsecret new value of secret * @param newsecret new value of secret
*/ */
public void setSecret(final String newsecret) { public void setSecret(final String newsecret) {
@ -100,7 +104,7 @@ public class Subscriber implements Serializable {
/** /**
* Get the value of secret * Get the value of secret
* *
* @return the value of secret * @return the value of secret
*/ */
public String getSecret() { public String getSecret() {
@ -109,7 +113,7 @@ public class Subscriber implements Serializable {
/** /**
* Set the value of topic * Set the value of topic
* *
* @param newtopic new value of topic * @param newtopic new value of topic
*/ */
public void setTopic(final String newtopic) { public void setTopic(final String newtopic) {
@ -118,7 +122,7 @@ public class Subscriber implements Serializable {
/** /**
* Get the value of topic * Get the value of topic
* *
* @return the value of topic * @return the value of topic
*/ */
public String getTopic() { public String getTopic() {
@ -127,7 +131,7 @@ public class Subscriber implements Serializable {
/** /**
* Set the value of verify * Set the value of verify
* *
* @param newverify new value of verify * @param newverify new value of verify
*/ */
public void setVerify(final String newverify) { public void setVerify(final String newverify) {
@ -136,7 +140,7 @@ public class Subscriber implements Serializable {
/** /**
* Get the value of verify * Get the value of verify
* *
* @return the value of verify * @return the value of verify
*/ */
public String getVerify() { public String getVerify() {
@ -145,7 +149,7 @@ public class Subscriber implements Serializable {
/** /**
* Set the value of vertifyToken * Set the value of vertifyToken
* *
* @param newvertifyToken new value of vertifyToken * @param newvertifyToken new value of vertifyToken
*/ */
public void setVertifyToken(final String newvertifyToken) { public void setVertifyToken(final String newvertifyToken) {
@ -154,7 +158,7 @@ public class Subscriber implements Serializable {
/** /**
* Get the value of vertifyToken * Get the value of vertifyToken
* *
* @return the value of vertifyToken * @return the value of vertifyToken
*/ */
public String getVertifyToken() { public String getVertifyToken() {

View file

@ -21,17 +21,21 @@ package org.rometools.certiorem.hub.data;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class SubscriptionSummary implements Serializable { public class SubscriptionSummary implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String host; private String host;
private boolean lastPublishSuccessful = true; private boolean lastPublishSuccessful = true;
private int subscribers = 0; private int subscribers = 0;
/** /**
* Set the value of host * Set the value of host
* *
* @param newhost new value of host * @param newhost new value of host
*/ */
public void setHost(final String newhost) { public void setHost(final String newhost) {
@ -40,7 +44,7 @@ public class SubscriptionSummary implements Serializable {
/** /**
* Get the value of host * Get the value of host
* *
* @return the value of host * @return the value of host
*/ */
public String getHost() { public String getHost() {
@ -49,7 +53,7 @@ public class SubscriptionSummary implements Serializable {
/** /**
* Set the value of lastPublishSuccessful * Set the value of lastPublishSuccessful
* *
* @param newlastPublishSuccessful new value of lastPublishSuccessful * @param newlastPublishSuccessful new value of lastPublishSuccessful
*/ */
public void setLastPublishSuccessful(final boolean newlastPublishSuccessful) { public void setLastPublishSuccessful(final boolean newlastPublishSuccessful) {
@ -58,7 +62,7 @@ public class SubscriptionSummary implements Serializable {
/** /**
* Get the value of lastPublishSuccessful * Get the value of lastPublishSuccessful
* *
* @return the value of lastPublishSuccessful * @return the value of lastPublishSuccessful
*/ */
public boolean isLastPublishSuccessful() { public boolean isLastPublishSuccessful() {
@ -67,7 +71,7 @@ public class SubscriptionSummary implements Serializable {
/** /**
* Set the value of subscribers * Set the value of subscribers
* *
* @param newsubscribers new value of subscribers * @param newsubscribers new value of subscribers
*/ */
public void setSubscribers(final int newsubscribers) { public void setSubscribers(final int newsubscribers) {
@ -76,7 +80,7 @@ public class SubscriptionSummary implements Serializable {
/** /**
* Get the value of subscribers * Get the value of subscribers
* *
* @return the value of subscribers * @return the value of subscribers
*/ */
public int getSubscribers() { public int getSubscribers() {

View file

@ -33,7 +33,7 @@ import org.rometools.certiorem.hub.data.Subscriber;
import org.rometools.certiorem.hub.data.SubscriptionSummary; import org.rometools.certiorem.hub.data.SubscriptionSummary;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class JPADAO implements HubDAO { public class JPADAO implements HubDAO {
@ -57,7 +57,9 @@ public class JPADAO implements HubDAO {
query.setParameter("topic", topic); query.setParameter("topic", topic);
try { try {
for (final JPASubscriber subscriber : (List<JPASubscriber>) query.getResultList()) { @SuppressWarnings("unchecked")
final List<JPASubscriber> subscribers = query.getResultList();
for (final JPASubscriber subscriber : subscribers) {
if (subscriber.getLeaseSeconds() == -1) { if (subscriber.getLeaseSeconds() == -1) {
result.add(subscriber); result.add(subscriber);
continue; continue;

View file

@ -31,19 +31,23 @@ import javax.persistence.TemporalType;
import org.rometools.certiorem.hub.data.Subscriber; import org.rometools.certiorem.hub.data.Subscriber;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
@Entity @Entity
@NamedQueries({ @NamedQuery(name = "Subcriber.forTopic", query = "SELECT o FROM JPASubscriber o WHERE o.topic = :topic AND o.expired = false ORDER BY o.subscribedAt") }) @NamedQueries({ @NamedQuery(name = "Subcriber.forTopic", query = "SELECT o FROM JPASubscriber o WHERE o.topic = :topic AND o.expired = false ORDER BY o.subscribedAt") })
public class JPASubscriber extends Subscriber implements Serializable { public class JPASubscriber extends Subscriber implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private Date subscribedAt = new Date(); private Date subscribedAt = new Date();
private String id; private String id;
private boolean expired = false; private boolean expired = false;
/** /**
* Set the value of expired * Set the value of expired
* *
* @param newexpired new value of expired * @param newexpired new value of expired
*/ */
public void setExpired(final boolean newexpired) { public void setExpired(final boolean newexpired) {
@ -52,7 +56,7 @@ public class JPASubscriber extends Subscriber implements Serializable {
/** /**
* Get the value of expired * Get the value of expired
* *
* @return the value of expired * @return the value of expired
*/ */
public boolean isExpired() { public boolean isExpired() {
@ -61,7 +65,7 @@ public class JPASubscriber extends Subscriber implements Serializable {
/** /**
* Set the value of id * Set the value of id
* *
* @param newid new value of id * @param newid new value of id
*/ */
public void setId(final String newid) { public void setId(final String newid) {
@ -70,7 +74,7 @@ public class JPASubscriber extends Subscriber implements Serializable {
/** /**
* Get the value of id * Get the value of id
* *
* @return the value of id * @return the value of id
*/ */
@Id @Id
@ -80,7 +84,7 @@ public class JPASubscriber extends Subscriber implements Serializable {
/** /**
* Set the value of subscribedAt * Set the value of subscribedAt
* *
* @param newsubscribedAt new value of subscribedAt * @param newsubscribedAt new value of subscribedAt
*/ */
public void setSubscribedAt(final Date newsubscribedAt) { public void setSubscribedAt(final Date newsubscribedAt) {
@ -89,7 +93,7 @@ public class JPASubscriber extends Subscriber implements Serializable {
/** /**
* Get the value of subscribedAt * Get the value of subscribedAt
* *
* @return the value of subscribedAt * @return the value of subscribedAt
*/ */
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)

View file

@ -30,7 +30,7 @@ import org.rometools.certiorem.hub.data.SubscriptionSummary;
/** /**
* A Simple In-Memory HubDAO for subscribers. * A Simple In-Memory HubDAO for subscribers.
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class InMemoryHubDAO implements HubDAO { public class InMemoryHubDAO implements HubDAO {
@ -89,7 +89,7 @@ public class InMemoryHubDAO implements HubDAO {
return result; return result;
} else { } else {
return Collections.EMPTY_LIST; return Collections.emptyList();
} }
} }

View file

@ -38,22 +38,24 @@ import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedOutput; import com.sun.syndication.io.SyndFeedOutput;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public abstract class AbstractNotifier implements Notifier { public abstract class AbstractNotifier implements Notifier {
/** /**
* This method will serialize the synd feed and build Notifications for the implementation class to handle. * This method will serialize the synd feed and build Notifications for the
* * implementation class to handle.
*
* @see enqueueNotification * @see enqueueNotification
* *
* @param subscribers List of subscribers to notify * @param subscribers List of subscribers to notify
* @param value The SyndFeed object to send * @param value The SyndFeed object to send
* @param callback A callback that will be invoked each time a subscriber is notified. * @param callback A callback that will be invoked each time a subscriber is
* * notified.
*
*/ */
@Override @Override
public void notifySubscribers(final List<Subscriber> subscribers, final SyndFeed value, final SubscriptionSummaryCallback callback) { public void notifySubscribers(final List<? extends Subscriber> subscribers, final SyndFeed value, final SubscriptionSummaryCallback callback) {
String mimeType = null; String mimeType = null;
if (value.getFeedType().startsWith("rss")) { if (value.getFeedType().startsWith("rss")) {
@ -92,15 +94,16 @@ public abstract class AbstractNotifier implements Notifier {
/** /**
* Implementation method that queues/sends a notification * Implementation method that queues/sends a notification
* *
* @param not notification to send. * @param not notification to send.
*/ */
protected abstract void enqueueNotification(Notification not); protected abstract void enqueueNotification(Notification not);
/** /**
* POSTs the payload to the subscriber's callback and returns a SubscriptionSummary with subscriber counts (where possible) and the success state of the * POSTs the payload to the subscriber's callback and returns a
* notification. * SubscriptionSummary with subscriber counts (where possible) and the
* * success state of the notification.
*
* @param subscriber subscriber data. * @param subscriber subscriber data.
* @param mimeType MIME type for the request * @param mimeType MIME type for the request
* @param payload payload of the feed to send * @param payload payload of the feed to send

View file

@ -22,7 +22,7 @@ import org.rometools.certiorem.hub.Notifier.SubscriptionSummaryCallback;
import org.rometools.certiorem.hub.data.Subscriber; import org.rometools.certiorem.hub.data.Subscriber;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class Notification { public class Notification {

View file

@ -28,8 +28,9 @@ import java.util.concurrent.TimeUnit;
import org.rometools.certiorem.hub.data.SubscriptionSummary; import org.rometools.certiorem.hub.data.SubscriptionSummary;
/** /**
* A notifier implementation that uses a thread pool to deliver notifications to subscribers * A notifier implementation that uses a thread pool to deliver notifications to
* * subscribers
*
* @author robert.cooper * @author robert.cooper
*/ */
public class ThreadPoolNotifier extends AbstractNotifier { public class ThreadPoolNotifier extends AbstractNotifier {
@ -51,9 +52,10 @@ public class ThreadPoolNotifier extends AbstractNotifier {
} }
/** /**
* Enqueues a notification to run. If the notification fails, it will be retried every two minutes until 5 attempts are completed. Notifications to the same * Enqueues a notification to run. If the notification fails, it will be
* callback should be delivered successfully in order. * retried every two minutes until 5 attempts are completed. Notifications
* * to the same callback should be delivered successfully in order.
*
* @param not * @param not
*/ */
@Override @Override
@ -82,7 +84,7 @@ public class ThreadPoolNotifier extends AbstractNotifier {
/** /**
* Schedules a notification to retry in two minutes. * Schedules a notification to retry in two minutes.
* *
* @param not Notification to retry * @param not Notification to retry
*/ */
protected void retry(final Notification not) { protected void retry(final Notification not) {

View file

@ -18,30 +18,27 @@
package org.rometools.certiorem.hub.notify.standard; package org.rometools.certiorem.hub.notify.standard;
import java.util.concurrent.ConcurrentSkipListSet;
import org.rometools.certiorem.hub.data.SubscriptionSummary; import org.rometools.certiorem.hub.data.SubscriptionSummary;
/** /**
* A notifier that does not use threads. All calls are blocking and synchronous. * A notifier that does not use threads. All calls are blocking and synchronous.
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class UnthreadedNotifier extends AbstractNotifier { public class UnthreadedNotifier extends AbstractNotifier {
private final ConcurrentSkipListSet<Notification> retries = new ConcurrentSkipListSet<Notification>();
/** /**
* A blocking call that performs a notification. If there are pending retries that are older than two minutes old, they will be retried before the method * A blocking call that performs a notification. If there are pending
* returns. * retries that are older than two minutes old, they will be retried before
* * the method returns.
*
* @param not * @param not
*/ */
@Override @Override
protected void enqueueNotification(final Notification not) { protected void enqueueNotification(final Notification not) {
not.lastRun = System.currentTimeMillis(); not.lastRun = System.currentTimeMillis();
final SubscriptionSummary summary = postNotification(not.subscriber, not.mimeType, not.payload); final SubscriptionSummary summary = postNotification(not.subscriber, not.mimeType, not.payload);
not.callback.onSummaryInfo(summary); not.callback.onSummaryInfo(summary);
} }
} }

View file

@ -34,8 +34,9 @@ import org.rometools.certiorem.hub.Verifier;
import org.rometools.certiorem.hub.data.Subscriber; import org.rometools.certiorem.hub.data.Subscriber;
/** /**
* An abstract verifier based on the java.net HTTP classes. This implements only synchronous operations, and expects a child class to do Async ops. * An abstract verifier based on the java.net HTTP classes. This implements only
* * synchronous operations, and expects a child class to do Async ops.
*
* @author robert.cooper * @author robert.cooper
*/ */
public abstract class AbstractVerifier implements Verifier { public abstract class AbstractVerifier implements Verifier {
@ -68,7 +69,8 @@ public abstract class AbstractVerifier implements Verifier {
final HttpURLConnection connection = (HttpURLConnection) url.openConnection(); final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true); connection.setDoInput(true);
// connection.setRequestProperty("Host", url.getHost()); // connection.setRequestProperty("Host", url.getHost());
// connection.setRequestProperty("Port", Integer.toString(url.getPort())); // connection.setRequestProperty("Port",
// Integer.toString(url.getPort()));
connection.setRequestProperty("User-Agent", "ROME-Certiorem"); connection.setRequestProperty("User-Agent", "ROME-Certiorem");
connection.connect(); connection.connect();
final int rc = connection.getResponseCode(); final int rc = connection.getResponseCode();

View file

@ -26,7 +26,7 @@ import org.rometools.certiorem.hub.data.Subscriber;
/** /**
* Uses a ThreadPoolExecutor to do async verifications. * Uses a ThreadPoolExecutor to do async verifications.
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class ThreadPoolVerifier extends AbstractVerifier { public class ThreadPoolVerifier extends AbstractVerifier {

View file

@ -21,7 +21,7 @@ package org.rometools.certiorem.hub.verify.standard;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class ThreadpoolVerifierAdvanced extends ThreadPoolVerifier { public class ThreadpoolVerifierAdvanced extends ThreadPoolVerifier {

View file

@ -22,7 +22,7 @@ import org.rometools.certiorem.hub.data.Subscriber;
/** /**
* A verifier that does not use threads. Suitable for Google App Engine. * A verifier that does not use threads. Suitable for Google App Engine.
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class UnthreadedVerifier extends AbstractVerifier { public class UnthreadedVerifier extends AbstractVerifier {

View file

@ -19,11 +19,16 @@
package org.rometools.certiorem.pub; package org.rometools.certiorem.pub;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class NotificationException extends Exception { public class NotificationException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
public NotificationException(final String message) { public NotificationException(final String message) {
super(message); super(message);
} }

View file

@ -33,20 +33,22 @@ import com.sun.syndication.feed.synd.SyndLink;
/** /**
* A class for sending update notifications to a hub. * A class for sending update notifications to a hub.
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class Publisher { public class Publisher {
private ThreadPoolExecutor executor; private ThreadPoolExecutor executor;
/** /**
* Constructs a new publisher. This publisher will spawn a new thread for each async send. * Constructs a new publisher. This publisher will spawn a new thread for
* each async send.
*/ */
public Publisher() { public Publisher() {
} }
/** /**
* Constructs a new publisher with an optional ThreadPoolExector for sending updates. * Constructs a new publisher with an optional ThreadPoolExector for sending
* updates.
*/ */
public Publisher(final ThreadPoolExecutor executor) { public Publisher(final ThreadPoolExecutor executor) {
this.executor = executor; this.executor = executor;
@ -54,7 +56,7 @@ public class Publisher {
/** /**
* Sends the HUB url a notification of a change in topic * Sends the HUB url a notification of a change in topic
* *
* @param hub URL of the hub to notify. * @param hub URL of the hub to notify.
* @param topic The Topic that has changed * @param topic The Topic that has changed
* @throws NotificationException Any failure * @throws NotificationException Any failure
@ -91,8 +93,9 @@ public class Publisher {
} }
/** /**
* Sends a notification for a feed located at "topic". The feed MUST contain rel="hub". * Sends a notification for a feed located at "topic". The feed MUST contain
* * rel="hub".
*
* @param topic URL for the feed * @param topic URL for the feed
* @param feed The feed itself * @param feed The feed itself
* @throws NotificationException Any failure * @throws NotificationException Any failure
@ -109,8 +112,9 @@ public class Publisher {
} }
/** /**
* Sends a notification for a feed. The feed MUST contain rel="hub" and rel="self" links. * Sends a notification for a feed. The feed MUST contain rel="hub" and
* * rel="self" links.
*
* @param feed The feed to notify * @param feed The feed to notify
* @throws NotificationException Any failure * @throws NotificationException Any failure
*/ */
@ -145,7 +149,7 @@ public class Publisher {
/** /**
* Sends the HUB url a notification of a change in topic asynchronously * Sends the HUB url a notification of a change in topic asynchronously
* *
* @param hub URL of the hub to notify. * @param hub URL of the hub to notify.
* @param topic The Topic that has changed * @param topic The Topic that has changed
* @param callback A callback invoked when the notification completes. * @param callback A callback invoked when the notification completes.
@ -172,8 +176,9 @@ public class Publisher {
} }
/** /**
* Asynchronously sends a notification for a feed located at "topic". The feed MUST contain rel="hub". * Asynchronously sends a notification for a feed located at "topic". The
* * feed MUST contain rel="hub".
*
* @param topic URL for the feed * @param topic URL for the feed
* @param feed The feed itself * @param feed The feed itself
* @param callback A callback invoked when the notification completes. * @param callback A callback invoked when the notification completes.
@ -200,8 +205,9 @@ public class Publisher {
} }
/** /**
* Asyncronously sends a notification for a feed. The feed MUST contain rel="hub" and rel="self" links. * Asyncronously sends a notification for a feed. The feed MUST contain
* * rel="hub" and rel="self" links.
*
* @param feed The feed to notify * @param feed The feed to notify
* @param callback A callback invoked when the notification completes. * @param callback A callback invoked when the notification completes.
* @throws NotificationException Any failure * @throws NotificationException Any failure
@ -232,7 +238,7 @@ public class Publisher {
public static interface AsyncNotificationCallback { public static interface AsyncNotificationCallback {
/** /**
* Called when a notification fails * Called when a notification fails
* *
* @param thrown Whatever was thrown during the failure * @param thrown Whatever was thrown during the failure
*/ */
public void onFailure(Throwable thrown); public void onFailure(Throwable thrown);

View file

@ -21,7 +21,7 @@ package org.rometools.certiorem.sub;
import org.rometools.certiorem.sub.data.Subscription; import org.rometools.certiorem.sub.data.Subscription;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public interface Requester { public interface Requester {

View file

@ -45,7 +45,7 @@ import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput; import com.sun.syndication.io.SyndFeedInput;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class Subscriptions { public class Subscriptions {

View file

@ -19,7 +19,7 @@
package org.rometools.certiorem.sub.data; package org.rometools.certiorem.sub.data;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public interface SubDAO { public interface SubDAO {

View file

@ -21,10 +21,14 @@ package org.rometools.certiorem.sub.data;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class Subscription implements Serializable { public class Subscription implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String id; private String id;
private String sourceUrl; private String sourceUrl;
private String verifyToken; private String verifyToken;
@ -35,7 +39,7 @@ public class Subscription implements Serializable {
/** /**
* Set the value of expirationTime * Set the value of expirationTime
* *
* @param newexpirationTime new value of expirationTime * @param newexpirationTime new value of expirationTime
*/ */
public void setExpirationTime(final long newexpirationTime) { public void setExpirationTime(final long newexpirationTime) {
@ -44,7 +48,7 @@ public class Subscription implements Serializable {
/** /**
* Get the value of expirationTime * Get the value of expirationTime
* *
* @return the value of expirationTime * @return the value of expirationTime
*/ */
public long getExpirationTime() { public long getExpirationTime() {
@ -53,7 +57,7 @@ public class Subscription implements Serializable {
/** /**
* Set the value of id * Set the value of id
* *
* @param newid new value of id * @param newid new value of id
*/ */
public void setId(final String newid) { public void setId(final String newid) {
@ -62,7 +66,7 @@ public class Subscription implements Serializable {
/** /**
* Get the value of id * Get the value of id
* *
* @return the value of id * @return the value of id
*/ */
public String getId() { public String getId() {
@ -71,7 +75,7 @@ public class Subscription implements Serializable {
/** /**
* Set the value of sourceUrl * Set the value of sourceUrl
* *
* @param newsourceUrl new value of sourceUrl * @param newsourceUrl new value of sourceUrl
*/ */
public void setSourceUrl(final String newsourceUrl) { public void setSourceUrl(final String newsourceUrl) {
@ -80,7 +84,7 @@ public class Subscription implements Serializable {
/** /**
* Get the value of sourceUrl * Get the value of sourceUrl
* *
* @return the value of sourceUrl * @return the value of sourceUrl
*/ */
public String getSourceUrl() { public String getSourceUrl() {
@ -89,7 +93,7 @@ public class Subscription implements Serializable {
/** /**
* Set the value of unsubscribed * Set the value of unsubscribed
* *
* @param newunsubscribed new value of unsubscribed * @param newunsubscribed new value of unsubscribed
*/ */
public void setUnsubscribed(final boolean newunsubscribed) { public void setUnsubscribed(final boolean newunsubscribed) {
@ -98,7 +102,7 @@ public class Subscription implements Serializable {
/** /**
* Get the value of unsubscribed * Get the value of unsubscribed
* *
* @return the value of unsubscribed * @return the value of unsubscribed
*/ */
public boolean isUnsubscribed() { public boolean isUnsubscribed() {
@ -107,7 +111,7 @@ public class Subscription implements Serializable {
/** /**
* Set the value of validated * Set the value of validated
* *
* @param newvalidated new value of validated * @param newvalidated new value of validated
*/ */
public void setValidated(final boolean newvalidated) { public void setValidated(final boolean newvalidated) {
@ -116,7 +120,7 @@ public class Subscription implements Serializable {
/** /**
* Get the value of validated * Get the value of validated
* *
* @return the value of validated * @return the value of validated
*/ */
public boolean isValidated() { public boolean isValidated() {
@ -125,7 +129,7 @@ public class Subscription implements Serializable {
/** /**
* Set the value of verifyToken * Set the value of verifyToken
* *
* @param newverifyToken new value of verifyToken * @param newverifyToken new value of verifyToken
*/ */
public void setVerifyToken(final String newverifyToken) { public void setVerifyToken(final String newverifyToken) {
@ -134,7 +138,7 @@ public class Subscription implements Serializable {
/** /**
* Get the value of verifyToken * Get the value of verifyToken
* *
* @return the value of verifyToken * @return the value of verifyToken
*/ */
public String getVerifyToken() { public String getVerifyToken() {

View file

@ -8,7 +8,7 @@ package org.rometools.certiorem.sub.data;
import org.rometools.fetcher.impl.SyndFeedInfo; import org.rometools.fetcher.impl.SyndFeedInfo;
/** /**
* *
* @author najmi * @author najmi
*/ */
public interface SubscriptionCallback { public interface SubscriptionCallback {

View file

@ -32,7 +32,7 @@ import org.rometools.certiorem.sub.data.SubDAO;
import org.rometools.certiorem.sub.data.Subscription; import org.rometools.certiorem.sub.data.Subscription;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class InMemorySubDAO implements SubDAO { public class InMemorySubDAO implements SubDAO {

View file

@ -27,7 +27,7 @@ import org.rometools.certiorem.sub.Requester;
import org.rometools.certiorem.sub.data.Subscription; import org.rometools.certiorem.sub.data.Subscription;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public abstract class AbstractRequester implements Requester { public abstract class AbstractRequester implements Requester {

View file

@ -26,7 +26,7 @@ import org.rometools.certiorem.sub.data.Subscription;
/** /**
* A simple requester implementation that always makes requests as Async. * A simple requester implementation that always makes requests as Async.
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class AsyncRequester extends AbstractRequester { public class AsyncRequester extends AbstractRequester {

View file

@ -30,7 +30,7 @@ import org.rometools.certiorem.sub.data.Subscription;
/** /**
* A simple requester implementation that always makes requests as Async. * A simple requester implementation that always makes requests as Async.
* *
* @author Farrukh Najmi * @author Farrukh Najmi
*/ */
public class SyncRequester extends AbstractRequester { public class SyncRequester extends AbstractRequester {

View file

@ -30,10 +30,14 @@ import org.rometools.certiorem.HttpStatusCodeException;
import org.rometools.certiorem.hub.Hub; import org.rometools.certiorem.hub.Hub;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public abstract class AbstractHubServlet extends HttpServlet { public abstract class AbstractHubServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
public static final String HUBMODE = "hub.mode"; public static final String HUBMODE = "hub.mode";
private final Hub hub; private final Hub hub;

View file

@ -30,11 +30,15 @@ import org.rometools.certiorem.HttpStatusCodeException;
import org.rometools.certiorem.sub.Subscriptions; import org.rometools.certiorem.sub.Subscriptions;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class AbstractSubServlet extends HttpServlet { public class AbstractSubServlet extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
private final Subscriptions subscriptions; private final Subscriptions subscriptions;
protected AbstractSubServlet(final Subscriptions subscriptions) { protected AbstractSubServlet(final Subscriptions subscriptions) {

View file

@ -21,7 +21,7 @@ package org.rometools.certiorem.hub;
import org.rometools.certiorem.hub.data.Subscriber; import org.rometools.certiorem.hub.data.Subscriber;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class AlwaysVerifier implements Verifier { public class AlwaysVerifier implements Verifier {

View file

@ -36,7 +36,7 @@ import org.rometools.fetcher.impl.HashMapFeedInfoCache;
import org.rometools.fetcher.impl.HttpURLFeedFetcher; import org.rometools.fetcher.impl.HttpURLFeedFetcher;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class ControllerTest { public class ControllerTest {

View file

@ -19,7 +19,7 @@ import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed; import com.sun.syndication.feed.synd.SyndFeed;
/** /**
* *
* @author najmi * @author najmi
*/ */
public class DeltaSyndFeedInfoTest { public class DeltaSyndFeedInfoTest {
@ -44,7 +44,8 @@ public class DeltaSyndFeedInfoTest {
List<SyndEntry> entries = feed.getEntries(); List<SyndEntry> entries = feed.getEntries();
assertTrue(!entries.isEmpty()); assertTrue(!entries.isEmpty());
// Fetch again and this time the entries should be empty as none have changed. // Fetch again and this time the entries should be empty as none have
// changed.
feed = feedFetcher.retrieveFeed(getFeedUrl()); feed = feedFetcher.retrieveFeed(getFeedUrl());
entries = feed.getEntries(); entries = feed.getEntries();
assertTrue(entries.isEmpty()); assertTrue(entries.isEmpty());
@ -52,7 +53,8 @@ public class DeltaSyndFeedInfoTest {
private URL getFeedUrl() throws IOException { private URL getFeedUrl() throws IOException {
final URL feedUrl = new URL("http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss"); final URL feedUrl = new URL("http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&output=rss");
// URL feedUrl = new URL("http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml"); // URL feedUrl = new
// URL("http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml");
return feedUrl; return feedUrl;
} }

View file

@ -21,7 +21,7 @@ package org.rometools.certiorem.hub;
import org.rometools.certiorem.hub.data.Subscriber; import org.rometools.certiorem.hub.data.Subscriber;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class ExceptionVerifier implements Verifier { public class ExceptionVerifier implements Verifier {

View file

@ -21,7 +21,7 @@ package org.rometools.certiorem.hub;
import org.rometools.certiorem.hub.data.Subscriber; import org.rometools.certiorem.hub.data.Subscriber;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class NeverVerifier implements Verifier { public class NeverVerifier implements Verifier {

View file

@ -25,7 +25,7 @@ import java.util.logging.Logger;
import org.junit.Test; import org.junit.Test;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public abstract class AbstractDAOTest { public abstract class AbstractDAOTest {
@ -46,7 +46,7 @@ public abstract class AbstractDAOTest {
assert result.equals(subscriber) : "Subscriber not equal."; assert result.equals(subscriber) : "Subscriber not equal.";
final List<Subscriber> subscribers = (List<Subscriber>) instance.subscribersForTopic(subscriber.getTopic()); final List<? extends Subscriber> subscribers = instance.subscribersForTopic(subscriber.getTopic());
assert subscribers.contains(result) : "Subscriber not in result."; assert subscribers.contains(result) : "Subscriber not in result.";
} }
@ -65,11 +65,11 @@ public abstract class AbstractDAOTest {
assert subscriber.equals(result) : "Subscriber not equal."; assert subscriber.equals(result) : "Subscriber not equal.";
// quick test for store. // quick test for store.
List<Subscriber> subscribers = (List<Subscriber>) instance.subscribersForTopic(subscriber.getTopic()); List<? extends Subscriber> subscribers = instance.subscribersForTopic(subscriber.getTopic());
assert subscribers.contains(result) : "Subscriber not in result."; assert subscribers.contains(result) : "Subscriber not in result.";
// sleep past expiration // sleep past expiration
Thread.sleep(1100); Thread.sleep(1100);
subscribers = (List<Subscriber>) instance.subscribersForTopic(subscriber.getTopic()); subscribers = instance.subscribersForTopic(subscriber.getTopic());
assert !subscribers.contains(result) : "Subscriber should have expired"; assert !subscribers.contains(result) : "Subscriber should have expired";
} }
@ -83,8 +83,8 @@ public abstract class AbstractDAOTest {
subscriber.setLeaseSeconds(1); subscriber.setLeaseSeconds(1);
subscriber.setVerify("VerifyMe"); subscriber.setVerify("VerifyMe");
final Subscriber result = instance.addSubscriber(subscriber);
// TODO // TODO
// final Subscriber result = instance.addSubscriber(subscriber);
} }
} }

View file

@ -22,7 +22,7 @@ import org.rometools.certiorem.hub.data.AbstractDAOTest;
import org.rometools.certiorem.hub.data.HubDAO; import org.rometools.certiorem.hub.data.HubDAO;
/** /**
* *
* @author robert.cooper * @author robert.cooper
*/ */
public class InMemoryDAOTest extends AbstractDAOTest { public class InMemoryDAOTest extends AbstractDAOTest {