Table of Contents |
---|
Introduction
Although the PoC will only implement a few of the possible Java API methods it is important to have a good detailed view of the structure and naming of this interface going forward and document it.
...
- Models (add, list)
- Data (CRUD)
- Queries
Jira Ticket:
Jira Legacy | ||||||||
---|---|---|---|---|---|---|---|---|
|
Jira Backlog:
Gerrit Review
https://gerrit.nordix.org/#/c/onap/ccsdk/features/+/6477/
Java Doc
View file | ||||
---|---|---|---|---|
|
External Resources
https://wiki.onap.org/display/DW/Data+Representation
https://wiki.onap.org/display/DW/Interface+style
Open Issues/Decisions
# | Description | Details | Decisions |
---|---|---|---|
1 | Should the java interface take in one (JSON) objects (like REST interface) or a few individual fields in a signature? |
|
|
2 | Input streams and/or files to take in large amounts of data like yang models? |
| 03/11/20 Team meeting Niamh, Toine, Rishi, Aditya, Bruno, Phillipe We have decided to use (buffered) input streams. |
3 | API uses (generated) ID's or customer provided names? If names are used should we return IDs at all? | 03/11/20 Team meeting notes - Niamh, Toine, Rishi, Aditya, Bruno, Phillipe
Cons:
Other considerations:
| 04/11/20 Team meeting notes - Niamh, Toine, Rishi, Tony We should not expose internal DB ID for dataspace, module set, module, anchor or fragment. DB ids should be fully encapsulated. Exposure of DB ids to clients limits freedom in the future. We do not want to expose them for the following reasons:
Database technology uplift/swap out will not guarantee that ids will be immutable. Any client that uses DB ids would be broken. I can see this being quite important for ONAP trails going to commercially supported ONAP deployments.
We would like to reserve the right to change database ID's. You eliminate the option that will shuffle the ID's without impacting the client.
If there is a fragment that has restricted properties that can only be set at creation. This fragment will be identified by an xpath and internally by a DB id. An update of this (restricted) attribute will require a delete/create – this will change the DB id, but not the xpath. If a client had cached (or otherwise stored) the DB id, then their use case would be broken
|
4 | Should a user be able to delete a dataspace, module ( (of the same revision), module set? |
| 04/11/20Team meeting notes - Niamh, Toine, Rishi, Tony
|
5 | Should a user be able to update/override (create again) dataspace, module (of the same revision), module set? |
| 04/11/20 Team meeting notes - Niamh, Toine, Rishi, Tony For now we are not going to be idempotent but we may consider it in the future. Need to be document clearly as part of Java API proposal (i.e in this wiki!) |
6 | How should we specify attributes? | 1) can it be done by xpaths 2) additional parameters 3) part of query builder? | 11/11/20 Team meeting notes - Niamh, Toine, Aditya, Tony, Ruslan, Claudio We will use an optional parameter (suggested name outputSpecification) to specify the leaf(s) (attributes). All queries will return Node(s). If you do not specify leaf(s), all leaves will be returned. |
7 | Should we have one method with any type of xpath to handle both direct gets with a fully qualified xpaths (pointing to one unique node) and any type of more advanced xpath expression/querys (pointing to multiple nodes)? Theoretically this is possible but if might be confusing for the end user | alternative we could have more specialized methods like getNodeByXpathKey(String qualifiedXPath) queryNodesByXpath(String xpathExpression) And we could still consider an xpath builder pattern (like a query builder) XPathBuilder.withChildOfType() XapthBuilder.withAttributeValue() | 11/11/20 Team meeting notes - Niamh, Toine, Aditya, Tony, Ruslan, Claudio We decided to use key instead of ID. We have decided to split the behavior into different methods e.g getNodeByXpathKey(String qualifiedXPath) queryNodesByXpath(String xpathExpression) We do intend to use a query builder too and it will be extended in step with any progress on the xpath query supported functionality |
8 | Will we have separate methods to validate our modules or data? Alternatively validate on submitting of data/modules (and throw validation exception if needed) | 11/11/20 Team meeting notes - Niamh, Toine, Aditya, Tony, Ruslan, Claudio We intend to publish validation in a separate java library. We will do validation on write to ensure whatever is being stored in the database is valid and will give the user a fast failure. We will not have separate validation methods on the main Java API. | |
9 | The parser has detailed exception classes instead of one exception with different messages, we need to ask ourselves if we want to have a similar pattern | See section on error handling. | 11/11/20 Team meeting notes - Niamh, Toine, Aditya, Tony, Ruslan, Claudio We intend to have our own detailed validation list of validation exception classes. We will have an exception class hierarchy like below:
|
Error Handling
Exception Class Hierarchy:
...
# | Class | Definition | Source | Proposed Exception Class |
---|---|---|---|---|
1 | YangValidationException | Unchecked exception thrown if yang definition is not valid according to {YangModelBasicValidationListener} | ODL Yang Parser (Yang Model) | YangValidationException |
2 | YangParseException | Unchecked exception thrown if unable to parse yang | ODL Yang Parser (Yang Model) | YangValidationException |
3 | YangSyntaxErrorException | Exception thrown if yang syntax is invalid | ODL Yang Parser (Yang Model) | YangValidationException |
4 | DataValidationException | Exception thrown when a the specified data is invalid | ODL Yang Parser (Yang Data) | YangDataValidationException |
5 | LeafRefDataValidationFailedException | ODL Yang Parser (Yang Data) | YangDataValidationException | |
6 | LeafRefPathSyntaxErrorException | ODL Yang Parser (Yang Data) | YangDataValidationException | |
7 | ModifiedNodeDoesNotExistException | Exception thrown when a proposed change fails validation before being applied into the Data Tree because tree node which child nodes are modified or written did not exist when transaction started and still does not exists when transaction is processed. Note if node existed in first place and was removed by other transaction, thrown exception should be ConflictingModificationAppliedException. | ODL Yang Parser (Yang Data) | NodeDoesNotExistException |
8 | ConflictingModificationAppliedException | Exception thrown when a proposed change fails validation before being applied into the Data Tree because the Data Tree has been modified in way that a conflicting node is present. | ODL Yang Parser (Yang Data) | DataModificationException |
9 | MissingSchemaSourceException | Exception thrown when a the specified schema source is not available. | ODL Yang Parser (Yang Model) | MissingSchemaSourceException |
10 | SchemaResolutionException | Exception thrown when a Schema Source fails to resolve. | ODL Yang Parser (Yang Model) | SchemaSourceException |
11 | SchemaValidationFailedException | ODL Yang Parser (Yang Model) | SchemaValidationException | |
12 | OperationFailedException | A general base exception for an operation failure. | ? | |
13 | AlreadyExistsException | Database duplicates | ModelAlreadyExistsException DataAlreadyExistsException | |
14 | IO Exception | N/A |
CPS provides the following interfaces:
Interface Name | Interface Definition | Interface Capabilities |
---|---|---|
Model Interface | Behavior interface that represents cps modules. |
|
Data Interface | Behavior interface that represents CPS data. |
|
Query Interface | Provides the capability to query CPS data using XPaths. |
|
Query Builder Interface | Provides the capability to query CPS data using restrictions from a query builder (see open issue 1). |
...