name: "Funny"
target-data:
name: "Comic"
- NotificationSubscriptionsDataSample:
+ notificationSubscriptionRequestSample:
+ value:
+ dataspace:
+ - name: my-dataspace
+ anchors:
+ anchor:
+ - name: my-anchor
+ xpaths:
+ xpath:
+ - path: /shops/bookstore
+ notificationSubscriptionResponseSample:
value:
cps-notification-subscriptions:dataspaces:
dataspace:
- - name: dataspace01
- - name: dataspace02
+ - name: my-dataspace
+ - name: bookstore-dataspace
parameters:
dataspaceNameInQuery:
name: dataspace-name
type: string
default: /dataspaces
examples:
- subscription by dataspace xpath:
+ dataspace xpath:
+ value: /dataspaces
+ anchor xpath:
value: /dataspaces/dataspace[@name='dataspace01']
- subscription by anchor xpath:
- value: /dataspaces/dataspace[@name='dataspace01']/anchors/anchor[@name='anchor01']
requiredXpathInQuery:
name: xpath
in: query
content:
application/json:
schema:
- $ref: 'components.yml#/components/examples/NotificationSubscriptionsDataSample'
+ $ref: 'components.yml#/components/examples/notificationSubscriptionResponseSample'
'400':
$ref: 'components.yml#/components/responses/BadRequest'
'403':
type: object
examples:
dataSample:
- $ref: 'components.yml#/components/examples/NotificationSubscriptionsDataSample'
+ $ref: 'components.yml#/components/examples/notificationSubscriptionRequestSample'
responses:
'201':
$ref: 'components.yml#/components/responses/CreatedV2'
public interface CpsNotificationService {
+ /**
+ * Creates a notification subscription for a given xpath. The dataspacename and anchor details are provided as part
+ * of the notification subscription JSON.
+ *
+ * @param notificationSubscriptionAsJson notification subscription in JSON format
+ * @param xpath the location where the notification subscription is to be created
+ */
void createNotificationSubscription(String notificationSubscriptionAsJson, String xpath);
+ /**
+ * Deletes a notification subscription for a given xpath.
+ *
+ * @param xpath the location where the notification subscription is to be deleted
+ */
void deleteNotificationSubscription(String xpath);
+ /**
+ * Checks if notification is enabled for a given dataspace and anchor.
+ *
+ * @param dataspaceName the dataspace name
+ * @param anchorName the anchor name
+ * @return true if notification is enabled, false otherwise
+ */
boolean isNotificationEnabled(String dataspaceName, String anchorName);
+ /**
+ * Retrieves notification subscription for a given xpath.
+ *
+ * @param xpath the location where the notification subscription is to be retrieved
+ * @return list of notification subscriptions as map
+ */
List<Map<String, Object>> getNotificationSubscription(String xpath);
}