Example #1
0
 /** Copies a given app archive with a given target name to the apps folder for deployment */
 private void addAppArchive(URL url, String targetFile) throws IOException {
   // copy is not atomic, copy to a temp file and rename instead (rename is atomic)
   final String tempFileName =
       new File((targetFile == null ? url.getFile() : targetFile) + ".part").getName();
   final File tempFile = new File(appsDir, tempFileName);
   FileUtils.copyURLToFile(url, tempFile);
   boolean renamed =
       tempFile.renameTo(new File(StringUtils.removeEnd(tempFile.getAbsolutePath(), ".part")));
   if (!renamed) {
     throw new IllegalStateException("Unable to add application archive");
   }
 }
Example #2
0
  private void setMuleFolders() throws IOException {
    appsDir = createFolder("apps");
    logsDir = createFolder("logs");
    pluginsDir = createFolder("plugins");
    domainsDir = createFolder("domains");

    File confDir = createFolder("conf");
    URL log4jFile = getClass().getResource("/log4j2-test.xml");
    FileUtils.copyURLToFile(log4jFile, new File(confDir, "log4j2-test.xml"));

    createFolder("lib/shared/default");
  }
Example #3
0
 public void addZippedPlugin(String resource) throws IOException, URISyntaxException {
   URL url = getClass().getClassLoader().getResource(resource).toURI().toURL();
   String baseName = FilenameUtils.getName(url.getPath());
   File tempFile = new File(getPluginsDir(), baseName);
   FileUtils.copyURLToFile(url, tempFile);
 }