Codota Logo
org.apache.webbeans.component
Code IndexAdd Codota to your IDE (free)

How to use org.apache.webbeans.component

Best Java code snippets using org.apache.webbeans.component (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: HotswapProjects/HotswapAgent

private static void doReloadInjectionTargetBean(BeanManagerImpl beanManager, InjectionTargetBean<?> bean,
    Map<String, String> oldSignatures, BeanReloadStrategy reloadStrategy) {
  String signatureByStrategy = OwbClassSignatureHelper.getSignatureByStrategy(reloadStrategy, bean.getBeanClass());
  String oldSignature = oldSignatures.get(bean.getBeanClass().getName());
  if (reloadStrategy == BeanReloadStrategy.CLASS_CHANGE ||
      (reloadStrategy != BeanReloadStrategy.NEVER && signatureByStrategy != null && !signatureByStrategy.equals(oldSignature))) {
    // Reload bean in contexts - invalidates existing instances
    doReloadBeanInBeanContexts(beanManager, bean);
  } else {
    // keep beans in contexts, reinitialize bean injection points
    doReinjectBean(beanManager, bean);
  }
}
origin: HotswapProjects/HotswapAgent

private static void doReinjectBean(BeanManagerImpl beanManager, InjectionTargetBean<?> bean) {
  try {
    if (!bean.getScope().equals(ApplicationScoped.class) && HaCdiCommons.isRegisteredScope(bean.getScope())) {
      doReinjectRegisteredBeanInstances(beanManager, bean);
    } else {
      doReinjectBeanInstance(beanManager, bean, beanManager.getContext(bean.getScope()));
    }
  } catch (ContextNotActiveException e) {
    LOGGER.info("No active contexts for bean '{}'", bean.getBeanClass().getName());
  }
}
origin: HotswapProjects/HotswapAgent

@SuppressWarnings({ "unchecked", "rawtypes" })
private static void doReinjectRegisteredBeanInstances(BeanManagerImpl beanManager, InjectionTargetBean bean) {
  for (Object instance: HaCdiCommons.getBeanInstances(bean)) {
    if (instance != null) {
      bean.getProducer().inject(instance, beanManager.createCreationalContext(bean));
      LOGGER.info("Bean '{}' injection points was reinjected.", bean.getBeanClass().getName());
    } else {
      LOGGER.info("Unexpected 'null' bean instance in registry. bean='{}'", bean.getBeanClass().getName());
    }
  }
}
origin: HotswapProjects/HotswapAgent

@SuppressWarnings({ "rawtypes", "unchecked" })
private static void createAnnotatedTypeForExistingBeanClass(BeanManagerImpl beanManager, InjectionTargetBean bean) {
  WebBeansContext wbc = beanManager.getWebBeansContext();
  AnnotatedElementFactory annotatedElementFactory = wbc.getAnnotatedElementFactory();
  // Clear AnnotatedElementFactory caches
  annotatedElementFactory.clear();
  AnnotatedType annotatedType = annotatedElementFactory.newAnnotatedType(bean.getBeanClass());
  ReflectionHelper.set(bean, InjectionTargetBean.class, "annotatedType", annotatedType);
  // Updated members that were set by bean attributes
  BeanAttributesImpl attributes = BeanAttributesBuilder.forContext(wbc).newBeanAttibutes(annotatedType).build();
  ReflectionHelper.set(bean, BeanAttributesImpl.class, "types", attributes.getTypes());
  ReflectionHelper.set(bean, BeanAttributesImpl.class, "qualifiers", attributes.getQualifiers());
  ReflectionHelper.set(bean, BeanAttributesImpl.class, "scope", attributes.getScope());
  ReflectionHelper.set(bean, BeanAttributesImpl.class, "name", attributes.getName());
  ReflectionHelper.set(bean, BeanAttributesImpl.class, "stereotypes", attributes.getStereotypes());
  ReflectionHelper.set(bean, BeanAttributesImpl.class, "alternative", attributes.isAlternative());
  InjectionTargetFactory factory = new InjectionTargetFactoryImpl(annotatedType, bean.getWebBeansContext());
  InjectionTarget injectionTarget = factory.createInjectionTarget(bean);
  ReflectionHelper.set(bean, InjectionTargetBean.class, "injectionTarget", injectionTarget);
  LOGGER.debug("New annotated type created for bean '{}'", bean.getBeanClass());
}
origin: org.apache.openwebbeans/openwebbeans-impl

public InterceptionFactoryBean(WebBeansContext webBeansContext)
{
  super(webBeansContext,
      WebBeansType.INTERCEPTIONFACTORY,
      new BeanAttributesImpl<>(
          CollectionUtil.<Type>unmodifiableSet(InterceptionFactory.class, Object.class),
          AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION_SET),
      InterceptionFactory.class,
      false,
      new SimpleProducerFactory<>(new InterceptionFactoryProducer(webBeansContext)));
}
origin: org.apache.geronimo.modules/geronimo-openejb

/**
 * delegation of serialization behavior
 */
public <T> T readExternal(Bean<T> bean, ObjectInput out) throws IOException,
    ClassNotFoundException {
  return (T) ((ResourceBean)bean).getActualInstance();
}
origin: HotswapProjects/HotswapAgent

  /**
   * Will re-inject any managed beans in the target. Will not call any other life-cycle methods
   *
   * @param ctx
   * @param managedBean
   */
  @SuppressWarnings("unchecked")
  static void reinitialize(Context ctx, Contextual<Object> contextual) {
    try {
      ManagedBean<Object> managedBean = ManagedBean.class.cast(contextual);
      LOGGER.debug("Re-Initializing bean '{}' in context '{}'", managedBean, ctx);
      Object get = ctx.get(managedBean);
      if (get != null) {
        LOGGER.debug("Bean injection points are reinitialized '{}'", managedBean);
        CreationalContextImpl<Object> creationalContext = managedBean.getWebBeansContext().getCreationalContextFactory().getCreationalContext(managedBean);
        managedBean.getProducer().inject(get, creationalContext);
      }
    } catch (Exception e) {
      LOGGER.error("Error reinitializing bean '{}' in context '{}'", e, contextual, ctx);
    }
  }
}
origin: org.apache.openwebbeans/openwebbeans-impl

@Override
protected <X> P createBean(InjectionTargetBean<X> owner, Class<T> beanClass)
{
  return (P) new ProducerFieldBean<T>(owner, beanAttributes, beanClass, new FieldProducerFactory(annotatedMember, owner, owner.getWebBeansContext()));
}

origin: org.apache.openwebbeans/openwebbeans-impl

public WebBeansUtil(WebBeansContext webBeansContext)
{
  this.webBeansContext = webBeansContext;
  instanceBean = new InstanceBean(webBeansContext);
  eventBean = new EventBean<>(webBeansContext);
}
origin: org.apache.openwebbeans/openwebbeans-impl

/**
 * {@inheritDoc}
 */
@Override
public T create(CreationalContext<T> creationalContext)
{
  T instance = null;
  
  instance = super.create(creationalContext);
  checkNullInstance(instance, producerField.getName());
  checkScopeType(producerField.getName(), instance);
  return instance;
}
origin: org.apache.openwebbeans/openwebbeans-impl

@Override
public String getId()
{
  return ((OwbBean<?>) bean).getId();
}
origin: org.apache.openwebbeans/openwebbeans-impl

public CdiInterceptorBean(WebBeansContext webBeansContext,
             AnnotatedType<T> annotatedType,
             BeanAttributes<T> beanAttributes,
             Class<T> beanClass,
             Set<Annotation> interceptorBindings,
             boolean enabled,
             Map<InterceptionType, Method[]> interceptionMethods)
{
  super(webBeansContext, annotatedType, beanAttributes, beanClass, interceptionMethods);
  this.interceptorBindings = interceptorBindings;
  this.setEnabled(enabled);
}
origin: org.apache.openwebbeans/openwebbeans-impl

  Object readResolve() throws ObjectStreamException
  {
    return get();
  }
}
origin: org.apache.openwebbeans/openwebbeans-impl

public InterceptionFactoryBean getInterceptionFactoryBean()
{
  return new InterceptionFactoryBean(webBeansContext);
}
origin: org.apache.openwebbeans/openwebbeans-impl

/**
 * Creates a new decorator metadata bean.
 * @return new bean
 */
public <T> DecoratorMetadataBean<T> getDecoratorMetadataBean()
{
  return new DecoratorMetadataBean<>(webBeansContext);
}
origin: org.apache.openwebbeans/openwebbeans-impl

  Object readResolve() throws ObjectStreamException
  {
    return get();
  }
}
origin: org.apache.openwebbeans/openwebbeans-impl

/**
 * Creates a new bean metadata bean.
 * @return new  bean
 */
public <T> BeanMetadataBean<T> getBeanMetadataBean()
{
  return new BeanMetadataBean<>(webBeansContext);
}
origin: org.apache.openwebbeans/openwebbeans-impl

/**
 * Returns observer owner bean.
 * 
 * @return the bean
 */
@Override
@SuppressWarnings("unchecked")
public Class<?> getBeanClass()
{
  return ownerBean.getBeanClass();
}
origin: HotswapProjects/HotswapAgent

@SuppressWarnings({ "unchecked", "rawtypes" })
private static void doReinjectBeanInstance(BeanManagerImpl beanManager, InjectionTargetBean bean, Context context) {
  Object instance = context.get(bean);
  if (instance != null) {
    bean.getProducer().inject(instance, beanManager.createCreationalContext(bean));
    LOGGER.info("Bean '{}' injection points was reinjected.", bean.getBeanClass().getName());
  }
}
origin: HotswapProjects/HotswapAgent

private static void doReloadBeanInBeanContexts(BeanManagerImpl beanManager, InjectionTargetBean<?> bean) {
  try {
    Map<Class<? extends Annotation>, Context> singleContextMap = getSingleContextMap(beanManager);
    Context context = singleContextMap.get(bean.getScope());
    if (context != null) {
      doReloadBeanInContext(beanManager, bean, context);
    } else {
      Map<Class<? extends Annotation>, List<Context>> allContexts = getContextMap(beanManager);
      List<Context> ctxList = allContexts.get(bean.getScope());
      if (ctxList != null) {
        for(Context ctx: ctxList) {
          doReloadBeanInContext(beanManager, bean, ctx);
        }
      } else {
        LOGGER.debug("No active contexts for bean '{}' in scope '{}'", bean.getBeanClass().getName(),  bean.getScope());
      }
    }
  } catch (ContextNotActiveException e) {
    LOGGER.warning("No active contexts for bean '{}'", e, bean.getBeanClass().getName());
  } catch (Exception e) {
    LOGGER.warning("Context for '{}' failed to reload", e, bean.getBeanClass().getName());
  }
}
org.apache.webbeans.component

Most used classes

  • InjectionTargetBean
  • ResourceBean
  • OwbBean
  • AbstractOwbBean
    Abstract implementation of the OwbBean contract.
  • BeanAttributesImpl
  • ProducerMethodBean,
  • SimpleProducerFactory,
  • BeanAttributesBuilder$BeanAttributesBuilderFactory,
  • BeanAttributesBuilder,
  • InjectionPointBean,
  • ObserverMethodsBuilder,
  • ProducerFieldBeansBuilder,
  • ProducerMethodBeansBuilder,
  • CdiInterceptorBean,
  • InstanceBean,
  • ManagedBean,
  • AbstractInjectionTargetBean,
  • AbstractProducerBean,
  • BeanManagerBean
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now