Changeset 4380 for trunk/src/core/net
- Timestamp:
- Aug 6, 2008, 1:30:07 PM (15 years ago)
- Location:
- trunk/src/core/net/sf/basedb/core
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/Install.java
r4379 r4380 107 107 method. 108 108 */ 109 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(6 2).intValue();109 public static final int NEW_SCHEMA_VERSION = Integer.valueOf(63).intValue(); 110 110 111 111 public static synchronized void createTables(boolean update, final ProgressReporter progress) -
trunk/src/core/net/sf/basedb/core/Job.java
r4379 r4380 579 579 580 580 /** 581 Check if the job should be/was executed as a dry-run job. 582 A dry-run job is a job that does all the things a normal job would 583 do except committing the changes to the database. The dry-run job 584 may output a log file with detailed information about what should 585 have happened if it hadn't been a dry-run. 586 @since 2.8 587 */ 588 public boolean isDryRun() 589 { 590 return getData().isDryRun(); 591 } 592 593 /** 581 594 The maximum allowed length of the status message. 582 595 */ … … 1058 1071 parameters in case these has changed since the job was created 1059 1072 @throws PermissionDeniedException If the logged in user doesn't have write permission 1073 @deprecated Use {@link #retry(boolean, boolean)} instead 1060 1074 */ 1061 1075 public void retry(boolean useLatestConfiguration) 1076 throws PermissionDeniedException 1077 { 1078 retry(useLatestConfiguration, false); 1079 } 1080 1081 /** 1082 Retry a job which finished with an error or a successful dry-run job. 1083 @param useLatestConfiguration If the job should use the latest configuration 1084 parameters in case these has changed since the job was created 1085 @param clearDryRun If the job was a dry-run job, clear the dry-run flag 1086 to indicate that it should be executed for real the next time 1087 @throws PermissionDeniedException If the logged in user doesn't have write permission 1088 */ 1089 public void retry(boolean useLatestConfiguration, boolean clearDryRun) 1062 1090 throws PermissionDeniedException 1063 1091 { … … 1080 1108 } 1081 1109 } 1082 } 1110 if (clearDryRun) data.setDryRun(false); 1111 } 1112 1083 1113 1084 1114 /** … … 1629 1659 data.setServer(null); 1630 1660 data.setJobAgentId(null); 1661 data.setDryRun(response.isDryRun()); 1631 1662 data.setEstimatedExecutionTime(response.getEstimatedExecutionTime().getValue()); 1632 1663 } … … 1661 1692 dc = sc.newDbControl(); 1662 1693 Job job = Job.getById(dc, jobId); 1694 job.getData().setDryRun(response.isDryRun()); 1663 1695 1664 1696 if (response.getStatus() == Response.Status.ERROR) -
trunk/src/core/net/sf/basedb/core/PluginConfigurationRequest.java
r3679 r4380 86 86 private Job.ProgressReporterImpl progress; 87 87 private boolean allowImmediateExecution; 88 private boolean dryRun; 88 89 89 90 PluginConfigurationRequest(SessionControl sc, InteractivePlugin plugin, String command, … … 95 96 this.context = context; 96 97 this.allowImmediateExecution = allowImmediateExecution; 98 if (job != null) dryRun = job.isDryRun(); 97 99 } 98 100 … … 107 109 boolean allowImmediateDownload = allowImmediateExecution && 108 110 plugin instanceof ImmediateDownloadExporter; 109 PluginResponse pluginResponse = new PluginResponse(this, allowImmediateExecution, allowImmediateDownload );111 PluginResponse pluginResponse = new PluginResponse(this, allowImmediateExecution, allowImmediateDownload, dryRun); 110 112 Request request = new RequestImpl(allowImmediateExecution); 111 113 Response response = pluginResponse.getResponseImpl(); -
trunk/src/core/net/sf/basedb/core/PluginExecutionRequest.java
r4078 r4380 86 86 public PluginResponse invoke() 87 87 { 88 PluginResponse pluginResponse = new PluginResponse(null, false, false );88 PluginResponse pluginResponse = new PluginResponse(null, false, false, getJob().isDryRun()); 89 89 Request request = new RequestImpl(false); 90 90 Response response = pluginResponse.getResponseImpl(); -
trunk/src/core/net/sf/basedb/core/PluginResponse.java
r4379 r4380 59 59 private Job.ExecutionTime estimatedExecutionTime; 60 60 private String message; 61 private boolean dryRun; 61 62 private List<? extends Throwable> errorList; 62 63 private String nextCommand; 63 64 64 PluginResponse(PluginConfigurationRequest request, boolean allowImmediateExection, boolean allowImmediateDownload) 65 PluginResponse(PluginConfigurationRequest request, 66 boolean allowImmediateExection, boolean allowImmediateDownload, boolean dryRun) 65 67 { 66 68 this.request = request; … … 70 72 this.allowImmediateExecution = allowImmediateExection; 71 73 this.message = "A response has not been specified by the plugin"; 74 this.dryRun = dryRun; 72 75 } 73 76 … … 78 81 { 79 82 return status; 83 } 84 85 /** 86 Check if the job should be executed or was executed in 87 dry-run mode. 88 @since 2.8 89 */ 90 public boolean isDryRun() 91 { 92 return dryRun; 80 93 } 81 94 … … 136 149 137 150 /** 138 aAve all parameters that has been configured during the configuration sequence to151 Save all parameters that has been configured during the configuration sequence to 139 152 the database. 140 153 @param dc An open DbControl to use when accessing the database. … … 290 303 PluginResponse.this.errorList = errorList; 291 304 } 305 306 public void setDryRun(boolean dryRun) 307 { 308 PluginResponse.this.dryRun = dryRun; 309 } 292 310 // ------------------------------------------- 293 311 } -
trunk/src/core/net/sf/basedb/core/Update.java
r4379 r4380 712 712 </tr> 713 713 714 <tr> 715 <td>63</td> 716 <td> 717 Added: 718 <ul> 719 <li>{@link net.sf.basedb.core.data.JobData#isDryRun()}. 720 </ul> 721 The update will set the value for all existing jobs to false. 722 </td> 723 </tr> 724 714 725 </table> 715 726 … … 994 1005 } 995 1006 996 if (schemaVersion < 6 2)997 { 998 if (progress != null) progress.display((int)(6 1*progress_factor), "--Updating schema version: " + schemaVersion + " -> 62...");999 schemaVersion = setSchemaVersionInTransaction(session, 6 2);1007 if (schemaVersion < 63) 1008 { 1009 if (progress != null) progress.display((int)(62*progress_factor), "--Updating schema version: " + schemaVersion + " -> 63..."); 1010 schemaVersion = setSchemaVersionInTransaction(session, 63); 1000 1011 } 1001 1012 … … 2890 2901 HibernateUtil.executeUpdate(query); 2891 2902 } 2903 2904 if (schemaVersion < 63) 2905 { 2906 // Set dryRun = false on all jobs 2907 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, 2908 "SET_DRYRUN_ON_JOBS"); 2909 /* 2910 UPDATE JobData job 2911 SET job.dryRun = false 2912 WHERE job.dryRun IS NULL 2913 */ 2914 HibernateUtil.executeUpdate(query); 2915 } 2892 2916 2893 2917 // Commit the changes -
trunk/src/core/net/sf/basedb/core/data/JobData.java
r4379 r4380 230 230 } 231 231 232 private boolean dryRun; 233 /** 234 If the job should be/was executed as a dry-run job. 235 @hibernate.property column="`dry_run`" type="boolean" not-null="true" 236 */ 237 public boolean isDryRun() 238 { 239 return dryRun; 240 } 241 public void setDryRun(boolean dryRun) 242 { 243 this.dryRun = dryRun; 244 } 245 232 246 /** 233 247 The maximum allowed length of the status message. -
trunk/src/core/net/sf/basedb/core/plugin/Response.java
r4023 r4380 122 122 123 123 /** 124 A plug-in may call this method in it's configuration phase or 125 after it has been executed to indicate that the job should be 126 or was executed as a dry-run job. A dry-run job is a job that 127 does all the things a normal job would do except committing the 128 changes to the database. The dry-run job may output a 129 log file with detailed information about what should have happened 130 if it hadn't been a dry-run. 131 <p> 132 NOTE! Setting this value to true doesn't change the behaviour 133 of the core. It is the responsibility of the plug-in to check 134 this value(eg. {@link Job#isDryRun()} and take appropriate action. 135 136 @param dryRun TRUE to indicate that the job should be or was 137 executed as a dry-run 138 @since 2.8 139 */ 140 public void setDryRun(boolean dryRun); 141 142 /** 124 143 This will end the job execution or configuration and report it as a 125 144 failure. If in a configuration sequence the client application may try
Note: See TracChangeset
for help on using the changeset viewer.