def __init__(self, redboxVersion, config, baseline, log): self.config = config self.redboxVersion = redboxVersion self.name = config['name'] self.path = StrSubstitutor.replaceSystemProperties(config['path']) self.harvestConfig = StrSubstitutor.replaceSystemProperties(config['harvestConfig']) self.handlers = config['handlers'] self.processLog = [] self.__log = log if 'baseline' in config: #Merge the alert's fixed metadata over the main baseline self.baseline = dict(baseline.items() + config['baseline'].items()) else: self.baseline = baseline self.timestampFields = [] if 'timestampFields' in config: self.timestampFields = config['timestampFields'] #These directories are used to hold files during/after processing self.__DIR_PROCESSED = os.path.join(self.path, ".processed") self.__DIR_ALERT = os.path.join(self.__DIR_PROCESSED, time.strftime("%Y_%m_%d_%H_%M_%S")) self.__DIR_PROCESSING = os.path.join(self.__DIR_PROCESSED, "processing/") self.__DIR_SUCCESS = os.path.join(self.__DIR_ALERT, "success/") self.__DIR_FAILED = os.path.join(self.__DIR_ALERT, "failed/") self.__DIR_ORIGINAL = os.path.join(self.__DIR_ALERT, "original/")
def __init__(self, redboxVersion, config, baseline, log): self.config = config self.redboxVersion = redboxVersion self.name = config['name'] self.path = StrSubstitutor.replaceSystemProperties(config['path']) self.harvestConfig = StrSubstitutor.replaceSystemProperties( config['harvestConfig']) self.handlers = config['handlers'] self.processLog = [] self.__log = log if 'baseline' in config: #Merge the alert's fixed metadata over the main baseline self.baseline = dict(baseline.items() + config['baseline'].items()) else: self.baseline = baseline self.timestampFields = [] if 'timestampFields' in config: self.timestampFields = config['timestampFields'] #These directories are used to hold files during/after processing self.__DIR_PROCESSED = os.path.join(self.path, ".processed") self.__DIR_ALERT = os.path.join(self.__DIR_PROCESSED, time.strftime("%Y_%m_%d_%H_%M_%S")) self.__DIR_PROCESSING = os.path.join(self.__DIR_PROCESSED, "processing/") self.__DIR_SUCCESS = os.path.join(self.__DIR_ALERT, "success/") self.__DIR_FAILED = os.path.join(self.__DIR_ALERT, "failed/") self.__DIR_ORIGINAL = os.path.join(self.__DIR_ALERT, "original/")
def __init__(self, file, config, baseline): AlertHandler.__init__(self, file, config, baseline) docFactory = DocumentFactory() self.saxReader = SAXReader(docFactory) self.xmlMapFile = StrSubstitutor.replaceSystemProperties(config['xmlMap']) if not os.path.exists(self.xmlMapFile): raise AlertException("Requested xmlMap file %s does not exist." % self.xmlMapFile) ## Make sure we can see our mappings inStream = FileInputStream(File(self.xmlMapFile)) xmlMappings = JsonSimple(inStream) self.map = xmlMappings.getObject(["mappings"]) self.exceptions = xmlMappings.getObject(["exceptions"]) self.defaultNamespace = xmlMappings.getObject(["defaultNamespace"]) self.mappedExceptionCount = 0
def __init__(self, file, config, baseline): AlertHandler.__init__(self, file, config, baseline) docFactory = DocumentFactory() self.saxReader = SAXReader(docFactory) self.xmlMapFile = StrSubstitutor.replaceSystemProperties( config['xmlMap']) if not os.path.exists(self.xmlMapFile): raise AlertException("Requested xmlMap file %s does not exist." % self.xmlMapFile) ## Make sure we can see our mappings inStream = FileInputStream(File(self.xmlMapFile)) xmlMappings = JsonSimple(inStream) self.map = xmlMappings.getObject(["mappings"]) self.exceptions = xmlMappings.getObject(["exceptions"]) self.defaultNamespace = xmlMappings.getObject(["defaultNamespace"]) self.mappedExceptionCount = 0
def getStageInfo(self, workflowId): uploader = self.uploaders.get(workflowId) config = JsonSimple(File(StrSubstitutor.replaceSystemProperties(uploader.getString("", ["json-config"])))) return StageInfo(config.getArray(["stages"]))