示例#1
0
 public void updateJob(ApplicationInfo appInfo, CIJob job) throws PhrescoException {
   if (debugEnabled) {
     S_LOGGER.debug(
         "Entering Method ProjectAdministratorImpl.updateJob(Project project, CIJob job)");
   }
   FileWriter writer = null;
   try {
     CIJobStatus jobStatus = configureJob(job, FrameworkConstants.CI_UPDATE_JOB_COMMAND);
     if (jobStatus.getCode() == -1) {
       throw new PhrescoException(jobStatus.getMessage());
     }
     if (debugEnabled) {
       S_LOGGER.debug("getCustomModules() ProjectInfo = " + appInfo);
     }
     updateJsonJob(appInfo, job);
   } catch (ClientHandlerException ex) {
     if (debugEnabled) {
       S_LOGGER.error(ex.getLocalizedMessage());
     }
     throw new PhrescoException(ex);
   } finally {
     if (writer != null) {
       try {
         writer.close();
       } catch (IOException e) {
         if (debugEnabled) {
           S_LOGGER.error(e.getLocalizedMessage());
         }
       }
     }
   }
 }
 @Override
 public boolean saveConfigurations(ConfigurationElement configurationTreeRoot) {
   if (!mConfigurationFile.getParentFile().exists()) {
     if (!mConfigurationFile
         .getParentFile()
         .mkdirs()) { // If the File doesn't exist on disk, first create the Folders it is in
       return false;
     }
   }
   try {
     FileWriter writer = new FileWriter(mConfigurationFile);
     Gson gson = new GsonBuilder().setPrettyPrinting().create();
     writer.write(gson.toJson(convertConfigurationTreeToJsonTree(configurationTreeRoot)));
     writer.close();
   } catch (IOException e) {
     e.printStackTrace();
     return false;
   }
   return true;
 }