oracle.syndication.client.local
Class ICESampleClient

java.lang.Object
  |
  +--oracle.syndication.client.local.ICESampleClient

public class ICESampleClient
extends java.lang.Object
implements ICEClient, ICEStatusCode, ICEClientOfferConstants

Reference implementation of the ICEClient interface. This implementation allows the user to create an instance of this client and initialize it with the URI of the Syndication Server, the URI of the subscriber listening for PUSH deliveries, and information on the ice-sender that will represent the client. After initialization, the client code can either call methods to create ice-requests as readers or actually have this client library make a remote call to the Syndication server to perform a series of ice-requests including ice-get-catalog, ice-offer, and ice-get-package, and get the response back as an ice-payload.


Constructor Summary
ICESampleClient()
          Default empty constructor does some simple initialization.
 
Method Summary
TypeMethod
 java.io.Reader createGetCatalogPayload(java.lang.String szPid, java.lang.String szReqId)
          Creates the get-catalog request payload as a reader
 java.io.Reader createGetEventsPayload(java.lang.String szPayloadId, java.lang.String szRequestId, java.lang.String szFormat, ISODatetime isodtStart, ISODatetime isodtStop, java.lang.String szSubsId)
          Creates the get-events request payload as a reader
 java.io.Reader createGetPackagePayload(java.lang.String szPayloadId, java.lang.String szRequestId, java.lang.String szSubsId, java.lang.String szCurrState)
          Creates the get-package request payload as a reader
 java.io.Reader createGetStatusPayload(java.lang.String szPayloadId, java.lang.String szRequestId, java.lang.String szSubsId)
          Creates the get-status request payload as a reader
 java.io.Reader createSubscribePayload(java.lang.String szPayloadId, java.lang.String szRequestId, Ice_offer offer)
          Creates the subscribe (ice-offer) request payload as a reader
 java.io.Reader createUnsubscribePayload(java.lang.String szPid, java.lang.String szReqId, java.lang.String szSubscriptionId)
          Creates the cancel-subscription request payload as a reader
 Ice_payload getCatalog(java.lang.String payload_id, java.lang.String request_id)
          Asks for the catalog from the specified server.
 Ice_payload getEvents(java.lang.String payload_id, java.lang.String request_id, java.lang.String format, ISODatetime start, ISODatetime stop, java.lang.String subscription_id)
          get events for a specified subscription within certain timeframe
 java.lang.String getId()
          Returns the sender id that every ICE message will be branded with
 int getInterval()
           
 java.lang.String getName()
          Returns the sender name that every ICE message will be branded with
 Ice_payload getPackage(java.lang.String payload_id, java.lang.String request_id, java.lang.String subscription_id, java.lang.String current_state)
          PULL package ( content ) for an existing subscription
 java.lang.String getServerURI()
          Gets the URI in String format of the Syndication Server
 java.lang.String getSSOPassword()
          Returns the sender password that every ICE message will be branded with
 java.lang.String getSSOUsername()
          Return SSO user identity
 Ice_payload getStatus(java.lang.String payload_id, java.lang.String request_id, java.lang.String subscription_id)
          get status for a specified subscription
 java.lang.String getUri()
          Return the subscriber location for receiving a PUSHed package
 void init(HTTPClient.URI serverUri, java.lang.String szSubscriberUri, java.lang.String szSenderId, java.lang.String szSenderName, java.lang.String szSSOUser, java.lang.String szSSOPawd, int iSenderRole, int iDeliveryIntv)
           
 OSSResponse nonSSOSendRequest(HTTPClient.URI destURI, OSSRequest req)
          This method is used in non-sso case for the syndication entity ( Server: PUSH or Broadcasting; Client: Send request )
 OSSResponse sendRequest(HTTPClient.URI destURI, OSSRequest req)
          This method is used for the syndication entity ( Server: PUSH or Broadcasting; Client: Send request ) if m_szSenderPassword is null, we will try non-sso sendRequest otherwise, we will try sso SendRequest
 void setId(java.lang.String id)
           
 void setInterval(int iIntv)
          Set the delivery interval
 void setName(java.lang.String name)
           
 void setSenderRole(int role)
           
 void setServerURI(HTTPClient.URI serverUri)
           
 void setSSOPassword(java.lang.String p_szPassword)
           
 void setSSOUsername(java.lang.String p_szUser)
           
 Ice_payload subscribe(java.lang.String payload_id, java.lang.String request_id, Ice_offer ice_offer)
          Subscribe to the offer from the catalog provided by the server and establish the business term and delivery policies
 Ice_payload unsubscribe(java.lang.String payload_id, java.lang.String request_id, java.lang.String szSubscriptionId)
          Cancel subscription
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ICESampleClient

public ICESampleClient()
Default empty constructor does some simple initialization. Then the init method has to be called to make use of the library.
Method Detail

init

public void init(HTTPClient.URI serverUri,
                 java.lang.String szSubscriberUri,
                 java.lang.String szSenderId,
                 java.lang.String szSenderName,
                 java.lang.String szSSOUser,
                 java.lang.String szSSOPawd,
                 int iSenderRole,
                 int iDeliveryIntv)
          throws OSSException
Parameters:
szServerUri - The url of the ICE syndication server this subscriber instance is going to commucate with
szSenderId - The required sender unique identifier (UUID) of the current ICE-request sender which is using the current subscriber instance
szSenderName - The sender name
szSSOUser - The Oracle SSO User name
szSSOPawd - The Oracle SSO User password
iSenderRole - The role describes the role in this ICE conversation
iDeliveryIntv - The parameter describes the default PUSH delivery interval

getUri

public java.lang.String getUri()
Return the subscriber location for receiving a PUSHed package
Specified by:
getUri in interface ICEClient

createGetCatalogPayload

public java.io.Reader createGetCatalogPayload(java.lang.String szPid,
                                              java.lang.String szReqId)
Creates the get-catalog request payload as a reader
Specified by:
createGetCatalogPayload in interface ICEClient

createSubscribePayload

public java.io.Reader createSubscribePayload(java.lang.String szPayloadId,
                                             java.lang.String szRequestId,
                                             Ice_offer offer)
Creates the subscribe (ice-offer) request payload as a reader
Specified by:
createSubscribePayload in interface ICEClient

createUnsubscribePayload

public java.io.Reader createUnsubscribePayload(java.lang.String szPid,
                                               java.lang.String szReqId,
                                               java.lang.String szSubscriptionId)
Creates the cancel-subscription request payload as a reader
Specified by:
createUnsubscribePayload in interface ICEClient

sendRequest

public OSSResponse sendRequest(HTTPClient.URI destURI,
                               OSSRequest req)
                        throws OSSException
This method is used for the syndication entity ( Server: PUSH or Broadcasting; Client: Send request ) if m_szSenderPassword is null, we will try non-sso sendRequest otherwise, we will try sso SendRequest
Parameters:
destURI - , the target where req to be sent
req - , the request to be sent
Returns:
the response from the server

nonSSOSendRequest

public OSSResponse nonSSOSendRequest(HTTPClient.URI destURI,
                                     OSSRequest req)
                              throws OSSException
This method is used in non-sso case for the syndication entity ( Server: PUSH or Broadcasting; Client: Send request )

createGetPackagePayload

public java.io.Reader createGetPackagePayload(java.lang.String szPayloadId,
                                              java.lang.String szRequestId,
                                              java.lang.String szSubsId,
                                              java.lang.String szCurrState)
Creates the get-package request payload as a reader
Specified by:
createGetPackagePayload in interface ICEClient

createGetStatusPayload

public java.io.Reader createGetStatusPayload(java.lang.String szPayloadId,
                                             java.lang.String szRequestId,
                                             java.lang.String szSubsId)
Creates the get-status request payload as a reader

createGetEventsPayload

public java.io.Reader createGetEventsPayload(java.lang.String szPayloadId,
                                             java.lang.String szRequestId,
                                             java.lang.String szFormat,
                                             ISODatetime isodtStart,
                                             ISODatetime isodtStop,
                                             java.lang.String szSubsId)
Creates the get-events request payload as a reader

getCatalog

public Ice_payload getCatalog(java.lang.String payload_id,
                              java.lang.String request_id)
                       throws OSSException
Asks for the catalog from the specified server.
Specified by:
getCatalog in interface ICEClient
Parameters:
payload_id - The sender specifies the unique id for the "get-catalog" request payload
request_id - The sender spefified the unique id for the individual request inside the GETCATALOG request payload ( mutiple request supported in ICE1.1)
Returns:
Response payload from the syndication server

subscribe

public Ice_payload subscribe(java.lang.String payload_id,
                             java.lang.String request_id,
                             Ice_offer ice_offer)
                      throws OSSException
Subscribe to the offer from the catalog provided by the server and establish the business term and delivery policies
Specified by:
subscribe in interface ICEClient
Parameters:
payload_id - The sender specifies the unique id for the "subscribe" request payload
request_id - The sender spefified the unique id for the individual request inside the "subscribe" request payload ( mutiple request supported in ICE1.1)
ice_offer - The offer list which the subscriber is about to subscribe to.
Returns:
Server response

unsubscribe

public Ice_payload unsubscribe(java.lang.String payload_id,
                               java.lang.String request_id,
                               java.lang.String szSubscriptionId)
                        throws OSSException
Cancel subscription
Specified by:
unsubscribe in interface ICEClient
Parameters:
payload_id - The payload id generated by the local client system. Must be unique across all the payloads sent out by this client application.
request_id - The request id to identify the current "cancel- subscription" request which is generated by the local client system and should be unique within the same ice payload across all the requests.
szSubscriptionId - The unique id known to both the client ( as the subscriber ) and the syndication server, which is assigned to the client by the server during the subscribing time
Returns:
Server response

getPackage

public Ice_payload getPackage(java.lang.String payload_id,
                              java.lang.String request_id,
                              java.lang.String subscription_id,
                              java.lang.String current_state)
                       throws OSSException
PULL package ( content ) for an existing subscription
Specified by:
getPackage in interface ICEClient
Parameters:
payload_id - The payload id generated by the local client system. Must be unique across all the payloads sent out by this client application.
request_id - The request id to identify the current "get-package" request which is generated by the local client system and should be unique within the same ice payload across all the requests.
szSubscriptionId - The unique id known to both the client ( as the subscriber ) and the syndication server, which is assigned to the client by the server during the subscribing time.
Returns:
Server response

getStatus

public Ice_payload getStatus(java.lang.String payload_id,
                             java.lang.String request_id,
                             java.lang.String subscription_id)
                      throws OSSException
get status for a specified subscription
Specified by:
getStatus in interface ICEClient
Parameters:
payload_id - The payload id generated by the local client system. Must be unique across all the payloads sent out by this client application.
request_id - The request id to identify the current "get-status" request which is generated by the local client system and should be unique within the same ice payload across all the requests.
szSubscriptionId - The unique id known to both the client ( as the subscriber ) and the syndication server, which is assigned to the client by the server during the subscribing time.
Returns:
Server response

getEvents

public Ice_payload getEvents(java.lang.String payload_id,
                             java.lang.String request_id,
                             java.lang.String format,
                             ISODatetime start,
                             ISODatetime stop,
                             java.lang.String subscription_id)
                      throws OSSException
get events for a specified subscription within certain timeframe
Specified by:
getEvents in interface ICEClient
Parameters:
payload_id - The payload id generated by the local client system. Must be unique across all the payloads sent out by this client application.
request_id - The request id to identify the current "get-status" request which is generated by the local client system and should be unique within the same ice payload across all the requests.
format - should be "ice" in current implementation
start - used to filter returned events
stop - used to filter returned events
szSubscriptionId - The unique id known to both the client ( as the subscriber ) and the syndication server, which is assigned to the client by the server during the subscribing time.
Returns:
Server response

setServerURI

public void setServerURI(HTTPClient.URI serverUri)
Parameters:
serverUri - The url of the ICE Syndication Server this client instance is going to talk to

getServerURI

public java.lang.String getServerURI()
Gets the URI in String format of the Syndication Server

setId

public void setId(java.lang.String id)
Parameters:
id - The GUID for the sender currently bind to the sender instance

getId

public java.lang.String getId()
Returns the sender id that every ICE message will be branded with
Specified by:
getId in interface ICEClient

setSSOUsername

public void setSSOUsername(java.lang.String p_szUser)
Parameters:
p_szUsername - for SSO login process

getSSOUsername

public java.lang.String getSSOUsername()
Return SSO user identity

setSSOPassword

public void setSSOPassword(java.lang.String p_szPassword)
Parameters:
password - for the sender

getSSOPassword

public java.lang.String getSSOPassword()
Returns the sender password that every ICE message will be branded with

setName

public void setName(java.lang.String name)
Parameters:
name - The name for the current sender who is bound to the current sender instance

getName

public java.lang.String getName()
Returns the sender name that every ICE message will be branded with
Specified by:
getName in interface ICEClient

setSenderRole

public void setSenderRole(int role)
                   throws OSSException
Parameters:
role - describes the role in this ICE conversation for the current sender. It is restricted to be "Ice_sender.ROLE_SUBSCRIBER or Ice_sender.ROLE_SYNDICATOR"

setInterval

public void setInterval(int iIntv)
Set the delivery interval

getInterval

public int getInterval()
Specified by:
getInterval in interface ICEClient