= Migrated to CSV
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
package core;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import dataStructures.Pair;
|
||||
|
||||
public class BaseKeyValueFile
|
||||
{
|
||||
// Variables
|
||||
public static final String headerStart = "[";
|
||||
public static final String headerEnd = "]";
|
||||
public static final String pairSplit = "=";
|
||||
public static final char pairSeparator = '\n';
|
||||
|
||||
protected final String header;
|
||||
|
||||
|
||||
// Constructor
|
||||
public BaseKeyValueFile()
|
||||
{
|
||||
this.header = headerStart + this.getClass().getSimpleName() + headerEnd;
|
||||
}
|
||||
|
||||
// Reads in and calls the specifid function for each keyvalue pair we find
|
||||
protected void parse(String content, Consumer<? super Pair<String, String>> keyValueCallback)
|
||||
{
|
||||
content = content.trim();
|
||||
String[] lines = content.split("" + pairSeparator);
|
||||
|
||||
for(int i = 0; i < lines.length; ++i)
|
||||
{
|
||||
if(lines[i].contains(header))
|
||||
continue;
|
||||
|
||||
String[] pair = lines[i].split(pairSplit);
|
||||
|
||||
if(pair.length < 2)
|
||||
continue;
|
||||
|
||||
String key = pair[0].trim().toLowerCase();
|
||||
String value = pair[1].trim().toLowerCase();
|
||||
|
||||
keyValueCallback.accept(new Pair<String, String>(key, value));
|
||||
}
|
||||
}
|
||||
|
||||
// Writes the set of keyvalue pairs to a string
|
||||
protected String write(List<Pair<String, String>> toWrite)
|
||||
{
|
||||
ListIterator<Pair<String, String>> iter = toWrite.listIterator();
|
||||
|
||||
String outString = "";
|
||||
outString += header + pairSeparator;
|
||||
|
||||
while(iter.hasNext())
|
||||
{
|
||||
Pair<String, String> pair = iter.next();
|
||||
String key = pair.First.toLowerCase();
|
||||
String value = pair.Second.toLowerCase();
|
||||
|
||||
outString += key + pairSplit + value + pairSeparator;
|
||||
}
|
||||
|
||||
return outString;
|
||||
}
|
||||
}
|
||||
+82
-46
@@ -2,41 +2,58 @@ package core;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Vector;
|
||||
|
||||
import dataStructures.TaggedPairStore;
|
||||
import utils.GlobalLog;
|
||||
import utils.LogFilter;
|
||||
import utils.io.FileMonitor;
|
||||
import utils.io.FileUtils;
|
||||
|
||||
|
||||
// A quick-and-dirty localization tool that scrapes the project for calls to itself, then
|
||||
// generates/updates a file externally with all the stub values as keys that are localized.
|
||||
public abstract class BaseLocFile
|
||||
public abstract class BaseLocFile implements IConfigSection
|
||||
{
|
||||
// Filename
|
||||
public final String functionName; // Example: "Localizer.Stub";
|
||||
|
||||
// Local translation storage
|
||||
protected TaggedPairStore stringStore;
|
||||
// Variables
|
||||
protected final String headerName; // Example: Loc Strings
|
||||
protected final String functionName; // Example: "Localizer.Stub";
|
||||
protected Map<String, String> localized;
|
||||
|
||||
// Logging
|
||||
private void log(String str) { GlobalLog.log(LogFilter.Strings, str); }
|
||||
private void warn(String str) { GlobalLog.warn(LogFilter.Strings, str); }
|
||||
private void error(String str) { GlobalLog.error(LogFilter.Strings, str); }
|
||||
|
||||
// File monitoring
|
||||
protected FileMonitor fileMonitor;
|
||||
|
||||
// Constructor
|
||||
public BaseLocFile(String functionName)
|
||||
public BaseLocFile(String headerName, String functionName)
|
||||
{
|
||||
this.headerName = headerName;
|
||||
this.functionName = functionName;
|
||||
localized = new HashMap<String, String>();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// First Step: Populating with existing strings //
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
private void buildLocalized(List<ConfigItem> pairs)
|
||||
{
|
||||
for(ConfigItem item : pairs)
|
||||
{
|
||||
localized.put(item.key, item.value);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
// Second Step: Scraping existing files //
|
||||
//////////////////////////////////////////
|
||||
|
||||
// Structure used for holding a pair of strings and any other info we need
|
||||
// about localized information that is being looked up.
|
||||
@SuppressWarnings("unused")
|
||||
private class LocInfo
|
||||
{
|
||||
public String file;
|
||||
@@ -49,8 +66,21 @@ public abstract class BaseLocFile
|
||||
}
|
||||
}
|
||||
|
||||
// Try to perform stripping java files for contents to localize
|
||||
private void tryStripSpecified(Path path, ArrayList<LocInfo> toFill)
|
||||
{
|
||||
try
|
||||
{
|
||||
stripForContents(path, toFill);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
error("issue with file: " + path.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// Do processing on each path in the scraped directory here, assuming it's .java
|
||||
public void stripForContents(Path path, ArrayList<LocInfo> strings)
|
||||
private void stripForContents(Path path, ArrayList<LocInfo> strings)
|
||||
{
|
||||
String filename = path.getFileName().toString();
|
||||
if(filename.contains(".java"))
|
||||
@@ -68,8 +98,8 @@ public abstract class BaseLocFile
|
||||
{
|
||||
if(noWhitespace.charAt(noWhitespace.indexOf(")") - 1) == '"' && split[i].charAt(loc - 2) != '\\')
|
||||
{
|
||||
// At this point, we find the first ), then verify there's a ") behind it, and that
|
||||
// the " is not an escaped character.
|
||||
// At this point we find the first ), then verify there's a ") behind it,
|
||||
// and that the " is not an escaped character.
|
||||
try
|
||||
{
|
||||
String toLocalize = split[i].substring(2, loc - 1);
|
||||
@@ -88,61 +118,67 @@ public abstract class BaseLocFile
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing for now, but in the future will return a parsed and localized version of
|
||||
// the string in question if one can be found. If the localized string is empty,
|
||||
// Returns the value. If the localized string is empty,
|
||||
// returns a the key instead which is the default phrase.
|
||||
public String getKey(String input)
|
||||
{
|
||||
if(stringStore == null)
|
||||
if(localized == null)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
String value = stringStore.getKey(input);
|
||||
String value = localized.get(input);
|
||||
if(value == null || value.trim().length() < 1)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// Update localization from the disk on file. Creates the file if it doesn't exist.
|
||||
// This file is internally formatted as an ini file.
|
||||
public void updateLocFromString(String fileContents)
|
||||
{
|
||||
log("Attempting to read localization file contents");
|
||||
|
||||
stringStore = new TaggedPairStore(fileContents);
|
||||
}
|
||||
|
||||
private void tryStripSpecified(Path path, ArrayList<LocInfo> toFill)
|
||||
{
|
||||
try
|
||||
{
|
||||
stripForContents(path, toFill);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
error("issue with file: " + path.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// Scrape the project and generate all the possible localizeable phrases.
|
||||
// This stubs out phrases to be localized.
|
||||
// This stubs out phrases to be localized, by default placing the key in as the value.
|
||||
public void scrapeAll()
|
||||
{
|
||||
ArrayList<LocInfo> localizeList = new ArrayList<LocInfo>();
|
||||
FileUtils.acquireAllFiles(Constants.SourceDirectory).forEach((path) -> tryStripSpecified(path, localizeList));
|
||||
|
||||
for(LocInfo toStub : localizeList)
|
||||
stringStore.addKeyValue(toStub.file, toStub.phrase, toStub.phrase);
|
||||
{
|
||||
localized.putIfAbsent(toStub.phrase, toStub.phrase);
|
||||
}
|
||||
}
|
||||
|
||||
// Converts this to a string
|
||||
public String toString()
|
||||
///////////////////////////////////
|
||||
// IConfigSection Implementation //
|
||||
///////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getSectionTitle()
|
||||
{
|
||||
return stringStore.toString();
|
||||
return headerName;
|
||||
}
|
||||
|
||||
public List<ConfigItem> toConfigList();
|
||||
@Override
|
||||
public void consume(List<ConfigItem> pairs)
|
||||
{
|
||||
localized.clear();
|
||||
buildLocalized(pairs);
|
||||
scrapeAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConfigItem> produce()
|
||||
{
|
||||
List<ConfigItem> items = new Vector<ConfigItem>();
|
||||
|
||||
for(Entry<String, String> entry : localized.entrySet())
|
||||
{
|
||||
items.add(new ConfigItem(headerName, entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
||||
items.sort((item1, item2) -> item1.key.compareToIgnoreCase(item2.key));
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import utils.LogFilter;
|
||||
// commands that are being looked up will behave slightly differently so trimming
|
||||
// rules for this file are different than the localization ones - this is more
|
||||
// aggresive with whitespace removal.
|
||||
public class CommandEnabler extends BaseKeyValueFile implements DEPRECATED_IConfigSection
|
||||
public class CommandEnabler implements IConfigSection
|
||||
{
|
||||
// Config/const variables
|
||||
public static final String enabled = "1";
|
||||
@@ -48,14 +48,15 @@ public class CommandEnabler extends BaseKeyValueFile implements DEPRECATED_IConf
|
||||
}
|
||||
|
||||
// Reads in the config file and parses it, keeping tabs on the order it read things
|
||||
private void readIn(String contents)
|
||||
private void readIn(List<ConfigItem> items)
|
||||
{
|
||||
parse(contents, (pair) ->{
|
||||
String key = pair.First;
|
||||
String value = pair.Second;
|
||||
for(ConfigItem item : items)
|
||||
{
|
||||
String key = item.key;
|
||||
String value = item.value;
|
||||
|
||||
keyList.add(key);
|
||||
|
||||
|
||||
if(value.equalsIgnoreCase(enabled))
|
||||
{
|
||||
enabledMap.putIfAbsent(key, true);
|
||||
@@ -64,7 +65,7 @@ public class CommandEnabler extends BaseKeyValueFile implements DEPRECATED_IConf
|
||||
{
|
||||
enabledMap.putIfAbsent(key, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Look up the already scraped values from the localizer and store them if they
|
||||
@@ -86,8 +87,9 @@ public class CommandEnabler extends BaseKeyValueFile implements DEPRECATED_IConf
|
||||
}
|
||||
|
||||
// Write out enabled/disabled file info.
|
||||
private String writeOut()
|
||||
private List<ConfigItem> writeOut()
|
||||
{
|
||||
// Parse in original format
|
||||
List<Pair<String, String>> list = new Vector<Pair<String, String>>();
|
||||
|
||||
for(int i = 0; i < keyList.size(); ++i)
|
||||
@@ -105,7 +107,15 @@ public class CommandEnabler extends BaseKeyValueFile implements DEPRECATED_IConf
|
||||
|
||||
Collections.sort(list, (c1, c2) -> { return c1.First.compareTo(c2.First); });
|
||||
|
||||
return write(list);
|
||||
// Convert to new ConfigItem list format for return
|
||||
List<ConfigItem> configItems = new Vector<ConfigItem>();
|
||||
|
||||
for(Pair<String, String> pair : list)
|
||||
{
|
||||
configItems.add(new ConfigItem(HeaderName, pair.First, pair.Second));
|
||||
}
|
||||
|
||||
return configItems;
|
||||
}
|
||||
|
||||
// Looks up a key to see if it's enabled or not
|
||||
@@ -122,18 +132,21 @@ public class CommandEnabler extends BaseKeyValueFile implements DEPRECATED_IConf
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHeader() {
|
||||
public String getSectionTitle()
|
||||
{
|
||||
return HeaderName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(String contents) {
|
||||
public void consume(List<ConfigItem> pairs)
|
||||
{
|
||||
readIn(pairs);
|
||||
getTrackedCommands();
|
||||
readIn(contents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String write() {
|
||||
public List<ConfigItem> produce()
|
||||
{
|
||||
return writeOut();
|
||||
}
|
||||
}
|
||||
|
||||
+28
-5
@@ -2,11 +2,15 @@ package core;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import utils.io.FileMonitor;
|
||||
|
||||
public class Config
|
||||
{
|
||||
ConfigCSV configCSV;
|
||||
List<IConfigSection> sections;
|
||||
private static final String filepath = Constants.AssetDirectory + Constants.ConfigFilename;
|
||||
|
||||
private ConfigCSV configCSV;
|
||||
private List<IConfigSection> sections;
|
||||
private FileMonitor monitoredConfigFile;
|
||||
|
||||
public static Config instance;
|
||||
|
||||
@@ -15,10 +19,16 @@ public class Config
|
||||
if(instance == null)
|
||||
{
|
||||
sections = new Vector<IConfigSection>();
|
||||
|
||||
configCSV = new ConfigCSV(sections, "./config.csv");
|
||||
configCSV.writeFile();
|
||||
|
||||
// Add all sections
|
||||
sections.add(new LocCommands());
|
||||
sections.add(new LocStrings());
|
||||
sections.add(new CommandEnabler());
|
||||
|
||||
// Being monitoring configs and mark this as the instance now that it's made
|
||||
monitoredConfigFile = new FileMonitor(filepath);
|
||||
build(filepath);
|
||||
|
||||
instance = this;
|
||||
}
|
||||
else
|
||||
@@ -28,4 +38,17 @@ public class Config
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
public void build(String path)
|
||||
{
|
||||
configCSV = new ConfigCSV(sections, path);
|
||||
configCSV.writeFile();
|
||||
}
|
||||
|
||||
public void upkeep()
|
||||
{
|
||||
monitoredConfigFile.update((monitoredFile) -> {
|
||||
build(monitoredFile.path.toString());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ public final class Constants
|
||||
{
|
||||
public static final Color ColorDefault = new Color(7*16, 8*16, 9*16); // A slate-grey
|
||||
public static final String AssetDirectory = "./assets/";
|
||||
public static final String ConfigFilename = "config.config";
|
||||
public static final String ConfigFilename = "config.csv";
|
||||
public static final String SourceDirectory = "./src";
|
||||
}
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
package core;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
import utils.GlobalLog;
|
||||
import utils.LogFilter;
|
||||
import utils.io.FileMonitor;
|
||||
import utils.io.FileUtils;
|
||||
|
||||
public class DEPRECATED_Config
|
||||
{
|
||||
private static final String filepath = Constants.AssetDirectory + Constants.ConfigFilename;
|
||||
|
||||
public static DEPRECATED_Config instance;
|
||||
|
||||
// Private
|
||||
private Vector<DEPRECATED_IConfigSection> sections;
|
||||
private FileMonitor monitoredConfigFile;
|
||||
|
||||
public DEPRECATED_Config()
|
||||
{
|
||||
if(instance == null)
|
||||
{
|
||||
// Create local variables
|
||||
sections = new Vector<DEPRECATED_IConfigSection>();
|
||||
|
||||
// Add all sections
|
||||
sections.add(new LocCommands());
|
||||
sections.add(new LocStrings());
|
||||
sections.add(new CommandEnabler());
|
||||
|
||||
// Read file in and parse everything out
|
||||
performStartup();
|
||||
|
||||
// Being monitoring configs and mark this as the instance now that it's made
|
||||
monitoredConfigFile = new FileMonitor(filepath);
|
||||
instance = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalLog.error(LogFilter.Core, "You can't have two of the following: " + this.getClass().getSimpleName());
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
// Perform startup
|
||||
private void performStartup()
|
||||
{
|
||||
File configFile = new File(filepath);
|
||||
|
||||
if(configFile.exists())
|
||||
{
|
||||
reformConfig(configFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
configFile.createNewFile();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
GlobalLog.error(LogFilter.Core, "Failed to load config or create empty config at " + filepath);
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final String sectionStart = "[[";
|
||||
public static final String sectionEnd = "]]";
|
||||
public static final String headerStart = "[";
|
||||
public static final String headerEnd = "]";
|
||||
public static final String pairSplit = "=";
|
||||
public static final String pairSeparator = "\n";
|
||||
|
||||
private void reformConfig(File configFile)
|
||||
{
|
||||
// Read and update
|
||||
String configContents = FileUtils.readContent(configFile);
|
||||
readConfigs(configContents);
|
||||
|
||||
// Form updated data as necessary for autogeneration
|
||||
String output = combineConfigs();
|
||||
|
||||
// Write to file.
|
||||
try
|
||||
{
|
||||
OutputStreamWriter fileWriter = new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8);
|
||||
fileWriter.write(output);
|
||||
fileWriter.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
GlobalLog.error(LogFilter.Core, "Config writing failure.");
|
||||
GlobalLog.error(LogFilter.Core, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void readConfigs(String fullContents)
|
||||
{
|
||||
String[] str = fullContents.split(pairSeparator);
|
||||
HashMap<String, String> parsedSections = new HashMap<String, String>();
|
||||
|
||||
String currentHeader = "";
|
||||
for(int i = 0; i < str.length; ++i)
|
||||
{
|
||||
String line = str[i].trim();
|
||||
if(line.startsWith(sectionStart) && line.endsWith(sectionEnd))
|
||||
{
|
||||
currentHeader = line.substring(sectionStart.length(), line.length() - sectionEnd.length());
|
||||
}
|
||||
else
|
||||
{
|
||||
String sectionContents = parsedSections.getOrDefault(currentHeader, "");
|
||||
parsedSections.put(currentHeader, sectionContents + line + pairSeparator);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < sections.size(); ++i)
|
||||
{
|
||||
DEPRECATED_IConfigSection section = sections.get(i);
|
||||
String header = section.getHeader();
|
||||
String content = parsedSections.getOrDefault(header, null);
|
||||
|
||||
if(content != null)
|
||||
{
|
||||
section.read(content);
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalLog.warn(LogFilter.Core, "Mismatch during config parsing - expected but did not find " + header);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String combineConfigs()
|
||||
{
|
||||
String output = "";
|
||||
|
||||
for(int i = 0; i < sections.size(); ++i)
|
||||
{
|
||||
// If not the first section, add spacing!
|
||||
if(i != 0)
|
||||
{
|
||||
for(int spacing = 0; spacing < 3; ++spacing)
|
||||
{
|
||||
output += pairSeparator;
|
||||
}
|
||||
}
|
||||
|
||||
DEPRECATED_IConfigSection section = sections.get(i);
|
||||
output += sectionStart + section.getHeader() + sectionEnd + pairSeparator;
|
||||
output += section.write() + pairSeparator;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public void upkeep()
|
||||
{
|
||||
monitoredConfigFile.update((monitoredFile) -> {
|
||||
File configFile = new File(filepath);
|
||||
reformConfig(configFile);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import utils.GlobalLog;
|
||||
import utils.LogFilter;
|
||||
@@ -18,7 +17,7 @@ public class LocCommands extends BaseLocFile implements IConfigSection
|
||||
|
||||
public LocCommands()
|
||||
{
|
||||
super(function);
|
||||
super(HeaderName, function);
|
||||
|
||||
GlobalLog.log(LogFilter.Core, "Initializing " + this.getClass().getSimpleName());
|
||||
|
||||
@@ -42,39 +41,7 @@ public class LocCommands extends BaseLocFile implements IConfigSection
|
||||
public static ArrayList<String> getUnlocalizedCommands()
|
||||
{
|
||||
ArrayList<String> raw = new ArrayList<>();
|
||||
instance.stringStore.forEach((pair) -> raw.add((String)((Pair<?, ?>)pair).First ));
|
||||
instance.localized.keySet().forEach((key) -> raw.add(key));
|
||||
return raw;
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public String getHeader() {
|
||||
// return HeaderName;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void read(String contents) {
|
||||
// updateLocFromString(contents);
|
||||
// scrapeAll();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String write() {
|
||||
// return toString();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String getSectionTitle() {
|
||||
return HeaderName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void consume(List<ConfigItem> pairs) {
|
||||
scrapeAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConfigItem> produce() {
|
||||
// TODO Auto-generated method stub
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import utils.GlobalLog;
|
||||
import utils.LogFilter;
|
||||
|
||||
// A quick-and-dirty localization tool that scrapes the project for calls to itself, then
|
||||
// generates/updates a file externally (phrases.config) with all the stub values as keys that
|
||||
// can then be localized.
|
||||
public class LocStrings extends BaseLocFile implements IConfigSection
|
||||
public class LocStrings extends BaseLocFile
|
||||
{
|
||||
public static final String HeaderName = "Localized Strings";
|
||||
public static final String function = "LocStrings.stub";
|
||||
@@ -17,7 +15,7 @@ public class LocStrings extends BaseLocFile implements IConfigSection
|
||||
|
||||
public LocStrings()
|
||||
{
|
||||
super(function);
|
||||
super(HeaderName, function);
|
||||
|
||||
GlobalLog.log(LogFilter.Core, "Initializing " + this.getClass().getSimpleName());
|
||||
|
||||
@@ -41,36 +39,4 @@ public class LocStrings extends BaseLocFile implements IConfigSection
|
||||
{
|
||||
return instance.getKey(stubbedPreviously);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSectionTitle() {
|
||||
return HeaderName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void consume(List<ConfigItem> pairs) {
|
||||
scrapeAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConfigItem> produce() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getHeader() {
|
||||
// return HeaderName;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void read(String contents) {
|
||||
// updateLocFromString(contents);
|
||||
// scrapeAll();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String write() {
|
||||
// return toString();
|
||||
// }
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class ObjectBuilderFactory
|
||||
@SuppressWarnings("unused") private static LocCommands locCommands;
|
||||
|
||||
// Config
|
||||
@SuppressWarnings("unused") private static DEPRECATED_Config config;
|
||||
@SuppressWarnings("unused") private static Config config;
|
||||
|
||||
// Lazy initialization multithreaded mutex stuff to prevent explosions.
|
||||
// TODO: Investigate using 'synchronized' instead potentially
|
||||
@@ -88,7 +88,7 @@ public class ObjectBuilderFactory
|
||||
// Start by reading from things that are external. Because
|
||||
// we require these things to be resolved before the rest of the application,
|
||||
// we place them here.
|
||||
config = new DEPRECATED_Config();
|
||||
config = new Config();
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user