def getOdrName(dwlMbean): odrName = String(dwlmMbean) odrIdx = odrName.indexOf("process=") odrName = odrName.substring(odrIdx+8) odrName1 = String(odrName) odrIdx1 = odrName1.indexOf(',') odrname = odrName1.substring(0, odrIdx1) return odrname
def getDistributors(self, oshv, sqlServerId): #is there is a chance that we have more than one distributor? rs = self.connection.doCall(Queries.SERVER_DIST_CALL) distributor = None databaseName = None while rs.next(): name = rs.getString('distributor') if (name is None): rs.close() return None databaseName = rs.getString('distribution database') max = int(rs.getInt('max distrib retention')) min = int(rs.getInt('min distrib retention')) history = int(rs.getInt('history retention')) cleanup = String(rs.getString('history cleanup agent')) idx = cleanup.indexOf('Agent history clean up:') if (idx >= 0): cleanup = cleanup.substring(len("Agent history clean up:")) distributor = ObjectStateHolder('sqlserverdistributor') sqlServer = self.createSqlServer(name, oshv, sqlServerId) distributor.setContainer(sqlServer) distributor.setAttribute(Queries.DATA_NAME, name) distributor.setIntegerAttribute('maxTxRetention', max) distributor.setIntegerAttribute('minTxRetention', min) distributor.setIntegerAttribute('historyRetention', history) distributor.setAttribute('cleanupAgentProfile', cleanup) oshv.add(sqlServer) oshv.add(distributor) database = self.getDatabase(sqlServer, databaseName) oshv.add(database) oshv.add(modeling.createLinkOSH('use', distributor, database)) rs.close() if (distributor != None): logger.debug('we got a distributor') return [distributor, databaseName]
def getDistributors(self,oshv,sqlServerId): #is there is a chance that we have more than one distributor? rs = self.connection.doCall(Queries.SERVER_DIST_CALL) distributor = None databaseName = None while rs.next(): name = rs.getString('distributor') if(name is None): rs.close() return None databaseName = rs.getString('distribution database') max = int(rs.getInt('max distrib retention')) min = int(rs.getInt('min distrib retention')) history = int(rs.getInt('history retention')) cleanup = String(rs.getString('history cleanup agent')) idx = cleanup.indexOf('Agent history clean up:') if(idx>=0): cleanup=cleanup.substring(len("Agent history clean up:")) distributor = ObjectStateHolder('sqlserverdistributor') sqlServer = self.createSqlServer(name,oshv,sqlServerId) distributor.setContainer(sqlServer) distributor.setAttribute(Queries.DATA_NAME,name) distributor.setIntegerAttribute('maxTxRetention',max) distributor.setIntegerAttribute('minTxRetention',min) distributor.setIntegerAttribute('historyRetention',history) distributor.setAttribute('cleanupAgentProfile',cleanup) oshv.add(sqlServer) oshv.add(distributor) database = self.getDatabase(sqlServer,databaseName) oshv.add(database) oshv.add(modeling.createLinkOSH('use',distributor,database)) rs.close() if(distributor!=None): logger.debug('we got a distributor') return [distributor,databaseName]
def fixProcessPath(path, name): if (path != None) and (len(path) > 0): processPathStr = String(path) if processPathStr.endsWith(name): return path if processPathStr.indexOf('\\') != -1: if processPathStr.endsWith('\\'): return path + name else: return path + '\\' + name if processPathStr.indexOf('/') != -1: if processPathStr.endsWith('/'): return path + name else: return path + '/' + name return path
def getGLacct(description): descr = String(description) acct = "" ck = mbo.getUserInfo().getConnectionKey() conn = mbo.getMboServer().getDBConnection(ck) stmt = conn.createStatement() whereClause = "SITEID='DIS'" if descr.indexOf("TRN") > -1: whereClause = "SITEID='TRN'" rs = stmt.executeQuery("select * from site where " + whereClause) if rs.next(): if descr.indexOf(" Service Fee ") > -1: acct = rs.getString("EX2FREIGHTMGMTACCT") else: acct = rs.getString("EX2FREIGHTACCT") mbo.getMboServer().freeDBConnection(ck) stmt.close() rs.close() return acct
def addCIs(CONTEXT, allObjectChildren, smartUpdateIgnoreFieldsList, sortCSVFieldsList): iter = allObjectChildren.iterator() contextOK = 1 while iter.hasNext(): keyAttrLogStr = 'PK:' if contextOK == 0: break keyAttributes = HashMap() objectElement = iter.next() className = objectElement.getAttributeValue('name') mamId = objectElement.getAttributeValue('mamId') mode = objectElement.getAttributeValue('mode') nameSpace = objectElement.getAttributeValue('nameSpace') # if className is nameSpace:className (className, nameSpace) = getClassAndNamespace(className, nameSpace) if isNoneOrEmpty(nameSpace): nameSpace = 'BMC' attributesMap = HashMap() datatypes = HashMap() fieldChildren = objectElement.getChildren('field') if fieldChildren is not None: iter2 = fieldChildren.iterator() while iter2.hasNext(): fieldElement = iter2.next() fieldName = fieldElement.getAttributeValue('name') datatype = fieldElement.getAttributeValue('datatype') fieldValue = fieldElement.getText() if sortCSVFieldsList.count(fieldName): fieldValue = sortCsvStr(fieldValue) attributesMap.put(fieldName, fieldValue) if datatype is not None: datatypes.put(fieldName, datatype) isKey = fieldElement.getAttributeValue('key') if isKey == 'true': keyAttributes.put(fieldName, fieldName) keyAttrLogStr = keyAttrLogStr + fieldName + '=' + str( fieldValue) + ' ' mamIdToAttributesMap.put(mamId, attributesMap) mamIdToKeyAttributes.put(mamId, keyAttributes) isArs = objectElement.getAttributeValue('ars') try: if isNoneOrEmpty(isArs): insertCiToAtrium(CONTEXT, className, attributesMap, mode, mamId, keyAttributes, nameSpace, smartUpdateIgnoreFieldsList) else: insertCiToRemedyARS(CONTEXT, className, attributesMap, mode, mamId, keyAttributes, nameSpace, datatypes) except: err = traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]) strErrorJava = None try: strErrorJava = String(str(err)) except: pass flogger.debug("%s\t%s\t%s\t%s\n" % (mamId, mode, className, keyAttrLogStr)) if strErrorJava is not None and strErrorJava.indexOf( 'Authentication failed') != -1: logger.error( 'Could not connect to Atrium. Exiting from the integration' ) contextOK = 0 logger.debug("insertCiToAtrium/insertCiToRemedyARS failed") logger.error(err)
def loadProperties(cfg_file, extra_props): props = Properties() iterated_props = Properties() inherited_props = Properties() data_linage = Properties() global_reg = global_platform.load_global_registry() site_home = global_reg.getProperty('site.home') global_properties = global_reg.getProperty('global.properties') if global_properties: if site_home: baseFile = getBaseFile(global_properties, site_home) if baseFile == '': log.error('Global properties file does not exist: ' + global_properties) log.info( 'Suggested Fix: Update the global_platform.properties property within global.properties to the correct file path' ) sys.exit() global_properties = baseFile log.info('Loading global configuration from file: ' + global_properties) addPropertiesFromFile(props, global_properties, site_home) if cfg_file: addPropertiesFromFile(props, cfg_file, site_home) if extra_props: props.putAll(extra_props) # resolve property level inheritance and iterations log.debug('Attempting to resolve property level inheritance') enum = props.keys() while enum.hasMoreElements(): key = enum.nextElement() value = props.getProperty(key) # Check for property level inheritance if re.search(r"\.base$", key) is not None: prop_to_inherit = value prop_to_extend = key[:-5] log.debug('Inheriting the properties from the ' + prop_to_inherit + ' section in to the section ' + prop_to_extend) # Iterate the properties again looking for a match on properties to inherit enum_inner = props.keys() while enum_inner.hasMoreElements(): key_inner = enum_inner.nextElement() value_inner = props.getProperty(key_inner) log.debug('Checking key_inner [' + key_inner + '] matches ' + prop_to_inherit) if String.startsWith(String(key_inner), String(prop_to_inherit)): new_property = prop_to_extend + String.substring( key_inner, len(prop_to_inherit)) # Don't override the property if it has already been defined earlier if props.getProperty(new_property) is None: log.debug('Setting inherited property ' + new_property + ' to value ' + value_inner) inherited_props.setProperty(new_property, value_inner) addDataLinage(key, cfg_file, value_inner) # Remove the key that defines the base, just keeps us consistant with the template behaviours log.debug("About to remove key " + key) props.remove(key) props.putAll(inherited_props) log.debug('Attempting to resolve iterations') enum = props.keys() while enum.hasMoreElements(): key = enum.nextElement() value = props.getProperty(key) # Check for property set iterations if re.search(r"\.iterate$", key) is not None: iteration_key = key iteration_set = eval(value) prop_to_iterate = key[:-9] log.debug('Iterating the properties from the ' + prop_to_iterate + ' section') # Iterate the properties again looking for a match on properties to iterate enum_inner = props.keys() while enum_inner.hasMoreElements(): key_inner = enum_inner.nextElement() value_inner = props.getProperty(key_inner) # if the string is part of the set but not the actual iterator then we will check it if String.startsWith(String(key_inner), String( prop_to_iterate)) and key_inner != iteration_key: log.debug('Checking if the key [' + key_inner + '] or value = ' + value_inner + ' contains an iterator ') contains_iterator = 0 iterated_key = String(key_inner) iterated_value = String(value_inner) if String.indexOf(String(key_inner), "%") > -1: log.debug(key_inner + ' contains an iterator, replacing it') contains_iterator = 1 if String.indexOf(String(value_inner), "%") > -1: log.debug(value_inner + ' contains an iterator, replacing it') contains_iterator = 1 for i in iteration_set: iterated_key = String.replaceAll( String(key_inner), "\%", str(i)) iterated_value = String.replaceAll( String(value_inner), "\%", str(i)) # Don't override the property if it has already been defined earlier if props.getProperty(iterated_key) is None: log.debug('Setting iterated property ' + iterated_key + ' to value ' + iterated_value) iterated_props.setProperty(iterated_key, iterated_value) addDataLinage(key, cfg_file, iterated_value) # Remove the key that gets iterated, just keeps us consistant with the template behaviours if (contains_iterator == 1): log.debug('About to remove ' + key_inner) props.remove(key_inner) # Remove the key that defines the iterations, just keeps us consistant with the template behaviours props.remove(iteration_key) # Add the iterated properties back in to the main set props.putAll(iterated_props) # resolve embedded references enum = props.keys() while enum.hasMoreElements(): key = enum.nextElement() value = props.getProperty(key) if not value is None and len(value) > 0: if re.search(r"\$\{(.*?)\}", value) is not None: resolvedValue = resolveProperty(key, props) if resolvedValue is None: raise Exception('unable to resolve property: ' + key + '=' + value) else: props.setProperty(key, resolvedValue) addDataLinage(key, cfg_file, resolvedValue) # remove any properties that start with base (assumed that these are baseline properties that have been inherited enum = props.keys() while enum.hasMoreElements(): key = enum.nextElement() if String.startsWith(String(key), 'base.'): props.remove(key) decryptAllPasswords(cfg_file, props) return props
dwlmMBean = AdminControl.queryNames(dwlmMBeanStr) dwlmMBeans = convertToList(dwlmMBean) for dwlmMbean in dwlmMBeans: odrName = getOdrName(dwlmMbean) methodName = "disableEventTracing" if (option == "enableReqBasedTracing"): methodName = "enableEventTracing" params = [ruleId, ruleExpr, odrTraceSpec, appServerTraceSpec] signature = ['java.lang.String', 'java.lang.String', 'java.lang.String', 'java.lang.String'] objName = mgmt.ObjectName(dwlmMbean) rc = AdminControl.invoke_jmx(objName, methodName, params, signature) if (rc.startswith("SUCCESS:") == 1): print "Successfully enabled request based tracing for expression: \"" + ruleExpr + "\" on the ODR '" + odrName + "'. The rule ID is: " + ruleId elif (rc.startswith("FAILURE:") == 1): rcStr = String(rc) idx = rcStr.indexOf(':') print "Enable request based tracing failed on the ODR '" + odrName + "' with error message: \"" + rcStr.substring(idx+1) + "\"" elif (option == "disableReqBasedTracing"): methodName = "disableEventTracing" rc = AdminControl.invoke(dwlmMbean, methodName, ruleId) if (rc.startswith("SUCCESS:") == 1): print "Successfully disabled request based tracing for rule IDs: " + ruleId + " on the ODR '" + odrName + "'" elif (rc.startswith("FAILURE:") == 1): rcStr = String(rc) idx = rcStr.indexOf(':') print "Disable request based tracing failed on the ODR '" + odrName + "' with error message: \"" + rcStr.substring(idx+1) + "\"" elif (option == "listRuleIDs"): methodName = "queryEventTracing" objName = mgmt.ObjectName(dwlmMbean) parms = [] sig= []
def listConnectionFactory(ConnectionFactory_list, scopeId, scopeName, scopeType): for ConnectionFactory in ConnectionFactory_list.splitlines(): if not isObjectInScope(ConnectionFactory, scopeName, scopeType): continue sc = getScopeResources(ConnectionFactory) targetClient = '' typeConnectionFactory = '' connectionInterface = '' BusName = '' connectionFactoryInterface = '' rcStr = String(ConnectionFactory) idx = rcStr.indexOf('#CMPConnectorFactory') indx1 = rcStr.indexOf('#DataSource') if idx != -1 or indx1 != -1: continue else: print " found ConnFactory = %s " % (ConnectionFactory) typeConnectionFactory = getTypeName(ConnectionFactory) print "typeConnectionFactory == %s " % (typeConnectionFactory) if typeConnectionFactory == 'J2CConnectionFactory': targetClient = 'JMS' cnDef = AdminConfigShowAttribute(ConnectionFactory, 'connectionDefinition') connectionFactoryInterface = AdminConfigShowAttribute( cnDef, 'connectionFactoryInterface') #print " connectionFactoryInterface == %s for CF %s " %(connectionFactoryInterface, ConnectionFactory) if connectionFactoryInterface.find(".") != -1: typeConnectionFactory = connectionFactoryInterface.split( ".")[2] print "connectionFactoryInterface = %s" % ( connectionFactoryInterface) elif typeConnectionFactory == 'MQQueueConnectionFactory' or typeConnectionFactory == 'MQConnectionFactory': targetClient = 'MQ' else: continue if (connectionFactoryInterface != 'javax.resource.cci.ConnectionFactory'): partName = AdminConfigShowAttribute(ConnectionFactory, 'name') fileName = "%s/%s.%s.%s.py" % ( outputPath, replace(partName, " ", "_"), replace(sc, ":", "_"), typeConnectionFactory) print "filename = %s " % (fileName) displayList = [] f = open(fileName, "w") #root properties mapping = AdminConfigShowAttribute(ConnectionFactory, 'mapping') authenticationAlias = AdminConfigShowAttribute( mapping, 'authDataAlias') cp = AdminConfigShowAttribute(ConnectionFactory, 'connectionPool') maxConnections = AdminConfigShowAttribute(cp, 'maxConnections') minConnections = AdminConfigShowAttribute(cp, 'minConnections') jndiName = AdminConfigShowAttribute(ConnectionFactory, 'jndiName') name = AdminConfigShowAttribute(ConnectionFactory, 'name') description = AdminConfigShowAttribute(ConnectionFactory, 'description') qmgrType = AdminConfigShowAttribute(ConnectionFactory, 'qmgrType') host = AdminConfigShowAttribute(ConnectionFactory, 'host') queueManager = AdminConfigShowAttribute( ConnectionFactory, 'queueManager') channel = AdminConfigShowAttribute(ConnectionFactory, 'channel') port = AdminConfigShowAttribute(ConnectionFactory, 'port') provider = AdminConfigShowAttribute(ConnectionFactory, 'provider') propSet = wsadminToList( AdminConfigShowAttribute(ConnectionFactory, 'propertySet')) MQtransportType = AdminConfigShowAttribute( ConnectionFactory, 'transportType') for prop in propSet: propList = AdminConfig.list('J2EEResourceProperty', prop).splitlines() if propList != None: for resProps in propList: if AdminConfigShowAttribute(resProps, 'name') == 'BusName': BusName = AdminConfigShowAttribute( resProps, 'value') xaRecoveryAuthAlias = AdminConfigShowAttribute( ConnectionFactory, 'xaRecoveryAuthAlias') cnDef = AdminConfigShowAttribute(ConnectionFactory, 'connectionDefinition') if len(cnDef.strip()) != 0: connectionInterface = AdminConfigShowAttribute( cnDef, 'connectionInterface') if connectionInterface == 'javax.jms.QueueConnection': connectionInterface = 'queue' elif connectionInterface == 'javax.jms.TopicConnection': connectionInterface = 'topic' elif connectionInterface == 'javax.jms.Connection': connectionInterface = '' else: connectionInterface = '' displayList.append("scopeName='%s'" % (sc)) displayList.append("name='%s'" % (name)) displayList.append("jndiName='%s'" % (jndiName)) displayList.append("authenticationAlias='%s'" % (authenticationAlias)) displayList.append("xaRecoveryAuthAlias='%s'" % (xaRecoveryAuthAlias)) displayList.append("JMSbusName='%s'" % (BusName)) displayList.append("description='%s'" % (description)) displayList.append("Type='%s'" % (connectionInterface)) displayList.append("typeConnectionFactory='%s'" % (typeConnectionFactory)) displayList.append("MQhostName='%s'" % (host)) displayList.append("qmgrType='%s'" % (qmgrType)) displayList.append("MQqueueManager='%s'" % (queueManager)) displayList.append("MQchannel='%s'" % (channel)) displayList.append("MQport='%s'" % (port)) displayList.append("MQtransportType='%s'" % (MQtransportType)) #displayList.append("provider='%s'" %(provider)) displayList.append("targetClient='%s'" % (targetClient)) displayList.append("deleteIfExist=1") void = display(displayList, f) f.close() else: print "ConnectionFactory %s skipped in this version" % ( ConnectionFactory)
def getPath(path): ss = String(path) if(ss.indexOf("\\")==-1): # return ss return path # changed by Daniel La - HP Case 4644803487 return ss.substring(0,ss.lastIndexOf("\\"))
def addCIs(CONTEXT, allObjectChildren, smartUpdateIgnoreFieldsList, sortCSVFieldsList): iter = allObjectChildren.iterator() contextOK = 1 while iter.hasNext(): keyAttrLogStr = 'PK:' if contextOK == 0: break keyAttributes = HashMap() objectElement = iter.next() className = objectElement.getAttributeValue('name') mamId = objectElement.getAttributeValue('mamId') mode = objectElement.getAttributeValue('mode') nameSpace = objectElement.getAttributeValue('nameSpace') # if className is nameSpace:className (className, nameSpace) = getClassAndNamespace(className, nameSpace) if isNoneOrEmpty(nameSpace): nameSpace = 'BMC' attributesMap = HashMap() datatypes = HashMap() fieldChildren = objectElement.getChildren('field') if fieldChildren is not None: iter2 = fieldChildren.iterator() while iter2.hasNext(): fieldElement = iter2.next() fieldName = fieldElement.getAttributeValue('name') datatype = fieldElement.getAttributeValue('datatype') fieldValue = fieldElement.getText() if sortCSVFieldsList.count(fieldName): fieldValue = sortCsvStr(fieldValue) attributesMap.put(fieldName, fieldValue) if datatype is not None: datatypes.put(fieldName, datatype) isKey = fieldElement.getAttributeValue('key') if isKey == 'true': keyAttributes.put(fieldName, fieldName) keyAttrLogStr = keyAttrLogStr + fieldName + '=' + str(fieldValue) + ' ' mamIdToAttributesMap.put(mamId,attributesMap) mamIdToKeyAttributes.put(mamId,keyAttributes) isArs = objectElement.getAttributeValue('ars') try: if isNoneOrEmpty(isArs): insertCiToAtrium(CONTEXT, className, attributesMap, mode, mamId, keyAttributes, nameSpace, smartUpdateIgnoreFieldsList) else: insertCiToRemedyARS(CONTEXT, className, attributesMap, mode, mamId, keyAttributes, nameSpace, datatypes) except: err = traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]) strErrorJava = None try: strErrorJava = String(str(err)) except: pass flogger.debug("%s\t%s\t%s\t%s\n" % (mamId, mode, className, keyAttrLogStr)) if strErrorJava is not None and strErrorJava.indexOf('Authentication failed')!=-1: logger.error('Could not connect to Atrium. Exiting from the integration') contextOK = 0 logger.debug( "insertCiToAtrium/insertCiToRemedyARS failed") logger.error(err)
def loadProperties(cfg_file, extra_props): props = Properties() iterated_props = Properties() inherited_props = Properties() data_linage = Properties() redback_reg = redback.load_redback_registry() site_home = redback_reg.getProperty('site.home') global_properties = redback_reg.getProperty('global.properties') if global_properties: if site_home: baseFile=getBaseFile(global_properties, site_home) if baseFile=='': log.error('Global properties file does not exist: ' + global_properties) log.info('Suggested Fix: Update the global.properties property within redback.properties to the correct file path') sys.exit() global_properties=baseFile log.info('Loading global configuration from file: ' + global_properties) addPropertiesFromFile(props, global_properties, site_home) if cfg_file: addPropertiesFromFile(props, cfg_file, site_home) if extra_props: props.putAll(extra_props) # resolve property level inheritance and iterations log.debug('Attempting to resolve property level inheritance') enum = props.keys() while enum.hasMoreElements(): key = enum.nextElement() value = props.getProperty(key) # Check for property level inheritance if re.search(r"\.base$", key) is not None: prop_to_inherit = value prop_to_extend = key[:-5] log.debug('Inheriting the properties from the ' + prop_to_inherit + ' section in to the section ' + prop_to_extend) # Iterate the properties again looking for a match on properties to inherit enum_inner = props.keys() while enum_inner.hasMoreElements(): key_inner = enum_inner.nextElement() value_inner = props.getProperty(key_inner) log.debug('Checking key_inner [' + key_inner + '] matches ' + prop_to_inherit) if String.startsWith(String(key_inner),String(prop_to_inherit)): new_property = prop_to_extend + String.substring(key_inner, len(prop_to_inherit)) # Don't override the property if it has already been defined earlier if props.getProperty(new_property) is None: log.debug('Setting inherited property ' + new_property + ' to value ' + value_inner) inherited_props.setProperty(new_property, value_inner) addDataLinage(key,cfg_file,value_inner) # Remove the key that defines the base, just keeps us consistant with the template behaviours log.debug("About to remove key " + key) props.remove(key) props.putAll(inherited_props) log.debug('Attempting to resolve iterations') enum = props.keys() while enum.hasMoreElements(): key = enum.nextElement() value = props.getProperty(key) # Check for property set iterations if re.search(r"\.iterate$", key) is not None: iteration_key = key iteration_set = eval(value) prop_to_iterate = key[:-9] log.debug('Iterating the properties from the ' + prop_to_iterate + ' section') # Iterate the properties again looking for a match on properties to iterate enum_inner = props.keys() while enum_inner.hasMoreElements(): key_inner = enum_inner.nextElement() value_inner = props.getProperty(key_inner) # if the string is part of the set but not the actual iterator then we will check it if String.startsWith(String(key_inner),String(prop_to_iterate)) and key_inner != iteration_key: log.debug('Checking if the key [' + key_inner + '] or value = ' + value_inner + ' contains an iterator ') contains_iterator = 0 iterated_key = String(key_inner) iterated_value = String(value_inner) if String.indexOf(String(key_inner),"%") > -1: log.debug(key_inner + ' contains an iterator, replacing it') contains_iterator = 1 if String.indexOf(String(value_inner),"%") > -1: log.debug(value_inner + ' contains an iterator, replacing it') contains_iterator = 1 for i in iteration_set: iterated_key = String.replaceAll(String(key_inner),"\%",str(i)) iterated_value = String.replaceAll(String(value_inner),"\%",str(i)) # Don't override the property if it has already been defined earlier if props.getProperty(iterated_key) is None: log.debug('Setting iterated property ' + iterated_key + ' to value ' + iterated_value) iterated_props.setProperty(iterated_key, iterated_value) addDataLinage(key,cfg_file,iterated_value) # Remove the key that gets iterated, just keeps us consistant with the template behaviours if (contains_iterator == 1): log.debug('About to remove ' + key_inner) props.remove(key_inner) # Remove the key that defines the iterations, just keeps us consistant with the template behaviours props.remove(iteration_key) # Add the iterated properties back in to the main set props.putAll(iterated_props) # resolve embedded references enum = props.keys() while enum.hasMoreElements(): key = enum.nextElement() value = props.getProperty(key) if not value is None and len(value) > 0: if re.search(r"\$\{(.*?)\}", value) is not None: resolvedValue = resolveProperty(key, props) if resolvedValue is None: raise Exception('unable to resolve property: ' + key + '=' + value) else: props.setProperty(key, resolvedValue) addDataLinage(key,cfg_file,resolvedValue) # remove any properties that start with base (assumed that these are baseline properties that have been inherited enum = props.keys() while enum.hasMoreElements(): key = enum.nextElement() if String.startsWith(String(key),'base.'): props.remove(key) decryptAllPasswords(cfg_file,props) return props
def getPath(path): ss = String(path) if(ss.indexOf("\\")==-1): return path return ss.substring(0,ss.lastIndexOf("\\"))
def getFileFromPath(path): ss = String(path) if(ss.indexOf("\\")==-1): return path return ss.substring(ss.lastIndexOf("\\")+1)