# $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: component_prop_defs.py 10295 2009-12-22 23:27:28Z dhiraj $
from snaplogic.cc import prop
from snaplogic.snapi_base import keys
ftype = prop.SimpleProp("View Field", "string")
field_prop = prop.ListProp("Field Definition", ftype, "Field definition", 3, 3)
fields_prop = prop.ListProp("Fields List", field_prop, "List of Fields")
VIEW_FIELDS_PROP = fields_prop
c_type_prop = prop.SimpleProp("Content-Type", "string")
c_type_list_prop = prop.ListProp("Content Types List", c_type_prop, "List of Content-types")
#
# Definition of an input view
#
inp_prop = prop.DictProp("Definition", None, "View definition", fixed_keys = True)
# Fields related entries (like pass-thru, field def) cannot be required, since the view could
# be binary. Similarly, binary related entries (like content type) cannot be required either.
inp_prop[keys.VIEW_FIELDS] = fields_prop
# This pass-through flag is no longer needed as of 2.0.3. Leaving it in there for backward
# compatibility
inp_prop[keys.INPUT_VIEW_IS_PASSTHROUGH] = prop.SimpleProp("Is Pass-through", "boolean")
inp_prop[keys.VIEW_CONTENT_TYPES] = c_type_list_prop
# These entries apply for both binary and record mode, so they are required in an input view
inp_prop[keys.DESCRIPTION] = prop.SimpleProp("Description", "string")
inp_prop[keys.MODIFIABLE] = prop.SimpleProp("Modifiable", "boolean", required = True)
inp_prop[keys.VIEW_IS_RECORD] = prop.SimpleProp("Is Record Mode", "boolean", required = True)
INPUT_VIEWS_PROP = prop.DictProp("Input View", inp_prop, required = True)
#
# Definition of an output view.
#
out_prop = prop.DictProp("Definition", None, "View definition", fixed_keys = True)
out_prop[keys.VIEW_FIELDS] = fields_prop
out_prop[keys.VIEW_CONTENT_TYPES] = c_type_list_prop
# These entries apply for both binary and record mode, so they are required in an output view
out_prop[keys.DESCRIPTION] = prop.SimpleProp("Description", "string")
out_prop[keys.MODIFIABLE] = prop.SimpleProp("Modifiable", "boolean")
out_prop[keys.VIEW_IS_RECORD] = prop.SimpleProp("Is Record Mode", "boolean")
OUT_VIEW_PROP = out_prop
OUTPUT_VIEWS_PROP = prop.DictProp("Output View", out_prop)
#
# Definition of pass-through setting.
#
pt_inp_prop = prop.SimpleProp(" Input View", "string")
pt_inp_list_prop = prop.ListProp("Input View List", pt_inp_prop,
"Order of Input Views passing through fields to this output view", 1, required = True)
pt_def = prop.DictProp("Pass-through Definition", fixed_keys = True, required = True)
pt_def[keys.MODIFIABLE] = prop.SimpleProp("Modifiable", "boolean", required = True)
pt_def[keys.INPUT_VIEWS] = pt_inp_list_prop
PASSTHROUGH_PROP = prop.DictProp("Output View", pt_def)
#
# Definition of param
#
def_value_prop = prop.SimpleProp("Default Value", "string")
modifiable_prop = prop.SimpleProp("Modifiable", "boolean", required = True)
param_prop = prop.DictProp("Definition", None, "Param definition", 2, 2)
param_prop[keys.DEFAULT_VALUE] = def_value_prop
param_prop[keys.MODIFIABLE] = modifiable_prop
PARAMS_PROP = prop.DictProp("Param", param_prop, required = True)
#
# Definition of categories
#
CATEGORIES_PROP = prop.DictProp("Categories Definition", fixed_keys = True)
cat_entry = prop.SimpleProp("Category", "string")
CATEGORIES_PROP[keys.VALUE] = prop.ListProp("List of Categories", cat_entry,
"List of categories that the resource belongs to.")
CATEGORIES_PROP[keys.MODIFIABLE] = prop.SimpleProp("Modifiable", "boolean", required = True)
#
# Definition of resource ref
#
RESOURCE_REF_ENTRY = prop.DictProp("Resource Ref", fixed_keys = True)
RESOURCE_REF_ENTRY[keys.LABEL] = prop.SimpleProp("Label", "string")
RESOURCE_REF_ENTRY[keys.VALUE] = prop.SimpleProp("Ref Value", "string")
RESOURCE_REF_ENTRY[keys.CATEGORIES_ALLOWED] = prop.ListProp("Categories Allowed", cat_entry, "Resource categories")
RESOURCE_REF_ENTRY[keys.REQUIRED] = prop.SimpleProp("Modifiable", "boolean", required = True)
RESOURCE_REF_PROP = prop.DictProp("Resource References", RESOURCE_REF_ENTRY)
#
# Definition of internal and general info properties.
#
internal_prop = prop.DictProp("SnapLogic Internal", None, "Internal resource values", required = True)
gen_prop = prop.DictProp("General Information", None, "General information values", required = True)
# Author and desc don't have to be set.
gen_prop[keys.AUTHOR] = prop.SimpleProp("Author", "string", "Author of the resource")
gen_prop[keys.DESCRIPTION] = prop.SimpleProp("Description", "string", "Description of the resource")
basic_prop_val = prop.DictProp("Property Values", required = True)
basic_prop_val[keys.SNAP_GENERAL_INFO] = gen_prop
basic_prop_val[keys.SNAP_INTERNAL] = internal_prop
basic_prop_val = None #XXXXXXXXXXXXXXXXXXXXXX
BASIC_PROPERTY_VALS_PROP = basic_prop_val
# TODO: Should this go?
# Definition of internal and general info propert
DESC_PROP = prop.SimpleProp("Description", "string")
DOC_URI_PROP = prop.SimpleProp("Documentation URI", "string")
#
# Capabilities
#
cap_prop = prop.DictProp("Capabilities", None, "Capabilities of the component", required = True)
cap_prop[keys.CAPABILITY_INPUT_VIEW_LOWER_LIMIT] = prop.SimpleProp("Input view lower limit", "number",
"Lower limit on the number of input views",
required = True)
cap_prop[keys.CAPABILITY_INPUT_VIEW_UPPER_LIMIT] = prop.SimpleProp("Input view upper limit", "number",
"Upper limit on the number of input views",
required = True)
cap_prop[keys.CAPABILITY_OUTPUT_VIEW_LOWER_LIMIT] = prop.SimpleProp("Output view lower limit", "number",
"Lower limit on the number of output views",
required = True)
cap_prop[keys.CAPABILITY_OUTPUT_VIEW_UPPER_LIMIT] = prop.SimpleProp("Output view upper limit", "number",
"Upper limit on the number of output views",
required = True)
cap_prop[keys.CAPABILITY_INPUT_VIEW_ALLOW_BINARY] = prop.SimpleProp("Allow Binary Inputs", "boolean",
"Set to true if component has binary input views",
required = True)
cap_prop[keys.CAPABILITY_OUTPUT_VIEW_ALLOW_BINARY] = prop.SimpleProp("Allow Binary Outputs", "boolean",
"Set to true if component has binary output views",
required = True)
cap_prop[keys.CAPABILITY_ALLOW_PASS_THROUGH] = prop.SimpleProp("Allow Pass-through", "boolean",
"Set to true if the component supports pass-through",
required = True)
cap_prop[keys.CAPABILITY_VALIDATE] = prop.SimpleProp("Validate URI", "string",
"URI to be used to make validation requests")
cap_prop[keys.CAPABILITY_SUGGEST_RESOURCE_VALUES] = prop.SimpleProp("Suggest URI", "string",
"URI to be used to make validation requests")
cap_prop[keys.CAPABILITY_CREATE_RESOURCE_TEMPLATE] = prop.SimpleProp("Template URI", "string",
"URI to be used to make validation requests")
CAPABILITIES_PROP = cap_prop
COMPONENT_NAME = prop.SimpleProp("Component Name", "string", "Name of the component that the resource is based on")
RELATED_RESOURCES_PROP = prop.DictProp("Related resources", None, "Resources related to this resource")
|