-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MODDINV-1071: Extended Authority Mapping
- Loading branch information
Showing
6 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/java/org/folio/inventory/config/PropertiesReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.folio.inventory.config; | ||
|
||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Properties; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
public class PropertiesReader { | ||
|
||
private static final String PROPERTIES_FILE = "/application.yaml"; | ||
|
||
protected static final Logger LOGGER = LogManager.getLogger( | ||
PropertiesReader.class); | ||
private static final Properties properties = new Properties(); | ||
|
||
static { | ||
loadProperties(); | ||
} | ||
|
||
private PropertiesReader() { | ||
} | ||
|
||
private static void loadProperties() { | ||
try (InputStream inputStream = PropertiesReader.class.getResourceAsStream( | ||
PROPERTIES_FILE)) { | ||
properties.load(inputStream); | ||
} catch (IOException e) { | ||
LOGGER.error("Couldn't load application configuration file", e); | ||
} | ||
} | ||
|
||
public static boolean getPropertyAsBoolean(String key) { | ||
String value = properties.getProperty(key); | ||
return Boolean.parseBoolean(value); | ||
} | ||
|
||
public static void setProperty(String key, String value) { | ||
properties.setProperty(key, value); | ||
} | ||
|
||
public static void clearProperties() { | ||
properties.clear(); | ||
loadProperties(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
authorities-extended: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters