Package org.bedework.synch.shared.cnctrs
Interface ConnectorInstance<InfoT extends BaseSubscriptionInfo>
-
- All Known Implementing Classes:
AbstractConnectorInstance,BaseConnectorInstance
public interface ConnectorInstance<InfoT extends BaseSubscriptionInfo>The interface implemented by connectors. A connector instance is obtained from a connector to handle a specific end of a specific subscription - items of inforamtion handed to the getConnectorInstance method.- Author:
- Mike Douglass
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classConnectorInstance.ItemInfoInformation used to synch ends A and B This information is only valid in the context of a given subscription.static classConnectorInstance.SynchItemsInfoStatus OK and no items is end of batch.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.oasis_open.docs.ws_calendar.ns.soap.AddItemResponseTypeaddItem(ietf.params.xml.ns.icalendar_2.IcalendarType val)Add a calendar componentbooleanchanged()Called before a resynch takes place to determine if the end point has changed and needs resynch.org.oasis_open.docs.ws_calendar.ns.soap.DeleteItemResponseTypedeleteItem(String uid)Delete a calendar component.org.oasis_open.docs.ws_calendar.ns.soap.FetchItemResponseTypefetchItem(String uid)Fetch a calendar component.List<org.oasis_open.docs.ws_calendar.ns.soap.FetchItemResponseType>fetchItems(List<String> uids)Fetch a batch of calendar components.ConnectorgetConnector()ConnectorInstance.SynchItemsInfogetItemsInfo()Get information about items in the subscribed calendar.BaseSubscriptionInfo.CrudCtsgetLastCrudCts()InfoTgetSubInfo()BaseSubscriptionInfo.CrudCtsgetTotalCrudCts()org.oasis_open.docs.ws_calendar.ns.soap.BaseResponseTypeopen()Called when a subscription is activated on synch engine startup or after creation of a new subscription.voidsetLastCrudCts(BaseSubscriptionInfo.CrudCts val)voidsetTotalCrudCts(BaseSubscriptionInfo.CrudCts val)booleansubscribe(org.bedework.synch.wsmessages.SubscribeResponseType sr)Do whatever is required to set up a subscription to the end point for this connector instance.booleanunsubscribe(org.bedework.synch.wsmessages.UnsubscribeRequestType usreq, org.bedework.synch.wsmessages.UnsubscribeResponseType usresp)Check to see if an unsubscribe can go ahead.org.oasis_open.docs.ws_calendar.ns.soap.UpdateItemResponseTypeupdateItem(org.oasis_open.docs.ws_calendar.ns.soap.UpdateItemType updates)Update a calendar component.booleanvalidateActiveSubInfo(org.bedework.synch.wsmessages.ActiveSubscriptionRequestType req, org.oasis_open.docs.ws_calendar.ns.soap.BaseResponseType resp, Connector cnctr, BaseSubscriptionInfo info)Ensure active subscription info matches the subscription
-
-
-
Method Detail
-
subscribe
boolean subscribe(org.bedework.synch.wsmessages.SubscribeResponseType sr) throws SynchExceptionDo whatever is required to set up a subscription to the end point for this connector instance. This is a one time call when a new subscription is created and allows the connector instance to validate the information.This method should set the appropriate status if an error occurs.
the open method handles any dynamic creation of a connection to the subscribed-to service.
- Parameters:
sr-- Returns:
- false if the subscription fails - status has been set in response
- Throws:
SynchException
-
unsubscribe
boolean unsubscribe(org.bedework.synch.wsmessages.UnsubscribeRequestType usreq, org.bedework.synch.wsmessages.UnsubscribeResponseType usresp) throws SynchExceptionCheck to see if an unsubscribe can go ahead. This method should ensure that the important properties in the request match those set in the subscription, e.g. pathsThis method should set the appropriate status and return false if an error occurs.
- Parameters:
usreq-usresp-- Returns:
- false if the unsubscribe fails - status has been set in response
- Throws:
SynchException
-
validateActiveSubInfo
boolean validateActiveSubInfo(org.bedework.synch.wsmessages.ActiveSubscriptionRequestType req, org.oasis_open.docs.ws_calendar.ns.soap.BaseResponseType resp, Connector cnctr, BaseSubscriptionInfo info) throws SynchExceptionEnsure active subscription info matches the subscription- Parameters:
req-resp-cnctr-info-- Returns:
- true if all ok
- Throws:
SynchException
-
open
org.oasis_open.docs.ws_calendar.ns.soap.BaseResponseType open() throws SynchExceptionCalled when a subscription is activated on synch engine startup or after creation of a new subscription.- Returns:
- status + messages
- Throws:
SynchException
-
getConnector
Connector getConnector() throws SynchException
- Returns:
- the connector for this instance
- Throws:
SynchException
-
getSubInfo
InfoT getSubInfo() throws SynchException
- Returns:
- the info for the subscription this instance is handling.
- Throws:
SynchException
-
changed
boolean changed() throws SynchExceptionCalled before a resynch takes place to determine if the end point has changed and needs resynch. Only the source end of a subscription will be checked. Note that false positives may occur if changes happen outside of the synch time boundaries. For notification driven endpoints this can probably always return false.- Returns:
- true if a change occurred
- Throws:
SynchException
-
setLastCrudCts
void setLastCrudCts(BaseSubscriptionInfo.CrudCts val) throws SynchException
- Parameters:
val-- Throws:
SynchException
-
getLastCrudCts
BaseSubscriptionInfo.CrudCts getLastCrudCts() throws SynchException
- Returns:
- cts
- Throws:
SynchException
-
setTotalCrudCts
void setTotalCrudCts(BaseSubscriptionInfo.CrudCts val) throws SynchException
- Parameters:
val-- Throws:
SynchException
-
getTotalCrudCts
BaseSubscriptionInfo.CrudCts getTotalCrudCts() throws SynchException
- Returns:
- cts
- Throws:
SynchException
-
getItemsInfo
ConnectorInstance.SynchItemsInfo getItemsInfo() throws SynchException
Get information about items in the subscribed calendar. Used for initial synch.- Returns:
- List of items - never null, maybe empty.
- Throws:
SynchException
-
addItem
org.oasis_open.docs.ws_calendar.ns.soap.AddItemResponseType addItem(ietf.params.xml.ns.icalendar_2.IcalendarType val) throws SynchExceptionAdd a calendar component- Parameters:
val-- Returns:
- response
- Throws:
SynchException
-
fetchItem
org.oasis_open.docs.ws_calendar.ns.soap.FetchItemResponseType fetchItem(String uid) throws SynchException
Fetch a calendar component. The uid is required as a key as it is the only value which is guaranteed to be available at both ends.- Parameters:
uid- of item- Returns:
- response
- Throws:
SynchException
-
fetchItems
List<org.oasis_open.docs.ws_calendar.ns.soap.FetchItemResponseType> fetchItems(List<String> uids) throws SynchException
Fetch a batch of calendar components. The number and order of the result set must match that of the parameter uids.- Parameters:
uids- of items- Returns:
- responses
- Throws:
SynchException
-
updateItem
org.oasis_open.docs.ws_calendar.ns.soap.UpdateItemResponseType updateItem(org.oasis_open.docs.ws_calendar.ns.soap.UpdateItemType updates) throws SynchExceptionUpdate a calendar component.- Parameters:
updates- has the change token, href, and the component selection fields set.- Returns:
- response
- Throws:
SynchException
-
deleteItem
org.oasis_open.docs.ws_calendar.ns.soap.DeleteItemResponseType deleteItem(String uid) throws SynchException
Delete a calendar component.- Parameters:
uid- - of the component to delete.- Returns:
- response
- Throws:
SynchException
-
-