Skip to content

Commit

Permalink
Added catalog type SourceSet
Browse files Browse the repository at this point in the history
  • Loading branch information
cpiker committed Nov 25, 2023
1 parent 0312c0f commit dd2492a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
42 changes: 27 additions & 15 deletions das2/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ typedef struct das_catalog {

das_node_type_e das_node_type(const char* sType){
if(sType == NULL) return d2node_inv;
if(strcmp(sType, D2CV_TYPE_CATALOG) == 0) return d2node_catalog;
if(strcmp(sType, D2CV_TYPE_COLLECTION) == 0) return d2node_collection;
if(strcmp(sType, D2CV_TYPE_STREAM) == 0) return d2node_stream_src;
if(strcmp(sType, D2CV_TYPE_TIMEAGG) == 0) return d2node_file_agg;
if(strcmp(sType, D2CV_TYPE_SPASE) == 0) return d2node_spase_cat;
if(strcmp(sType, D2CV_TYPE_CATALOG) == 0) return d2node_catalog;
if(strcmp(sType, D2CV_TYPE_COLLECTION) == 0) return d2node_collection;
if(strcmp(sType, D2CV_TYPE_SRCSET) == 0) return d2node_srcset; // collection look alike
if(strcmp(sType, D2CV_TYPE_STREAM) == 0) return d2node_stream_src;
if(strcmp(sType, D2CV_TYPE_TIMEAGG) == 0) return d2node_file_agg;
if(strcmp(sType, D2CV_TYPE_SPASE) == 0) return d2node_spase_cat;
if(strcmp(sType, D2Cv_TYPE_SPDF_MASTER) == 0) return d2node_spdf_cat;
return d2node_inv;
}
Expand All @@ -96,17 +97,19 @@ das_node_type_e das_node_type(const char* sType){

bool DasNode_isCatalog(const DasNode* pThis)
{
return ((pThis->nType == d2node_catalog) ||
(pThis->nType == d2node_spdf_cat) ||
(pThis->nType == d2node_spase_cat) ||
(pThis->nType == d2node_collection));
return (
(pThis->nType == d2node_catalog) ||(pThis->nType == d2node_spdf_cat)
||(pThis->nType == d2node_spase_cat)||(pThis->nType == d2node_collection)
||(pThis->nType == d2node_srcset)
);
}

bool DasNode_isJson(const DasNode* pThis){
return ((pThis->nType == d2node_catalog)||
(pThis->nType == d2node_stream_src)||
(pThis->nType == d2node_file_agg) ||
(pThis->nType == d2node_collection));
return (
(pThis->nType == d2node_catalog)||(pThis->nType == d2node_stream_src)
||(pThis->nType == d2node_file_agg)||(pThis->nType == d2node_collection)
||(pThis->nType == d2node_srcset)
);
}

const DasJdo* DasNode_getJdo(const DasNode* pThis, const char* sFragment)
Expand Down Expand Up @@ -160,6 +163,14 @@ const char* DasNode_name(const DasNode* pThis){
return DasNode_rootStr(pThis, D2FRAG_NAME);
}

const char* DasNode_label(const DasNode* pThis){
const char* pLabel = DasNode_rootStr(pThis, D2FRAG_LABEL);
if(pLabel != NULL)
return pLabel;

return DasNode_rootStr(pThis, D2FRAG_NAME);
}

const char* DasNode_title(const DasNode* pThis){
return DasNode_rootStr(pThis, D2FRAG_TITLE);
}
Expand Down Expand Up @@ -542,7 +553,7 @@ DasNode* _DasNode_loadSubNode_dasCat(

daslog_error_v(
"Node %s (URI '%s') has no child node that starts with %s",
DasNode_name((DasNode*)pThis), DasNode_pathUri((DasNode*)pThis), sRelPath
DasNode_label((DasNode*)pThis), DasNode_pathUri((DasNode*)pThis), sRelPath
);

return NULL;
Expand Down Expand Up @@ -570,7 +581,7 @@ DasNode* DasNode_subNode(
return NULL;
}
if(!DasNode_isCatalog(pThis)){
daslog_error_v("Node %s from %s is a terminating node", DasNode_name(pThis));
daslog_error_v("Node %s from %s is a terminating node", DasNode_label(pThis));
return NULL;
}
DasCatNode* pCat = (DasCatNode*)pThis;
Expand Down Expand Up @@ -628,6 +639,7 @@ DasNode* DasNode_subNode(
switch(pThis->nType){
case d2node_collection:
case d2node_catalog:
case d2node_srcset:
return _DasNode_loadSubNode_dasCat(pCat, sRelPath, pMgr, sAgent);
case d2node_spdf_cat:
return _DasNode_loadSubNode_spdfCat(pCat, sRelPath, pMgr, sAgent);
Expand Down
6 changes: 4 additions & 2 deletions das2/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ extern "C" {
/* Defines for common document fragments */
#define D2FRAG_TYPE "type"
#define D2FRAG_NAME "name"
#define D2FRAG_LABEL "label"
#define D2FRAG_TITLE "title"
#define D2FRAG_DESC "description"
#define D2FRAG_SUB_PATHS "catalog"
Expand All @@ -140,6 +141,7 @@ extern "C" {
/* Defines for common document string values */
#define D2CV_TYPE_CATALOG "Catalog"
#define D2CV_TYPE_COLLECTION "Collection"
#define D2CV_TYPE_SRCSET "SourceSet"
#define D2CV_TYPE_STREAM "HttpStreamSrc"
#define D2CV_TYPE_TIMEAGG "FileTimeAgg"
#define D2CV_TYPE_SPASE "SpaseRecord"
Expand All @@ -148,8 +150,8 @@ extern "C" {
/** Catalog node type */
typedef enum das_node_type_enum {
d2node_inv = 0, d2node_catalog = 1, d2node_collection = 2,
d2node_stream_src = 3, d2node_file_agg = 4, d2node_spdf_cat = 5,
d2node_spase_cat = 6
d2node_srcset = 3, d2node_stream_src = 4, d2node_file_agg = 5,
d2node_spdf_cat = 6, d2node_spase_cat = 7
} das_node_type_e;

/** @addtogroup catalog
Expand Down

0 comments on commit dd2492a

Please sign in to comment.