load and backup system parameters  initialize certain system info (such as projectID, projectSecret)
517498
function (name, default_value) {
	if (l_states.hasOwnProperty(name) === false) {
		LOG.warn('[' + name + '] initialized to: ' + default_value, 'handlers.system');
		l_states[name] = default_value;
	}
}
1370416
private static void initializeProperties() {
        JMeterUtils.loadJMeterProperties(JMeterUtils.getJMeterHome()
                + File.separator
                + "bin" + File.separator
                + "jmeter.properties");

        //JMeterUtils.initLogging();
        JMeterUtils.initLocale();

        Properties jmeterProps = JMeterUtils.getJMeterProperties();

        // Add local JMeter properties, if the file is found
        String userProp = JMeterUtils.getPropDefault("user.properties", "");
        if (userProp.length() > 0) {
            FileInputStream fis = null;
            try {
                File file = JMeterUtils.findFile(userProp);
                if (file.canRead()) {
                    log.info("Loading user properties from: " + file.getCanonicalPath());
                    fis = new FileInputStream(file);
                    Properties tmp = new Properties();
                    tmp.load(fis);
                    jmeterProps.putAll(tmp);
                    LoggingManager.setLoggingLevels(jmeterProps);//Do what would be done earlier
                }
            } catch (IOException e) {
                log.warn("Error loading user property file: " + userProp, e);
            } finally {
                try {
                    if (fis != null) {
                        fis.close();
                    }
                } catch (IOException ex) {
                    log.warn("There was problem closing file stream", ex);
                }
            }
        }

        // Add local system properties, if the file is found
        String sysProp = JMeterUtils.getPropDefault("system.properties", "");
        if (sysProp.length() > 0) {
            FileInputStream fis = null;
            try {
                File file = JMeterUtils.findFile(sysProp);
                if (file.canRead()) {
                    log.info("Loading system properties from: " + file.getCanonicalPath());
                    fis = new FileInputStream(file);
                    System.getProperties().load(fis);
                }
            } catch (IOException e) {
                log.warn("Error loading system property file: " + sysProp, e);
            } finally {
                try {
                    if (fis != null) {
                        fis.close();
                    }
                } catch (IOException ex) {
                    log.warn("There was problem closing file stream", ex);
                }
            }
        }
    }
583172
public void initSystem() {
        createIzouPropertiesFile();
        setSystemProperties();
        reloadFile(null);

        try {
            if (System.getProperty(IZOU_CONFIGURED).equals("false")) {
                fatal("Izou not completely configured, please configure Izou and launch again.");
                System.exit(0);
            }
        } catch (NullPointerException e) {
            fatal("Izou not completely configured, please configure Izou by editing izou.properties in the " +
                    "properties folder and launch again.");
            System.exit(0);
        }
    }
502239
def __init(self):
        
        params = {
            "f" : "json",
        }
        json_dict = self._get(self._url, params,
                                 securityHandler=self._securityHandler,
                                 proxy_url=self._proxy_url,
                                 proxy_port=self._proxy_port)
        self._json_dict = json_dict
        self._json = json.dumps(self._json_dict)
        attributes = [attr for attr in dir(self)
                      if not attr.startswith('__') and \
                      not attr.startswith('_')]

        for k,v in json_dict.items():
            if k in attributes:
                if k == "routeLayers" and json_dict[k]:
                    self._routeLayers = []
                    for rl in v:
                        self._routeLayers.append(
                            RouteNetworkLayer(url=self._url + "/%s" % rl,
                                              securityHandler=self._securityHandler,
                                              proxy_url=self._proxy_url,
                                              proxy_port=self._proxy_port,
                                              initialize=False))

                elif k == "serviceAreaLayers" and json_dict[k]:
                    self._serviceAreaLayers = []
                    for sal in v:
                        self._serviceAreaLayers.append(
                            ServiceAreaNetworkLayer(url=self._url + "/%s" % sal,
                                                    securityHandler=self._securityHandler,
                                                    proxy_url=self._proxy_url,
                                                    proxy_port=self._proxy_port,
                                                    initialize=False))

                elif k == "closestFacilityLayers" and json_dict[k]:
                    self._closestFacilityLayers = []
                    for cf in v:
                        self._closestFacilityLayers.append(
                            ClosestFacilityNetworkLayer(url=self._url + "/%s" % cf,
                                                    securityHandler=self._securityHandler,
                                                    proxy_url=self._proxy_url,
                                                    proxy_port=self._proxy_port,
                                                    initialize=False))
                else:
                    setattr(self, "_"+ k, v)
            else:
                print ("attribute %s is not implemented." % k)
979413
private void readParamsFromFile()
   {
      PropertiesParam pps = initParams.getPropertiesParam(BACKUP_PROPERTIES);

      backupDir = pps.getProperty(BACKUP_DIR);
      // full backup type can be not defined. Using default.
      fullBackupType =
         pps.getProperty(FULL_BACKUP_TYPE) == null ? DEFAULT_VALUE_FULL_BACKUP_TYPE : pps.getProperty(FULL_BACKUP_TYPE);
      // incremental backup can be not configured. Using default values.
      defIncrPeriod =
         pps.getProperty(DEFAULT_INCREMENTAL_JOB_PERIOD) == null ? DEFAULT_VALUE_INCREMENTAL_JOB_PERIOD : pps
            .getProperty(DEFAULT_INCREMENTAL_JOB_PERIOD);
      incrementalBackupType =
         pps.getProperty(INCREMENTAL_BACKUP_TYPE) == null ? DEFAULT_VALUE_INCREMENTAL_BACKUP_TYPE : pps
            .getProperty(INCREMENTAL_BACKUP_TYPE);

      LOG.info("Backup dir from configuration file: " + backupDir);
      LOG.info("Full backup type from configuration file: " + fullBackupType);
      LOG.info("(Experimental) Incremental backup type from configuration file: " + incrementalBackupType);
      LOG.info("(Experimental) Default incremental job period from configuration file: " + defIncrPeriod);

      checkParams();
   }
1212901
def init_modules(self):
        ''' '''
        for module_id, module_cfg in self._module_cfgs.items():
            if module_id in self._modules or module_id in self._tx_module_groups:
                if module_id in self._modules:
                    module_id_str = "module " + module_id
                else:
                    module_id_str = module_id.split('=', 1)
                    module_id_str[0] = module_id_str[0].replace("_", " ")
                    module_id_str = "=".join(module_id_str)
                logging.info("Initializing configuration for %s..." % module_id_str)
                # adding scan parameters to dict
                if 'scan_parameters' in self._module_run_conf[module_id] and self._module_run_conf[module_id]['scan_parameters'] is not None:
                    # evaluating string for support of nested lists and other complex data structures
                    if isinstance(self._module_run_conf[module_id]['scan_parameters'], basestring):
                        self._module_run_conf[module_id]['scan_parameters'] = ast.literal_eval(self._module_run_conf[module_id]['scan_parameters'])
                    sp = namedtuple('scan_parameters', field_names=zip(*self._module_run_conf[module_id]['scan_parameters'])[0])
                    self._scan_parameters[module_id] = sp(*zip(*self._module_run_conf[module_id]['scan_parameters'])[1])
                else:
                    sp = namedtuple_with_defaults('scan_parameters', field_names=[])
                    self._scan_parameters[module_id] = sp()
                # init FE config
                if module_id in self._modules:
                    # only real modules can have an existing configuration
                    last_configuration = self.get_configuration(module_id=module_id)
                else:
                    last_configuration = None
                if (('configuration' not in module_cfg or module_cfg['configuration'] is None) and last_configuration is None) or (isinstance(module_cfg['configuration'], (int, long)) and module_cfg['configuration'] <= 0):
                    if 'chip_address' in module_cfg:
                        if module_cfg['chip_address'] is None:
                            chip_address = 0
                            broadcast = True
                        else:
                            chip_address = module_cfg['chip_address']
                            broadcast = False
                    else:
                        raise ValueError('Parameter "chip_address" not specified for module "%s".' % module_id)
                    if 'flavor' in module_cfg and module_cfg['flavor']:
                        module_cfg['configuration'] = FEI4Register(fe_type=module_cfg['flavor'], chip_address=chip_address, broadcast=broadcast)
                    else:
                        raise ValueError('Parameter "flavor" not specified for module "%s".' % module_id)
                # use existing config
                elif not module_cfg['configuration'] and last_configuration:
                    module_cfg['configuration'] = FEI4Register(configuration_file=last_configuration)
                # path string
                elif isinstance(module_cfg['configuration'], basestring):
                    if os.path.isabs(module_cfg['configuration']):  # absolute path
                        module_cfg['configuration'] = FEI4Register(configuration_file=module_cfg['configuration'])
                    else:  # relative path
                        module_cfg['configuration'] = FEI4Register(configuration_file=os.path.join(module_cfg['working_dir'], module_cfg['configuration']))
                # run number
                elif isinstance(module_cfg['configuration'], (int, long)) and module_cfg['configuration'] > 0:
                    module_cfg['configuration'] = FEI4Register(configuration_file=self.get_configuration(module_id=module_id, run_number=module_cfg['configuration']))
                # assume configuration already initialized
                elif not isinstance(module_cfg['configuration'], FEI4Register):
                    raise ValueError('Found no valid value for parameter "configuration" for module "%s".' % module_id)

                # init register utils
                self._registers[module_id] = self._module_cfgs[module_id]['configuration']
                self._register_utils[module_id] = FEI4RegisterUtils(self._module_dut[module_id], self._module_cfgs[module_id]['configuration'])

                if module_id in self._modules:
                    # Create module data path for real modules
                    module_path = self.get_module_path(module_id)
                    if not os.path.exists(module_path):
                        os.makedirs(module_path)

        # Set all modules to conf mode to prevent from receiving BCR and ECR broadcast
        for module_id in self._tx_module_groups:
            with self.access_module(module_id=module_id):
                self.register_utils.set_conf_mode()

        # Initial configuration (reset and configuration) of all modules.
        # This is done by iterating over each module individually
        for module_id in self._modules:
            logging.info("Configuring %s..." % module_id)
            with self.access_module(module_id=module_id):
                if self._run_conf['configure_fe']:
                    self.register_utils.global_reset()
                    self.register_utils.configure_all()
                else:
                    self.register_utils.set_conf_mode()
                if is_fe_ready(self):
                    fe_not_ready = False
                else:
                    fe_not_ready = True
                # BCR and ECR might result in RX errors
                # a reset of the RX and FIFO will happen just before scan()
                if self._run_conf['reset_fe']:
                    self.register_utils.reset_bunch_counter()
                    self.register_utils.reset_event_counter()
                if fe_not_ready:
                    # resetting service records must be done once after power up
                    self.register_utils.reset_service_records()
                    if not is_fe_ready(self):
                        logging.warning('Module "%s" is not sending any data.' % module_id)
                # set all modules to conf mode afterwards to be immune to ECR and BCR
                self.register_utils.set_conf_mode()
234581
def run_init(args):
    
    root = args.root
    if root is None:
        root = '.'
    root = os.path.abspath(root)

    project_data = _get_package_data()
    project_name = project_data['project_name']

    directories = [os.path.join(root, 'bin'),
                   os.path.join(root, 'docs'),
                   os.path.join(root, 'tests'),
                   os.path.join(root, project_name),
                   ]
    for dir_path in directories:
        if not os.path.exists(dir_path):
            os.makedirs(dir_path)

    script_paths = [os.path.join(root, 'README.md'),
                    os.path.join(root, 'tests/__init__.py'),
                    ]
    for script_path in script_paths:
        if not os.path.exists(script_path):
            os.mknod(script_path)

    copy_samples = [(resource_filename('mpu', 'package/templates/tox.ini.txt'),
                     os.path.join(root, 'tox.ini')),
                    (resource_filename('mpu',
                                       'package/templates/setup.cfg.txt'),
                     os.path.join(root, 'setup.cfg')),
                    (resource_filename('mpu',
                                       'package/templates/setup.py.txt'),
                     os.path.join(root, 'setup.py')),
                    (resource_filename('mpu',
                                       'package/templates/_version.py.txt'),
                     os.path.join(root, project_name + '/_version.py')),
                    (resource_filename('mpu',
                                       'package/templates/coveragerc.txt'),
                     os.path.join(root, '.coveragerc')),
                    (resource_filename('mpu', 'package/templates/init.py.txt'),
                     os.path.join(root, project_name + '/__init__.py')),
                    ]
    translate = {'[[project_name]]': project_data['project_name'],
                 '[[license]]': project_data['license'],
                 '[[author]]': project_data['author'],
                 '[[email]]': project_data['email'],
                 }
    for source, destination in copy_samples:
        if not os.path.exists(destination):
            copyfile(source, destination)
            _adjust_template(destination, translate)
284294
private void checkParams()
   {
      if (backupDir == null)
      {
         throw new IllegalStateException(BACKUP_DIR + " not specified");
      }

      logsDirectory = new File(backupDir);
      if (!PrivilegedFileHelper.exists(logsDirectory))
      {
         if (!PrivilegedFileHelper.mkdirs(logsDirectory))
         {
            throw new IllegalStateException("Could not create the backup directory at "
               + logsDirectory.getAbsolutePath());
         }
      }

      if (defIncrPeriod == null)
      {
         throw new IllegalStateException(DEFAULT_INCREMENTAL_JOB_PERIOD + " not specified");
      }

      defaultIncrementalJobPeriod = Integer.valueOf(defIncrPeriod);

      if (fullBackupType == null)
      {
         throw new IllegalStateException(FULL_BACKUP_TYPE + " not specified");
      }

      if (incrementalBackupType == null)
      {
         throw new IllegalStateException(INCREMENTAL_BACKUP_TYPE + " not specified");
      }
   }
1249012
def _load_init(self, data, ctx):
        """"""
        if self.shape:
            for self_dim, data_dim in zip(self.shape, data.shape):
                assert self_dim in (0, data_dim), \
                    "Failed loading Parameter '%s' from saved params: " \
                    "shape incompatible expected %s vs saved %s"%(
                        self.name, str(self.shape), str(data.shape))
            self.shape = tuple(i if i != 0 else j for i, j in zip(self.shape, data.shape))
        if self.dtype:
            assert np.dtype(self.dtype).type == data.dtype, \
                "Failed loading Parameter '%s' from saved params: " \
                "dtype incompatible expected %s vs saved %s"%(
                    self.name, str(self.dtype), str(data.dtype))
        if self._stype != data.stype:
            data = data.tostype(self._stype)
        if isinstance(ctx, Context):
            ctx = [ctx]
        if self._data is None:
            if self._deferred_init:
                assert ctx is None or set(ctx) == set(self._deferred_init[1]), \
                    "Failed to load Parameter '%s' on %s because it was " \
                    "previous initialized on %s."%(
                        self.name, str(ctx), str(self.list_ctx()))
                ctx = self._deferred_init[1]
            elif ctx is None:
                ctx = [cpu()]
            self._init_impl(data, ctx)
        else:
            assert ctx is None or set(ctx) == set(self.list_ctx()), \
                "Failed to load Parameter '%s' on %s because it was " \
                "previous initialized on %s."%(
                    self.name, str(ctx), str(self.list_ctx()))
            self.set_data(data)
        self._deferred_init = ()
401659
private void loadServerParameters() {
    serverParser.addArgument("-p", "--port").required(true)
        .help("Port to be assigned to the server.\n");
    serverParser.addArgument("-m", "--model").required(true)
        .help("Pass the model to do the tagging as a parameter.\n");
    serverParser.addArgument("--clearFeatures").required(false)
        .choices("yes", "no", "docstart").setDefault(Flags.DEFAULT_FEATURE_FLAG)
        .help(
            "Reset the adaptive features every sentence; defaults to 'no'; if -DOCSTART- marks"
                + " are present, choose 'docstart'.\n");
    serverParser
        .addArgument("-l", "--language").required(true).choices("ca", "de",
            "en", "es", "eu", "fr", "gl", "it", "nl", "pt", "ru")
        .help("Choose language.\n");
    serverParser.addArgument("-o", "--outputFormat").required(false)
        .choices("conll03", "conll02", "naf")
        .setDefault(Flags.DEFAULT_OUTPUT_FORMAT)
        .help("Choose output format; it defaults to NAF.\n");
    serverParser.addArgument("--lexer").choices("numeric")
        .setDefault(Flags.DEFAULT_LEXER).required(false)
        .help("Use lexer rules for NERC tagging; it defaults to false.\n");
    serverParser.addArgument("--dictTag").required(false).choices("tag", "post")
        .setDefault(Flags.DEFAULT_DICT_OPTION).help(
            "Choose to directly tag entities by dictionary look-up; if the 'tag' option is chosen, "
                + "only tags entities found in the dictionary; if 'post' option is chosen, it will "
                + "post-process the results of the statistical model.\n");
    serverParser.addArgument("--dictPath").required(false)
        .setDefault(Flags.DEFAULT_DICT_PATH).help(
            "Provide the path to the dictionaries for direct dictionary tagging; it ONLY WORKS if --dictTag "
                + "option is activated.\n");
  }
553561
def _store_parameters(self):
        """"""
        datapath = self.dir

        out_dict = {
            'protocol_version': 2,
            'mtools_version': __version__,
            'parsed_args': self.args,
            'unknown_args': self.unknown_args,
            'startup_info': self.startup_info
        }

        if not os.path.exists(datapath):
            os.makedirs(datapath)
        try:
            json.dump(out_dict,
                      open(os.path.join(datapath,
                                        '.mlaunch_startup'), 'w'), indent=-1)
        except Exception as ex:
            print("ERROR STORING Parameters:", ex)
1261503
private void initialize()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "initialize");
        
    subsets = new ReliabilitySubset[maxReliabilityIndex + 1];
    subsetIDs = new long[maxReliabilityIndex + 1];
    for(int i=0;i<subsetIDs.length;i++)
    {
      subsetIDs[i] = NO_ID;             
    }
    
    createControlAdapter(); 
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "initialize");
  }
686719
private void readParamsFromFile()
   {
      if (initParams != null)
      {
         ValueParam valParam = initParams.getValueParam(ADMIN_INDENTITY);
         if (valParam != null)
         {
            adminIdentity = valParam.getValue();
            LOG.info("Admin identity is read from configuration file");
         }
         ValueParam defaultIdentityParam = initParams.getValueParam(DEFAULT_INDENTITY);
         if (defaultIdentityParam != null)
         {
            defaultIdentity = defaultIdentityParam.getValue();
            LOG.info("Default identity is read from configuration file");
         }
      }
      checkParams();
   }
34017
private static String readInitParam(Configuration configuration, String key) {
        String value = null;
        try {
            String param = (String) configuration.getProperty(key);
            if (param != null) {
                param = param.trim();
                if (param.length() > 0) {
                    value = param;
                }
            }
        } catch (Exception e) {
            String msg = "initParameter config [" + key + "] error";
            logger.warn(msg, e);
        }
        return value;
    }
435167
def initialize(self):
        """"""
        if self.collname not in self.current_kv_names():
            r = self.request('post',
                             self.url+"storage/collections/config",
                             headers={'content-type': 'application/json'},
                             data={'name': self.collname})
            r.raise_for_status()
        # initialize schema
        re = self.request('post',
                          self.url+"storage/collections/config/"+self.collname,
                          headers = {'content-type': 'application/json'},
                          data=self.schema)
        re.raise_for_status()
        logger.info("initialized Splunk Key Value Collection %s with schema %s"\
                        % (self.collname, str(self.schema)))
        if self.collname not in self.current_kv_names():
            raise EnvironmentError('expected %s in list of kv collections %s' % (self.collname, str(self.current_kv_names())))
1331429
private void init() {
    host = DEFAULT_HOST;
    port = DEFAULT_PORT;
    database = DEFAULT_DATABASE;
    user = DEFAULT_USER;
    password = DEFAULT_PASSWORD;
    cachePreparedStatements = DEFAULT_CACHE_PREPARED_STATEMENTS;
    pipeliningLimit = DEFAULT_PIPELINING_LIMIT;
    sslMode = DEFAULT_SSLMODE;
  }
1119055
public void initialize(CmsObject cms) {

        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(
                Messages.get().getBundle().key(
                    Messages.INIT_NUM_SITE_ROOTS_CONFIGURED_1,
                    new Integer((m_siteMatcherSites.size() + ((m_defaultUri != null) ? 1 : 0)))));
        }

        try {

            m_clone = OpenCms.initCmsObject(cms);
            m_clone.getRequestContext().setSiteRoot("");
            m_clone.getRequestContext().setCurrentProject(m_clone.readProject(CmsProject.ONLINE_PROJECT_NAME));

            CmsObject cms_offline = OpenCms.initCmsObject(m_clone);
            CmsProject tempProject = cms_offline.createProject(
                "tempProjectSites",
                "",
                "/Users",
                "/Users",
                CmsProject.PROJECT_TYPE_TEMPORARY);
            cms_offline.getRequestContext().setCurrentProject(tempProject);

            m_siteUUIDs = new HashMap<CmsUUID, CmsSite>();
            // check the presence of sites in VFS

            m_onlyOfflineSites = new ArrayList<CmsSite>();

            for (CmsSite site : m_siteMatcherSites.values()) {
                checkUUIDOfSiteRoot(site, m_clone, cms_offline);
                try {
                    CmsResource siteRes = m_clone.readResource(site.getSiteRoot());
                    site.setSiteRootUUID(siteRes.getStructureId());

                    m_siteUUIDs.put(siteRes.getStructureId(), site);
                    // during server startup the digester can not access properties, so set the title afterwards
                    if (CmsStringUtil.isEmptyOrWhitespaceOnly(site.getTitle())) {
                        String title = m_clone.readPropertyObject(
                            siteRes,
                            CmsPropertyDefinition.PROPERTY_TITLE,
                            false).getValue();
                        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(title)) {
                            site.setTitle(title);
                        }
                    }
                } catch (Throwable t) {
                    if (CmsLog.INIT.isWarnEnabled()) {
                        CmsLog.INIT.warn(Messages.get().getBundle().key(Messages.INIT_NO_ROOT_FOLDER_1, site));
                    }
                }
            }
            cms_offline.deleteProject(tempProject.getUuid());

            // check the presence of the default site in VFS
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_defaultUri)) {
                m_defaultSite = null;
            } else {
                m_defaultSite = new CmsSite(m_defaultUri, CmsSiteMatcher.DEFAULT_MATCHER);
                try {
                    m_clone.readResource(m_defaultSite.getSiteRoot());
                } catch (Throwable t) {
                    if (CmsLog.INIT.isWarnEnabled()) {
                        CmsLog.INIT.warn(
                            Messages.get().getBundle().key(Messages.INIT_NO_ROOT_FOLDER_DEFAULT_SITE_1, m_defaultSite));
                    }
                }
            }
            if (m_defaultSite == null) {
                m_defaultSite = new CmsSite("/", CmsSiteMatcher.DEFAULT_MATCHER);
            }
            if (CmsLog.INIT.isInfoEnabled()) {
                if (m_defaultSite != null) {
                    CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DEFAULT_SITE_ROOT_1, m_defaultSite));
                } else {
                    CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DEFAULT_SITE_ROOT_0));
                }
            }
            initWorkplaceMatchers();

            // set site lists to unmodifiable
            setSiteMatcherSites(m_siteMatcherSites);

            // store additional site roots to optimize lookups later
            for (String root : m_siteRootSites.keySet()) {
                if (!root.startsWith(SITES_FOLDER) || (root.split("/").length >= 4)) {
                    m_additionalSiteRoots.add(root);
                }
            }

            if (m_sharedFolder == null) {
                m_sharedFolder = DEFAULT_SHARED_FOLDER;
            }

            // initialization is done, set the frozen flag to true
            m_frozen = true;
        } catch (CmsException e) {
            LOG.warn(e);
        }
        if (!m_isListenerSet) {
            OpenCms.addCmsEventListener(this, new int[] {I_CmsEventListener.EVENT_PUBLISH_PROJECT});
            m_isListenerSet = true;
        }
    }