Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2012, 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.events;
 
 import java.util.List;
 import java.util.Set;
 
 
 
 
     private boolean everythingObserved;
     private boolean processAnnotatedTypeObserved;
     private boolean processBeanObserved;
     private boolean processBeanAttributesObserved;
     private boolean processInjectionPointObserved;
     private boolean processInjectionTargetObserved;
     private boolean processProducerObserved;
     private boolean processObserverMethodObserved;
     private final RequiredAnnotationDiscovery discovery;
 
     private final ContainerLifecycleEventPreloader preloader;
 
         this. = preloader;
         this. = discovery;
     }
 
     public void processObserverMethod(ObserverMethod<?> observer) {
         if (observer instanceof ExtensionObserverMethodImpl<?, ?>) {
             processObserverMethodType(observer.getObservedType());
         }
     }
 
     protected void processObserverMethodType(Type observedType) {
         if () {
             return;
         }
 
         Class<?> rawType = Reflections.getRawType(observedType);
         if (Object.class.equals(rawType)) {
             this. = true;
             this. = true;
             this. = true;
             this. = true;
             this. = true;
             this. = true;
             this. = true;
             this. = true;
        } else if (! && ProcessAnnotatedType.class.isAssignableFrom(rawType)) {
             = true;
        } else if (! && ProcessBean.class.isAssignableFrom(rawType)) {
             = true;
        } else if (! && ProcessBeanAttributes.class.isAssignableFrom(rawType)) {
             = true;
        } else if (! && ProcessObserverMethod.class.isAssignableFrom(rawType)) {
             = true;
        } else if (! && ProcessProducer.class.equals(rawType)) {
             = true;
        } else if (! && ProcessInjectionTarget.class.equals(rawType)) {
             = true;
        } else if (! && ProcessInjectionPoint.class.equals(rawType)) {
             = true;
        }
    }
    public boolean isProcessAnnotatedTypeObserved() {
        return ;
    }
    public boolean isProcessBeanObserved() {
        return ;
    }
    public boolean isProcessBeanAttributesObserved() {
        return ;
    }
    public boolean isProcessObserverMethodObserved() {
        return ;
    }
    public boolean isProcessProducerObserved() {
        return ;
    }
    public boolean isProcessInjectionTargetObserved() {
        return ;
    }
    public boolean isProcessInjectionPointObserved() {
        return ;
    }
    public <T> ProcessAnnotatedTypeImpl<T> fireProcessAnnotatedType(BeanManagerImpl beanManagerSlimAnnotatedTypeContext<T> annotatedTypeContext) {
        if (!isProcessAnnotatedTypeObserved()) {
            return null;
        }
        final Set<ExtensionObserverMethodImpl<?, ?>> observers = annotatedTypeContext.getResolvedProcessAnnotatedTypeObservers();
        final SlimAnnotatedType<T> annotatedType = annotatedTypeContext.getAnnotatedType();
        // if the fast resolver resolved an empty set of observer methods, skip this event
        if (observers != null && observers.isEmpty()) {
            ..patSkipped(annotatedType);
            return null;
        }
        ProcessAnnotatedTypeImpl<T> event = null;
        if (annotatedTypeContext.getExtension() == null) {
            event = new ProcessAnnotatedTypeImpl<T>(beanManagerannotatedType);
        } else {
            event = new ProcessSyntheticAnnotatedTypeImpl<T>(beanManagerannotatedTypeContext);
        }
        if (observers == null) {
            ..patDefaultResolver(annotatedType);
            fireProcessAnnotatedType(eventbeanManager);
        } else {
            ..patFastResolver(annotatedType);
            fireProcessAnnotatedType(eventannotatedTypeContext.getResolvedProcessAnnotatedTypeObservers());
        }
        return event;
    }

    
    private void fireProcessAnnotatedType(ProcessAnnotatedTypeImpl<?> eventBeanManagerImpl beanManager) {
        final Resolvable resolvable = ProcessAnnotatedTypeEventResolvable.of(event);
        try {
            beanManager.getGlobalLenientObserverNotifier().fireEvent(eventresolvable);
        } catch (Exception e) {
            throw new DefinitionException(e);
        }
    }

    
Fires a ProcessAnnotatedType. Instead of using the default event dispatching mechanism, this method directly notifies extension observers resolved by FastProcessAnnotatedTypeResolver.
    @SuppressWarnings({ "rawtypes""unchecked" })
    private void fireProcessAnnotatedType(ProcessAnnotatedTypeImpl<?> eventSet<ExtensionObserverMethodImpl<?, ?>> observers) {
        List<Throwableerrors = new LinkedList<Throwable>();
        for (ExtensionObserverMethodImpl observer : observers) {
            // FastProcessAnnotatedTypeResolver does not consider special scope inheritance rules (see CDI - section 4.1)
            if (checkScopeInheritanceRules(event.getOriginalAnnotatedType(), observer)) {
                try {
                    observer.notify(event);
                } catch (Throwable e) {
                    errors.add(e);
                }
            }
        }
        if (!errors.isEmpty()) {
            throw new DefinitionException(errors);
        }
    }
    private boolean checkScopeInheritanceRules(SlimAnnotatedType<?> typeExtensionObserverMethodImpl<?, ?> observer) {
        Collection<Class<? extends Annotation>> scopes = observer.getRequiredScopeAnnotations();
        if (!scopes.isEmpty() && scopes.size() == observer.getRequiredScopeAnnotations().size()) {
            // this check only works if only scope annotations are listed within @WithAnnotations
            // performing a complete check would be way too expensive - eliminating the benefit of ClassFileServices
            for (Class<? extends Annotationannotation : scopes) {
                if (type.isAnnotationPresent(annotation)) {
                    return true;
                }
            }
            return false;
        }
        return true;
    }
    public void fireProcessBean(BeanManagerImpl beanManagerBean<?> bean) {
        if (isProcessBeanObserved()) {
            if (bean instanceof ManagedBean<?>) {
                ProcessManagedBeanImpl.fire(beanManager, (ManagedBean<?>) bean);
            } else if (bean instanceof SessionBean<?>) {
                ProcessSessionBeanImpl.fire(beanManager, Reflections.<SessionBean<Object>> cast(bean));
            } else if (bean instanceof ProducerField<?, ?>) {
                ProcessProducerFieldImpl.fire(beanManager, (ProducerField<?, ?>) bean);
            } else if (bean instanceof ProducerMethod<?, ?>) {
                ProcessProducerMethodImpl.fire(beanManager, (ProducerMethod<?, ?>) bean);
            } else {
                ProcessBeanImpl.fire(beanManagerbean);
            }
        }
    }
    public <T> ProcessBeanAttributesImpl<T> fireProcessBeanAttributes(BeanManagerImpl beanManagerBeanAttributes<T> attributesAnnotated annotatedType type) {
        if (isProcessBeanAttributesObserved()) {
            return ProcessBeanAttributesImpl.fire(beanManagerattributesannotatedtype);
        }
        return null;
    }
    public void fireProcessInjectionTarget(BeanManagerImpl beanManagerAbstractClassBean<?> bean) {
        if (isProcessInjectionTargetObserved()) {
            AbstractProcessInjectionTarget.fire(beanManagerbean);
        }
    }
    public <X> InjectionTarget<X> fireProcessInjectionTarget(BeanManagerImpl beanManagerAnnotatedType<X> annotatedTypeInjectionTarget<X> injectionTarget) {
        if (isProcessInjectionTargetObserved()) {
            return AbstractProcessInjectionTarget.fire(beanManagerannotatedTypeinjectionTarget);
        }
        return injectionTarget;
    }
    public <T, X> FieldInjectionPointAttributes<T, X> fireProcessInjectionPoint(FieldInjectionPointAttributes<T, X> attributesClass<?> declaringComponentClass,
            BeanManagerImpl manager) {
        if (isProcessInjectionPointObserved()) {
            return ProcessInjectionPointImpl.fire(attributesdeclaringComponentClassmanager);
        }
        return attributes;
    }
    public <T, X> ParameterInjectionPointAttributes<T, X> fireProcessInjectionPoint(ParameterInjectionPointAttributes<T, X> injectionPointAttributes,
            Class<?> declaringComponentClassBeanManagerImpl manager) {
        if (isProcessInjectionPointObserved()) {
            return ProcessInjectionPointImpl.fire(injectionPointAttributesdeclaringComponentClassmanager);
        }
        return injectionPointAttributes;
    }
    public void fireProcessObserverMethod(BeanManagerImpl beanManagerObserverMethod<?> observer) {
        if (isProcessObserverMethodObserved()) {
            ProcessObserverMethodImpl.fire(beanManagerobserver);
        }
    }
    public void fireProcessProducer(BeanManagerImpl beanManagerAbstractProducerBean<?, ?, Memberbean) {
        if (isProcessProducerObserved()) {
            ProcessProducerImpl.fire(beanManagerbean);
        }
    }
    public void preloadProcessAnnotatedType(Class<?> type) {
        if ( != null && isProcessAnnotatedTypeObserved()) {
        }
    }
    public <T extends ProcessBean<?>> void preloadProcessBean(Class<T> eventRawTypeType... typeParameters) {
        if ( != null && isProcessBeanObserved()) {
            .preloadContainerLifecycleEvent(ProcessAnnotatedType.classtypeParameters);
        }
    }
    public void preloadProcessBeanAttributes(Type type) {
        if ( != null && isProcessBeanAttributesObserved()) {
        }
    }
    public void preloadProcessInjectionPoint(Type... typeParameters) {
        if ( != null && isProcessInjectionPointObserved()) {
            .preloadContainerLifecycleEvent(ProcessInjectionPoint.classtypeParameters);
        }
    }
    public void preloadProcessInjectionTarget(Class<?> type) {
        if ( != null && isProcessInjectionTargetObserved()) {
        }
    }
    public void preloadProcessObserverMethod(Type... typeParameters) {
        if ( != null && isProcessObserverMethodObserved()) {
            .preloadContainerLifecycleEvent(ProcessObserverMethod.classtypeParameters);
        }
    }
    public void preloadProcessProducer(Type... typeParameters) {
        if ( != null && isProcessProducerObserved()) {
            .preloadContainerLifecycleEvent(ProcessProducer.classtypeParameters);
        }
    }
    @Override
    public void cleanupAfterBoot() {
        if ( != null) {
            .shutdown();
        }
    }
    public boolean isPreloaderEnabled() {
        return  != null;
    }
New to GrepCode? Check out our FAQ X