Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package io.dropwizard.setup;
  
 
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
 // TODO: 5/15/13 <coda> -- add tests for Environment
 
A Dropwizard application's environment.
 
 public class Environment {
     private final String name;
     private final MetricRegistry metricRegistry;
     private final HealthCheckRegistry healthCheckRegistry;
 
     private final ObjectMapper objectMapper;
     private Validator validator;
 
     private final JerseyEnvironment jerseyEnvironment;
 
     private final ServletEnvironment servletEnvironment;
 
     private final LifecycleEnvironment lifecycleEnvironment;
 
     private final MutableServletContextHandler adminContext;
     private final AdminEnvironment adminEnvironment;

    
Creates a new environment.

Parameters:
name the name of the application
objectMapper the com.fasterxml.jackson.databind.ObjectMapper for the application
 
     public Environment(String name,
                        ObjectMapper objectMapper,
                        Validator validator,
                        MetricRegistry metricRegistry,
                        ClassLoader classLoader) {
         this. = name;
         this. = objectMapper;
         this. = metricRegistry;
         this. = new HealthCheckRegistry();
         this. = validator;
 
         this. = new MutableServletContextHandler();
         .setClassLoader(classLoader);
         this. = new ServletEnvironment();
 
         this. = new MutableServletContextHandler();
         .setClassLoader(classLoader);
         this. = new AdminEnvironment(metricRegistry);
 
         this. = new LifecycleEnvironment();
 
         final DropwizardResourceConfig jerseyConfig = new DropwizardResourceConfig(metricRegistry);
 
         this. = new JerseyContainerHolder(new ServletContainer(jerseyConfig));
         this. = new JerseyEnvironment(jerseyConfig);
     }

    
 
     public JerseyEnvironment jersey() {
         return ;
     }

    
Returns the application's AdminEnvironment.
 
     public AdminEnvironment admin() {
         return ;
     }

    
 
     public LifecycleEnvironment lifecycle() {
         return ;
     }

    
 
    public ServletEnvironment servlets() {
        return ;
    }

    
Returns the application's com.fasterxml.jackson.databind.ObjectMapper.
    public ObjectMapper getObjectMapper() {
        return ;
    }

    
Returns the application's name.
    public String getName() {
        return ;
    }

    
Returns the application's javax.validation.Validator.
    public Validator getValidator() {
        return ;
    }

    
Sets the application's javax.validation.Validator.
    public void setValidator(Validator validator) {
        this. = checkNotNull(validator);
    }

    
Returns the application's com.codahale.metrics.MetricRegistry.
    public MetricRegistry metrics() {
        return ;
    }

    
    public HealthCheckRegistry healthChecks() {
        return ;
    }
    /*
    * Internal Accessors
    */
    // TODO: 5/4/13 <coda> -- figure out how to make these accessors not a public API
        return ;
    }
        return .getContainer();
    }
        return ;
    }
New to GrepCode? Check out our FAQ X