HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
jchecker.JsonChecker.JsonChecker Class Reference

JsonChecker Class contents main functional of JsonChecker application, class inherits from foundation.CementApp. More...

Inheritance diagram for jchecker.JsonChecker.JsonChecker:
Collaboration diagram for jchecker.JsonChecker.JsonChecker:

Classes

class  Meta
 

Public Member Functions

def __init__ (self)
 constructor initialise all class variable More...
 
def fillError (self, errorStr, errorCode)
 fillError method calls from error-code point from main processing More...
 
def readJSONValue (self, fileName, path)
 readJSONValue method Method reads json string from file and search alue by path More...
 
def valueChecker (self, jsonValue, value)
 valueChecker method Method compares incoming jsonValue with value, or find jsonValue in value if value is value's list More...
 
def setup (self)
 setup method Method calls before run application More...
 
def run (self)
 run method Method contains main application functionality More...
 
def close (self)
 close method Method calls after application run More...
 

Public Attributes

 errorCode
 
 errorStr
 

Detailed Description

JsonChecker Class contents main functional of JsonChecker application, class inherits from foundation.CementApp.

Definition at line 30 of file JsonChecker.py.

Constructor & Destructor Documentation

◆ __init__()

def jchecker.JsonChecker.JsonChecker.__init__ (   self)

constructor initialise all class variable

Definition at line 38 of file JsonChecker.py.

38  def __init__(self):
39  foundation.CementApp.__init__(self)
40  self.errorCode = CONSTANTS.ERROR_NOERROR
41  self.errorStr = ""
42 
43 
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ close()

def jchecker.JsonChecker.JsonChecker.close (   self)

close method Method calls after application run

Definition at line 114 of file JsonChecker.py.

114  def close(self):
115  foundation.CementApp.close(self)
116 

◆ fillError()

def jchecker.JsonChecker.JsonChecker.fillError (   self,
  errorStr,
  errorCode 
)

fillError method calls from error-code point from main processing

Definition at line 46 of file JsonChecker.py.

46  def fillError(self, errorStr, errorCode):
47  self.errorCode = errorCode
48  self.errorStr = errorStr
49  logger.error(self.errorStr)
50 
51 
Here is the caller graph for this function:

◆ readJSONValue()

def jchecker.JsonChecker.JsonChecker.readJSONValue (   self,
  fileName,
  path 
)

readJSONValue method Method reads json string from file and search alue by path

Definition at line 54 of file JsonChecker.py.

54  def readJSONValue(self, fileName, path):
55  fd = None
56  value = None
57  try:
58  fd = open(fileName, 'r')
59  except IOError:
60  fd = None
61  if fd != None:
62  jsonString = fd.read()
63  try:
64  value = Utils.getPath(None, jsonString, path)
65  value = str(value)
66  except (ValueError):
67  self.fillError(CONSTANTS.ERROR_STR3, CONSTANTS.ERROR_BAD_JSON)
68  except (TypeError, KeyError, IndexError):
69  self.fillError(CONSTANTS.ERROR_STR4, CONSTANTS.ERROR_PATH_NOT_FOUND)
70  else:
71  self.fillError(CONSTANTS.ERROR_STR2, CONSTANTS.ERROR_FILE)
72  return value
73 
74 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

def jchecker.JsonChecker.JsonChecker.run (   self)

run method Method contains main application functionality

Definition at line 100 of file JsonChecker.py.

100  def run(self):
101  foundation.CementApp.run(self)
102  jsonValue = None
103  if self.pargs.path == None or self.pargs.file == None:
104  self.fillError(CONSTANTS.ERROR_STR1, CONSTANTS.ERROR_ARG1)
105  else:
106  jsonValue = self.readJSONValue(self.pargs.file, self.pargs.path)
107  if jsonValue != None and self.pargs.value != None:
108  self.valueChecker(jsonValue, self.pargs.value)
109  sys.exit(self.errorCode)
110 
111 
Here is the call graph for this function:

◆ setup()

def jchecker.JsonChecker.JsonChecker.setup (   self)

setup method Method calls before run application

Definition at line 91 of file JsonChecker.py.

91  def setup(self):
92  foundation.CementApp.setup(self)
93  self.args.add_argument("-path", "--path", action="store")
94  self.args.add_argument("-value", "--value", action="store")
95  self.args.add_argument("-file", "--file", action="store")
96 
97 

◆ valueChecker()

def jchecker.JsonChecker.JsonChecker.valueChecker (   self,
  jsonValue,
  value 
)

valueChecker method Method compares incoming jsonValue with value, or find jsonValue in value if value is value's list

Definition at line 78 of file JsonChecker.py.

78  def valueChecker(self, jsonValue, value):
79  isFind = False
80  valueList = value.split(CONSTANTS.VALUE_SEPARATOR)
81  for item in valueList:
82  if item == jsonValue:
83  isFind = True
84  break
85  if isFind == False:
86  self.fillError(CONSTANTS.ERROR_STR5, CONSTANTS.ERROR_VALUE_NOT_FOUND)
87 
88 
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ errorCode

jchecker.JsonChecker.JsonChecker.errorCode

Definition at line 40 of file JsonChecker.py.

◆ errorStr

jchecker.JsonChecker.JsonChecker.errorStr

Definition at line 41 of file JsonChecker.py.


The documentation for this class was generated from the following file: