Java 类org.apache.commons.configuration2.ex.ConfigurationException 实例源码

项目:fwm    文件:JettyController.java   
public void setPassword() {

    String content = passwordVar.getText();
    if (passwordVisibility){
        content = visPasswordVar.getText();
    }

    try {
        WorldConfig.savePassword(content);
    } catch (ConfigurationException e) {
        e.printStackTrace();
    }

    loadedPassword = content;
    log.debug("Done");
    showPassword();
}
项目:ProjectAltaria    文件:ConfigurationManager.java   
private void loadConfigurationManager() {
    log.trace(() -> "Initializing configuration cache.");

    @NotNull Parameters params = new Parameters();

    FileBasedConfigurationBuilder<FileBasedConfiguration> builder =
            new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)
                    .configure(params.properties()
                            .setFileName(PROPERTIES_FILE));

    try {
        this.config = builder.getConfiguration();
    } catch (ConfigurationException e) {
        log.fatal(e);
        throw new RuntimeException("Couldnt load configuration file " + PROPERTIES_FILE);
    }
}
项目:beadledom    文件:PropertiesConfigurationSource.java   
private static FileBasedConfiguration createPropertiesConfiguration(Reader reader)
    throws ConfigurationException, IOException {
  if (reader == null) {
    throw new NullPointerException("reader: null");
  }

  FileBasedConfigurationBuilder<FileBasedConfiguration> builder =
      new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)
          .configure(new Parameters()
              .properties()
              .setListDelimiterHandler(new DefaultListDelimiterHandler(',')));

  FileBasedConfiguration config = builder.getConfiguration();
  config.read(reader);
  return config;
}
项目:beadledom    文件:XmlConfigurationSource.java   
private static FileBasedConfiguration createConfiguration(Reader reader)
    throws ConfigurationException {
  if (reader == null) {
    throw new NullPointerException("reader: null");
  }

  FileBasedConfigurationBuilder<FileBasedConfiguration> builder =
      new FileBasedConfigurationBuilder<FileBasedConfiguration>(XMLConfiguration.class)
          .configure(new Parameters().xml());

  FileBasedConfiguration fileBasedConfiguration = builder.getConfiguration();

  FileHandler handler = new FileHandler(fileBasedConfiguration);
  handler.load(reader);
  return fileBasedConfiguration;
}
项目:bitflyer4j    文件:KeyTypeTest.java   
@Test
public void test() throws ConfigurationException {

    // Null input.  (= Default value.)
    assertEquals(VERSION.fetch(null), VERSION.getDefaultValue());

    // Not found. (= Default value.)
    Configuration conf = new MapConfiguration(new HashMap<>());
    assertEquals(VERSION.fetch(conf), VERSION.getDefaultValue());

    // Retrieved from properties. (Empty)
    conf.setProperty(VERSION.getKey(), "");
    assertNull(VERSION.fetch(conf));

    // Retrieved from properties. (Configured)
    conf.setProperty(VERSION.getKey(), "test");
    assertEquals(VERSION.fetch(conf), "test");

}
项目:sponge    文件:DefaultConfigurationManager.java   
protected Pair<XMLConfiguration, URL> createXmlConfiguration(String fileName) {
    List<Lookup> lookups = Arrays.asList(new SystemPropertiesLookup(), new HomeLookup(), new ConfigLookup());

    Parameters params = new Parameters();
    FallbackBasePathLocationStrategy locationStrategy =
            new FallbackBasePathLocationStrategy(FileLocatorUtils.DEFAULT_LOCATION_STRATEGY, home);
    FileBasedConfigurationBuilder<XMLConfiguration> builder = new FileBasedConfigurationBuilder<>(XMLConfiguration.class)
            .configure(params.xml().setDefaultLookups(lookups).setLocationStrategy(locationStrategy).setFileName(fileName)
                    .setSchemaValidation(true).setEntityResolver(new ResourceSchemaResolver()));

    try {
        XMLConfiguration xmlConfiguration = builder.getConfiguration();

        return new ImmutablePair<>(xmlConfiguration, locationStrategy.getLocatedUrl());
    } catch (ConfigurationException e) {
        throw new ConfigException(e);
    }
}
项目:sbc-qsystem    文件:OrangeMainboard.java   
@Override
public void showBoard() {
    File paramFile = new File("config/mainboardfx.properties");
    try {
        final FileBasedConfigurationBuilder<FileBasedConfiguration> builder = new FileBasedConfigurationBuilder<FileBasedConfiguration>(
            PropertiesConfiguration.class)
            .configure(
                new FileBasedBuilderParametersImpl().setFile(paramFile).setEncoding("utf8"));
        cfg = builder.getConfiguration();
    } catch (ConfigurationException ex) {
        QLog.l().logger()
            .error("Не загружен файл конфигурации " + paramFile.getAbsolutePath(), ex);
        throw new ServerException(
            "Не загружен файл конфигурации " + paramFile.getAbsolutePath());
    }

    super.showBoard();
}
项目:yadaframework    文件:YadaAppConfig.java   
/**
     * Ritorna una istanza di YadaConfiguration. Il progetto deve dichiarare la sua sottoclasse specifica in configuration.xml e fare un override
     * di questo metodo per ritornare il tipo castato alla sottoclasse, oltre ad aggiungere @Bean
     * @return
     * @throws ConfigurationException 
     */
    protected void makeCombinedConfiguration(YadaConfiguration yadaConfiguration) throws ConfigurationException {
        Parameters params = new Parameters();
        ReloadingCombinedConfigurationBuilder builder = new ReloadingCombinedConfigurationBuilder()
            .configure(
                params.fileBased()
                    .setFile(new File("configuration.xml"))
                );
        yadaConfiguration.setBuilder(builder);
//      yadaConfiguration.setConfiguration(ConfigurationUtils.unmodifiableConfiguration(builder.getConfiguration()));

//      builder.addEventListener(ConfigurationBuilderEvent.CONFIGURATION_REQUEST, new EventListener<Event>() {
//          @Override
//          public void onEvent(Event event) {
//              builder.getReloadingController().checkForReloading(null);
////                try {
////                    yadaConfiguration.setConfiguration(ConfigurationUtils.unmodifiableConfiguration(builder.getConfiguration()));
////                } catch (ConfigurationException e) {
////                    log.error("Can't reload configuration (ignored)", e);
////                }
//          }
//      });
    }
项目:MockTCPServer    文件:MockTCPServer.java   
@Override
public void run() {
    try {
        try {
            while (this.getStatus() == Status.OPEN && this.getSocket() != null) {
                handleConnection();
            }
        } catch (final IOException | ConfigurationException e) {
            this.logger.error(e.getMessage(), e);
        }
    } finally {
        this.setStatus(Status.CLOSING);

        this.close();
    }
}
项目:MockTCPServer    文件:ClientConnection.java   
/**
 * Read and process the incoming stream.
 *
 * @throws IOException
 * @throws XPathExpressionException
 * @throws ConfigurationException
 * @throws ParserConfigurationException
 * @throws SAXException
 */
public void readIncomingStream() throws IOException, XPathExpressionException, ConfigurationException, ParserConfigurationException, SAXException {
    this.setDataStream(null);
    try {
        while (this.getDataStream().write(this.getInputStream().read()) != -1) {
            if (Arrays.equals(this.getDataStream().getTail(), this.getTerminator())) {
                this.incrementMessagesReceivedCount();

                break;
            }
        }

        if (this.getDataStream().getLastByte() == -1) {
            // The stream has ended so close all streams so that a new ServerSocket is opened and a new connection can be accepted.
            this.close();
        } else if (this.getDataStream().size() > 0) { // Ignore null (i.e. zero length) in order allow a probing ping e.g. paping.exe
            this.processIncomingMessage();
        }

        responsesSent.addAll(sendResponses());
    } catch (SocketTimeoutException e) {
        // Do nothing. This occurs because a client was not closed and the read timeout on the locked stream (i.e. blocked thread) is 60 seconds.
        this.logger.warn(e);
    }
}
项目:MockTCPServer    文件:ClientConnection.java   
private List<ResponseDAO> sendResponses() throws XPathExpressionException, ConfigurationException, ParserConfigurationException, SAXException, IOException {
    if (getIsResponses()) {
        final String message = this.getDataStream().toString().substring(0, this.getDataStream().toString().length() - this.getDataStream().getTail().length);
        Set<TCPClient> clients = getResponses().get(message);
        if (clients != null) {
            for (TCPClient tcpClient : clients) {
                logger.debug("Sending responses from \"{}\".", tcpClient.toString());
                responsesSent.addAll(tcpClient.sendResponses());

                tcpClient.close();
            }
        }
    }

    return responsesSent;
}
项目:MockTCPServer    文件:ConfigurationSettings.java   
/**
 * Retrieve a unmodifiable set of server port numbers, to listen on, that are specified in the {@link #getFileName() configuration file}.
 *
 * @return an unmodifiable set of server port numbers specified in the {@link #getFileName() configuration file}
 * @throws ConfigurationException error reading the configuration file
 */
public Set<Integer> getPorts() throws ConfigurationException {
    try {
        final String expression = "/configuration/server";
        final XPath xPath = XPathFactory.newInstance().newXPath();

        final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        final DocumentBuilder builder = factory.newDocumentBuilder();
        final Document document = builder.parse(getFileName().toString());
        final NodeList portNodes = (NodeList) xPath.compile(expression).evaluate(document, XPathConstants.NODESET);
        final Set<Integer> ports = new HashSet<>();
        for (int i = 0; i < portNodes.getLength(); i++) {
            final Node server = portNodes.item(i);
            final String portValue = server.getAttributes().getNamedItem(PORT_ATTRIBUTE_NAME).getNodeValue();
            final Integer port = Integer.parseInt(portValue);

            ports.add(port);
        }

        return Collections.unmodifiableSet(ports);
    } catch (ParserConfigurationException | SAXException | IOException | XPathExpressionException e) {
        throw new ConfigurationException(e);
    }
}
项目:MockTCPServer    文件:ConfigurationSettings.java   
/**
 * Returns all of the responses specified for the {@link MockTCPServer} configured on the specified port.
 *
 * @param port of the {@link MockTCPServer} in question.
 * @return The responses for the {@link MockTCPServer} running on the specified port.
 * @throws ConfigurationException error reading the configuration file
 */
public Responses getResponses(int port) throws ConfigurationException {
    final Responses responses = new Responses();

    final NodeList incomingList = getIncomingMessages(port);
    for (int incomingIndex = 0; incomingIndex <= incomingList.getLength() - 1; ++incomingIndex) {
        final Node incoming = incomingList.item(incomingIndex);
        final String incomingMessage = getIncomingMessage(incoming);
        final Node responseList = getIncomingResponses(incoming);
        for (int responseIndex = 0; responseIndex <= responseList.getChildNodes().getLength() - 1; ++responseIndex) {
            final Node response = responseList.getChildNodes().item(responseIndex);
            if (response.getNodeName().equals(RESPONSE_ELEMENT_NAME)) {
                responses.add(incomingMessage, createResponseDAO(response));
            }
        }
    }

    return responses;
}
项目:MockTCPServer    文件:TestMockTCPServerST.java   
/**
 * Server returns the expected ACK to a properly terminated message.
 *
 * @throws IOException see source documentation.
 * @throws ConfigurationException error reading the configuration file
 * @throws InterruptedException the MockTCPServer was unexpectedly interrupted
 */
@Test(timeout = TIMEOUT)
public void ack() throws IOException, ConfigurationException, InterruptedException {
    final int totalClientsPerServer = 500;

    // Start the client connections and send two messages from each one.
    for (int i = 0; i < totalClientsPerServer; i++) {
        clientList.add(clientList.size(), getClientFactory(TestConstants.MOCK_SERVER_PORT_1111));
        assertArrayEquals(TestConstants.getAck(), clientList.get(clientList.size() - 1).send(TestConstants.WELLFORMED_XML_WITH_VALID_TERMINATOR).toByteArray());
        assertArrayEquals(TestConstants.getAck(), clientList.get(clientList.size() - 1).send(TestConstants.WELLFORMED_XML_WITH_VALID_TERMINATOR).toByteArray());
        clientList.add(clientList.size(), getClientFactory(TestConstants.MOCK_SERVER_PORT_2222));
        assertArrayEquals(TestConstants.getAck(), clientList.get(clientList.size() - 1).send(TestConstants.WELLFORMED_XML_WITH_VALID_TERMINATOR).toByteArray());
        assertArrayEquals(TestConstants.getAck(), clientList.get(clientList.size() - 1).send(TestConstants.WELLFORMED_XML_WITH_VALID_TERMINATOR).toByteArray());
    }

    // Confirm that each client is still open.
    for (TCPClient tcpClient : clientList) {
        assertTrue(tcpClient.isConectionActive());
    }

    this.checkLogMonitorForUnexpectedMessages();
}
项目:MockTCPServer    文件:TestMockTCPServerST.java   
/**
 * Having set the Server to expect only messages that match a specified Regular Expression, ensure that a NAK is returned for messages that do not match and an ACK for messages that do match.
 *
 * @throws IOException see source documentation.
 * @throws InterruptedException
 * @throws ConfigurationException
 */
@Test(timeout = TIMEOUT)
public void expectSpecificMessage() throws IOException, ConfigurationException, InterruptedException {
    final String baseMessage = "Hello World!!";
    final String message = String.format("%s%s", baseMessage, new String(TestConstants.DEFAULT_TERMINATOR));

    // All messages sent to the Server must match this regular expression.
    final String messageRegularExpression = String.format("%s%s", "Hello.*", new String(TestConstants.DEFAULT_TERMINATOR));
    final String invalidMessage = String.format("%s%s", "This does not match the expected Regular Expression.",
            new String(TestConstants.DEFAULT_TERMINATOR));

    this.getServer().setExpectedMessage(messageRegularExpression);

    assertArrayEquals(TestConstants.getAck(), this.getClient().send(message).toByteArray());
    assertNull(this.getServer().getAssertionError());
    assertArrayEquals(TestConstants.getNak(), this.getClient().send(invalidMessage).toByteArray());
    assertNotNull(this.getServer().getAssertionError());

    this.checkLogMonitorForUnexpectedMessages();
}
项目:MockTCPServer    文件:TestBootstrap.java   
/**
 * Bootstrap multiple servers using details from the configuration file.
 *
 * @throws ConfigurationException error reading the configuration file
 * @throws InterruptedException the MockTCPServer was unexpectedly interrupted
 * @throws IOException error while sending responses
 */
@Test(timeout = TestConstants.TEST_TIMEOUT_5_MINUTE)
public void startup() throws ConfigurationException, InterruptedException, IOException {
    try (final Bootstrap bootstrap = new Bootstrap();) {
        bootstrap.startup();

        final List<String> expectedMessages = new ArrayList<>(Arrays.asList(StringEscapeUtils.unescapeJava(TestConstants.MACHINE_A_RESPONSE_MESSAGE), StringEscapeUtils.unescapeJava(TestConstants.MACHINE_B_RESPONSE_MESSAGE)));

        testResponses(bootstrap.getServerPool().get(TestConstants.MOCK_SERVER_PORT_1234), TestConstants.MOCK_SERVER_PORT_2345, TestConstants.INCOMING_MESSAGE_ONE + TestConstants.DEFAULT_TERMINATOR, expectedMessages, TestConstants.SERVER_TIMEOUT, TestConstants.ONE_TENTH_OF_A_SECOND);
        checkLogMonitorForUnexpectedMessages();
        testResponses(bootstrap.getServerPool().get(TestConstants.MOCK_SERVER_PORT_6789), TestConstants.MOCK_SERVER_PORT_5678, TestConstants.WELLFORMED_XML_WITH_VALID_TERMINATOR, expectedMessages, TestConstants.SERVER_TIMEOUT, TestConstants.ONE_TENTH_OF_A_SECOND);
        checkLogMonitorForUnexpectedMessages();

        bootstrap.shutdown();
    }
}
项目:opennlp-enhancer    文件:Config.java   
/**
 * Instantiates a new config.
 */
private Config() {
    try {
        Parameters params = new Parameters();
        FileBasedConfigurationBuilder<FileBasedConfiguration> builder = new FileBasedConfigurationBuilder<FileBasedConfiguration>(
                PropertiesConfiguration.class);
        builder.configure(params.fileBased().setFileName("nlp.properties")
                .setLocationStrategy(new ClasspathLocationStrategy()));
        configuration = builder.getConfiguration();
        // Adding TEKSTO_HOME path to Configuration
        String homePath = System.getenv(TEKSTO_HOME);
        if (homePath != null && !homePath.isEmpty()) {
            configuration.setProperty(MODEL_PATH, homePath + "/Models");
        }
    } catch (ConfigurationException e) {
        LOG.error(e, e);
    }
}
项目:loginsight-java-api    文件:Configuration.java   
/**
 * Builds the Configuration object from the properties file (apache commons
 * properties file format). <br>
 * The values provided in the config file will be overwritten environment
 * variables (if present)
 * 
 * List of the properties <br>
 * loginsight.host = host name <br>
 * loginsight.port = port number <br>
 * loginsight.user = User name <br>
 * loginsight.password = password <br>
 * loginsight.ingestion.agentId = agentId <br>
 * loginsight.connection.scheme = http protocol scheme <br>
 * loginsight.ingestion.port = Ingestion port number <br>
 * 
 * @param configFileName
 *            Name of the config file to read
 * @return Newly created Configuration object
 */
public static Configuration buildFromConfig(String configFileName) {
    try {
        List<FileLocationStrategy> subs = Arrays.asList(new ProvidedURLLocationStrategy(),
                new FileSystemLocationStrategy(), new ClasspathLocationStrategy());
        FileLocationStrategy strategy = new CombinedLocationStrategy(subs);

        FileBasedConfigurationBuilder<PropertiesConfiguration> builder = new FileBasedConfigurationBuilder<PropertiesConfiguration>(
                PropertiesConfiguration.class).configure(
                        new Parameters().fileBased().setLocationStrategy(strategy).setFileName(configFileName));
        PropertiesConfiguration propConfig = builder.getConfiguration();
        Map<String, String> propMap = new HashMap<String, String>();
        Iterator<String> keys = propConfig.getKeys();
        keys.forEachRemaining(key -> {
            logger.info(key + ":" + propConfig.getString(key));
            propMap.put(key, propConfig.getString(key));
        });
        Configuration config = Configuration.buildConfig(propMap);
        config.loadFromEnv();
        return config;
    } catch (ConfigurationException e1) {
        throw new RuntimeException("Unable to load config", e1);
    }
}
项目:personal    文件:PropertyOverrideTest.java   
@Test
public void testOverride() {

    Parameters params = new Parameters();
    FileBasedConfigurationBuilder<FileBasedConfiguration> builder =
            new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)
                    .configure(params.properties()
                            .setFileName("file.properties"));
    Configuration config = null;
    try {
        config = builder.getConfiguration();
        config.setProperty("somekey", "somevalue");
        builder.save();
    } catch (ConfigurationException e) {
        e.printStackTrace();
    }
}
项目:commons-configuration2-jackson    文件:ConfigurationTests.java   
@Test
public void readWriteReadConfiguration() throws IOException, ConfigurationException {
    // Arrange
    final String str = getExampleConfiguration();
    final T config = create();
    config.read(new StringReader(str));
    final StringWriter writer = new StringWriter();
    config.write(writer);
    final String str2 = writer.toString();

    // Act
    final T config2 = create();
    config2.read(new StringReader(str2));
    final StringWriter writer2 = new StringWriter();
    config.write(writer2);
    final String str3 = writer2.toString();

    // Assert
    assertThat(str2, is(str3));
}
项目:commons-configuration2-jackson    文件:ConfigurationTests.java   
@Test
public void readConfigurationWithVariables() throws IOException, ConfigurationException {
    // Arrange
    final T configuration = create();
    configuration.setProperty("application.groupid", "org.example");
    configuration.setProperty("application.artifactid", "testapp");
    configuration.setProperty("application.version", "1.0-alpha");
    configuration.setProperty("id", "${application.groupid}:${application.artifactid}:${application.version}");
    final String input = asString(configuration);

    // Act
    final T sut = create();
    sut.read(new StringReader(input));
    final String id = sut.getString("id");

    // Assert
    assertThat(id, is("org.example:testapp:1.0-alpha"));
}
项目:commons-configuration2-jackson    文件:ConfigurationTests.java   
@Test
public void readWriteReadConfigurationWithVariables() throws IOException, ConfigurationException {
    // Arrange
    final T configuration = create();
    configuration.setProperty("application.groupid", "org.example");
    configuration.setProperty("application.artifactid", "testapp");
    configuration.setProperty("application.version", "1.0-alpha");
    configuration.setProperty("id", "${application.groupid}:${application.artifactid}:${application.version}");
    final String input = asString(configuration);

    final T sut = create();
    sut.read(new StringReader(input));
    final String str2 = asString(sut);
    final T sut2 = create();
    sut2.read(new StringReader(str2));
    final String str3 = asString(sut2);

    // Act
    final T sut3 = create();
    sut3.read(new StringReader(str3));
    final String id = sut3.getString("id");

    // Assert
    assertThat(id, is("org.example:testapp:1.0-alpha"));
}
项目:commons-configuration2-jackson    文件:JsonConfigurationTests.java   
@Test
public void readFromBuilder() throws ConfigurationException {
    // Arrange
    final FileBasedBuilderParameters params = new Parameters()
            .fileBased()
            .setThrowExceptionOnMissing(true)
            .setEncoding("UTF-8")
            .setFileName(Resources.getResource("example.json").toString());

    // Act
    final FileBasedConfigurationBuilder<JsonConfiguration> builder = new FileBasedConfigurationBuilder<>(
            JsonConfiguration.class);
    final JsonConfiguration sut = builder.configure(params).getConfiguration();

    // Assert
    assertThat(sut.getString("name"), is("testName"));
}
项目:data-prep    文件:PropertiesEncryption.java   
/**
 * Applies the specified function to the specified set of parameters contained in the input file.
 *
 * @param input The specified name of file to encrypt
 * @param mustBeModified the specified set of parameters
 * @param function the specified function to apply to the set of specified parameters
 */
private void modifyAndSave(String input, Set<String> mustBeModified, Function<String, String> function) {
    Path inputFilePath = Paths.get(input);
    if (Files.exists(inputFilePath) && Files.isRegularFile(inputFilePath) && Files.isReadable(inputFilePath)) {
        try {
            Parameters params = new Parameters();
            FileBasedConfigurationBuilder<PropertiesConfiguration> builder = //
                    new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class) //
                            .configure(params.fileBased() //
                                    .setFile(inputFilePath.toFile())); //
            PropertiesConfiguration config = builder.getConfiguration();
            mustBeModified.stream().filter(config::containsKey)
                    .forEach(key -> config.setProperty(key, function.apply(config.getString(key))));

            builder.save();
        } catch (ConfigurationException e) {
            LOGGER.error("unable to read {} {}", input, e);
        }
    } else {
        LOGGER.debug("No readable file at {}", input);
    }
}
项目:spoofax    文件:AConfigService.java   
/**
 * Gets the configuration from the given file.
 *
 * @param configFile
 *            The configuration file with the configuration.
 * @return The configuration, or <code>null</code> when no configuration could be retrieved.
 */
public ConfigRequest<TConfig> getFromConfigFile(FileObject configFile, FileObject rootFolder) {
    final HierarchicalConfiguration<ImmutableNode> configuration;
    try {
        configuration = readConfig(configFile, rootFolder);
    } catch(ConfigurationException | IOException e) {
        // @formatter:off
        final IMessage message = MessageBuilder
            .create()
            .withSource(configFile)
            .withMessage("Unable to read configuration from " + configFile)
            .withException(e)
            .build();
        // @formatter:on
        return new ConfigRequest<>(message);
    }

    if(configuration != null) {
        return toConfig(configuration, configFile);
    } else {
        return new ConfigRequest<>();
    }
}
项目:fwm    文件:JettyController.java   
@FXML
public void toggleRadios() throws ConfigurationException{
    WorldConfig.saveRadios(radio10.isSelected(), radio15.isSelected(), radioShowAll.isSelected());  
    //radio1.0 show content
    //radio1.5 allow players to view/search gods/npcs/regions/events and search
    //radio2.0 allow co-dm to edit
}
项目:fwm    文件:WorldSettingsController.java   
public void setDarkMode() throws ConfigurationException{
    AppConfig.setDarkMode(darkModeOn.isSelected());
    App.getMainController().setDark(darkModeOn.isSelected());
    if(JettyController.getStarted())
        JettyController.setDark(darkModeOn.isSelected());
    if(ShowPlayersController.getStarted())
        ShowPlayersController.setDark(darkModeOn.isSelected());

}
项目:fwm    文件:HotkeyController.java   
public static void init() throws ConfigurationException {
    configManager = new Configurations();
    builder = new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)
            .configure(configManager.getParameters().fileBased().setFile(App.appFileUtil.getHotkeysFile()));
    config = builder.getConfiguration();
    loadHotkeys();
}
项目:fwm    文件:HotkeyController.java   
public static void saveHotkeys() throws ConfigurationException {
    log.debug("Saving Hotkeys");
    for (String key : hotkeys.keySet()) {
        config.setProperty(key, hotkeys.get(key).getHotkeyText());
        log.debug(hotkeys.get(key).getHotkeyText());
    }
    builder.save();
}
项目:fwm    文件:HotkeyController.java   
private static boolean addHotkey(KeyEvent event, String function) {
    String keyCombString = "";
    boolean modified = false;
    if (event.isShiftDown()) {
        modified = true;
        keyCombString += "Shift+";
    }
    if (event.isAltDown()) {
        modified = true;
        keyCombString += "Alt+";
    }
    if (event.isShortcutDown()) {
        modified = true;
        keyCombString += "Shortcut+";
    }
    keyCombString += event.getCode().getName();
    if (!event.getCode().isModifierKey() && modified) {
        hotkeys.get(function).setHotkey(keyCombString);
        try {
            saveHotkeys();
        } catch (ConfigurationException e) {
            e.printStackTrace();
        }
        return true;
    }
    return false;
}
项目:fwm    文件:WorldConfig.java   
public static void init(String worldLocation) throws ConfigurationException {
    log.debug("World Location for properties: " + worldLocation);
    configManager = new Configurations();
    if(worldLocation == null){
        builder = new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)
            .configure(configManager.getParameters().fileBased().setFileName(defaultWorldPropertiesLocation));
    }else
    {
        builder = new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)
                .configure(configManager.getParameters().fileBased().setFileName(worldLocation));
    }
    config = builder.getConfiguration();        
}
项目:fwm    文件:WorldConfig.java   
public static void savePassword(String password) throws ConfigurationException{
    log.debug("saveDefaultWorldLocation: " + password);
    config.setProperty(PASSWORD, password);
    config = builder.getConfiguration();
    config.setProperty(PASSWORD, password);
    builder.save();
}
项目:fwm    文件:WorldConfig.java   
public static void saveRadios(boolean r10, boolean r15, boolean showAll) throws ConfigurationException {
    log.debug("saveJettyRadios");
    config=builder.getConfiguration();
    config.setProperty(RADIO10, r10);
    config.setProperty(RADIO15, r15);
    config.setProperty(RADIOSHOWNONLY, showAll);
    builder.save();
    log.debug("radio 1.0: " + config.getBoolean(RADIO10) + 
            "\nradio 1.5: " + config.getBoolean(RADIO15)+ 
            "\nradioshownonly: " + config.getBoolean(RADIOSHOWNONLY));

}
项目:fwm    文件:WorldConfig.java   
public static void setShowPlayersPopup(boolean popup) throws ConfigurationException {
    log.debug("save showplayers");
    config=builder.getConfiguration();
    config.setProperty(SHOWPLAYERSPOPUP, popup);
    builder.save();
    log.debug("ShowPlayersPopup: " + config.getBoolean(SHOWPLAYERSPOPUP));
}
项目:fwm    文件:AppConfig.java   
public static void init() throws ConfigurationException {
    configManager = new Configurations();
    builder = new FileBasedConfigurationBuilder<FileBasedConfiguration>(PropertiesConfiguration.class)
            .configure(configManager.getParameters().fileBased().setFile(App.appFileUtil.getAppPropFile()));

    config = builder.getConfiguration();        
}
项目:fwm    文件:AppConfig.java   
public static void saveDefaultWorldLocation(String worldloc) throws ConfigurationException{
    log.debug("saveDefaultWorldLocation: " + worldloc);
    config.setProperty(WORLD_LOCATION, worldloc);
    config = builder.getConfiguration();
    config.setProperty(WORLD_LOCATION, worldloc);
    builder.save();
}
项目:fwm    文件:AppConfig.java   
public static void setManualSaveOnly(boolean popup) throws ConfigurationException {
    log.debug("save manualSaveOnly");
    config=builder.getConfiguration();
    config.setProperty(MANUAL_SAVE_ONLY, popup);
    builder.save();
    log.debug("manualSaveOnly: " + config.getBoolean(MANUAL_SAVE_ONLY));
}
项目:fwm    文件:AppConfig.java   
public static void setDarkMode(boolean popup) throws ConfigurationException {
    log.debug("dark mode toggle");
    config=builder.getConfiguration();
    config.setProperty(DARKMODE, popup);
    builder.save();
    log.debug("darkMode: " + config.getBoolean(DARKMODE));
}
项目:fwm    文件:AppConfig.java   
public static void setAutoUpdateTabs(boolean autoUpdateTabs) throws ConfigurationException{
    log.debug("auto update tabs toggle");
    config=builder.getConfiguration();
    config.setProperty(AUTO_UPDATE_TABS, autoUpdateTabs);
    builder.save();
    log.debug("autoUpdateTabs: " + config.getBoolean(AUTO_UPDATE_TABS));
}
项目:grpc-mate    文件:ConfigurationProvider.java   
@Override
public Configuration get() {
  Configurations configs = new Configurations();
  try {
    return configs.properties(new File(getPropertyFilePath()));
  } catch (ConfigurationException e) {
    log.error(" error on build configuration", e);
    throw new IllegalStateException(e);
  }
}