All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uk.co.codera.ci.tooling.jenkins.JenkinsCommand Maven / Gradle / Ivy

The newest version!
package uk.co.codera.ci.tooling.jenkins;

public abstract class JenkinsCommand {

    private final JenkinsConnectionDetails jenkinsConfiguration;

    protected JenkinsCommand(Builder builder) {
        this.jenkinsConfiguration = builder.jenkinsConfiguration;
    }

    public abstract String getName();

    public String[] getArguments() {
        return new String[] { "-s", this.jenkinsConfiguration.getServerUrl(), getName() };
    }

    public void execute(JenkinsCommandLineInterfaceInvoker cliInvoker) {
        cliInvoker.invoke(getArguments());
    }

    @SuppressWarnings("unchecked")
    public abstract static class Builder {
        private JenkinsConnectionDetails jenkinsConfiguration;

        public T with(JenkinsConnectionDetails jenkinsConfiguration) {
            this.jenkinsConfiguration = jenkinsConfiguration;
            return (T) this;
        }

        public abstract C build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy