jimm.twice.ice
Class Subscriber

java.lang.Object
  extended byjimm.twice.ice.IceMachine
      extended byjimm.twice.ice.Subscriber
Direct Known Subclasses:
TwICESubscriber

public abstract class Subscriber
extends IceMachine

The subscriber class implements behavior common to all subscribers. Subclasses need to manage subscriptions and worry about HTTP.

Author:
Jim Menard, jimm@io.com

Field Summary
protected static java.lang.String LOG_FILE_PREFIX
           
protected  java.util.ArrayList offers
          Presumably, subclasses will add offers to this list.
protected  java.util.ArrayList subscriptions
          Presumably, subclasses will add subscriptions to this list.
 
Fields inherited from class jimm.twice.ice.IceMachine
DEFAULT_LOGGER_PREFIX, domain, loggerPrefix, party, PING_RESPONSE_STRING
 
Constructor Summary
Subscriber(java.lang.String domain, Party party)
          Constructor.
 
Method Summary
 SubscriptionType findSubscription(java.lang.String subId)
          Returns the subscription with the specified identifier, or null if there is no such subscription.
abstract  void handlePing()
           
 boolean hasSubscription(java.lang.String subId)
          Returns true if we have the specified subscription.
 boolean hasSubscriptions()
          Returns true if this subscriber has any subscriptions.
abstract  OK receiveCancellation(Cancellation cancellationResp)
           
abstract  PackageConfirmationsType receivePackage(PackageType packageResp)
           
abstract  PackageConfirmationsType receivePackages(Packages packagesResp)
           
abstract  OK receiveStatus(StatusType statusResp)
           
abstract  OK receiveSubscription(SubscriptionType subscriptionResp)
           
 java.util.Iterator subscriptions()
          Returns an iterator over the collection of subscriptions.
 
Methods inherited from class jimm.twice.ice.IceMachine
createIceHeader, getDomain, getLocationURL, getName, getParty, getRole, getUuid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_FILE_PREFIX

protected static final java.lang.String LOG_FILE_PREFIX
See Also:
Constant Field Values

subscriptions

protected java.util.ArrayList subscriptions
Presumably, subclasses will add subscriptions to this list.


offers

protected java.util.ArrayList offers
Presumably, subclasses will add offers to this list.

Constructor Detail

Subscriber

public Subscriber(java.lang.String domain,
                  Party party)
Constructor. The log file prefix is set to LOG_FILE_PREFIX.

Parameters:
domain - the machine's domain, used for generating ids 'n stuff
party - this machine's syndicator or subscriber information
Method Detail

hasSubscriptions

public boolean hasSubscriptions()
Returns true if this subscriber has any subscriptions.

Returns:
true if this subscriber has any subscriptions

subscriptions

public java.util.Iterator subscriptions()
Returns an iterator over the collection of subscriptions.

Returns:
an iterator over the collection of subscriptions

findSubscription

public SubscriptionType findSubscription(java.lang.String subId)
Returns the subscription with the specified identifier, or null if there is no such subscription.

Parameters:
subId - a subscription id
Returns:
the subcription or null if not found

hasSubscription

public boolean hasSubscription(java.lang.String subId)
Returns true if we have the specified subscription.


handlePing

public abstract void handlePing()
                         throws StatusCode
Throws:
StatusCode

receivePackage

public abstract PackageConfirmationsType receivePackage(PackageType packageResp)
                                                 throws StatusCode
Throws:
StatusCode

receivePackages

public abstract PackageConfirmationsType receivePackages(Packages packagesResp)
                                                  throws StatusCode
Throws:
StatusCode

receiveCancellation

public abstract OK receiveCancellation(Cancellation cancellationResp)
                                throws StatusCode
Throws:
StatusCode

receiveSubscription

public abstract OK receiveSubscription(SubscriptionType subscriptionResp)
                                throws StatusCode
Throws:
StatusCode

receiveStatus

public abstract OK receiveStatus(StatusType statusResp)
                          throws StatusCode
Throws:
StatusCode