|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjimm.twice.ice.IceMachine
jimm.twice.ice.Subscriber
jimm.twice.subscriber.TwICESubscriber
A subscriber that can deal with subscriptions, persistence, and HTTP.
Field Summary | |
protected static int |
BUFSIZ
|
protected java.util.ArrayList |
confirmationsList
|
protected java.lang.String |
cstoreDir
|
protected java.text.SimpleDateFormat |
dateFormatter
|
protected boolean |
dateTimeStamps
|
protected java.util.ArrayList |
itemContents
|
protected org.apache.axis.MessageContext |
msgContext
|
protected java.lang.String |
pstoreDir
|
protected java.util.ArrayList |
remainingOffers
|
protected static java.lang.String |
SAVED_FILE_DATE_FORMAT
|
protected IceSyndicatorFullPortType |
syndicator
|
protected java.net.URL |
syndicatorURL
|
protected boolean |
uniqueFileNames
|
Fields inherited from class jimm.twice.ice.Subscriber |
LOG_FILE_PREFIX, offers, subscriptions |
Fields inherited from class jimm.twice.ice.IceMachine |
DEFAULT_LOGGER_PREFIX, domain, loggerPrefix, party, PING_RESPONSE_STRING |
Constructor Summary | |
TwICESubscriber()
Constructor. |
Method Summary | |
void |
addSubscription(Subscription sub)
Add a subscription. |
protected void |
buildDirectoryHierarchy(java.lang.StringBuffer buf,
java.lang.String dirPrefix,
java.io.File dir)
Recursively builds a string representation of a directory structure. |
java.lang.String |
cancelSelectedSubscriptions(HttpServletRequest request)
Cancels selected subscriptions and returns HTML for display. |
java.lang.String |
cancelSubscription(java.lang.String subId)
Requests a subscription cancellation. |
OfferType |
findOffer(java.lang.String id)
Returns the offer with the given id. |
static TwICESubscriber |
findOrCreate(HttpSession session)
Either finds the current subscriber or creates a new one. |
java.lang.String |
getListenerURL()
|
protected java.lang.String |
getSubscriptionFileContents(java.lang.String subId,
java.lang.String contentFilename)
|
void |
handlePing()
|
boolean |
hasOffers()
Returns true if there are any offers. |
protected void |
load()
Loads subscriber and subscription information from permanent storage. |
java.util.List |
offerList()
For testing. |
java.util.Iterator |
offers()
Returns an iterator over the offer id strings. |
java.lang.String |
pingSyndicator()
Pings the syndicator and returns the response. |
OK |
receiveCancellation(Cancellation cancellationResp)
|
PackageConfirmationsType |
receivePackage(PackageType p)
|
PackageConfirmationsType |
receivePackages(Packages p)
|
OK |
receiveStatus(StatusType statusResp)
|
OK |
receiveSubscription(SubscriptionType subscriptionResp)
|
void |
removeAllSubscriptions()
Removes all subscriptions. |
protected OfferType |
removeUnwantedTransports(OfferType offer,
int offerNum,
HttpServletRequest request)
Given an offer, remove the transports that are not selected by the user. |
void |
requestAndParseCatalog()
Requests a catalog and parses the results, saving a list of outstanding offers. |
java.lang.String[] |
requestSubscriptionContents(HttpServletRequest request)
Requests the contents of all specified "pull" subscriptions from the syndicator. |
java.lang.String[] |
requestSubscriptionStatus(java.lang.String subId)
Requests the status of the specified subscription from the syndicator. |
java.lang.String |
retrieveSubscriptionContents(java.lang.String subId)
Retrieves and returns the contents of the subscription with the specified subscription id. |
protected void |
sendDeliveryConfirmations()
Sends a delivery confirmations message to the syndicator |
void |
setMessageContext(org.apache.axis.MessageContext msgContext)
|
protected void |
store()
Stores subscriber and subscription information to permanent storage. |
void |
subscribe(HttpServletRequest request)
Subscribes to offers selected in HTTP form by sending one subscription request to the syndicator for each offer. |
void |
subscribeDirect(java.util.Collection wanted)
Subscribes to offers contained in a list by building and sending a subscription request to the syndicator. |
void |
subscribeFull(java.util.Collection wanted)
Subscribes to offers contained in a list by building and sending a subscription request to the syndicator. |
protected java.lang.String |
subscriptionContentsAsString(SubscriptionType sub)
Returns the contents of a subscription as a string. |
Methods inherited from class jimm.twice.ice.Subscriber |
findSubscription, hasSubscription, hasSubscriptions, 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 |
protected static final int BUFSIZ
protected static final java.lang.String SAVED_FILE_DATE_FORMAT
protected java.lang.String pstoreDir
protected java.lang.String cstoreDir
protected java.net.URL syndicatorURL
protected boolean dateTimeStamps
protected boolean uniqueFileNames
protected java.text.SimpleDateFormat dateFormatter
protected IceSyndicatorFullPortType syndicator
protected org.apache.axis.MessageContext msgContext
protected java.util.ArrayList confirmationsList
protected java.util.ArrayList remainingOffers
protected java.util.ArrayList itemContents
Constructor Detail |
public TwICESubscriber()
Method Detail |
public static TwICESubscriber findOrCreate(HttpSession session)
public void setMessageContext(org.apache.axis.MessageContext msgContext)
public java.lang.String getListenerURL()
public java.util.Iterator offers()
public boolean hasOffers()
true
if there are any offers. Requests a catalog from
the syndicator if necessary.
public OfferType findOffer(java.lang.String id)
null
if not foundpublic java.util.List offerList()
public void requestAndParseCatalog()
null
.
public void subscribe(HttpServletRequest request)
request
- the http servlet requestprotected OfferType removeUnwantedTransports(OfferType offer, int offerNum, HttpServletRequest request) throws org.apache.axis.types.URI.MalformedURIException
offer
- an offerofferNum
- offer's number in list of HTTP fields; not same as idrequest
- the http servlet request
org.apache.axis.types.URI.MalformedURIException
public void subscribeDirect(java.util.Collection wanted)
wanted
- list of subscription offerspublic void subscribeFull(java.util.Collection wanted)
wanted
- list of subscription offerspublic void addSubscription(Subscription sub)
public void removeAllSubscriptions()
public java.lang.String cancelSelectedSubscriptions(HttpServletRequest request)
public java.lang.String cancelSubscription(java.lang.String subId)
subId
- a subscription id
public java.lang.String retrieveSubscriptionContents(java.lang.String subId)
subId
- a subscription idprotected java.lang.String getSubscriptionFileContents(java.lang.String subId, java.lang.String contentFilename) throws java.io.IOException
java.io.IOException
protected void sendDeliveryConfirmations()
public java.lang.String[] requestSubscriptionContents(HttpServletRequest request)
public java.lang.String[] requestSubscriptionStatus(java.lang.String subId)
subId
- subscription IDpublic void handlePing() throws StatusCode
handlePing
in class Subscriber
StatusCode
public PackageConfirmationsType receivePackage(PackageType p) throws StatusCode
receivePackage
in class Subscriber
StatusCode
public PackageConfirmationsType receivePackages(Packages p) throws StatusCode
receivePackages
in class Subscriber
StatusCode
public OK receiveCancellation(Cancellation cancellationResp) throws StatusCode
receiveCancellation
in class Subscriber
StatusCode
public OK receiveSubscription(SubscriptionType subscriptionResp) throws StatusCode
receiveSubscription
in class Subscriber
StatusCode
public OK receiveStatus(StatusType statusResp) throws StatusCode
receiveStatus
in class Subscriber
StatusCode
protected java.lang.String subscriptionContentsAsString(SubscriptionType sub)
sub
- a subscription
protected void buildDirectoryHierarchy(java.lang.StringBuffer buf, java.lang.String dirPrefix, java.io.File dir)
buf
- output goes into this string bufferdirPrefix
- a string representing the directories above this onedir
- a directorypublic java.lang.String pingSyndicator()
protected void load()
protected void store()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |