private void run() { try { logger.info("Running distributedlog server : args = {}", Arrays.toString(args)); BasicParser parser = new BasicParser(); CommandLine cmdline = parser.parse(options, args); runCmd(cmdline); } catch (ParseException pe) { logger.error("Argument error : {}", pe.getMessage()); printUsage(); Runtime.getRuntime().exit(-1); } catch (IllegalArgumentException iae) { logger.error("Argument error : {}", iae.getMessage()); printUsage(); Runtime.getRuntime().exit(-1); } catch (ConfigurationException ce) { logger.error("Configuration error : {}", ce.getMessage()); printUsage(); Runtime.getRuntime().exit(-1); } catch (IOException ie) { logger.error("Failed to start distributedlog server : ", ie); Runtime.getRuntime().exit(-1); } }
public static void storeConfiguration(final String fileName) throws IOException { try { PropertiesConfiguration.setDefaultListDelimiter('\0'); final PropertiesConfiguration config = new PropertiesConfiguration(); // store settings for (final Setting setting : settings.values()) { // story only modified settings and the super user password if (setting.isModified() || "superuser.password".equals(setting.getKey())) { config.setProperty(setting.getKey(), setting.getValue()); } } config.save(fileName); } catch (ConfigurationException ex) { System.err.println("Unable to store configuration: " + ex.getMessage()); } }
public static void loadConfiguration(final String fileName) { try { PropertiesConfiguration.setDefaultListDelimiter('\0'); final PropertiesConfiguration config = new PropertiesConfiguration(fileName); final Iterator<String> keys = config.getKeys(); while (keys.hasNext()) { final String key = keys.next(); final String value = trim(config.getString(key)); Setting<?> setting = Settings.getSetting(key); if (setting != null) { setting.fromString(value); } else { SettingsGroup targetGroup = miscGroup; // put key in cron group if it contains ".cronExpression" if (key.contains(".cronExpression")) { targetGroup = cronGroup; } // create new StringSetting for unknown key Settings.createSettingForValue(targetGroup, key, value); } } } catch (ConfigurationException ex) { System.err.println("Unable to load configuration: " + ex.getMessage()); } }
protected void run(String[] args) { SLF4JBridgeHandler.removeHandlersForRootLogger(); SLF4JBridgeHandler.install(); LaunchOptions res = parseArguments(args); final JBakeConfiguration config; try { if (res.isRunServer()) { config = getJBakeConfigurationFactory().createJettyJbakeConfiguration(res.getSource(), res.getDestination(), res.isClearCache()); } else { config = getJBakeConfigurationFactory().createDefaultJbakeConfiguration(res.getSource(), res.getDestination(), res.isClearCache()); } } catch (final ConfigurationException e) { throw new JBakeException("Configuration error: " + e.getMessage(), e); } run(res, config); }
@Override public void actionPerformed(ActionEvent e) { try { extension.showPolicyDialog(PolicyManagerDialog.this); } catch (ConfigurationException e1) { logger.error(e1.getMessage(), e1); } } });
private static String getNodeID() { try { nodeId = AppConfig.getConfiguration().getString(Property.JUDDI_NODE_ID); } catch (ConfigurationException ex) { logger.warn(ex.getMessage()); nodeId = "JUDDI_v3"; } return nodeId; } private static Log logger = LogFactory.getLog(UDDIv2PublishImpl.class);
public static String getNodeID(){ try { nodeId=AppConfig.getConfiguration().getString(Property.JUDDI_NODE_ID); } catch (ConfigurationException ex) { logger.warn(ex.getMessage()); nodeId="JUDDI_v3"; } return nodeId; }
public static String getNodeID(){ try { nodeId=AppConfig.getConfiguration().getString(Property.JUDDI_NODE_ID); } catch (ConfigurationException ex) { logger.warn(ex.getMessage()); nodeId="JUDDI_v3"; } return nodeId; }
private static String getNodeID() { try { nodeId = AppConfig.getConfiguration().getString(Property.JUDDI_NODE_ID); } catch (ConfigurationException ex) { logger.warn(ex.getMessage()); nodeId = "JUDDI_v3"; } return nodeId; } private static Log logger = LogFactory.getLog(UDDIv2PublishImpl.class);
private void writeToPropertiesFile(Configuration conf, File file) { try { PropertiesConfiguration propConf = new PropertiesConfiguration(file); propConf.append(conf); propConf.save(); } catch (ConfigurationException ex) { throw new RuntimeException("Failed writing Titan config to " + file.getAbsolutePath() + ": " + ex.getMessage(), ex); } }
@Override public void actionPerformed(ActionEvent e) { String name = (String) getParamsModel().getValueAt(getParamsTable().getSelectedRow(), 0); if (name != null) { try { extension.showPolicyDialog(PolicyManagerDialog.this, name); } catch (ConfigurationException e1) { logger.error(e1.getMessage(), e1); } } } });
public void save(UserAccount user) { Configuration userConfig = getUserConfiguration(user); if (userConfig instanceof PropertiesConfiguration) { try { ((PropertiesConfiguration) userConfig).save(); } catch (ConfigurationException e) { log.error("could not save user configuration for user #0: #1", user.getLogin(), e.getMessage()); } } }
private DynamicTransformer() throws IllegalStateException { this.instrControl = InstrumentationControl.getInstance(this.getClass().getSimpleName()); try { if(!CoreConfiguration.existsInBackend(CoreConfiguration.getAppContext())) throw new IllegalStateException("Application " + CoreConfiguration.getAppContext() + " does not exist in backend"); } catch (ConfigurationException e) { throw new IllegalStateException("Error while reading configuration: " + e.getMessage()); } // Freeze a couple of classes this.freezeClasses(); }
public void setDayLastInstallWarned() { getConfig().setProperty(DAY_LAST_INSTALL_WARNED, getSdf().format(new Date())); try { getConfig().save(); } catch (ConfigurationException e) { log.error(e.getMessage(), e); } }
public void setDayLastUpdateWarned() { getConfig().setProperty(DAY_LAST_UPDATE_WARNED, getSdf().format(new Date())); try { getConfig().save(); } catch (ConfigurationException e) { log.error(e.getMessage(), e); } }
private void policySelected() { String policyName = getStringValue(FIELD_POLICY); try { scanPolicy = extension.getPolicyManager().getPolicy(policyName); policyPanel.setScanPolicy(scanPolicy); scanPolicyName = policyName; } catch (ConfigurationException e) { logger.error(e.getMessage(), e); } }
protected void createNew() { PropertyPatternMessageColorizer colorizer = new PropertyPatternMessageColorizer(otrosApplication.getTheme()); try { colorizer.init(new ByteArrayInputStream(getDefaultContent().getBytes())); } catch (ConfigurationException e) { otrosApplication.getStatusObserver().updateStatus("Can't load message colorizer template: " + e.getMessage(), StatusObserver.LEVEL_WARNING); } colorizer.setFile(""); container.addElement(colorizer); jList.setSelectedItem(colorizer); saveAsButton.setEnabled(false); }
protected void saveTabState(AbstractPanel ap) { if (ap == null) { return; } Model.getSingleton().getOptionsParam().getConfig().setProperty( OptionsParamView.TAB_PIN_OPTION + "." + safeName(ap.getName()), ap.isPinned()); try { Model.getSingleton().getOptionsParam().getConfig().save(); } catch (ConfigurationException e) { logger.error(e.getMessage(), e); } }
@Override public void actionPerformed(ActionEvent evt) { boolean showTabNames = getShowTabIconNamesButton().isSelected(); setShowTabNames(showTabNames); Model.getSingleton().getOptionsParam().getViewParam().setShowTabNames(showTabNames); try { Model.getSingleton().getOptionsParam().getViewParam().getConfig().save(); } catch (ConfigurationException e) { LOGGER.error(e.getMessage(), e); } } });
@Override public void save() { try { Model.getSingleton().getSession().exportContext(getContextValue(CONTEXT_FIELD), getSelectedFile()); } catch (ConfigurationException e) { View.getSingleton().showWarningDialog(this, Constant.messages.getString("context.export.error", e.getMessage())); } }