Package net.kuujo.vertigo.platform

Examples of net.kuujo.vertigo.platform.PlatformManagerException


        File modDir = locateModule(modID);
        if (modDir != null) {
          File modJson = new File(modDir, MOD_JSON_FILE);
          return loadModuleInfo(modID, modJson);
        } else {
          throw new PlatformManagerException("Invalid module.");
        }
      }
    }, resultHandler);
    return this;
  }
View Full Code Here


    context.execute(new Action<Void>() {
      @Override
      public Void perform() {
        File file = new File(zipFile);
        if (!file.exists()) {
          throw new PlatformManagerException("File does not exist.");
        }
        installModule(file);
        return null;
      }
    }, doneHandler);
View Full Code Here

   */
  private JsonObject loadModuleConfig(ModuleIdentifier modID, File modJsonFile) {
    try (@SuppressWarnings("resource") Scanner scanner = new Scanner(modJsonFile, "UTF-8").useDelimiter("\\A")) {
      return new JsonObject(scanner.next());
    } catch (FileNotFoundException e) {
      throw new PlatformManagerException("Module " + modID + " does not contains a mod.json file");
    } catch (NoSuchElementException e) {
      throw new PlatformManagerException("Module " + modID + " contains an empty mod.json");
    } catch (DecodeException e) {
      throw new PlatformManagerException("Module " + modID + " mod.json contains invalid json");
    }
  }
View Full Code Here

    // access from any node to which the module goes.
    if (!mods.isEmpty()) {
      File internalModsDir = new File(modDir, "mods");
      if (!internalModsDir.exists()) {
        if (!internalModsDir.mkdir()) {
          throw new PlatformManagerException("Failed to create directory " + internalModsDir);
        }
      }

      for (String moduleName : mods) {
        File internalModDir = new File(internalModsDir, moduleName);
View Full Code Here

   * Creates a zip file from a module.
   */
  private File zipModule(ModuleIdentifier modID) {
    File modDir = new File(modRoot, modID.toString());
    if (!modDir.exists()) {
      throw new PlatformManagerException("Cannot find module");
    }

    // Create a temporary directory in which to store the module and its dependencies.
    File modRoot = new File(TEMP_DIR, "vertx-zip-mods");

View Full Code Here

  private void zipDirectory(String zipFile, String dirToZip) {
    File directory = new File(dirToZip);
    try (ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(zipFile))) {
      addDirectoryToZip(directory, directory, stream);
    } catch (Exception e) {
      throw new PlatformManagerException("Failed to zip module", e);
    }
  }
View Full Code Here

        if (!entryName.isEmpty()) {
          if (entry.isDirectory()) {
            File dir = new File(directory, entryName);
            if (!dir.exists()) {
              if (!new File(directory, entryName).mkdir()) {
                throw new PlatformManagerException("Failed to create directory");
              }
            }
          } else {
            int count;
            byte[] buffer = new byte[BUFFER_SIZE];
            BufferedOutputStream out = null;
            try {
              OutputStream os = new FileOutputStream(new File(directory, entryName));
              out = new BufferedOutputStream(os, BUFFER_SIZE);
              while ((count = zin.read(buffer, 0, BUFFER_SIZE)) != -1) {
                out.write(buffer, 0, count);
              }
              out.flush();
            } finally {
              if (out != null) {
                out.close();
              }
            }
          }
        }
      }
    } catch (Exception e) {
      throw new PlatformManagerException("Failed to unzip module", e);
    } finally {
      if (deleteZip) {
        zipFile.delete();
      }
    }
View Full Code Here

TOP

Related Classes of net.kuujo.vertigo.platform.PlatformManagerException

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.