Interface Connector<C extends ConnectorInstance<?>,​N extends Notification<?>,​Tconf extends ConnectorConfigI>

  • Type Parameters:
    C -
    N -
    All Known Implementing Classes:
    AbstractConnector

    public interface Connector<C extends ConnectorInstance<?>,​N extends Notification<?>,​Tconf extends ConnectorConfigI>
    The interface implemented by connectors. This represents the kind of object used to communicate with a particular system or entity. We may implement connectors for files, for exchange for bedework etc.

    The connector instance carries out global initialization and provides ConnectorInstance objects per subscription.

    There is only one instance of each kind of connector with a particular configuration. This connector is called to obtain a ConnectorInstance which carries out the actual operations for a given subscription.

    Author:
    Mike Douglass
    • Method Detail

      • start

        void start​(String connectorId,
                   Tconf conf,
                   String callbackUri,
                   SynchEngine syncher)
            throws SynchException
        Start the connector. A response of null means no synch available.

        The callback url is unique to the connector. It will be used as a path prefix to allow the callback service to locate the handler for incoming callback requests.

        For example, if the callback context is /synchcb/ and the connector id is "bedework" then the callback uri might be /synchcb/bedework/. The connector might append a uid to that path to allow it to locate the active subscription for which the callback is intended.

        Parameters:
        connectorId - - registered id for the connector
        conf -
        callbackUri -
        syncher -
        Throws:
        SynchException
      • getStatus

        String getStatus()
        Returns:
        a useful status message
      • isManager

        boolean isManager()
        Returns:
        true if we are the manager
      • isStarted

        boolean isStarted()
        Returns:
        true if we started
      • isFailed

        boolean isFailed()
        Returns:
        true if we failed in some way
      • isStopped

        boolean isStopped()
        Returns:
        true if we're stopped
      • isReadOnly

        boolean isReadOnly()
        Is this a read-only connector?
        Returns:
        boolean
      • getTrustLastmod

        boolean getTrustLastmod()
        Can we trust the lastmod from this connector?
        Returns:
        boolean
      • getId

        String getId()
        Returns:
        id provided at start
      • getCallbackUri

        String getCallbackUri()
        Returns:
        callbackUri provided at start
      • getSyncher

        SynchEngine getSyncher()
        Returns:
        syncher provided at start
      • getIcalObjectFactory

        ietf.params.xml.ns.icalendar_2.ObjectFactory getIcalObjectFactory()
        Returns:
        an object factory for icalendar
      • getPropertyInfo

        PropertiesInfo getPropertyInfo()
        Information about properties required for subscriptions via this connector.
        Returns:
        list of info
      • getSkipList

        List<Object> getSkipList()
        Returns:
        list of icalendar properties to skip.
      • getConnectorInstance

        C getConnectorInstance​(Subscription sub,
                               org.bedework.synch.wsmessages.SynchEndType end)
                        throws SynchException
        Called to obtain a connector instance for a subscription. A response of null means no synch available.
        Parameters:
        sub - - the subscription
        end - - which end
        Returns:
        null for no synch else a connector instance.
        Throws:
        SynchException
      • handleCallback

        Connector.NotificationBatch<N> handleCallback​(javax.servlet.http.HttpServletRequest req,
                                                      javax.servlet.http.HttpServletResponse resp,
                                                      List<String> resourceUri)
                                               throws SynchException
        Will create a notification batch object which will be passed to a synchling for processing. When processing is complete respond will be called.

        The resource URI has been stripped of the context element and the element which identifies the connector. What remains is used by the connector to determine a subscription id allowing retrieval of the subscription from the synch engine.

        Parameters:
        req -
        resp -
        resourceUri - - elements of the path with context and connector id removed
        Returns:
        Notification with 1 or more Notification items or null for no action.
        Throws:
        SynchException