Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2010, Red Hat, Inc., and individual contributors
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package org.jboss.weld.bootstrap.api;
 
 import java.util.Set;
 
Requirements for various well known environments.

Author(s):
Pete Muir
 
 public enum Environments implements Environment {

    
Java EE5 or Java EE6 In this environment, Weld requires that org.jboss.weld.injection.spi.JpaInjectionServices, org.jboss.weld.injection.spi.ResourceInjectionServices and org.jboss.weld.injection.spi.EjbInjectionServices are present, and so will perform EE-style field injection on managed beans itself
 
             .addRequiredDeploymentService(SecurityServices.class)
             /*
              * EjbServices is a required bean deployment archive service in this environment.
              * For backwards compatibility with older integrators that register EjbServices
              * as a deployment service, this check is suppressed.
              *
              * @see WELD-1685
              */
             // .addRequiredBeanDeploymentArchiveService(EjbServices.class)
             .addRequiredBeanDeploymentArchiveService(EjbInjectionServices.class)),

    
Java EE5 or Java EE6 In this environment, Weld requires that org.jboss.weld.injection.spi.InjectionServices are present, and expects the container to use this callback to perform EE-style injection
 
             .addRequiredDeploymentService(SecurityServices.class)
             /*
              * EjbServices is a required bean deployment archive service in this environment.
              * For backwards compatibility with older integrators that register EjbServices
              * as a deployment service, this check is suppressed.
              *
              * @see WELD-1685
              */
             // .addRequiredBeanDeploymentArchiveService(EjbServices.class)
             .addRequiredBeanDeploymentArchiveService(InjectionServices.class)),

    
Servlet container such as Tomcat
 
             .addRequiredBeanDeploymentArchiveService(ResourceLoader.class)),

    
Java SE
 
             .addRequiredBeanDeploymentArchiveService(ResourceLoader.class));
 
     private final Set<Class<? extends Service>> requiredDeploymentServices;
 
     private final Set<Class<? extends Service>> requiredBeanDeploymentArchiveServices;
 
     private Environments(EnvironmentBuilder builder) {
         this. = builder.getRequiredDeploymentServices();
    }
    public Set<Class<? extends Service>> getRequiredDeploymentServices() {
        return ;
    }
    public Set<Class<? extends Service>> getRequiredBeanDeploymentArchiveServices() {
    }
    private static class EnvironmentBuilder {
        private final Set<Class<? extends Service>> requiredDeploymentServices;
        private final Set<Class<? extends Service>> requiredBeanDeploymentArchiveServices;
        private EnvironmentBuilder() {
            this. = new HashSet<Class<? extends Service>>();
            this. = new HashSet<Class<? extends Service>>();
        }
        private Set<Class<? extends Service>> getRequiredBeanDeploymentArchiveServices() {
            return ;
        }
        private Set<Class<? extends Service>> getRequiredDeploymentServices() {
            return ;
        }
        private EnvironmentBuilder addRequiredDeploymentService(Class<? extends Serviceservice) {
            this..add(service);
            return this;
        }
        private EnvironmentBuilder addRequiredBeanDeploymentArchiveService(Class<? extends Serviceservice) {
            this..add(service);
            return this;
        }
    }
New to GrepCode? Check out our FAQ X