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