uk.co.codera.ci.tooling.application.ResourceConfigurer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codera-ci-tooling-application Show documentation
Show all versions of codera-ci-tooling-application Show documentation
Reponsible for wiring together the DropWizard configuration and application. Builds the runnable jar.
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