// Path: ratelimitj-dropwizard/src/main/java/es/moki/ratelimij/dropwizard/filter/RateLimited429EnforcerFeature.java
// @Provider
// public class RateLimited429EnforcerFeature implements DynamicFeature {
// 
//     @Override
//     public void configure(final ResourceInfo resourceInfo,
//                           final FeatureContext context) {
// 
//         final AnnotatedMethod method = new AnnotatedMethod(resourceInfo.getResourceMethod());
//         final RateLimited rateLimited = method.getAnnotation(RateLimited.class);
// 
//         if (null != rateLimited) {
//             context.register(RateLimit429EnforcerFilter.class);
//         }
//     }
// }
// 
// Path: ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestRateLimiterFactory.java
// public interface RequestRateLimiterFactory extends Closeable {
// 
//     RequestRateLimiter getInstance(Set<RequestLimitRule> rules);
// 
//     ReactiveRequestRateLimiter getInstanceReactive(Set<RequestLimitRule> rules);
// }


import es.moki.ratelimij.dropwizard.filter.RateLimited429EnforcerFeature;
import es.moki.ratelimitj.core.limiter.request.RequestRateLimiterFactory;
import io.dropwizard.Configuration;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import static java.util.Objects.requireNonNull;
package es.moki.ratelimij.dropwizard;



public class RateLimitBundle implements ConfiguredBundle<Configuration> {

    private final RequestRateLimiterFactory requestRateLimiterFactory;

    public RateLimitBundle(RequestRateLimiterFactory requestRateLimiterFactory) {
        this.requestRateLimiterFactory = requireNonNull(requestRateLimiterFactory);
    }

    @Override
    public void initialize(Bootstrap<?> bootstrap) {
    }

    @Override
    public void run(final Configuration configuration, final Environment environment) {
        environment.jersey().register(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(requestRateLimiterFactory).to(RequestRateLimiterFactory.class);
            }
// Path: ratelimitj-dropwizard/src/main/java/es/moki/ratelimij/dropwizard/filter/RateLimited429EnforcerFeature.java
// @Provider
// public class RateLimited429EnforcerFeature implements DynamicFeature {
// 
//     @Override
//     public void configure(final ResourceInfo resourceInfo,
//                           final FeatureContext context) {
// 
//         final AnnotatedMethod method = new AnnotatedMethod(resourceInfo.getResourceMethod());
//         final RateLimited rateLimited = method.getAnnotation(RateLimited.class);
// 
//         if (null != rateLimited) {
//             context.register(RateLimit429EnforcerFilter.class);
//         }
//     }
// }
// 
// Path: ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestRateLimiterFactory.java
// public interface RequestRateLimiterFactory extends Closeable {
// 
//     RequestRateLimiter getInstance(Set<RequestLimitRule> rules);
// 
//     ReactiveRequestRateLimiter getInstanceReactive(Set<RequestLimitRule> rules);
// }


// Path: ratelimitj-dropwizard/src/main/java/es/moki/ratelimij/dropwizard/RateLimitBundle.java
import es.moki.ratelimij.dropwizard.filter.RateLimited429EnforcerFeature;
import es.moki.ratelimitj.core.limiter.request.RequestRateLimiterFactory;
import io.dropwizard.Configuration;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.lifecycle.Managed;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import static java.util.Objects.requireNonNull;

package es.moki.ratelimij.dropwizard;



public class RateLimitBundle implements ConfiguredBundle<Configuration> {

    private final RequestRateLimiterFactory requestRateLimiterFactory;

    public RateLimitBundle(RequestRateLimiterFactory requestRateLimiterFactory) {
        this.requestRateLimiterFactory = requireNonNull(requestRateLimiterFactory);
    }

    @Override
    public void initialize(Bootstrap<?> bootstrap) {
    }

    @Override
    public void run(final Configuration configuration, final Environment environment) {
        environment.jersey().register(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(requestRateLimiterFactory).to(RequestRateLimiterFactory.class);
            }
        });