# $SnapHashLicense:
#
# SnapLogic - Open source data services
#
# Copyright (C) 2009, SnapLogic, Inc. All rights reserved.
#
# See http://www.snaplogic.org for more information about
# the SnapLogic project.
#
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LEGAL file
# at the top of the source tree.
#
# "SnapLogic" is a trademark of SnapLogic, Inc.
#
#
# $
# $Id: pipeline_prop_defs.py 10295 2009-12-22 23:27:28Z dhiraj $
"""
This module defines the properties used by a pipeline resdef.
"""
from snaplogic.cc import prop
from snaplogic.snapi_base import keys
import snaplogic.common.component_prop_defs as comp_defs
#
# Define a member resource in a pipeline.
# This has URI, name, genid/guid, input/output views
# and params.
#
# We store a little more for output views in the pipeline.
name_map = prop.DictProp("Rename Map", None,
"Maps pass-through input view's field names to the name used in pass-through output view")
inp_view_map = prop.DictProp("Pass-through Input Views", name_map,
"Pass-through input view for which the mapping is specified")
out_prop = prop.DictProp("Definition", None, "View definition")
for k in comp_defs.OUT_VIEW_PROP:
out_prop[k] = comp_defs.OUT_VIEW_PROP[k]
out_prop[keys.ORIGINAL_OUTPUT_FIELDS] = comp_defs.VIEW_FIELDS_PROP
out_prop[keys.RENAMED_FIELDS_MAP] = inp_view_map
rr_def = prop.DictProp("Resource Ref", fixed_keys = True)
for k in comp_defs.RESOURCE_REF_ENTRY:
rr_def[k] = comp_defs.RESOURCE_REF_ENTRY[k]
# This key is present only in the context of a pipeline
rr_def[keys.OVERRIDDEN_VALUE] = prop.SimpleProp("Overridden Ref Value", "string")
member_resource_ref_prop = prop.DictProp("Resource References", rr_def)
mem_resdef = prop.DictProp("Definition", None, "Resource definition of member",
fixed_keys = True, required = True)
mem_resdef[keys.OUTPUT_VIEWS] = prop.DictProp("Output View", out_prop, required = True)
mem_resdef[keys.PARAMS] = comp_defs.PARAMS_PROP
mem_resdef[keys.OUTPUT_VIEW_PASSTHROUGH] = comp_defs.PASSTHROUGH_PROP
mem_resdef[keys.INPUT_VIEWS] = comp_defs.INPUT_VIEWS_PROP
mem_resdef[keys.RESOURCE_REF] = member_resource_ref_prop
mem_resdef[keys.RESOURCE_CATEGORY] = comp_defs.CATEGORIES_PROP
mem_resdef[keys.INPUT_VIEWS] = comp_defs.INPUT_VIEWS_PROP
MEMBER_RESDEF = mem_resdef
mem_entry = prop.DictProp("Details", None, "Member resource details", fixed_keys = True)
mem_entry[keys.URI] = prop.SimpleProp("URI", "string", required = True)
mem_entry[keys.GUID] = prop.SimpleProp("GUID", "string", required = True)
mem_entry[keys.GEN_ID] = prop.SimpleProp("Gen ID", "number", required = True)
mem_entry[keys.RESDEF] = mem_resdef
MEMBER_RESOURCES_PROP = prop.DictProp("Resource", mem_entry)
#
# Define a param map in a pipeline.
#
param_def = prop.ListProp('Definition', prop.SimpleProp("Param map", "string"), '', 4, 4)
PARAMETER_MAP_PROP = prop.ListProp("Parameter Map", param_def, "The parameter map of the pipeline")
#
# Define a view assignment.
#
view_assign = prop.DictProp("Definition", None, "View assignment definition", fixed_keys = True)
view_assign[keys.RESOURCE_NAME] = prop.SimpleProp("Resource Name", "string")
view_assign[keys.RESOURCE_VIEW_NAME] = prop.SimpleProp("Resource View Name", "string")
INPUT_VIEW_ASSIGNMENT_PROP = prop.DictProp("Input View Assignment", view_assign, "Pipeline input view assignment",
required = True)
OUTPUT_VIEW_ASSIGNMENT_PROP = prop.DictProp("Output View Assignment", view_assign, "Pipeline output view assignment",
required = True)
pipe_res = prop.DictProp("Pipeline", None, "Pipeline resource definition", fixed_keys = True)
# First we define resdef entries that any resource has, including non pipeline resource.
pipe_res[keys.PROPERTY_VALS] = comp_defs.BASIC_PROPERTY_VALS_PROP
pipe_res[keys.PROPERTY_DEFS] = None
pipe_res[keys.OUTPUT_VIEW_PASSTHROUGH] = comp_defs.PASSTHROUGH_PROP
pipe_res[keys.OUTPUT_VIEWS] = comp_defs.OUTPUT_VIEWS_PROP
pipe_res[keys.INPUT_VIEWS] = comp_defs.INPUT_VIEWS_PROP
pipe_res[keys.PARAMS] = comp_defs.PARAMS_PROP
pipe_res[keys.DESCRIPTION] = comp_defs.DESC_PROP
pipe_res[keys.COMPONENT_DOC_URI] = comp_defs.DOC_URI_PROP
pipe_res[keys.CAPABILITIES] = comp_defs.CAPABILITIES_PROP
pipe_res[keys.COMPONENT_NAME] = comp_defs.COMPONENT_NAME
# Now, we define resdef entries that are specific to pipeline resources.
pipe_res[keys.PIPELINE_RESOURCES] = MEMBER_RESOURCES_PROP
pipe_res[keys.INPUT_VIEW_ASSIGNMENT] = INPUT_VIEW_ASSIGNMENT_PROP
pipe_res[keys.OUTPUT_VIEW_ASSIGNMENT] = OUTPUT_VIEW_ASSIGNMENT_PROP
pipe_res[keys.PIPELINE_PARAM_MAP] = PARAMETER_MAP_PROP
# Given the structure here (a list with varying types in it), we will use custom validation code in pipeline API
# to test VIEW_LINKS validity.
pipe_res[keys.VIEW_LINKS] = None
pipe_res[keys.RELATED_PIPELINES] = comp_defs.RELATED_RESOURCES_PROP
pipe_res[keys.RESOURCE_CATEGORY] = comp_defs.CATEGORIES_PROP
PIPELINE_RESOURCE_PROP = pipe_res
|