@@ -0,0 +1,2877 @@
+package hudson.plugins.scm.koji;%0A%0Aimport hudson.Extension;%0Aimport hudson.model.Describable;%0Aimport hudson.model.Descriptor;%0Aimport hudson.util.FormValidation;%0Aimport jenkins.model.Jenkins;%0Aimport org.fakekoji.xmlrpc.server.JavaServerConstants;%0Aimport org.kohsuke.stapler.DataBoundConstructor;%0Aimport org.kohsuke.stapler.QueryParameter;%0A%0Aimport javax.annotation.Nonnull;%0Aimport java.io.Serializable;%0Aimport java.net.MalformedURLException;%0Aimport java.net.URL;%0A%0Apublic class KojiBuildProvider implements Describable%3CKojiBuildProvider%3E, Serializable %7B%0A%0A    private final String topUrl;%0A    private final String downloadUrl;%0A%0A    @DataBoundConstructor%0A    public KojiBuildProvider(String topUrl, String downloadUrl) %7B%0A        this.topUrl = topUrl;%0A        this.downloadUrl = downloadUrl;%0A    %7D%0A%0A    @SuppressWarnings(%22unchecked%22)%0A    @Override%0A    public Descriptor%3CKojiBuildProvider%3E getDescriptor() %7B%0A        return Jenkins.getActiveInstance().getDescriptorOrDie(getClass());%0A    %7D%0A%0A    public String getTopUrl() %7B%0A        return replaceXPort(topUrl);%0A    %7D%0A%0A    public String getDownloadUrl() %7B%0A        return replaceDPORT(downloadUrl);%0A    %7D%0A%0A    private static String replaceDPORT(String url) %7B%0A        return url.replace(%0A                %22:%22 + JavaServerConstants.dPortAxiom,%0A                %22:%22 + JavaServerConstants.DFAULT_DWNLD_PORT%0A        );%0A    %7D%0A%0A    private static String replaceXPort(String url) %7B%0A        return url.replace(%0A                %22:%22 + JavaServerConstants.xPortAxiom,%0A                %22:%22 + JavaServerConstants.DFAULT_RP2C_PORT%0A        );%0A    %7D%0A%0A    @Extension%0A    public static final class KojiBuildProviderDescriptor extends Descriptor%3CKojiBuildProvider%3E %7B%0A%0A        private static final String SUPPORTED_PROTOCOL = %22HTTP%22;%0A        private static final String URL_INVALID = %22The URL is invalid%22;%0A        private static final String PROTOCOL_NOT_SUPPORTED = %22Only %22 + SUPPORTED_PROTOCOL + %22 protocol is supported%22;%0A%0A        @Nonnull%0A        @Override%0A        public String getDisplayName() %7B%0A            return %22Koji build provider%22;%0A        %7D%0A%0A        FormValidation doCheckTopUrl(@QueryParameter String value) %7B%0A            try %7B%0A                new URL(replaceXPort(value));%0A            %7D catch (MalformedURLException e) %7B%0A                return FormValidation.error(URL_INVALID);%0A            %7D%0A            return FormValidation.ok();%0A        %7D%0A%0A        FormValidation doCheckDownloadUrl(@QueryParameter String value) %7B%0A            try %7B%0A                final URL url = new URL(replaceDPORT(value));%0A                if (!url.getProtocol().equals(SUPPORTED_PROTOCOL.toLowerCase())) %7B%0A                    return FormValidation.error(PROTOCOL_NOT_SUPPORTED);%0A                %7D%0A            %7D catch (MalformedURLException e) %7B%0A                return FormValidation.error(URL_INVALID);%0A            %7D%0A            return FormValidation.ok();%0A        %7D%0A    %7D%0A%7D%0A

Create KojiBuildProvider to represent only one koji provider with top and download URL