Example #1
0
 private void extractBuild() throws MojoExecutionException {
   try {
     ArchiveUtil.extractArchive(buildFile.getPath(), targetDir.getPath(), ArchiveType.ZIP);
   } catch (PhrescoException e) {
     throw new MojoExecutionException(e.getErrorMessage(), e);
   }
 }
Example #2
0
  private void saveFile(String tech) throws PhrescoException {
    try {
      InputStream inputStream = null;
      URL url = new URL(getRepositoryUrl() + tech);
      URLConnection connection = url.openConnection();
      inputStream = connection.getInputStream();
      int index = tech.lastIndexOf(SEPERATOR);
      String fileName = tech.substring(index + 1);
      File imageFile = new File(BACK_FOLDER + WEB_APPS_FOLDER + serverContext + IMAGES_FOLDER);
      if (!imageFile.exists()) {
        imageFile.mkdirs();
      }
      FileOutputStream fileOutputStream = null;
      File archiveFile = new File(imageFile, fileName);
      fileOutputStream = new FileOutputStream(archiveFile);
      try {
        byte[] data = new byte[1024];
        int i = 0;
        while ((i = inputStream.read(data)) != -1) {
          fileOutputStream.write(data, 0, i);
        }
        fileOutputStream.flush();
        ArchiveUtil.extractArchive(archiveFile.getPath(), imageFile.getPath(), ArchiveType.ZIP);
      } finally {
        Utility.closeStream(inputStream);
        Utility.closeStream(fileOutputStream);
        archiveFile.delete();
      }
    } catch (Exception e) {
      throw new PhrescoException(e);
    } finally {

    }
  }
Example #3
0
 private void extractBuild() throws MojoExecutionException {
   try {
     String context = "";
     List<com.photon.phresco.configuration.Configuration> configuration =
         pUtil.getConfiguration(baseDir, environmentName, Constants.SETTINGS_TEMPLATE_SERVER);
     for (com.photon.phresco.configuration.Configuration config : configuration) {
       context = config.getProperties().getProperty(Constants.SERVER_CONTEXT);
       break;
     }
     tempDir = new File(buildDir.getPath() + TEMP_DIR + File.separator + context);
     tempDir.mkdirs();
     ArchiveUtil.extractArchive(buildFile.getPath(), tempDir.getPath(), ArchiveType.ZIP);
   } catch (PhrescoException e) {
     throw new MojoExecutionException(e.getErrorMessage(), e);
   }
 }
Example #4
0
  private void extractBuild() throws MojoExecutionException {
    try {
      ArchiveUtil.extractArchive(buildFile.getPath(), tempDir.getPath(), ArchiveType.ZIP);

      String tempDirPath = tempDir.getPath();
      File directory = new File(tempDirPath);
      String[] wspFiles =
          directory.list(
              new FilenameFilter() {
                public boolean accept(File directory, String fileName) {
                  return fileName.endsWith(".wsp");
                }
              });
      wspFile = wspFiles[0];
      temp = new File(tempDir.getPath() + "\\" + wspFile);

      FileUtils.copyFileToDirectory(temp, build);
      FileUtils.deleteDirectory(tempDir);
    } catch (PhrescoException e) {
      throw new MojoExecutionException(e.getErrorMessage(), e);
    } catch (IOException e) {
      throw new MojoExecutionException(e.getMessage(), e);
    }
  }