// Path: src/main/java/hudson/plugins/disk_usage/project/DiskUsagePostBuildCalculation.java
// public class DiskUsagePostBuildCalculation extends Recorder{
//     
//     public DiskUsagePostBuildCalculation(){
//     }
//     
//     @Override
//       public boolean perform(Build<?, ?> build, Launcher launcher, BuildListener listener){
//         listener.getLogger().println("append disk usage");
//           DiskUsageUtil.calculationDiskUsageOfBuild(build, listener);
//           DiskUsageJenkinsAction.getInstance().actualizeCashedBuildsData();
//           return true;
//       }
//     
//     
// 
//     @Override
//     public BuildStepMonitor getRequiredMonitorService() {
//         return BuildStepMonitor.NONE;
//     }
//     
//     
//     @Extension
//     public static class DescriptorImpl extends BuildStepDescriptor<Publisher> {
//         public String getDisplayName() {
//             return "Calculate disk usage of build";
//         }
// 
//         @Override
//         public DiskUsagePostBuildCalculation newInstance(StaplerRequest req, JSONObject formData) throws FormException {
//             return new DiskUsagePostBuildCalculation();
//         }
// 
//         @Override
//         public boolean isApplicable(Class<? extends AbstractProject> jobType) {
//             return true;
//         }
//     }
//     
// }


import hudson.Extension;
import hudson.model.AbstractBuild;
import hudson.model.TaskListener;
import hudson.model.listeners.RunListener;
import hudson.plugins.disk_usage.project.DiskUsagePostBuildCalculation;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
package hudson.plugins.disk_usage;


/**
 * Build listener for calculation build disk usage
 * 
 * @author Lucie Votypkova
 */
@Extension
public class DiskUsageBuildListener extends RunListener<AbstractBuild>{
    
    @Override
    public void onCompleted(AbstractBuild build, TaskListener listener){
        Long diskUsage = build.getAction(BuildDiskUsageAction.class).getDiskUsage();
// Path: src/main/java/hudson/plugins/disk_usage/project/DiskUsagePostBuildCalculation.java
// public class DiskUsagePostBuildCalculation extends Recorder{
//     
//     public DiskUsagePostBuildCalculation(){
//     }
//     
//     @Override
//       public boolean perform(Build<?, ?> build, Launcher launcher, BuildListener listener){
//         listener.getLogger().println("append disk usage");
//           DiskUsageUtil.calculationDiskUsageOfBuild(build, listener);
//           DiskUsageJenkinsAction.getInstance().actualizeCashedBuildsData();
//           return true;
//       }
//     
//     
// 
//     @Override
//     public BuildStepMonitor getRequiredMonitorService() {
//         return BuildStepMonitor.NONE;
//     }
//     
//     
//     @Extension
//     public static class DescriptorImpl extends BuildStepDescriptor<Publisher> {
//         public String getDisplayName() {
//             return "Calculate disk usage of build";
//         }
// 
//         @Override
//         public DiskUsagePostBuildCalculation newInstance(StaplerRequest req, JSONObject formData) throws FormException {
//             return new DiskUsagePostBuildCalculation();
//         }
// 
//         @Override
//         public boolean isApplicable(Class<? extends AbstractProject> jobType) {
//             return true;
//         }
//     }
//     
// }


// Path: src/main/java/hudson/plugins/disk_usage/DiskUsageBuildListener.java
import hudson.Extension;
import hudson.model.AbstractBuild;
import hudson.model.TaskListener;
import hudson.model.listeners.RunListener;
import hudson.plugins.disk_usage.project.DiskUsagePostBuildCalculation;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

package hudson.plugins.disk_usage;


/**
 * Build listener for calculation build disk usage
 * 
 * @author Lucie Votypkova
 */
@Extension
public class DiskUsageBuildListener extends RunListener<AbstractBuild>{
    
    @Override
    public void onCompleted(AbstractBuild build, TaskListener listener){
        Long diskUsage = build.getAction(BuildDiskUsageAction.class).getDiskUsage();
            if(build.getProject().getPublishersList().get(DiskUsagePostBuildCalculation.class)==null || diskUsage==0){