Package dovetaildb.dbrepository

Examples of dovetaildb.dbrepository.FileDbRepository


      if (! headerFile.exists()) {
        error("Metadata file does not exist at "+headerFile.getPath());
      }
    } else if ("RAND_KEY".equals(createMode)) {
      if (! headerFile.exists()) {
        FileDbRepository repo = new FileDbRepository(headerFile.getPath());
        repo.initMeta();
        byte[] accesskeyBytes = new byte[24];
        new SecureRandom().nextBytes(accesskeyBytes);
        String accesskey = Base64.encodeBytes(accesskeyBytes, Base64.URL_SAFE);
        String code = "apiplugins.add(Packages.dovetaildb.api.Plugin({'wrapApiService':function(api, req){return req.getParameter(\"accesskey\")==\""+accesskey+"\" ? api : null}}))";
        System.out.println();
        System.out.println("Configuration file not found; created a new (empty) configuration at:");
        System.out.println("  "+headerFile.getPath());
        System.out.println("The _meta database has a single code file named \"lockdown.js\".");
        System.out.println("It limits access to a newly generated accesskey with this single line:");
        System.out.println("  "+code);
        System.out.println("Make a note of this accesskey.");
        System.out.println();
        repo.setCodeFile("_meta", "lockdown.js", code);
      }
    } else if ("OPEN".equals(createMode)) {
      if (! headerFile.exists()) {
        FileDbRepository repo = new FileDbRepository(headerFile.getPath());
        repo.initMeta();
        repo.force();
      }
    } else {
      error("Invalid create mode: \""+createMode+"\"");
    }
View Full Code Here

TOP

Related Classes of dovetaildb.dbrepository.FileDbRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.