Package org.bedework.synch.shared.cnctrs
Class AbstractConnectorInstance<CnctrT extends AbstractConnector,InfoT extends BaseSubscriptionInfo,ConfigT extends ConnectorConfigI>
- java.lang.Object
-
- org.bedework.synch.shared.cnctrs.AbstractConnectorInstance<CnctrT,InfoT,ConfigT>
-
- All Implemented Interfaces:
ConnectorInstance<InfoT>,org.bedework.util.logging.Logged
- Direct Known Subclasses:
BaseConnectorInstance
public abstract class AbstractConnectorInstance<CnctrT extends AbstractConnector,InfoT extends BaseSubscriptionInfo,ConfigT extends ConnectorConfigI> extends Object implements org.bedework.util.logging.Logged, ConnectorInstance<InfoT>
Abstract connector instance to handle some trivia.- Author:
- Mike Douglass
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.bedework.synch.shared.cnctrs.ConnectorInstance
ConnectorInstance.ItemInfo, ConnectorInstance.SynchItemsInfo
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractConnectorInstance(Subscription sub, org.bedework.synch.wsmessages.SynchEndType end, InfoT info, CnctrT cnctr, ConfigT config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.http.impl.client.CloseableHttpClientgetClient()ConnectorgetConnector()BaseSubscriptionInfo.CrudCtsgetLastCrudCts()org.bedework.util.logging.BwLoggergetLogger()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.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 subscriptionprotected booleanvalidateSubInfo(org.bedework.synch.wsmessages.SubscribeResponseType sr, Connector cnctr, BaseSubscriptionInfo info)Ensure subscription info is valid-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bedework.synch.shared.cnctrs.ConnectorInstance
addItem, changed, deleteItem, fetchItem, fetchItems, getItemsInfo, updateItem
-
Methods inherited from interface org.bedework.util.logging.Logged
audit, debug, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, warn
-
-
-
-
Field Detail
-
sub
protected Subscription sub
-
end
protected org.bedework.synch.wsmessages.SynchEndType end
-
info
protected InfoT extends BaseSubscriptionInfo info
-
cnctr
protected final CnctrT extends AbstractConnector cnctr
-
config
protected final ConfigT extends ConnectorConfigI config
-
-
Constructor Detail
-
AbstractConnectorInstance
protected AbstractConnectorInstance(Subscription sub, org.bedework.synch.wsmessages.SynchEndType end, InfoT info, CnctrT cnctr, ConfigT config)
-
-
Method Detail
-
getConnector
public Connector getConnector()
- Specified by:
getConnectorin interfaceConnectorInstance<CnctrT extends AbstractConnector>- Returns:
- the connector for this instance
-
getSubInfo
public InfoT getSubInfo()
- Specified by:
getSubInfoin interfaceConnectorInstance<CnctrT extends AbstractConnector>- Returns:
- the info for the subscription this instance is handling.
-
open
public org.oasis_open.docs.ws_calendar.ns.soap.BaseResponseType open() throws SynchExceptionDescription copied from interface:ConnectorInstanceCalled when a subscription is activated on synch engine startup or after creation of a new subscription.- Specified by:
openin interfaceConnectorInstance<CnctrT extends AbstractConnector>- Returns:
- status + messages
- Throws:
SynchException
-
subscribe
public boolean subscribe(org.bedework.synch.wsmessages.SubscribeResponseType sr) throws SynchExceptionDescription copied from interface:ConnectorInstanceDo 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.
- Specified by:
subscribein interfaceConnectorInstance<CnctrT extends AbstractConnector>- Returns:
- false if the subscription fails - status has been set in response
- Throws:
SynchException
-
unsubscribe
public boolean unsubscribe(org.bedework.synch.wsmessages.UnsubscribeRequestType usreq, org.bedework.synch.wsmessages.UnsubscribeResponseType usresp) throws SynchExceptionDescription copied from interface:ConnectorInstanceCheck 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.
- Specified by:
unsubscribein interfaceConnectorInstance<CnctrT extends AbstractConnector>- Returns:
- false if the unsubscribe fails - status has been set in response
- Throws:
SynchException
-
validateActiveSubInfo
public boolean validateActiveSubInfo(org.bedework.synch.wsmessages.ActiveSubscriptionRequestType req, org.oasis_open.docs.ws_calendar.ns.soap.BaseResponseType resp, Connector cnctr, BaseSubscriptionInfo info) throws SynchExceptionDescription copied from interface:ConnectorInstanceEnsure active subscription info matches the subscription- Specified by:
validateActiveSubInfoin interfaceConnectorInstance<CnctrT extends AbstractConnector>- Returns:
- true if all ok
- Throws:
SynchException
-
setLastCrudCts
public void setLastCrudCts(BaseSubscriptionInfo.CrudCts val) throws SynchException
- Specified by:
setLastCrudCtsin interfaceConnectorInstance<CnctrT extends AbstractConnector>- Parameters:
val-- Throws:
SynchException
-
getLastCrudCts
public BaseSubscriptionInfo.CrudCts getLastCrudCts() throws SynchException
- Specified by:
getLastCrudCtsin interfaceConnectorInstance<CnctrT extends AbstractConnector>- Returns:
- cts
- Throws:
SynchException
-
setTotalCrudCts
public void setTotalCrudCts(BaseSubscriptionInfo.CrudCts val) throws SynchException
- Specified by:
setTotalCrudCtsin interfaceConnectorInstance<CnctrT extends AbstractConnector>- Parameters:
val-- Throws:
SynchException
-
getTotalCrudCts
public BaseSubscriptionInfo.CrudCts getTotalCrudCts() throws SynchException
- Specified by:
getTotalCrudCtsin interfaceConnectorInstance<CnctrT extends AbstractConnector>- Returns:
- cts
- Throws:
SynchException
-
validateSubInfo
protected boolean validateSubInfo(org.bedework.synch.wsmessages.SubscribeResponseType sr, Connector cnctr, BaseSubscriptionInfo info) throws SynchExceptionEnsure subscription info is valid- Parameters:
sr-cnctr-info-- Returns:
- true if all ok
- Throws:
SynchException
-
getClient
protected org.apache.http.impl.client.CloseableHttpClient getClient() throws SynchException- Throws:
SynchException
-
getLogger
public org.bedework.util.logging.BwLogger getLogger()
- Specified by:
getLoggerin interfaceorg.bedework.util.logging.Logged
-
-