コード例 #1
0
ファイル: Deploy.java プロジェクト: photon-infotech/plugins
 private void deploysolution(
     String protocol, String serverContext, String host, String port, String wspFile)
     throws MojoExecutionException {
   BufferedReader bufferedReader = null;
   boolean errorParam = false;
   try {
     StringBuilder sb = new StringBuilder();
     sb.append(SHAREPOINT_STSADM);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_STR_O);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_DEPLOYSOLUTION);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_STR_HYPEN);
     sb.append(SHAREPOINT_STR_NAME);
     sb.append(STR_SPACE);
     sb.append(wspFile);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_STR_HYPEN);
     sb.append(SHAREPOINT_STR_URL);
     sb.append(STR_SPACE);
     sb.append(protocol);
     sb.append(SHAREPOINT_STR_COLON);
     sb.append(SHAREPOINT_STR_DOUBLESLASH);
     sb.append(host);
     sb.append(SHAREPOINT_STR_COLON);
     sb.append(port);
     sb.append(SHAREPOINT_STR_BACKSLASH);
     sb.append(serverContext);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_STR_HYPEN);
     sb.append(SHAREPOINT_STR_IMMEDIATE);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_STR_HYPEN);
     sb.append(SHAREPOINT_STR_ALLOWACDEP);
     log.info("Deploy solution " + sb.toString());
     bufferedReader = Utility.executeCommand(sb.toString(), baseDir.getPath());
     String line = null;
     while ((line = bufferedReader.readLine()) != null) {
       if (line.startsWith("[ERROR]")) {
         errorParam = true;
       }
     }
     if (errorParam) {
       throw new MojoExecutionException("Deploying solution Failed ...");
     }
   } catch (IOException e) {
     throw new MojoExecutionException(e.getMessage(), e);
   } finally {
     Utility.closeStream(bufferedReader);
   }
 }
コード例 #2
0
ファイル: Deploy.java プロジェクト: photon-infotech/plugins
 private void restore(String protocol, String serverContext, String host, String port)
     throws MojoExecutionException {
   BufferedReader bufferedReader = null;
   boolean errorParam = false;
   try {
     File file = new File(build.getPath() + "\\phresco-pilot.dat");
     if (!file.exists()) {
       return;
     }
     StringBuilder sb = new StringBuilder();
     sb.append(SHAREPOINT_STSADM);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_STR_O);
     sb.append(SHAREPOINT_RESTORE);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_STR_URL);
     sb.append(STR_SPACE);
     sb.append(protocol);
     sb.append(SHAREPOINT_STR_COLON);
     sb.append(SHAREPOINT_STR_DOUBLESLASH);
     sb.append(host);
     sb.append(SHAREPOINT_STR_COLON);
     sb.append(port);
     sb.append(SHAREPOINT_STR_BACKSLASH);
     sb.append(serverContext);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_STR_HYPEN);
     sb.append(SHAREPOINT_STR_OVERWRITE);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_STR_HYPEN);
     sb.append(SHAREPOINT_STR_FILENAME);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_STR_DOUBLEQUOTES + file + SHAREPOINT_STR_DOUBLEQUOTES);
     log.info("Restore command " + sb.toString());
     bufferedReader = Utility.executeCommand(sb.toString(), baseDir.getPath());
     String line = null;
     while ((line = bufferedReader.readLine()) != null) {
       if (line.startsWith("[ERROR]")) {
         System.out.println(
             line); // do not use getLog() here as this line already contains the log type.
         errorParam = true;
       }
     }
     if (errorParam) {
       throw new MojoExecutionException("Restore Failed ...");
     }
   } catch (IOException e) {
     throw new MojoExecutionException(e.getMessage(), e);
   } finally {
     Utility.closeStream(bufferedReader);
   }
 }
コード例 #3
0
ファイル: Deploy.java プロジェクト: photon-infotech/plugins
 private void addSolution(String wspFile) throws MojoExecutionException {
   BufferedReader bufferedReader = null;
   boolean errorParam = false;
   try {
     StringBuilder sb = new StringBuilder();
     sb.append(SHAREPOINT_STSADM);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_STR_O);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_ADDSOLUTION);
     sb.append(STR_SPACE);
     sb.append(SHAREPOINT_STR_HYPEN);
     sb.append(SHAREPOINT_STR_FILENAME);
     sb.append(STR_SPACE);
     sb.append(
         SHAREPOINT_STR_DOUBLEQUOTES
             + baseDir.getPath()
             + "\\source"
             + "\\"
             + wspFile
             + SHAREPOINT_STR_DOUBLEQUOTES);
     File file = new File(baseDir.getPath() + "\\source" + "\\" + wspFile);
     log.info("Add soluition file " + file);
     if (file.exists()) {
       log.info("Add Solution command " + sb.toString());
       bufferedReader = Utility.executeCommand(sb.toString(), baseDir.getPath());
       String line = null;
       while ((line = bufferedReader.readLine()) != null) {
         if (line.startsWith("[ERROR]")) {
           System.out.println(
               line); // do not use getLog() here as this line already contains the log type.
           errorParam = true;
         }
       }
       if (errorParam) {
         throw new MojoExecutionException("Adding of Solution Failed ...");
       }
     } else {
       log.error("File Not found Exception");
     }
   } catch (IOException e) {
     throw new MojoExecutionException(e.getMessage(), e);
   } finally {
     Utility.closeStream(bufferedReader);
   }
 }