Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Jira
serverONAP JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId425b2b0a-557c-3c0c-b515-579789cceedb
keyCCSDK-2752

Decisions

#

Description

Details

Decisions

1

Assume flat attributes (no complex data types) but data could be stored as json object in SPI impl. for convenience/PoC



2SPI Implementation NOT using Model (service) current ENM SPI does!

Open Issues

#

Description

Details

Decisions

1Are we going to have XPath/query builder?
  • We should decide based on what the users want to use/is easy to use
  • We don't want a query builder that eventually mimics XPaths functionality, use what is defined already XPATH sa a based but maybe supplement with a xpath-builder

2

Having a fluent interface in my opinion would be way more intuitive and practical. E.g.

//AND of two restrictions

Restriction and(Restriction firstRestriction,  Restriction secondRestriction)

//OR of two restrictions

Restriction or(Restriction firstRestriction,  Restriction secondRestriction)

//NOT of a restriction

Restriction not(Restriction restriction)

This will give any user of the API an intuitive way to build a complex query and the developer of the API a tree to navigate and translate to SQL (or any other query language). A developer could do something the likes of myQuery.setRestriction(restriction1.and(restrcition2).and(restriction3))



3

SPI should be type safe (the SPI impl. has no access to models)

    1. All numeric types could be passed as ‘long’ in Java

We can do validation but still store as a string (JSON object).


ENM SPI Study

Details about the ENM SPI can be found here: https://wiki.onap.org/pages/resumedraft.action?draftId=92998891&draftShareId=2f0190f4-bc97-47b7-bd82-6561f3606575&

...

Proposed Future Implementation of CPS SPI

Data SPI


Name


Definition

 Capabilities

Module SPI

SimpleDataObjectProvides the basic information needed to access an object.
  • getFdn
  • getNamespace
  • getType
  • getName
  • getVersion
  • equals
  • hashCode
2DataPersistenceLayer
  • getBucketName

Gets the data bucket name to which this persistence object belongs.

  • getPersistenceObject

Gets the persistence layer object without any layers of decoration.

If the innermost object is not a persistence layer object then a suitable exception will be thrown.

  • checkUserSuppliedAttributesAtCreation

Passes the attributes supplied by the user for a new persistence object so that they may be verified as required.

  • initializeAttributes

Initializes the attributes for a new persistence object. This method should be invoked when creating a new persistence object rather than using setAttributes() as it will have different behavior, namely:

  1. it verifies all mandatory attributes have been supplied

  2. it initializes all non-supplied attributes to their default value where relevant

  3. no notifications will be sent as a result of this method being called

  • getAttributesSpecificallySet

Gets the values for the attributes which have been specifically set on this object.

This includes attributes which:

  1. were supplied at creation of the object or

  2. had default values applied during creation or

  3. were specifically set after creation by invoking one of the setAttribute(s) methods.

Note that an attribute may have been specifically set to null so the values returned in the map may contain nulls.

  • isAttributeSet

Determines if the supplied attribute has been specifically set (includes attributes which were set to null).

  • getAttributeNames

Gets all of the attribute names available in this persistence object.

  • unsetAttributes

Unsets the values of the supplied attributes.


Module SPI


Name


Definition

 Capabilities

1

ModulePersistenceLayer



  • getChildren

  • removeAllAssociations

Remove all associations of this persistence object.

  • getNamespace

Retrieves  the namespace of the type of object the type query is to target.


2BasicModuleObject
  • getModule
  • getNamespace
  • getType
  • getName
  • getVersion
  • equals
  • hashCode
Name

Definition

 Capabilities

1

Module Interface

Provides CRUD operations on a module set.

  • Create a module set
  • Merge a module set
  • Read all modules
  • Validate modules
  • Update a module set
  • Create a module set and validate it against a module reference (using a separate SPI)

    Query SPI


    Name


    Definition

     Capabilities

    1

    Interface QueryService 

    Service responsible for dealing with query related features of CPS.


    • execute

    Executes the query and presents the result as an iterator of objects queried for. 

    • executeProjection

    Executes the query and presents the result as a list. Returns a list of  the type of which is based on the Projection used.

    • executeProjection

    Executes the query and presents the result as a list. Will return a list of type Object array.

    • executeCount

    Executes the query and presents the result as a count of how many instances are matched against the query.
    Note: because of database limitations, at this moment this method is not optimized.

    • executeDeletion

    Deletes all matching objects and where appropriate deletes any children.

    • getTargetObjects

    Executes the query ands gets the result as an iterable of 'full' objects queried. 

    • projectResults

    Project the results from points in the query path. Projections allow the user project a single data element from the objects which were found along a query path - these elements can be modelled (i.e. persistence object attributes) or non-modelled (i.e. object fields).

    • getType

    Retrieves the type of object that the type query is to target.

    2

    Interface QueryPathService

    Service responsible for dealing with path query related features

    • executePathQuery

    executes the path query against the db. returns a list of type Object.

    • getTargetObjects

    Executes the query ands gets the result as an iterable of 'full' objects queried. 

    4Interface CpsRestriction
    • pathRestriction
    • getRestriction

    Gets the restriction used in the query criteria, including any internal restrictions added in addition to those set by the user.

    • getAttributeName

    Retrieves the name of the attribute that the restriction is.