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

uk.co.codera.ci.tooling.application.ResourceConfigurer Maven / Gradle / Ivy

Go to download

Reponsible for wiring together the DropWizard configuration and application. Builds the runnable jar.

There is a newer version: 0.2.4
Show newest version
package uk.co.codera.ci.tooling.application;

import io.dropwizard.jersey.setup.JerseyEnvironment;
import uk.co.codera.ci.tooling.api.github.GitHubResource;
import uk.co.codera.ci.tooling.git.GitEventListener;
import uk.co.codera.ci.tooling.git.GitPushEventAdapter;
import uk.co.codera.ci.tooling.scm.ScmEventListener;

public class ResourceConfigurer {

    public static void configure(JerseyEnvironment jerseyEnvironment, CiToolingConfiguration configuration, ScmEventListener scmEventListener) {
        GitEventListener gitEventListener = new GitEventListener(new GitPushEventAdapter(), scmEventListener);

        jerseyEnvironment.register(gitHubResource(gitEventListener));

        if (configuration.isBitBucketConfigured()) {
            jerseyEnvironment.register(BitBucketResourceFactory.create(configuration.getBitBucket(), gitEventListener));
        }

        if (configuration.isSvnConfigured()) {
            jerseyEnvironment.register(SvnResourceFactory.create(configuration.getSvn(), scmEventListener));
        }
    }

    private static GitHubResource gitHubResource(GitEventListener gitEventBroadcaster) {
        return new GitHubResource(new uk.co.codera.ci.tooling.api.github.GitPushEventAdapter(), gitEventBroadcaster);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy