@@ -0,0 +1,1526 @@
+package dev.kkorolyov.sqlob.assets;%0A%0Aimport java.io.IOException;%0Aimport java.io.UncheckedIOException;%0A%0Aimport dev.kkorolyov.simpleprops.Properties;%0A%0A/**%0A * Centralized access to all assets.%0A */%0Apublic class Assets %7B%0A%09@SuppressWarnings(%22javadoc%22)%0A%09public static final String PROPERTIES_NAME = %22SQLOb.ini%22;%0A%09private static final String HOST = %22HOST%22,%0A%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09DATABASE = %22DATABASE%22,%0A%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09USER = %22USER%22,%0A%09%09%09%09%09%09%09%09%09%09%09%09%09%09%09PASSWORD = %22PASSWORD%22;%0A%0A%09private static Properties props;%0A%0A%09/**%0A%09 * Initializes all assets.%0A%09 * @return %7B@code true%7D if properties were just initialized and must be set.%0A%09 */%0A%09public static boolean init() %7B%0A%09%09boolean firstInit = false;%0A%09%09%0A%09%09props = Properties.getInstance((PROPERTIES_NAME));%0A%09%09if (props.size() %3C 4) %7B%0A%09%09%09initProperties();%0A%09%09%09%0A%09%09%09firstInit = true;%0A%09%09%7D%0A%09%09return firstInit;%0A%09%7D%0A%09private static void initProperties() %7B%0A%09%09props.clear();%0A%09%09%0A%09%09props.addProperty(HOST, %22%22);%0A%09%09props.addProperty(DATABASE, %22%22);%0A%09%09props.addProperty(USER, %22%22);%0A%09%09props.addProperty(PASSWORD, %22%22);%0A%09%09%0A%09%09try %7B%0A%09%09%09props.saveToFile();%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09throw new UncheckedIOException(e);%0A%09%09%7D%0A%09%7D%0A%09%0A%09/** @return hostname value */%0A%09public static String hostname() %7B%0A%09%09return props.getValue(HOST);%0A%09%7D%0A%09/** @return database value */%0A%09public static String database() %7B%0A%09%09return props.getValue(DATABASE);%0A%09%7D%0A%09/** @return user value */%0A%09public static String user() %7B%0A%09%09return props.getValue(USER);%0A%09%7D%0A%09/** @return password value */%0A%09public static String password() %7B%0A%09%09return props.getValue(PASSWORD);%0A%09%7D%0A%7D%0A

Add Assets