package org.jenkinsci.plugins.radargun.config;

import java.util.List;

import org.jenkinsci.plugins.radargun.RadarGunBuilder;
import org.jenkinsci.plugins.radargun.RadarGunInstallation;
import org.kohsuke.stapler.DataBoundConstructor;

import hudson.Extension;
import jenkins.model.Jenkins;

public class RadarGunInstallationWrapper extends RadarGunInstance {

    private String radarGunName;
    //private transient RadarGunInstallation install;
    
    @DataBoundConstructor
    public RadarGunInstallationWrapper(String radarGunName) {
        if (radarGunName == null) {
            throw new IllegalArgumentException("RG installation name cannot be null");
        }
        this.radarGunName = radarGunName;
        //this.install = Jenkins.getInstance().getDescriptorByType(RadarGunBuilder.DescriptorImpl.class).getInstallation(radarGunName);
    }
    
    /*public RadarGunInstallationWrapper(RadarGunInstallation install) {
        if (install == null) {
            throw new IllegalArgumentException("RG installation cannot be null");
        }
        this.install = install;
    }
    
    public RadarGunInstallation getInsall() {
        return install;
    }*/
    
    public String getRadarGunName() {
        return radarGunName;
    }
    
    public String getName() {
        return getRadarGunName();
    }
    
    /*public String getHome() {
        return install.getHome();
    }
    
    public String getDisplayName() {
        return install.getDisplayName();
    }*/
    
    @Extension
    public static class DescriptorImpl extends RadarGunInstallationDescriptor {
        public String getDisplayName() {
            return "Pre-defined RadarGun installation";
        }
        
        public List<RadarGunInstallation> getInstallations() {
            return Jenkins.getInstance().getDescriptorByType(RadarGunBuilder.DescriptorImpl.class).getInstallations();
        }
    }
}

@@ -392,62 +392,8 @@
 me;%0A
-    //private transient RadarGunInstallation install;%0A
     
@@ -664,788 +664,162 @@
     
-    //this.install = Jenkins.getInstance().getDescriptorByType(RadarGunBuilder.DescriptorImpl.class).getInstallation(radarGunName);%0A    %7D%0A    %0A    /*public RadarGunInstallationWrapper(RadarGunInstallation install) %7B%0A        if (install == null) %7B%0A            throw new IllegalArgumentException(%22RG installation cannot be null%22);%0A        %7D%0A        this.install = install;%0A    %7D%0A    %0A    public RadarGunInstallation getInsall() %7B%0A        return install;%0A    %7D*/%0A    %0A    public String getRadarGunName() %7B%0A        return radarGunName;%0A    %7D%0A    %0A    public String getName() %7B%0A        return getRadarGunName();%0A    %7D%0A    %0A    /*public String getHome() %7B%0A        return install.getHome();%0A    %7D%0A    %0A    public String getDisplayName() %7B%0A        return install.getDisplayName();%0A    %7D*/
+%7D%0A    %0A    public String getRadarGunName() %7B%0A        return radarGunName;%0A    %7D%0A    %0A    public String getName() %7B%0A        return getRadarGunName();%0A    %7D
 %0A   

Remove unused code