コード例 #1
0
def addPropertiesFromFile(props, filename, site_home):
    addProps = Properties()
    input = FileInputStream(filename)
    addProps.load(input)
    input.close()

    baseFileList = addProps.getProperty('base')

    if not baseFileList is None:
        baseFiles = baseFileList.split(",")
        for baseFile in baseFiles:
            baseFileResolved = getBaseFile(baseFile, site_home)
            if baseFileResolved == '':
                log.error(
                    'Configuration inherits from properties file that does not exist: '
                    + baseFile)
                log.info('Suggested Fix: Update the base property within ' +
                         filename + ' to the correct file path')
                sys.exit()
            log.debug('Attempting to load properties from ' + baseFile)
            addPropertiesFromFile(addProps, baseFileResolved, site_home)
            addProps.remove('base')

    enum = addProps.keys()
    while enum.hasMoreElements():
        key = enum.nextElement()
        if props.getProperty(key) is None:
            props.setProperty(key, addProps.getProperty(key))
            addDataLinage(key, filename, addProps.getProperty(key))
コード例 #2
0
def intialize():
    global domainProps
    global userConfigFile
    global userKeyFile

    # test arguments
    if len(sys.argv) != 3:
        print 'Usage:  redeploy.sh  <default.properties_file> <property_file>'
        exit()

    print 'Starting the initialization process'

    try:
        domainProps = Properties()

        # load DEFAULT properties
        input = FileInputStream(sys.argv[1])
        domainProps.load(input)
        input.close()

        # load properties and overwrite defaults
        input = FileInputStream(sys.argv[2])
        domainProps.load(input)
        input.close()

        userConfigFile = File(sys.argv[2]).getParent(
        ) + '/' + domainProps.getProperty('domainName') + '.userconfig'
        userKeyFile = File(sys.argv[2]).getParent(
        ) + '/' + domainProps.getProperty('domainName') + '.userkey'

    except:
        print 'Cannot load properties  !'
        exit()

    print 'Initialization completed'
コード例 #3
0
def addPropertiesFromFile(props, filename, site_home):
    addProps = Properties()
    input = FileInputStream(filename)
    addProps.load(input)
    input.close()

    baseFileList = addProps.getProperty('base')
    
    if not baseFileList is None:
        baseFiles = baseFileList.split(",")
        for baseFile in baseFiles:
            baseFileResolved=getBaseFile(baseFile, site_home)
            if baseFileResolved=='':
                log.error('Configuration inherits from properties file that does not exist: ' + baseFile)
                log.info('Suggested Fix: Update the base property within ' + filename + ' to the correct file path')
                sys.exit()
            log.debug('Attempting to load properties from ' + baseFile)
            addPropertiesFromFile(addProps, baseFileResolved, site_home)
            addProps.remove('base')

    enum = addProps.keys()
    while enum.hasMoreElements():
        key = enum.nextElement()
        if props.getProperty(key) is None:
            props.setProperty(key, addProps.getProperty(key))
            addDataLinage(key,filename,addProps.getProperty(key))
コード例 #4
0
def intialize():
        global domainProps;
        global userConfigFile;
        global userKeyFile;

        # test arguments
        if len(sys.argv) != 3:
                print 'Usage:  stopDomain.sh  <default.properties_file> <property_file>';
                exit();

				
		print 'Starting the initialization process';                                                                                                                                                    

    	try:
    		domainProps = Properties()

		# load DEFAULT properties                                                                                                                                                                               
		input = FileInputStream(sys.argv[1])
		domainProps.load(input)
		input.close()
			
		
		# load properties and overwrite defaults
		input = FileInputStream(sys.argv[2])
		domainProps.load(input)
		input.close()

                userConfigFile = File(sys.argv[2]).getParent()+'/'+domainProps.getProperty('domainName')+'.userconfig'
                userKeyFile = File(sys.argv[2]).getParent()+'/'+domainProps.getProperty('domainName')+'.userkey'

        except:
                print 'Cannot load properties  !';
                exit();

        print 'Initialization completed';
コード例 #5
0
ファイル: config_reader.py プロジェクト: alex85k/qat_script
 def read_versions(self):
     versionsProperties = Properties()
     fin = FileInputStream(self.versionsFileName)
     versionsProperties.load(fin)
     scriptVersion = versionsProperties.getProperty("script")
     toolsVersion = versionsProperties.getProperty("tools")
     fin.close()
     return scriptVersion, toolsVersion
コード例 #6
0
 def read_versions(self):
     versionsProperties = Properties()
     fin = FileInputStream(self.versionsFileName)
     versionsProperties.load(fin)
     scriptVersion = versionsProperties.getProperty("script")
     toolsVersion = versionsProperties.getProperty("tools")
     fin.close()
     return scriptVersion, toolsVersion
コード例 #7
0
ファイル: pushToAtrium.py プロジェクト: ddonnelly19/dd-git
def getPushProperties():
    pushProperties          = HashMap()
    pushPropertiesFileStr   = "%s%s%s" % (adapterConfigBaseDir, FILE_SEPARATOR, PUSH_PROPERTIES_FILE)
    properties              = Properties()
    debugMode               = 0
    sortCSVFields           = ""
    smartUpdateIgnoreFields = ""
    testConnNameSpace       = "BMC.CORE"
    testConnClass           = "BMC_ComputerSystem"
    try:
        logger.debug("Checking push properties file for debugMode [%s]" % pushPropertiesFileStr)
        fileInputStream = FileInputStream(pushPropertiesFileStr)
        properties.load(fileInputStream)

        # Property: debugMode
        try:
            debugModeStr    = properties.getProperty("debugMode")
            if isNoneOrEmpty(debugModeStr) or string.lower(string.strip(debugModeStr)) == 'false':
                debugMode   = 0
            elif string.lower(string.strip(debugModeStr)) == 'true':
                debugMode   = 1
        except:
            logger.debugException("Unable to read debugMode property from push.properties")

        if debugMode:
            logger.debug("Debug mode = TRUE. XML data pushed to Remedy/Atrium will be persisted in the directory: %s" % adapterResBaseDir)
        else:
            logger.debug("Debug mode = FALSE")

        # Property: smartUpdateIgnoreFields
        try:
            smartUpdateIgnoreFields = properties.getProperty("smartUpdateIgnoreFields")
        except:
            logger.debugException("Unable to read smartUpdateIgnoreFields property from push.properties")

        # Property: sortCSVFields
        try:
            sortCSVFields = properties.getProperty("sortCSVFields")
        except:
            logger.debugException("Unable to read sortCSVFields property from push.properties")

        # Property: testConnNameSpace
        try:
            testConnNameSpace = properties.getProperty("testConnNameSpace")
        except:
            logger.debugException("Unable to read testConnNameSpace property from push.properties")

        # Property: testConnClass
        try:
            testConnClass = properties.getProperty("testConnClass")
        except:
            logger.debugException("Unable to read testConnClass property from push.properties")

        fileInputStream.close()
    except:
        logger.debugException("Unable to process %s file." % PUSH_PROPERTIES_FILE)

    return debugMode, smartUpdateIgnoreFields, sortCSVFields, testConnNameSpace, testConnClass
コード例 #8
0
def intialize():
        global domainLocation;
        global jvmLocation;
        global domainTemplate;
        global domainProps;
        global adminUserName;
        global adminPassword;
        global userConfigFile;
        global userKeyFile;

        # test arguments
        if len(sys.argv) != 6:
                print 'Usage:  createDomain.sh <template-file> <default.properties_file> <property_file> <wls_username> <wls_password>';
                exit();

        print 'Starting the initialization process';

        domainTemplate = sys.argv[1];
        print 'Using Domain Template: ' + domainTemplate;
        try:
                domainProps = Properties()

                # load DEFAULT properties
                # print 'Reading default properties from '+sys.argv[2];
                input = FileInputStream(sys.argv[2])
                domainProps.load(input)
                input.close()


                # load properties and overwrite defaults
                input = FileInputStream(sys.argv[3])
                domainProps.load(input)
                input.close()

                adminUserName = sys.argv[4];
                adminPassword = sys.argv[5];

		# Files for generating secret key

		userConfigFile = File(sys.argv[3]).getParent()+'/'+domainProps.getProperty('domainName')+'.userconfig'
                print userConfigFile
		userKeyFile = File(sys.argv[3]).getParent()+'/'+domainProps.getProperty('domainName')+'.userkey'
	        print userKeyFile			

                domainLocation = domainProps.getProperty('domainsDirectory') + pathSeparator + domainProps.getProperty('domainName');
                print 'Domain Location: ' + domainLocation;
                if len(domainProps.getProperty('jvmLocation')) == 0:
                        print 'JVM location property not defined - cancel creation !';
                        exit();
                print 'JVM Location: ' + domainProps.getProperty('jvmLocation');

        except:
                dumpStack()
                print 'Cannot initialize creation process !';
                exit();

        print 'Initialization completed';
コード例 #9
0
 def _areUserFilesValid(self):
   if not (self._userConfigFile and self._userKeyFile):
     return False
   if not (self._is_non_zero_file(self._userConfigFile) and self._is_non_zero_file(self._userKeyFile)):
     return False
   try:
     inStream=FileInputStream(self._userConfigFile)
     userConfigs=Properties()
     userConfigs.load(inStream)
   except NullPointerException:
     return False
   if not (userConfigs.getProperty('weblogic.management.username') and userConfigs.getProperty('weblogic.management.password')):
     return False
   return True
コード例 #10
0
ファイル: update_checker.py プロジェクト: alex85k/qat_script
def read_tools_list(tmpToolsListFile):
    """Read the tools names and tools data urls
       from the downlaoded tools list
    """
    toolsInfo = []
    properties = Properties()
    fin = FileInputStream(tmpToolsListFile)
    properties.load(fin)
    toolsRefs = properties.getProperty("tools.list").split("|")
    for toolRef in toolsRefs:
        jarUrl = properties.getProperty(toolRef)
        toolsInfo.append([toolRef, jarUrl.replace("\n", "")])
    fin.close()
    return toolsInfo
コード例 #11
0
def getDebugMode():
    pushPropertiesFileStr = "%s%s%s" % (adapterConfigBaseDir, FILE_SEPARATOR,
                                        PUSH_PROPERTIES_FILE)
    properties = Properties()
    debugMode = 0
    try:
        logger.debug("Checking push properties file for debugMode [%s]" %
                     pushPropertiesFileStr)
        fileInputStream = FileInputStream(pushPropertiesFileStr)
        properties.load(fileInputStream)
        debugModeStr = properties.getProperty("debugMode")
        if isNoneOrEmpty(debugModeStr) or string.lower(
                string.strip(debugModeStr)) == 'false':
            debugMode = 0
        elif string.lower(string.strip(debugModeStr)) == 'true':
            debugMode = 1
        fileInputStream.close()
    except:
        debugMode = 0  # ignore and continue with debugMode=0
        logger.debugException("Unable to process %s file." %
                              PUSH_PROPERTIES_FILE)
    if debugMode:
        logger.debug(
            "Debug mode = TRUE. XML data pushed to CA CMDB will be persisted in the directory: %s"
            % adapterResBaseDir)
    else:
        logger.debug("Debug mode = FALSE")
    return debugMode
コード例 #12
0
 def __getEc2PrivateIpv4s(self, additionalVariables):
     try:
         dir = File(self.__basedir)
         dir = dir.getParentFile().getParentFile().getParentFile()
         fileReader = FileReader(File(dir, "engine-session.properties"))
         props = Properties()
         props.load(fileReader)
         ec2PrivateIpv4s = props.getProperty("ec2PrivateIpv4s")
         if ec2PrivateIpv4s:
             ipList = ec2PrivateIpv4s.split()
             logger.info("Ec2 Private IPv4s:" + list2str(ipList))
             engineInstance = getVariableValue("ENGINE_INSTANCE")
             engineInstance = int(engineInstance)
             if len(ipList) > engineInstance:
                 self.__dockerHostIp = ipList[engineInstance]
                 logger.info("Setting DOCKER_HOST_IP:" +
                             self.__dockerHostIp)
                 additionalVariables.add(
                     RuntimeContextVariable(
                         "DOCKER_HOST_IP", self.__dockerHostIp,
                         RuntimeContextVariable.STRING_TYPE,
                         "Docker Host IP", False,
                         RuntimeContextVariable.NO_INCREMENT))
             else:
                 self.__dockerHostIp = getVariableValue("LISTEN_ADDRESS")
                 additionalVariables.add(
                     RuntimeContextVariable(
                         "DOCKER_HOST_IP", self.__dockerHostIp,
                         RuntimeContextVariable.STRING_TYPE,
                         "Docker Host IP", False,
                         RuntimeContextVariable.NO_INCREMENT))
     except:
         type, value, traceback = sys.exc_info()
         logger.warning("read engine session properties error:" + ` value `)
コード例 #13
0
def intialize():
    global domainProps
    global userConfigFile
    global userKeyFile
    global overwrittenServerURL
    global levelToPrint

    # test arguments
    if ((len(sys.argv) != 4) and (len(sys.argv) != 5)):
        print 'Usage:  printStatusInformation.sh  <default.properties_file> <property_file> <SUMMARY / ALL>'
        print 'OR'
        print 'Usage:  printStatusInformation.sh  <default.properties_file> <property_file> <SUMMARY / ALL> <ADMIN-URL overwrite>'
        exit()

    print 'Starting the initialization process'

    try:
        domainProps = Properties()

        # load DEFAULT properties
        input = FileInputStream(sys.argv[1])
        domainProps.load(input)
        input.close()

        # load properties and overwrite defaults
        input = FileInputStream(sys.argv[2])
        domainProps.load(input)
        input.close()

        userConfigFile = File(sys.argv[2]).getParent(
        ) + '/' + domainProps.getProperty('domainName') + '.userconfig'
        userKeyFile = File(sys.argv[2]).getParent(
        ) + '/' + domainProps.getProperty('domainName') + '.userkey'

        levelToPrint = sys.argv[3]

        if (len(sys.argv) == 5):
            overwrittenServerURL = sys.argv[4]

    except:
        dumpStack()
        print 'Cannot load properties  !'
        exit()

    print 'Initialization completed'
コード例 #14
0
def intialize():
        global domainProps;
        global userConfigFile;
        global userKeyFile;
        global overwrittenServerURL;
        global levelToPrint;

        # test arguments
        if ((len(sys.argv) != 3) and (len(sys.argv) != 4)):
                print 'Usage:  threaddump.py <default.properties_file> <property_file>';
                print 'OR'
                print 'Usage:  threaddump.py <default.properties_file> <property_file> <ADMIN-URL overwrite>';
                exit();


        print 'Starting the initialization process';

        try:
                domainProps = Properties()

                # load DEFAULT properties
                input = FileInputStream(sys.argv[1])
                domainProps.load(input)
                input.close()

                # load properties and overwrite defaults
                input = FileInputStream(sys.argv[2])
                domainProps.load(input)
                input.close()

                userConfigFile = File(sys.argv[2]).getParent()+'/'+domainProps.getProperty('domainName')+'.userconfig'
                userKeyFile = File(sys.argv[2]).getParent()+'/'+domainProps.getProperty('domainName')+'.userkey'

                if (len(sys.argv) == 4):
                    overwrittenServerURL = sys.argv[3];


        except:
                dumpStack()
                print 'Cannot load properties  !';
                exit();

        print 'Initialization completed';
コード例 #15
0
def read_tools_list(tmpToolsListFile):
    """Read the tools names and tools data urls
       from the downlaoded tools list
    """
    properties = Properties()
    fin = FileInputStream(tmpToolsListFile)
    properties.load(fin)
    toolsRefs = properties.getProperty("tools.list").split("|")
    fin.close()
    return toolsRefs
コード例 #16
0
ファイル: update_checker.py プロジェクト: floscher/qat_script
def read_tools_list(tmpToolsListFile):
    """Read the tools names and tools data urls
       from the downlaoded tools list
    """
    properties = Properties()
    fin = FileInputStream(tmpToolsListFile)
    properties.load(fin)
    toolsRefs = properties.getProperty("tools.list").split("|")
    fin.close()
    return toolsRefs
コード例 #17
0
def loadPropertiesFromFile(filename,props):
    newprops=Properties()
    inputstr = FileInputStream(filename)
    newprops.load(inputstr)
    inputstr.close()
    enum = newprops.keys()
    while enum.hasMoreElements():
        key = enum.nextElement()
        if props.getProperty(key) is None:
            props.setProperty(key, newprops.getProperty(key))
    return props
コード例 #18
0
def getVersionInfo(versionProperties):
    if versionProperties is None:
        versionProperties = Properties()
        versionProperties.setProperty('version','TBA')
    
    version=versionProperties.getProperty('version')
    date=versionProperties.getProperty('release.date')
    client=versionProperties.getProperty('client')
	
    versionInfo=''
    versionInfo += '\n\n ===================================================\n'
    versionInfo += ' ===================================================\n\n'
    versionInfo += ' Redback Environment Configuration Tool\n'
    versionInfo += ' \n'
    
    if not version:
        version='TBA'
    versionInfo += '  Release Version : ' + version + '\n'
    
    if date:
        versionInfo += '     Release Date : ' + date + '\n'
        
    if client:
        versionInfo += '           Client : ' + client + '\n'
    
    versionInfo += ' \n'
    
    if version == 'TBA':
        versionInfo += ' Notes: This is a development release of ConfigNOW.\n'
        versionInfo += ' Notes: This is a development release of ConfigNOW.\n'
        versionInfo += ' This release has not been packaged as part of the\n'
        versionInfo += ' formal release process.\n\n'
    
    versionInfo += ' ===================================================\n'
    versionInfo += ' ===================================================\n'
    return versionInfo
コード例 #19
0
def getVersionInfo(versionProperties):
    if versionProperties is None:
        versionProperties = Properties()
        versionProperties.setProperty('version', 'TBA')

    version = versionProperties.getProperty('version')
    date = versionProperties.getProperty('release.date')
    client = versionProperties.getProperty('client')

    versionInfo = ''
    versionInfo += '\n\n ===================================================\n'
    versionInfo += ' ===================================================\n\n'
    versionInfo += ' Redback Environment Configuration Tool\n'
    versionInfo += ' \n'

    if not version:
        version = 'TBA'
    versionInfo += '  Release Version : ' + version + '\n'

    if date:
        versionInfo += '     Release Date : ' + date + '\n'

    if client:
        versionInfo += '           Client : ' + client + '\n'

    versionInfo += ' \n'

    if version == 'TBA':
        versionInfo += ' Notes: This is a development release of ConfigNOW.\n'
        versionInfo += ' Notes: This is a development release of ConfigNOW.\n'
        versionInfo += ' This release has not been packaged as part of the\n'
        versionInfo += ' formal release process.\n\n'

    versionInfo += ' ===================================================\n'
    versionInfo += ' ===================================================\n'
    return versionInfo
コード例 #20
0
def getDebugMode():
    pushPropertiesFileStr = "%s%s%s" % (adapterConfigBaseDir, FILE_SEPARATOR, PUSH_PROPERTIES_FILE)
    properties = Properties()
    debugMode = 0
    try:
        logger.debug("Checking push properties file for debugMode [%s]" % pushPropertiesFileStr)
        fileInputStream = FileInputStream(pushPropertiesFileStr)
        properties.load(fileInputStream)
        debugModeStr = properties.getProperty("debugMode")
        if isNoneOrEmpty(debugModeStr) or string.lower(string.strip(debugModeStr)) == 'false':
            debugMode = 0
        elif string.lower(string.strip(debugModeStr)) == 'true':
            debugMode = 1
        fileInputStream.close()
    except:
        debugMode = 0 # ignore and continue with debugMode=0
        logger.debugException("Unable to process %s file." % PUSH_PROPERTIES_FILE)
    if debugMode:
        logger.debug("Debug mode = TRUE. XML data pushed to CA CMDB will be persisted in the directory: %s" % adapterResBaseDir)
    else:
        logger.debug("Debug mode = FALSE")
    return debugMode
コード例 #21
0
 def __getEc2PrivateIpv4s(self, additionalVariables):
     try:
         dir = File(self.__basedir)
         dir = dir.getParentFile().getParentFile().getParentFile()
         fileReader = FileReader(File(dir, "engine-session.properties" ))
         props = Properties()
         props.load(fileReader)
         ec2PrivateIpv4s = props.getProperty("ec2PrivateIpv4s")
         if ec2PrivateIpv4s:
             ipList = ec2PrivateIpv4s.split()
             logger.info("Ec2 Private IPv4s:" + list2str(ipList))
             engineInstance = getVariableValue("ENGINE_INSTANCE")
             engineInstance = int(engineInstance)
             if len(ipList) > engineInstance:
                 self.__dockerHostIp = ipList[engineInstance]
                 logger.info("Setting DOCKER_HOST_IP:" +self.__dockerHostIp)
                 additionalVariables.add(RuntimeContextVariable("DOCKER_HOST_IP", self.__dockerHostIp, RuntimeContextVariable.STRING_TYPE, "Docker Host IP", False, RuntimeContextVariable.NO_INCREMENT))
             else:
                 self.__dockerHostIp  = getVariableValue("LISTEN_ADDRESS")
                 additionalVariables.add(RuntimeContextVariable("DOCKER_HOST_IP", self.__dockerHostIp , RuntimeContextVariable.STRING_TYPE, "Docker Host IP", False, RuntimeContextVariable.NO_INCREMENT))
     except:
         type, value, traceback = sys.exc_info()
         logger.warning("read engine session properties error:" + `value`)
コード例 #22
0
def load_variables(file_path, allow_multiple_files=False):
    """
    Load a dictionary of variables from the specified file(s).
    :param file_path: the file from which to load properties
    :param allow_multiple_files: if True, allow a comma-separated list of variable files
    :return the dictionary of variables
    :raises VariableException if an I/O error occurs while loading the variables from the file
    """
    method_name = "load_variables"

    if allow_multiple_files:
        paths = file_path.split(CommandLineArgUtil.MODEL_FILES_SEPARATOR)
    else:
        paths = [file_path]

    variable_map = {}

    for path in paths:
        props = Properties()
        input_stream = None
        try:
            input_stream = FileInputStream(path)
            props.load(input_stream)
            input_stream.close()
        except IOException, ioe:
            ex = exception_helper.create_variable_exception(
                'WLSDPLY-01730', path, ioe.getLocalizedMessage(), error=ioe)
            _logger.throwing(ex,
                             class_name=_class_name,
                             method_name=method_name)
            if input_stream is not None:
                input_stream.close()
            raise ex

        for key in props.keySet():
            value = props.getProperty(key)
            variable_map[key] = value
コード例 #23
0
#!/usr/bin/env /oracle/product/middleware/Oracle_OSB1/common/bin/wlst.sh
from java.util import Properties
from java.io import FileInputStream

# ===============
#  Variable Defs
# ===============
# relativo estar na mesma pasta . 
prop = Properties()
prop.load(FileInputStream("osb.properties"))

ADMIN_SERVER 				= prop.getProperty('ADMIN_SERVER')
ADMIN_SERVER_PORT		 	= int(prop.getProperty('ADMIN_SERVER_PORT'))
DATABASE 					= prop.getProperty('DATABASE')
DOMAIN 						= prop.getProperty('DOMAIN')
DOMAIN_HOME 				= prop.getProperty('DOMAIN_HOME')
LISTEN_ADDRESS 				= prop.getProperty('LISTEN_ADDRESS')
MACHINE 					= prop.getProperty('MACHINE')
MANAGED_SERVER 				= prop.getProperty('MANAGED_SERVER')
MANAGED_SERVER_PORT			= int(prop.getProperty('MANAGED_SERVER_PORT'))
MDS_USER 					= prop.getProperty('MDS_USER')
MDS_PASSWORD 				= prop.getProperty('MDS_PASSWORD')
MW_HOME						= prop.getProperty('MW_HOME')
NODE_MANAGER 				= prop.getProperty('NODE_MANAGER')
NODE_MANAGER_LISTEN_ADDRESS = prop.getProperty('NODE_MANAGER_LISTEN_ADDRESS')
NODE_MANAGER_PASSWORD		= prop.getProperty('NODE_MANAGER_PASSWORD')
NODE_MANAGER_PORT 			= int(prop.getProperty('NODE_MANAGER_PORT'))
OSB_HOME					= prop.getProperty('OSB_HOME')
SOAINFRA_USER 				= prop.getProperty('SOAINFRA_USER')
SOAINFRA_PASSWORD 			= prop.getProperty('SOAINFRA_PASSWORD')
WEBLOGIC_PASSWORD			= prop.getProperty('WEBLOGIC_PASSWORD')
コード例 #24
0
def getCurrentProfileName(domainConfigurationDirectory):
    from oracle.fabric.profiles.impl import ProfileConstants;
    fileName = domainConfigurationDirectory + File.separatorChar + 'server-profile-mbean-config.xml'
    profileProperties = Properties()
    profileProperties.loadFromXML(FileInputStream(fileName))
    return profileProperties.getProperty(ProfileConstants.CURRENT_SOA_PROFILE_PROPERTY_NAME)
コード例 #25
0
    def doInBackground(self):
        #print "\n- Checking for the latest version..."
        try:
            url = URL(self.app.scriptVersionUrl)
            uc = url.openConnection()
            ins = uc.getInputStream()
            p = Properties()
            p.load(ins)
            latestScriptVersion = p.getProperty("script")
            self.app.latestToolsVersion = p.getProperty("tools")
        except (UnknownHostException, SocketException):
            print "I can't connect to:\n%s" % url
            ins.close()
            return

        if latestScriptVersion == self.app.SCRIPTVERSION:
            #using latest script
            print "  already using the latest script version:", self.app.SCRIPTVERSION
            if self.app.latestToolsVersion == self.app.TOOLSVERSION:
                #using latest tools
                print "  already using the latest tools version:", self.app.TOOLSVERSION
                if self.mode != "auto":
                    JOptionPane.showMessageDialog(
                        self.app.preferencesFrame,
                        self.app.strings.getString("using_latest"))
                    return
            else:
                #not using latest tools
                print "  tools can be updated: %s -> %s" % (
                    self.app.TOOLSVERSION, self.app.latestToolsVersion)
                if self.app.mode == "stable":
                    infoString = self.app.strings.getString(
                        "update_tools_question")
                else:
                    infoString = self.app.strings.getString(
                        "dev_update_tools_question")
                answer = JOptionPane.showConfirmDialog(
                    Main.parent, infoString,
                    self.app.strings.getString("updates_available"),
                    JOptionPane.YES_NO_OPTION)
                if answer == 0:
                    #Download the updated tools data
                    print "\n- Update tools data"
                    try:
                        self.app.toolsProgressDialog
                    except AttributeError:
                        from java.awt import Dialog
                        self.app.toolsProgressDialog = ToolsProgressDialog(
                            Main.parent,
                            self.app.strings.getString(
                                "download_tools_updates"),
                            Dialog.ModalityType.APPLICATION_MODAL, self.app)
                    self.app.toolsProgressDialog.show()
        else:
            #not using latest script
            print "a new script version is available:\n%s -> %s" % (
                self.app.SCRIPTVERSION, latestScriptVersion)
            messageArguments = array(
                [self.app.SCRIPTVERSION, latestScriptVersion], String)
            formatter = MessageFormat("")
            if self.app.mode == "stable":
                formatter.applyPattern(
                    self.app.strings.getString("updates_warning"))
                infoBtnString = self.app.strings.getString("Visit_Wiki")
            else:
                formatter.applyPattern(
                    self.app.strings.getString("dev_updates_warning"))
                infoBtnString = self.app.strings.getString("Visit_git")
            msg = formatter.format(messageArguments)
            options = [
                self.app.strings.getString("Do_not_check_for_updates"),
                infoBtnString,
                self.app.strings.getString("cancel")
            ]
            answer = JOptionPane.showOptionDialog(
                Main.parent, msg,
                self.app.strings.getString("updates_available"),
                JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,
                None, options, options[1])
            if answer == 0:
                self.app.properties.setProperty("check_for_update", "off")
                self.app.save_config(self)
            elif answer == 1:
                if self.app.mode == "stable":
                    url = self.app.SCRIPTWEBSITE
                else:
                    url = self.app.GITWEBSITE
                OpenBrowser.displayUrl(url)
コード例 #26
0
# Python
import contextlib
import os
import json
import urllib
from urlparse import urlparse

# Read VIVO deploy.properties file.
webinf = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
properties_file = os.path.join(webinf, "classes/deploy.properties")
in_stream = FileInputStream(properties_file)
properties = Properties()
properties.load(in_stream)

TOMCAT_HOME = properties.getProperty("tomcat.home").strip()

# setup logging
# TODO: make logging level conditional on the development setting in deploy.properties
import logging

logging.basicConfig(
    level=logging.INFO,
    filename=os.path.join(TOMCAT_HOME, "logs/vivo-etag-cache.log"),
    filemode="w",
    format="%(asctime)s - %(levelname)s - %(message)s",
)

VIVO_SOLR = properties.getProperty("vitro.local.solr.url").strip()
VIVO_NS = properties.getProperty("Vitro.defaultNamespace").strip()
ETAG_FIELD = "etag"
コード例 #27
0
ファイル: update_checker.py プロジェクト: alex85k/qat_script
    def doInBackground(self):
        #print "\n- Checking for the latest version..."
        try:
            url = URL(self.app.scriptVersionUrl)
            uc = url.openConnection()
            ins = uc.getInputStream()
            p = Properties()
            p.load(ins)
            latestScriptVersion = p.getProperty("script")
            self.app.latestToolsVersion = p.getProperty("tools")
        except (UnknownHostException, SocketException):
            print "I can't connect to:\n%s" % url
            ins.close()
            return

        if latestScriptVersion == self.app.SCRIPTVERSION:
            #using latest script
            print "  already using the latest script version:", self.app.SCRIPTVERSION
            if self.app.latestToolsVersion == self.app.TOOLSVERSION:
                #using latest tools
                print "  already using the latest tools version:", self.app.TOOLSVERSION
                if self.mode != "auto":
                    JOptionPane.showMessageDialog(self.app.preferencesFrame,
                                                  self.app.strings.getString("using_latest"))
                    return
            else:
                #not using latest tools
                print "  tools can be updated: %s -> %s" % (self.app.TOOLSVERSION,
                                                           self.app.latestToolsVersion)
                answer = JOptionPane.showConfirmDialog(Main.parent,
                    self.app.strings.getString("update_tools_question"),
                    self.app.strings.getString("updates_available"),
                    JOptionPane.YES_NO_OPTION)
                if answer == 0:
                    #Download the updated tools data
                    print "\n- Update tools data"
                    try:
                        self.app.toolsProgressDialog
                    except AttributeError:
                        from java.awt import Dialog
                        self.app.toolsProgressDialog = ToolsProgressDialog(Main.parent,
                                                           self.app.strings.getString("download_tools_updates"),
                                                           Dialog.ModalityType.APPLICATION_MODAL,
                                                           self.app)
                    self.app.toolsProgressDialog.show()
        else:
            #not using latest script
            print "a new script version is available:\n%s -> %s" % (self.app.SCRIPTVERSION,
                                                                    latestScriptVersion)
            messageArguments = array([self.app.SCRIPTVERSION, latestScriptVersion], String)
            formatter = MessageFormat("")
            formatter.applyPattern(self.app.strings.getString("updates_warning"))
            msg = formatter.format(messageArguments)
            options = [
                self.app.strings.getString("Do_not_check_for_updates"),
                self.app.strings.getString("Visit_Wiki"),
                self.app.strings.getString("cancel")]
            answer = JOptionPane.showOptionDialog(Main.parent,
                msg,
                self.app.strings.getString("updates_available"),
                JOptionPane.YES_NO_CANCEL_OPTION,
                JOptionPane.QUESTION_MESSAGE,
                None,
                options,
                options[1])
            if answer == 0:
                self.app.properties.setProperty("check_for_update", "off")
                self.app.save_config(self)
            elif answer == 1:
                OpenBrowser.displayUrl(self.app.SCRIPTWEBSITE)
コード例 #28
0
	set('Targets',jarray.array([ObjectName('com.bea:Name='+targetName+',Type=Server')], ObjectName))	
	#stopRedirect()
	progressBar('Trageting',STATUS_PASS_COLOR_CODE,'Completed',25)
	Thread.sleep(5)	
	
print '======================================================================'
print INFORMATION_COLOR_CODE+'   WELCOME TO THE WEBLOGIC ADMINISTRATION SCRIPT 	 '+END_COLOR_CODE
print '======================================================================'
ConfigFilePath = '/WorkArea/JenkinsAnt'
WLSPassword = '******'
ConfigProperties = Properties()
ConfigSeg={}
#Lanre
print '===============Config File: ' + ConfigFilePath+'/'+ConfigFileName + ' ... ' + MachineName.upper() + '============='
ConfigProperties.load(FileInputStream(File(ConfigFilePath+'/'+ConfigFileName)))
WLSUsername=ConfigProperties.getProperty(MachineName.upper()+'.ADMIN.USER_NAME')
#Lanre
print '===============WebLogic Username: '******'============='
WLSHost=ConfigProperties.getProperty(MachineName.upper()+'.ADMIN.HOST')
WLSPort=ConfigProperties.getProperty(MachineName.upper()+'.ADMIN.PORT')
WLSUrl='t3://' + WLSHost + ':' + WLSPort
connect(WLSUsername, WLSPassword, WLSUrl)

#! Connect to WebLogic Server
#connectWLS(WLSUsername, WLSPassword, WLSUrl)

startTransaction()
if (UserOperation_.upper() == 'CREATEJMSMODULE'):
	createJMSModule(moduleName_)
elif (UserOperation_.upper() == 'TARGETJMSMODULE'):
	targetJMSModule(moduleName_, targetName_)
コード例 #29
0
ファイル: pushToAtrium.py プロジェクト: deezeesms/dd-git
def getPushProperties():
    pushProperties = HashMap()
    pushPropertiesFileStr = "%s%s%s" % (adapterConfigBaseDir, FILE_SEPARATOR,
                                        PUSH_PROPERTIES_FILE)
    properties = Properties()
    debugMode = 0
    sortCSVFields = ""
    smartUpdateIgnoreFields = ""
    testConnNameSpace = "BMC.CORE"
    testConnClass = "BMC_ComputerSystem"
    try:
        logger.debug("Checking push properties file for debugMode [%s]" %
                     pushPropertiesFileStr)
        fileInputStream = FileInputStream(pushPropertiesFileStr)
        properties.load(fileInputStream)

        # Property: debugMode
        try:
            debugModeStr = properties.getProperty("debugMode")
            if isNoneOrEmpty(debugModeStr) or string.lower(
                    string.strip(debugModeStr)) == 'false':
                debugMode = 0
            elif string.lower(string.strip(debugModeStr)) == 'true':
                debugMode = 1
        except:
            logger.debugException(
                "Unable to read debugMode property from push.properties")

        if debugMode:
            logger.debug(
                "Debug mode = TRUE. XML data pushed to Remedy/Atrium will be persisted in the directory: %s"
                % adapterResBaseDir)
        else:
            logger.debug("Debug mode = FALSE")

        # Property: smartUpdateIgnoreFields
        try:
            smartUpdateIgnoreFields = properties.getProperty(
                "smartUpdateIgnoreFields")
        except:
            logger.debugException(
                "Unable to read smartUpdateIgnoreFields property from push.properties"
            )

        # Property: sortCSVFields
        try:
            sortCSVFields = properties.getProperty("sortCSVFields")
        except:
            logger.debugException(
                "Unable to read sortCSVFields property from push.properties")

        # Property: testConnNameSpace
        try:
            testConnNameSpace = properties.getProperty("testConnNameSpace")
        except:
            logger.debugException(
                "Unable to read testConnNameSpace property from push.properties"
            )

        # Property: testConnClass
        try:
            testConnClass = properties.getProperty("testConnClass")
        except:
            logger.debugException(
                "Unable to read testConnClass property from push.properties")

        fileInputStream.close()
    except:
        logger.debugException("Unable to process %s file." %
                              PUSH_PROPERTIES_FILE)

    return debugMode, smartUpdateIgnoreFields, sortCSVFields, testConnNameSpace, testConnClass
コード例 #30
0
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
コード例 #31
0
def datasource(cluster,user,password,url,env,jdbc_driver,timeOut,maxConn,minConn,reapTime,unusdTimeout,agedTimeout):

# Declare global variables 

global AdminConfig 
global AdminControl



## JDBCProvider ##


name = "jdbcOracle"+ env

print " Name of JDBC Provider which will be created ---> " + name

print " ----------------------------------------------------------------------------------------- "

# Gets the name of cell

cell = AdminControl.getCell()

cellid = AdminConfig.getid('/Cell:'+ cell +'/')

print " ----------------------------------------------------------------------------------------- "



# checking for the existence of Cluster


Serverid = AdminConfig.getid('/Cell:'+ cell +'/ServerCluster:'+ cluster +'/')

print " Checking for existence of Server :" + cluster

if len(Serverid) == 0:

print "Cluster doesnot exists "

else:

print "Cluster exist:"+ cluster

print " ----------------------------------------------------------------------------------------- "


## removing old jdbc provider and creating a new jdbc provider 

print " Checking for the existence of JDBC Provider :"+ name 

s2 = AdminConfig.getid('/Cell:'+ cell +'/ServerCluster:'+ cluster +'/JDBCProvider:'+ name) 

if len(s2) > 0:

print " JDBC Provider exists with name :"+ name

print " Removing JDBC Provider with name :"+ name

AdminConfig.remove(s2)

print " JDBC Provider removed "

AdminConfig.save()

print " Saving Configuraion "

print " ----------------------------------------------------------------------------------------- " 

## Creating New JDBC Provider ##

print " Creating New JDBC Provider :"+ name 

n1 = ["name" , name ]

desc = ["description" , "Oracle JDBC Driver"]

impn = ["implementationClassName" , "oracle.jdbc.pool.OracleConnectionPoolDataSource"]

classpath = ["classpath" , jdbc_driver ]

attrs1 = [n1 , impn , desc , classpath]

jdbc = AdminConfig.create('JDBCProvider' , Serverid , attrs1)

print " New JDBC Provider created :"+ name 

AdminConfig.save()

print " Saving Configuraion " 

print " ----------------------------------------------------------------------------------------- "

## checking for the existence of JAASAuthData and deleting ## 

node = AdminControl.getNode()

alias1 = node +"/"+ env

print " Checking for the existence of JAASAUTHDATA :"+ alias1 

jaasAuthDataList = AdminConfig.list("JAASAuthData")

if len(jaasAuthDataList) == 0: 

print " Creating New JAASAuthData with Alias name :"+ alias1

sec = AdminConfig.getid('/Cell:'+ cell +'/Security:/')

alias_attr = ["alias" , alias1]

desc_attr = ["description" , "alias"]

userid_attr = ["userId" , user ]

password_attr = ["password" , password]

attrs = [alias_attr , desc_attr , userid_attr , password_attr ]

authdata = AdminConfig.create('JAASAuthData' , sec , attrs)

print " Created new JASSAuthData with Alias name :"+ alias1

AdminConfig.save()

print " Saving Configuraion "

print " ----------------------------------------------------------------------------------------- "

else :

matchFound = 0 

jaasAuthDataList = AdminConfig.list("JAASAuthData") 

jaasAuthDataList=jaasAuthDataList.split(lineSeparator)

for jaasAuthId in jaasAuthDataList:

getAlias = AdminConfig.showAttribute(jaasAuthId, "alias")

if (cmp(getAlias,alias1) == 0):

print " JAASAuthData exists with name :"+ alias1

print " Removing JAASAuthData with name :"+ alias1

AdminConfig.remove(jaasAuthId)

print " JAASAuthData removed " 

AdminConfig.save()

print " Saving Configuraion " 

matchFound = 1

break

if (matchFound == 0):

print " No match was found for the given JASSAuthData : "+ alias1

#endIf

print " ----------------------------------------------------------------------------------------- "


## J2C Authentication Entries ##

print " Creating New JAASAuthData with Alias name :"+ alias1

sec = AdminConfig.getid('/Cell:'+ cell +'/Security:/')

alias_attr = ["alias" , alias1]

desc_attr = ["description" , "alias"]

userid_attr = ["userId" , user ]

password_attr = ["password" , password]

attrs = [alias_attr , desc_attr , userid_attr , password_attr ]

authdata = AdminConfig.create('JAASAuthData' , sec , attrs)

print " Created new JASSAuthData with Alias name :"+ alias1 

AdminConfig.save()

print " Saving Configuraion "

print " ----------------------------------------------------------------------------------------- " 

## DataSource ##

datasource = "DataSource"+ env

print " Name of datasource which will be created on JDBC Provider :"+ name +" is :"+ datasource

ds = AdminConfig.getid('/Cell:'+ cell +'/ServerCluster:'+ cluster +'/JDBCProvider:'+ name) 

name1 = ["name" , datasource]

jndi = ["jndiName" , "jdbc/tiers3DS"]

authentication = ["authDataAlias" , alias1]

st_cachesize = ["statementCacheSize" , "150"]

ds_hlpclass = ["datasourceHelperClassname" , "com.ibm.websphere.rsadapter.Oracle10gDataStoreHelper"]

map_configalias_attr=["mappingConfigAlias", "DefaultPrincipalMapping"]

map_attrs=[authentication , map_configalias_attr]

mapping_attr=["mapping", map_attrs]

ds_attr = [name1 , jndi , authentication , st_cachesize , ds_hlpclass ,mapping_attr ]

newds = AdminConfig.create('DataSource' , ds , ds_attr)

print " New DataSource created with name :"+ datasource 

AdminConfig.save()

print " Saving Configuraion "

print " ----------------------------------------------------------------------------------------- "

## set the properties for the datasource ##

print " Setting the properties for DataSource :"+ datasource

newds1 = AdminConfig.getid('/Cell:'+ cell +'/ServerCluster:'+ cluster +'/JDBCProvider:'+ name +'/DataSource:'+ datasource)

propSet = AdminConfig.create('J2EEResourcePropertySet' , newds1 , "")

name3 = ["name" , "URL"]

type = ["type" , "java.lang.String"]

required = ["required" , "true"]

value = ["value" , url]

rpAttrs = [name3 , type , required , value]

jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs)


print " Properties created for DataSource :"+ datasource 

AdminConfig.save()

print " Saving Configuraion "

print " ----------------------------------------------------------------------------------------- "

# Create an associated connection pool for the new DataSource#

print " Creating Connection Pool Setting for DataSource :"+ datasource

timeout = ["connectionTimeout" , timeOut]

maxconn = ["maxConnections" , maxConn]

minconn = ["minConnections" , minConn]

reaptime = ["reapTime" , reapTime]

unusedtimeout = ["unusedTimeout" , unusdTimeout]

agedtimeout = ["agedTimeout" , agedTimeout]

purgepolicy = ["purgePolicy" , "EntirePool"]

connPoolAttrs = [timeout , maxconn , minconn , reaptime , unusedtimeout , agedtimeout , purgepolicy] 

AdminConfig.create("ConnectionPool", newds , connPoolAttrs)

print " Connection Pool Setting created for DataSource :"+ datasource 

AdminConfig.save()

print " Saving Configuraion "

print " ----------------------------------------------------------------------------------------- "


## Full Syncronization ##

print " Syncronizing configuration with Master Repository "

nodelist = AdminTask.listManagedNodes().split(lineSep)

for nodename in nodelist :

print " Doing Full Resyncronization of node.......... "

####################Identifying the ConfigRepository MBean and assign it to variable######################

repo = AdminControl.completeObjectName('type=ConfigRepository,process=nodeagent,node='+ nodename +',*')

print AdminControl.invoke(repo, 'refreshRepositoryEpoch')

sync = AdminControl.completeObjectName('cell='+ cell +',node='+ nodename +',type=NodeSync,*')

print AdminControl.invoke(sync , 'sync')

#time.sleep(20)

print " ----------------------------------------------------------------------------------------- "

print " Full Resyncronization completed "

print " ----------------------------------------------------------------------------------------- "

#######Restarting Node Agent#########

nodelist = AdminTask.listManagedNodes().split(lineSep)

for nodename in nodelist :

print " Restarting Nodeagent of "+nodename+" node " 

na = AdminControl.queryNames('type=NodeAgent,node='+nodename+',*') 

AdminControl.invoke(na,'restart','true true') 

print " ----------------------------------------------------------------------------------------- "

time.sleep(30)

##########Testing Database Connection################

dsid = AdminConfig.getid('/ServerCluster:'+ cluster +'/JDBCProvider:'+ name +'/DataSource:'+ datasource +'/')

print " Testing Database Connection"

print AdminControl.testConnection(dsid)

print " ----------------------------------------------------------------------------------------- "
####################################################################################################################
####################################################################################################################

#main program starts here

arglen=len(sys.argv)

num_exp_args=2

if (arglen != num_exp_args):

print "Two arguments are required.one of them is property file"

print " ----------------------------------------------------------------------------------------- "

sys.exit(-1)

propFile=sys.argv[0]

properties=Properties();

try:

properties.load(FileInputStream(propFile))

print " ----------------------------------------------------------------------------------------- "

print "Succesfully read property file "+propFile

print " ----------------------------------------------------------------------------------------- "

except:

print "Cannot read property file "+propFile
sys.exit(-1)

print " ----------------------------------------------------------------------------------------- "

cluster = str(properties.getProperty("CLUSTER_NAME"))
env = sys.argv[1]
user = str(properties.getProperty("dbms.userId"))
password = str(properties.getProperty("dbms.password"))
url = str(properties.getProperty("dbms.url"))
jdbc_driver = str(properties.getProperty("JDBC_DRIVER_PATH"))
timeOut = int(properties.getProperty("TIMEOUT"))
maxConn = int(properties.getProperty("MAXCONN"))
minConn = int(properties.getProperty("MINCONN"))
reapTime = int(properties.getProperty("REAPTIME"))
unusdTimeout = int(properties.getProperty("UNUSEDTIMEOUT"))
agedTimeout = int(properties.getProperty("AGEDTIMEOUT"))

datasource(cluster,user,password,url,env,jdbc_driver,timeOut,maxConn,minConn,reapTime,unusdTimeout,agedTimeout)
コード例 #32
0
# ================================================================
#           Main Code Execution
# ================================================================
if __name__== "main":
        print '###################################################################';
        print '#                   Domain Creation                               #';
        print '###################################################################';
        print '';
        intialize();
        createCustomDomain();
        createAllBootProperties();
        overwriteDomainAdminStartScript();

        startAndConnnectToAdminServer();

        # do enroll on local machine
        print ' Do enroll '+ domainLocation +'  -  '+ domainProps.getProperty('nmDir')+' !\n';
        nmEnroll(domainLocation, domainProps.getProperty('nmDir'));

        setJTATimeout();
        createAllDatasources();

        createAllWTCServer()           

        deployAllApplications();

        shutdownAndExit();
# =========== End Of Script ===============


コード例 #33
0
    def go(self):
        # parse the arguments to determine which framework is desired
        #parseArguments(args)
        """   The driver is installed by loading its class.
        In an embedded environment, this will start up Derby, since it is not already running.

        """
        ds = None
        conn = None
        props = Properties()
        props.put("user", self.username)
        props.put("password", self.password)
        print props

        # check for J2ME specification - J2ME must use a DataSource further on */
        javaspec = props.getProperty("java.specification.name")
        """
           The connection specifies create=true in the url to cause
           the database to be created. To remove the database,
           remove the directory derbyDB and its contents.
           The directory derbyDB will be created under
           the directory that the system property
           derby.system.home points to, or the current
           directory if derby.system.home is not set.

         """
        Class.forName(self.driver).newInstance()
        print "Loaded the appropriate driver."

        database = "derbyDB5"  # put here the name for your database
        dbStr = self.protocol + database + ";create=true"
        print dbStr
        conn = DriverManager.getConnection(dbStr, props)
        print "Connected to and created database derbyDB"

        conn.setAutoCommit(False)
        """    Creating a statement lets us issue commands against
        the connection.

        """
        s = conn.createStatement()

        #   We create a table, add a few rows, and update one.
        s.execute("create table derbyDB(num int, addr varchar(40))")
        print "Created table derbyDB"
        s.execute("insert into derbyDB values (1956,'Webster St.')")
        print "Inserted 1956 Webster"
        s.execute("insert into derbyDB values (1910,'Union St.')")
        print "Inserted 1910 Union"
        s.execute("insert into derbyDB values (1,'Wandering Oak')")
        print "Inserted 1 Wandering Oak"

        s.execute(
            "update derbyDB set num=180, addr='Grand Ave.' where num=1956")
        print "Updated 1956 Webster to 180 Grand"

        s.execute(
            "update derbyDB set num=300, addr='Lakeshore Ave.' where num=180")
        print "Updated 180 Grand to 300 Lakeshore"

        #  We select the rows and verify the results.
        rs = s.executeQuery("SELECT num, addr FROM derbyDB ORDER BY num")

        print "Verified the rows"
        stmt = conn.createStatement()
        Query = 'SELECT * FROM derbyDB'
        rs = stmt.executeQuery(Query)
        rsmd = RSMD(rs)
        printRSMD(rsmd, Query)

        rowCount = 0
        while (rs.next()):
            rowCount += 1
            row = (rs.getInt(1), rs.getString(2))
            print row

        stmt.close()  # close stmt connection
        s.execute("drop table derbyDB")
        print "Dropped table derbyDB"

        # We release the result and statement resources.
        rs.close()
        s.close()
        print "Closed result set and statements"

        #  We end the transaction and the connection.
        conn.commit()
        conn.close()
        print "Committed transaction and closed connection"
        """   In embedded mode, an application should shut down Derby.
           If the application fails to shut down Derby explicitly,
           the Derby does not perform a checkpoint when the JVM shuts down, which means
           that the next connection will be slower.
           Explicitly shutting down Derby with the URL is preferred.
           This style of shutdown will always throw an "exception".

        """
        gotSQLExc = False
        try:
            DriverManager.getConnection("jdbc:derby:;shutdown=true")
        except SQLException:
            print "Catching exceptions"
            gotSQLExc = True

        if (not gotSQLExc):
            print "Database did not shut down normally"
        else:
            print "Database shut down normally"
        print("SimpleApp finished")
コード例 #34
0
ファイル: osb_domain.py プロジェクト: aselvaveltcs/wlst-1
#!/usr/bin/env /oracle/product/middleware/Oracle_OSB1/common/bin/wlst.sh
from java.util import Properties
from java.io import FileInputStream

# ===============
#  Variable Defs
# ===============

prop = Properties()
prop.load(FileInputStream('osb.properties'))

ADMIN_SERVER = prop.getProperty('ADMIN_SERVER')
ADMIN_SERVER_PORT = int(prop.getProperty('ADMIN_SERVER_PORT'))
DATABASE = prop.getProperty('DATABASE')
DOMAIN = prop.getProperty('DOMAIN')
DOMAIN_HOME = prop.getProperty('DOMAIN_HOME')
LISTEN_ADDRESS = prop.getProperty('LISTEN_ADDRESS')
MACHINE = prop.getProperty('MACHINE')
MANAGED_SERVER = prop.getProperty('MANAGED_SERVER')
MANAGED_SERVER_PORT = int(prop.getProperty('MANAGED_SERVER_PORT'))
MDS_USER = prop.getProperty('MDS_USER')
MDS_PASSWORD = prop.getProperty('MDS_PASSWORD')
MW_HOME = prop.getProperty('MW_HOME')
NODE_MANAGER = prop.getProperty('NODE_MANAGER')
NODE_MANAGER_LISTEN_ADDRESS = prop.getProperty('NODE_MANAGER_LISTEN_ADDRESS')
NODE_MANAGER_PASSWORD = prop.getProperty('NODE_MANAGER_PASSWORD')
NODE_MANAGER_PORT = int(prop.getProperty('NODE_MANAGER_PORT'))
OSB_HOME = prop.getProperty('OSB_HOME')
SOAINFRA_USER = prop.getProperty('SOAINFRA_USER')
SOAINFRA_PASSWORD = prop.getProperty('SOAINFRA_PASSWORD')
WEBLOGIC_PASSWORD = prop.getProperty('WEBLOGIC_PASSWORD')
コード例 #35
0
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
コード例 #36
0
def setupLog4jLogging(trace=False, debug=False):
    global log, logLevel
    #coll_home = getCollHome()
    #prog,ext = getProgramName()
    #Load properties file in java.util.Properties
    propsFileName = coll_home + "/etc/collation.properties"
    inStream = FileInputStream(propsFileName)
    propFile = Properties()
    propFile.load(inStream)

    if debug == True:
        logLevel = "DEBUG"
    else:
        logLevel = System.getProperty("com.collation.log.level")

    if logLevel == None:
        logLevel = "Info"

    # set properties for using the default TADDM log4j.xml file for logging
    if System.getProperty("com.collation.log.level") == None:
        System.setProperty("com.collation.log.level",
                           propFile.getProperty("com.collation.log.level"))
    if System.getProperty("com.collation.log.filesize") == None:
        System.setProperty("com.collation.log.filesize",
                           propFile.getProperty("com.collation.log.filesize"))
    if System.getProperty("com.collation.log.filecount") == None:
        System.setProperty("com.collation.log.filecount",
                           propFile.getProperty("com.collation.log.filecount"))
    if System.getProperty("com.collation.log4j.servicename") == None:
        System.setProperty("com.collation.log4j.servicename", "-" + prog)

    #Start logging

    # is a dedicated log4j.xml file provided (name is <prog>.xml
    log4jFile = []
    log4jFile.append("./" + prog + ".xml")
    log4jFile.append(coll_home + "/etc/" + prog + ".xml")
    log4jFile.append(coll_home + "/etc/log4j.xml")
    for logF in log4jFile:
        if os.path.isfile(logF):
            log4j = logF
            break

    DOMConfigurator.configure(logF)
    log = Logger.getLogger("com.ibm.cdb.TivoliStdMsgLogger")

    layout = PatternLayout("%d{ISO8601} %X{service} [%t] %x %p %c{2} - %m\n")

    if logLevel == "INFO":
        log.setLevel(Level.INFO)
    elif logLevel == "ERROR":
        log.setLevel(Level.ERROR)
    elif logLevel == "DEBUG":
        log.setLevel(Level.DEBUG)
    elif logLevel == "TRACE":
        log.setLevel(Level.TRACE)

    logfile = File(coll_home + "/log/" + prog + ".log")

    fileAppender = FileAppender(layout, logfile.getAbsolutePath(), True)

    log.addAppender(fileAppender)
    if trace == True:
        consoleAppender = ConsoleAppender(layout, "System.out")
        log.addAppender(consoleAppender)

    return log, logfile.getAbsolutePath()