Initial Database Migration

This commit is contained in:
Isaac Parenteau
2019-10-06 20:07:47 -05:00
parent 38dbc5bbf5
commit af8e8fa52a
20 changed files with 1567 additions and 113 deletions

View File

@@ -0,0 +1,127 @@
/**
*
* Project: Eight Track, File: Configuration.java
*
* Copyright 2019 Locusworks LLC.
* All rights reserved. Federal copyright law prohibits unauthorized reproduction by
* any means and imposes fines up to $25,000 for violation. No part of this material
* may be reproduced, transmitted, transcribed, stored in a retrieval system, copied,
* modified, duplicated, adapted or translated into another program language in any
* form or by any means, electronic, mechanical, photocopying, recording, or
* otherwise, without the prior written permission from Locusworks. Locusworks
* affirms that Eight-Track(R) software and data is subject to United States
* Government Purpose Rights. Contact Locusworks, 1313 Lawnview Drive
* Forney TX 75126, (802) 488-0438, for commercial licensing opportunities.
*
* IN NO EVENT SHALL LOCUSWORKS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
* INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF LOCUSWORKS HAS BEEN
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. NO RESPONSIBILITY IS ASSUMED BY
* LOCUSWORKS FOR ITS USE, OR FOR ANY INFRINGEMENTS OF PATENTS OR OTHER RIGHTS OF
* THIRD PARTIES RESULTING FROM ITS USE. LOCUSWORKS SPECIFICALLY DISCLAIMS ANY
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND
* ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS
* IS". LOCUSWORKS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS.
*/
package net.locusworks.discord.eighttrack.enums;
public enum Configuration {
DB_ROOT_USER("dbAdmin"),
DB_ROOT_PASSWORD("dbAdminPassword"),
DB_USER("dbUser"),
DB_PASSWORD("dbUserPassword"),
DB_HOST("dbHost"),
DB_PORT("dbPort"),
LOG_LEVEL("logLevel"),
MUSIC_DIR("musicDir"),
DISCORD_TOKEN("discordToken");
private String value;
private Configuration(String value) {
this.value = value;
}
/**
* Get the current value of the enumeration
* @return value
*/
public String getValue() {
return this.value;
}
@Override
public String toString() {
return this.value;
}
/**
* Checks to see if the configuration is of a certain value
* @param confTypes types to check against
* @return true if the current configuration is of a certain enumeration, false otherwise
*/
public boolean is(Configuration... confTypes) {
for (Configuration confType : confTypes) {
if (this == confType) {
return true;
}
}
return false;
}
/**
* Checks to see if the configuration is not of a certain value
* @param confTypes Types to check against
* @return true if the current configuration is not of a certain enuermation, false otherwise
*/
public boolean isNot(Configuration... confTypes) {
return !is(confTypes);
}
/**
* Finds a specific enumeration
* @param value Value to find
* @return the found enumeration or null if nothing is found
*/
public static Configuration findEnum(String value) {
for (Configuration conf: values()) {
if (conf.getValue().equalsIgnoreCase(value)) {
return conf;
}
}
return null;
}
/**
* Checks to see if a specific value is in a set of configuration types
* @param value Value to look for
* @param confTypes types to compare against
* @return true if the string value is in a certain set of configuration enumerations, false otherwise
*/
public static boolean in(String value, Configuration... confTypes) {
Configuration ft = findEnum(value);
if (ft == null) {
return false;
}
for (Configuration confType : confTypes) {
if (ft == confType) {
return true;
}
}
return false;
}
/**
* Checks to see if a specific value is not in a set of configuration types
* @param value Value to look for
* @param confTypes types to compare against
* @return true if the string value is not in a certain set of configuration enumerations, false otherwise
*/
public static boolean notIn(String value, Configuration... confTypes) {
return !in(value, confTypes);
}
}