| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2019 Ericsson Telecom AB // |
| // // |
| // All rights reserved. This program and the accompanying materials // |
| // are made available under the terms of the Eclipse Public License v2.0 // |
| // which accompanies this distribution, and is available at // |
| // https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html // |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // Module: EPTF_CLL_DsRestAPI_DSServer_Definitions |
| // |
| // Purpose: |
| // This module contains definitions of EPTF_CLL_DsRestAPI_DSServer. |
| // |
| // Module depends on: |
| // <EPTF_CLL_DataSource_Definitions> |
| // <EPTF_CLL_Base_Definitions> |
| // <EPTF_CLL_Logging_Definitions> |
| // <EPTF_CLL_Common_Definitions> |
| // <EPTF_CLL_FBQ_Definitions> |
| // |
| // Current Owner: |
| // Tamas Kis (ekistam) |
| // |
| // Last Review Date: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////// |
| module EPTF_CLL_DsRestAPI_DSServer_Definitions |
| { |
| import from EPTF_CLL_DataSource_Definitions all; |
| import from EPTF_CLL_Base_Definitions all; |
| import from EPTF_CLL_Common_Definitions all; |
| import from EPTF_CLL_FBQ_Definitions all; |
| import from EPTF_CLL_DsRestAPI_Filter_Definitions all; |
| import from EPTF_CLL_DsRestAPI_Storage_Definitions all; |
| |
| //////////////////////////////////////////////////////////////////////////////// |
| // Constant: cg_EPTF_DsRestAPI_DSServer_Error_InvalidRequest |
| // |
| // Purpose: |
| // Response JSON constant to invalid request |
| // |
| // Detailed comments: |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| const EPTF_DsRestAPI_ContentAndChildrenListWrapper cg_EPTF_DsRestAPI_DSServer_Error_InvalidRequest :={ |
| contentList := { |
| { |
| node := { |
| val := "Error processing request", |
| tp := 4, |
| childVals := omit |
| } |
| } |
| } |
| } |
| |
| //////////////////////////////////////////////////////////////////////////////// |
| // Constant: cg_EPTF_DsRestAPI_DSServer_Error_Timeout |
| // |
| // Purpose: |
| // Response JSON constant to uninitialized DsRestAPI |
| // |
| // Detailed comments: |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| const EPTF_DsRestAPI_ContentAndChildrenListWrapper cg_EPTF_DsRestAPI_DSServer_Error_Uninitialized :={ |
| contentList := { |
| { |
| node := { |
| val := "DsRestAPI datasource server is not initialized.", |
| tp := 4, |
| childVals := omit |
| } |
| } |
| } |
| } |
| |
| //////////////////////////////////////////////////////////////////////////////// |
| // Constant: cg_EPTF_DsRestAPI_DSServer_ConetentToBeDiscardedWhenFiltered |
| // |
| // Purpose: |
| // A tp for finding content that is discarded when filtered. |
| // |
| // Detailed comments: |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| const integer cg_EPTF_DsRestAPI_DSServer_ConetentToBeDiscardedWhenFiltered := -100 |
| |
| type record EPTF_DsRestAPI_GetData_Timeline { |
| float period optional, |
| integer maxpoints optional, |
| integer since optional |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_GetData |
| // |
| // Purpose: |
| // Type for getdata request |
| // |
| // Elements: |
| // - source - *charstring* - the name of source |
| // - ptcname - *charstring* *optional* - the name of PTC |
| // - method - *charstring* - the name of filtering method |
| // - params - *EPTF_DataSource_Params* *optional* - the record of DS parameters |
| // - cookie - *charstring* *optional* - the cookie of the request |
| // - children - *EPTF_DsRestAPI_Requests* *optional* - child request |
| // - filter - *EPTF_DsRestAPI_Filter* *optional* - the filter of the request |
| // - rangeFilter - *EPTF_DsRestAPI_RangeFilter* *optional* - the rangefilter of the request |
| // - selection - *EPTF_IntegerList* *optional* - the selection of the request |
| // - selectionValues - *EPTF_CharstringList* *optional* - the selection values |
| // - isWriteable - *boolean* *optional* - check if the dataElement is writeable |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| type record EPTF_DsRestAPI_GetData |
| { |
| charstring source, |
| charstring ptcname optional, |
| charstring element, |
| EPTF_DataSource_Params params optional, |
| charstring cookie optional, |
| EPTF_DsRestAPI_Requests children optional, |
| EPTF_DsRestAPI_Filter filter optional, |
| EPTF_DataSource_RangeFilter rangeFilter optional, |
| EPTF_IntegerList selection optional, |
| EPTF_CharstringList selectionValues optional, |
| boolean writableInfo optional, |
| EPTF_DsRestAPI_GetData_Timeline timeline optional |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_SetData |
| // |
| // Purpose: |
| // Type for setdata request |
| // |
| // Elements: |
| // - source - *charstring* - the name of source |
| // - ptcname - *charstring* *optional* - the name of PTC |
| // - element - *charstring* - the name of element |
| // - content - *charstring* - the content to set |
| // - tp - *integer* - the type of content to set |
| // - indxsInList - *EPTF_IntegerList* *optional* - the indexes to set in a list |
| // - params - *EPTF_DataSource_Params* *optional* - the record of DS parameters |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| type record EPTF_DsRestAPI_SetData { |
| charstring source, |
| charstring ptcname optional, |
| charstring element, |
| charstring content, |
| integer tp, |
| EPTF_IntegerList indxsInList optional, |
| EPTF_DataSource_Params params optional |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_Request |
| // |
| // Purpose: |
| // Type for wrapping a Request |
| // |
| // Elements: |
| // - getData - <EPTF_DsRestAPI_GetData> - a getdata request |
| // - setData - <EPTF_DsRestAPI_SetData> - a setdata request |
| // - listOfGetData - <EPTF_DsRestAPI_ListOfGetData> - list of getdata requests |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| type union EPTF_DsRestAPI_Request { |
| EPTF_DsRestAPI_GetData getData, |
| EPTF_DsRestAPI_SetData setData |
| } with { |
| variant(getData) "JSON:name as getData"; |
| variant(setData) "JSON:name as setData"; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_Requests |
| // |
| // Purpose: |
| // Type for storing list of <EPTF_DsRestAPI_Request> items |
| // |
| // Elements: |
| // <EPTF_DsRestAPI_Request> |
| /////////////////////////////////////////////////////////// |
| type record of EPTF_DsRestAPI_Request EPTF_DsRestAPI_Requests; |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_RqWrapper |
| // |
| // Purpose: |
| // Type for wrapping a requests |
| // |
| // Elements: |
| // - requests - <EPTF_DsRestAPI_Requests> - list of request |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| type record EPTF_DsRestAPI_RqWrapper { |
| EPTF_DsRestAPI_Requests requests, |
| float timeOut optional |
| } with { |
| variant(requests) "JSON: name as requests"; |
| variant(timeOut) "JSON: name as timeOut"; |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_Node |
| // |
| // Purpose: |
| // Type for the building blocks of response |
| // |
| // Elements: |
| // - val - *charstring* - the value of response content |
| // - tp - *integer* - the type of value |
| // - childVals - *EPTF_DsRestAPI_ContentList* *optional* - child responses |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| type record EPTF_DsRestAPI_Node { |
| charstring val, |
| integer tp, |
| EPTF_DsRestAPI_ContentList childVals optional |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_Content |
| // |
| // Purpose: |
| // Type for wrapping content |
| // |
| // Elements: |
| // - node - <EPTF_DsRestAPI_Node> - a single response |
| // - list - <EPTF_DsRestAPI_ContentList> - a tree based list of nodes |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| type union EPTF_DsRestAPI_Content { |
| EPTF_DsRestAPI_Node node, |
| EPTF_DsRestAPI_ContentList list |
| } with { |
| variant(node) "JSON:name as node"; |
| variant(list) "JSON:name as list"; |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_ContentList |
| // |
| // Purpose: |
| // Type for storing list of <EPTF_DsRestAPI_Content> items |
| // |
| // Elements: |
| // <EPTF_DsRestAPI_Content> |
| /////////////////////////////////////////////////////////// |
| type record of EPTF_DsRestAPI_Content EPTF_DsRestAPI_ContentList; |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_ContentAndChildrenListWrapper |
| // |
| // Purpose: |
| // Type for wrapping responses |
| // |
| // Elements: |
| // - contentList - <EPTF_DsRestAPI_ContentList> - list of responses |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| type record EPTF_DsRestAPI_ContentAndChildrenListWrapper { |
| EPTF_DsRestAPI_ContentList contentList |
| } with { variant(contentList) "JSON: name as contentList"; } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_ResponseHandlerItem |
| // |
| // Purpose: |
| // Type for storing data for the nonblocking callback calls |
| // |
| // Elements: |
| // - requestId - *integer* - the request id that identifies the request |
| // - path - *EPTF_IntegerList* - the path that points into the request tree |
| // - indexesInList - *EPTF_IntegerList* - the parent indexes when the response is a list |
| // this together with the path points into the response tree |
| // - isWriteable - *boolean* - whether the request is an isWritable request |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| type record EPTF_DsRestAPI_ResponseHandlerItem { |
| integer requestId, |
| EPTF_IntegerList path, |
| EPTF_IntegerList indexesInList, |
| boolean writableInfo, |
| boolean checkPostFilter, |
| EPTF_CharstringList parentList, |
| EPTF_IntegerList parentIndexList, |
| charstring storageKey |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_ResponseHandlerDB |
| // |
| // Purpose: |
| // Type for storing list of <EPTF_DsRestAPI_ResponseHandlerItem> items |
| // |
| // Elements: |
| // <EPTF_DsRestAPI_ResponseHandlerItem> |
| /////////////////////////////////////////////////////////// |
| type record of EPTF_DsRestAPI_ResponseHandlerItem EPTF_DsRestAPI_ResponseHandlerDB; |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_RequestHandlerItem |
| // |
| // Purpose: |
| // Type for storing data for the nonblocking callback calls |
| // |
| // Elements: |
| // - requests - *EPTF_DsRestAPI_Requests* - the request |
| // - responses - *EPTF_DsRestAPI_ContentAndChildrenListWrapper* - the response |
| // - outstandingRequests - *integer* - the outstanding requests towards the DataSource |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| type record EPTF_DsRestAPI_RequestHandlerItem { |
| EPTF_DsRestAPI_Requests requests, |
| EPTF_DsRestAPI_ContentList responses, |
| integer outstandingRequests |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_RequestHandlerDB |
| // |
| // Purpose: |
| // Type for storing list of <EPTF_DsRestAPI_RequestHandlerItem> items |
| // |
| // Elements: |
| // <EPTF_DsRestAPI_RequestHandlerItem> |
| /////////////////////////////////////////////////////////// |
| type record of EPTF_DsRestAPI_RequestHandlerItem EPTF_DsRestAPI_RequestHandlerDB; |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_PreFilterItem |
| // |
| // Purpose: |
| // Type for storing data for the nonblocking prefilter evaluation callback calls |
| // |
| // Elements: |
| // - requestToSend - *EPTF_DsRestAPI_GetData* - the request we have to send if the filter evaluates to true |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| type record EPTF_DsRestAPI_PreFilterItem { |
| EPTF_DsRestAPI_GetData requestToSend |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_PostFilterItem |
| // |
| // Purpose: |
| // Type for storing data for the nonblocking postfilter evaluation callback calls |
| // |
| // Elements: |
| // - errorCode - *integer* - the original error code of the getData |
| // - contentToInsert - *EPTF_DsRestAPI_Content* - the content we have to insert into the tree when the filter evaluation is complete |
| // - counter - *integer* - when the counter reaches 0 we insert the content |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| type record EPTF_DsRestAPI_PostFilterItem { |
| integer errorCode, |
| EPTF_DsRestAPI_Content contentToInsert, |
| integer counter |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_FilterItem |
| // |
| // Purpose: |
| // Type for handling filter evaluation callbacks |
| // |
| // Elements: |
| // - postFilterItem - <EPTF_DsRestAPI_PostFilterItem> - when we evaluated a postfilter |
| // - preFilterItem - <EPTF_DsRestAPI_PreFilterItem> - when we evaluated a prefilter |
| // |
| /////////////////////////////////////////////////////////////////////////////// |
| type union EPTF_DsRestAPI_FilterItem { |
| EPTF_DsRestAPI_PostFilterItem postFilterItem, |
| EPTF_DsRestAPI_PreFilterItem preFilterItem |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_RequestHandlerDB |
| // |
| // Purpose: |
| // Type for storing list of <EPTF_DsRestAPI_FilterItem> items |
| // |
| // Elements: |
| // <EPTF_DsRestAPI_FilterItem> |
| /////////////////////////////////////////////////////////////////////////////// |
| type record of EPTF_DsRestAPI_FilterItem EPTF_DsRestAPI_FilterItems; |
| |
| ///////////////////////////////////////////////////////////////////////////// |
| // Type: EPTF_DsRestAPI_DSServer_CT |
| // |
| // Purpose: |
| // The DataSource Server UI Model component |
| // |
| // Extensions: |
| // EPTF_Base_CT, EPTF_Var_CT, EPTF_Logging_CT, EPTF_DataSource_CLI_CT, EPTF_DataSourceClient_CT |
| // |
| // Variables: |
| // - v_DsRestAPI_DSServer_initialized - *boolean* - represents if DSServer is initialized |
| // |
| // - v_DsRestAPI_DSServer_noType - *integer* - integer representation value in type enumeration for items that were filtered |
| // - v_DsRestAPI_DSServer_intType - *integer* - integer representation value in type enumeration for integer |
| // - v_DsRestAPI_DSServer_floatType - *integer* - integer representation value in type enumeration for float |
| // - v_DsRestAPI_DSServer_boolType - *integer* - integer representation value in type enumeration for boolean |
| // - v_DsRestAPI_DSServer_charstringType - *integer* - integer representation value in type enumeration for charstring |
| // - v_DsRestAPI_DSServer_octetstringType - *integer* - integer representation value in type enumeration for octetstring |
| // - v_DsRestAPI_DSServer_hexstringType - *integer* - integer representation value in type enumeration for hexstring |
| // - v_DsRestAPI_DSServer_bitstringType - *integer* - integer representation value in type enumeration for bitstring |
| // - v_DsRestAPI_DSServer_integerlistType - *integer* - integer representation value in type enumeration for integerlist |
| // - v_DsRestAPI_DSServer_floatlistType - *integer* - integer representation value in type enumeration for floatlist |
| // - v_DsRestAPI_DSServer_charstringlistType - *integer* - integer representation value in type enumeration for charstringlist |
| // - v_DsRestAPI_DSServer_statusLEDType - *integer* - integer representation value in type enumeration for statusLED |
| // - v_DsRestAPI_DSServer_statusLEDType - *integer* - integer representation value in type enumeration for statusLED |
| // |
| // - v_DsRestAPI_DSServer_requestHandlerDB - *EPTF_DsRestAPI_RequestHandlerDB* - the list for the json requests |
| // - v_DsRestAPI_DSServer_responseHandlerDB - *EPTF_DsRestAPI_ResponseHandlerDB* - the list for the outstanding DataSource requests |
| // - v_DsRestAPI_DSServer_filterItemsDB - *EPTF_DsRestAPI_FilterItems* - the list for the filter handler items |
| // |
| // - v_DsRestAPI_DSServer_requestQueue - *EPTF_FreeBusyQueue* - the FBQ for the json requests |
| // - v_DsRestAPI_DSServer_responseQueue - *EPTF_FreeBusyQueue* - the FBQ for the outstanding DataSource requests |
| // |
| // Ports: |
| // - |
| // Function types: |
| // - |
| // |
| // Detailed Comments: |
| // - |
| ///////////////////////////////////////////////////////////////////////////// |
| type component EPTF_DsRestAPI_DSServer_CT extends |
| EPTF_Base_CT, |
| EPTF_DataSource_CLI_CT, |
| EPTF_DataSourceClient_CT, |
| EPTF_DsRestAPI_Filter_CT, |
| EPTF_DsRestAPI_Storage_CT |
| { |
| private var boolean v_DsRestAPI_DSServer_initialized := false; |
| |
| private var integer v_DsRestAPI_DSServer_noType := 0; |
| private var integer v_DsRestAPI_DSServer_intType; |
| private var integer v_DsRestAPI_DSServer_floatType; |
| private var integer v_DsRestAPI_DSServer_boolType; |
| private var integer v_DsRestAPI_DSServer_charstringType; |
| private var integer v_DsRestAPI_DSServer_octetstringType; |
| private var integer v_DsRestAPI_DSServer_hexstringType; |
| private var integer v_DsRestAPI_DSServer_bitstringType; |
| private var integer v_DsRestAPI_DSServer_integerlistType; |
| private var integer v_DsRestAPI_DSServer_floatlistType; |
| private var integer v_DsRestAPI_DSServer_charstringlistType; |
| private var integer v_DsRestAPI_DSServer_statusLEDType; |
| |
| private var EPTF_FreeBusyQueue v_DsRestAPI_DSServer_requestQueue := -1; |
| private var EPTF_FreeBusyQueue v_DsRestAPI_DSServer_responseQueue := -1; |
| private var EPTF_DsRestAPI_RequestHandlerDB v_DsRestAPI_DSServer_requestHandlerDB := {}; |
| private var EPTF_DsRestAPI_ResponseHandlerDB v_DsRestAPI_DSServer_responseHandlerDB := {}; |
| private var EPTF_DsRestAPI_FilterItems v_DsRestAPI_DSServer_filterItemsDB := {}; |
| } |
| |
| } // ~ module EPTF_CLL_DsRestAPI_DSServer_Definitions |