Renaming the gson driver to flatfile.
This commit is contained in:
parent
5e326ed672
commit
5faf1a885e
@ -4,7 +4,7 @@ import java.io.File;
|
||||
|
||||
import com.massivecraft.mcore.util.DiscUtil;
|
||||
|
||||
public class DbGson extends DbAbstract
|
||||
public class DbFlatfile extends DbAbstract
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
@ -12,14 +12,14 @@ public class DbGson extends DbAbstract
|
||||
|
||||
public File dir;
|
||||
|
||||
protected DriverGson driver;
|
||||
@Override public DriverGson getDriver() { return driver; }
|
||||
protected DriverFlatfile driver;
|
||||
@Override public DriverFlatfile getDriver() { return driver; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCTORS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public DbGson(DriverGson driver, File folder)
|
||||
public DbFlatfile(DriverFlatfile driver, File folder)
|
||||
{
|
||||
this.driver = driver;
|
||||
this.dir = folder;
|
@ -15,22 +15,22 @@ import com.massivecraft.mcore.util.DiscUtil;
|
||||
import com.massivecraft.mcore.xlib.gson.JsonElement;
|
||||
import com.massivecraft.mcore.xlib.gson.JsonParser;
|
||||
|
||||
public class DriverGson extends DriverAbstract
|
||||
public class DriverFlatfile extends DriverAbstract
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTANTS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static final String DOTJSON = ".json";
|
||||
public static final String NAME = "gson";
|
||||
public static final String NAME = "flatfile";
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static DriverGson i = new DriverGson();
|
||||
public static DriverGson get() { return i; }
|
||||
private DriverGson() { super(NAME); }
|
||||
private static DriverFlatfile i = new DriverFlatfile();
|
||||
public static DriverFlatfile get() { return i; }
|
||||
private DriverFlatfile() { super(NAME); }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
@ -39,10 +39,10 @@ public class DriverGson extends DriverAbstract
|
||||
@Override
|
||||
public Db getDb(String uri)
|
||||
{
|
||||
// "gson://" is 7 chars
|
||||
File folder = new File(uri.substring(7));
|
||||
// "flatfile://" is 8+3=11 chars
|
||||
File folder = new File(uri.substring(NAME.length() + 3));
|
||||
folder.mkdirs();
|
||||
return new DbGson(this, folder);
|
||||
return new DbFlatfile(this, folder);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,7 +50,7 @@ public class DriverGson extends DriverAbstract
|
||||
{
|
||||
Set<String> ret = new LinkedHashSet<String>();
|
||||
|
||||
for (File f : ((DbGson)db).dir.listFiles())
|
||||
for (File f : ((DbFlatfile)db).dir.listFiles())
|
||||
{
|
||||
if ( ! f.isDirectory()) continue;
|
||||
ret.add(f.getName());
|
@ -31,7 +31,7 @@ public class MStore
|
||||
static
|
||||
{
|
||||
registerDriver(DriverMongo.get());
|
||||
registerDriver(DriverGson.get());
|
||||
registerDriver(DriverFlatfile.get());
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
Loading…
Reference in New Issue
Block a user