microsoft.exchange.webservices.data.notification
Class StreamingSubscriptionConnection

java.lang.Object
  extended by microsoft.exchange.webservices.data.notification.StreamingSubscriptionConnection
All Implemented Interfaces:
Closeable, HangingServiceRequestBase.IHandleResponseObject, HangingServiceRequestBase.IHangingRequestDisconnectHandler

public final class StreamingSubscriptionConnection
extends Object
implements Closeable, HangingServiceRequestBase.IHandleResponseObject, HangingServiceRequestBase.IHangingRequestDisconnectHandler

Represents a connection to an ongoing stream of events.


Nested Class Summary
static interface StreamingSubscriptionConnection.INotificationEventDelegate
           
static interface StreamingSubscriptionConnection.ISubscriptionErrorDelegate
           
 
Constructor Summary
StreamingSubscriptionConnection(ExchangeService service, int lifetime)
          Initializes a new instance of the StreamingSubscriptionConnection class.
StreamingSubscriptionConnection(ExchangeService service, Iterable<StreamingSubscription> subscriptions, int lifetime)
          Initializes a new instance of the StreamingSubscriptionConnection class.
 
Method Summary
 void addOnDisconnect(StreamingSubscriptionConnection.ISubscriptionErrorDelegate disconnect)
          Set event to happen when property disconnect.
 void addOnNotificationEvent(StreamingSubscriptionConnection.INotificationEventDelegate notificationEvent)
          Set event to happen when property Notify.
 void addOnSubscriptionError(StreamingSubscriptionConnection.ISubscriptionErrorDelegate subscriptionError)
          Set event to happen when property subscriptionError.
 void addSubscription(StreamingSubscription subscription)
          Adds a subscription to this connection.
 void clearDisconnect()
          Clears disconnect events list.
 void clearNotificationEvent()
          Clears notification events list.
 void clearSubscriptionError()
          Clears subscription events list.
 void close()
          Closes this connection so it stops receiving events from the server.This terminates a long-standing call to EWS.
 void dispose()
          Frees resources associated with this StreamingSubscriptionConnection.
 boolean getIsOpen()
          Gets a value indicating whether this connection is opened
 void handleResponseObject(Object response)
          Callback delegate to handle asynchronous response.
 void hangingRequestDisconnectHandler(Object sender, HangingRequestDisconnectEventArgs args)
          Delegate method to handle a hanging request disconnection.
 void open()
          Opens this connection so it starts receiving events from the server.This results in a long-standing call to EWS.
 void removeDisconnect(StreamingSubscriptionConnection.ISubscriptionErrorDelegate disconnect)
          Remove the event from happening when property disconnect.
 void removeNotificationEvent(StreamingSubscriptionConnection.INotificationEventDelegate notificationEvent)
          Remove the event from happening when property Notify.
 void removeSubscription(StreamingSubscription subscription)
          Removes the specified streaming subscription from the connection.
 void removeSubscriptionError(StreamingSubscriptionConnection.ISubscriptionErrorDelegate subscriptionError)
          Remove the event from happening when property subscription.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamingSubscriptionConnection

public StreamingSubscriptionConnection(ExchangeService service,
                                       int lifetime)
                                throws Exception
Initializes a new instance of the StreamingSubscriptionConnection class.

Parameters:
service - The ExchangeService instance this connection uses to connect to the server.
lifetime - The maximum time, in minutes, the connection will remain open. Lifetime must be between 1 and 30.
Throws:
Exception

StreamingSubscriptionConnection

public StreamingSubscriptionConnection(ExchangeService service,
                                       Iterable<StreamingSubscription> subscriptions,
                                       int lifetime)
                                throws Exception
Initializes a new instance of the StreamingSubscriptionConnection class.

Parameters:
service - The ExchangeService instance this connection uses to connect to the server.
subscriptions - Iterable subcriptions
lifetime - The maximum time, in minutes, the connection will remain open. Lifetime must be between 1 and 30.
Throws:
Exception
Method Detail

addOnNotificationEvent

public void addOnNotificationEvent(StreamingSubscriptionConnection.INotificationEventDelegate notificationEvent)
Set event to happen when property Notify.

Parameters:
notificationEvent - notification event

removeNotificationEvent

public void removeNotificationEvent(StreamingSubscriptionConnection.INotificationEventDelegate notificationEvent)
Remove the event from happening when property Notify.

Parameters:
notificationEvent - notification event

clearNotificationEvent

public void clearNotificationEvent()
Clears notification events list.


addOnSubscriptionError

public void addOnSubscriptionError(StreamingSubscriptionConnection.ISubscriptionErrorDelegate subscriptionError)
Set event to happen when property subscriptionError.

Parameters:
subscriptionError - subscription event

removeSubscriptionError

public void removeSubscriptionError(StreamingSubscriptionConnection.ISubscriptionErrorDelegate subscriptionError)
Remove the event from happening when property subscription.

Parameters:
subscriptionError - subscription event

clearSubscriptionError

public void clearSubscriptionError()
Clears subscription events list.


addOnDisconnect

public void addOnDisconnect(StreamingSubscriptionConnection.ISubscriptionErrorDelegate disconnect)
Set event to happen when property disconnect.

Parameters:
disconnect - disconnect event

removeDisconnect

public void removeDisconnect(StreamingSubscriptionConnection.ISubscriptionErrorDelegate disconnect)
Remove the event from happening when property disconnect.

Parameters:
disconnect - disconnect event

clearDisconnect

public void clearDisconnect()
Clears disconnect events list.


addSubscription

public void addSubscription(StreamingSubscription subscription)
                     throws Exception
Adds a subscription to this connection.

Parameters:
subscription - The subscription to add.
Throws:
Exception - Thrown when AddSubscription is called while connected.

removeSubscription

public void removeSubscription(StreamingSubscription subscription)
                        throws Exception
Removes the specified streaming subscription from the connection.

Parameters:
subscription - The subscription to remove.
Throws:
Exception - Thrown when RemoveSubscription is called while connected.

open

public void open()
          throws ServiceLocalException,
                 Exception
Opens this connection so it starts receiving events from the server.This results in a long-standing call to EWS.

Throws:
Exception
ServiceLocalException - Thrown when Open is called while connected.

close

public void close()
Closes this connection so it stops receiving events from the server.This terminates a long-standing call to EWS.

Specified by:
close in interface Closeable

getIsOpen

public boolean getIsOpen()
                  throws Exception
Gets a value indicating whether this connection is opened

Throws:
Exception

dispose

public void dispose()
Frees resources associated with this StreamingSubscriptionConnection.


handleResponseObject

public void handleResponseObject(Object response)
                          throws ArgumentException
Description copied from interface: HangingServiceRequestBase.IHandleResponseObject
Callback delegate to handle asynchronous response.

Specified by:
handleResponseObject in interface HangingServiceRequestBase.IHandleResponseObject
Parameters:
response - Response received from the server
Throws:
ArgumentException

hangingRequestDisconnectHandler

public void hangingRequestDisconnectHandler(Object sender,
                                            HangingRequestDisconnectEventArgs args)
Description copied from interface: HangingServiceRequestBase.IHangingRequestDisconnectHandler
Delegate method to handle a hanging request disconnection.

Specified by:
hangingRequestDisconnectHandler in interface HangingServiceRequestBase.IHangingRequestDisconnectHandler
Parameters:
sender - the object invoking the delegate
args - event data


Copyright © 2012–2015 Microsoft. All rights reserved.