org.apache.webbeans.event.ObserverMethodImpl Maven / Gradle / Ivy
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.webbeans.event;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.enterprise.context.ContextNotActiveException;
import javax.enterprise.context.Dependent;
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
import javax.enterprise.event.Reception;
import javax.enterprise.event.TransactionPhase;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedParameter;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InjectionPoint;
import org.apache.webbeans.annotation.AnnotationManager;
import org.apache.webbeans.component.AbstractOwbBean;
import org.apache.webbeans.component.WebBeansType;
import org.apache.webbeans.config.OWBLogConst;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.container.BeanManagerImpl;
import org.apache.webbeans.context.creational.CreationalContextImpl;
import org.apache.webbeans.exception.WebBeansException;
import org.apache.webbeans.inject.impl.InjectionPointFactory;
import org.apache.webbeans.logger.WebBeansLoggerFacade;
import org.apache.webbeans.proxy.OwbNormalScopeProxy;
import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
import org.apache.webbeans.util.AnnotationUtil;
/**
* Defines observers that are declared in observer methods.
*
* Example:
*
* public class X {
*
* public void afterLoggedIn(@Observes @Current LoggedInEvent event)
* {
* .....
* }
* }
*
* Above class X instance observes for the event with type LoggedInEvent
* and event qualifier is Current
. Whenever event is fired, its {@link javax.enterprise.inject.spi.ObserverMethod#notify()}
* method is called.
*
*
* @version $Rev: 1524636 $ $Date: 2013-09-19 09:11:18 +0200 (Thu, 19 Sep 2013) $
*
* @param event type
*/
public class ObserverMethodImpl implements OwbObserverMethod
{
/**Logger instance*/
private final static Logger logger = WebBeansLoggerFacade.getLogger(ObserverMethodImpl.class);
/**Observer owner bean that defines observer method*/
private final AbstractOwbBean> bean;
/**Using existing bean instance or not*/
private final boolean ifExist;
/** the observed qualifiers */
private final Set observedQualifiers;
/** the type of the observed event */
private final Type observedEventType;
/** the transaction phase */
private final TransactionPhase phase;
private final Method view;
/**Annotated method*/
private AnnotatedMethod annotatedObserverMethod;
private static class ObserverParams
{
private Bean
© 2015 - 2025 Weber Informatics LLC | Privacy Policy