Refine search
/** * Creates a new invocation handler with supplier which provides a current injected value in proper scope. * * @param supplier provider of the value. */ private ThreadScopeBeanInstance(Supplier<T> supplier, Bean<T> bean, String contextId) { super(bean, new StringBeanIdentifier(((PassivationCapable) bean).getId()), contextId); this.supplier = supplier; }
private Class convertToKey(Contextual<?> contextual) { if (!(contextual instanceof Bean)) { if (contextual instanceof PassivationCapable) { final String id = ((PassivationCapable) contextual).getId(); contextual = beanManager.getPassivationCapableBean(id); } else { throw new IllegalArgumentException( contextual.getClass().getName() + " is not of type " + Bean.class.getName()); } } final Bean<?> bean = (Bean<?>) contextual; return bean.getQualifiers() .stream() .filter(annotation -> annotation instanceof RouteScopeOwner) .map(annotation -> (Class) (((RouteScopeOwner) annotation).value())) .findFirst() .orElse(bean.getBeanClass()); }
private void validateBean(Bean<?> bean) { if (bean.getBeanClass() == null) { throw BeanLogger.LOG.beanMethodReturnsNull("getBeanClass", bean); } if (bean.getInjectionPoints() == null) { throw BeanLogger.LOG.beanMethodReturnsNull("getInjectionPoints", bean); } if (bean instanceof PassivationCapable) { PassivationCapable passivationCapable = (PassivationCapable) bean; if (passivationCapable.getId() == null) { throw BeanLogger.LOG.passivationCapableBeanHasNullId(bean); } } if (bean instanceof Interceptor<?>) { validateInterceptor((Interceptor<?>) bean); } else if (bean instanceof Decorator<?>) { validateDecorator((Decorator<?>) bean); } }
return; if (_specializedMap.containsKey(bean.getBeanClass())) { return; for (Type type : bean.getTypes()) { addBeanByType(type, ann, bean); if (bean.getName() != null) { addBeanByName(bean.getName(), bean); PassivationCapable pass = (PassivationCapable) bean; if (pass.getId() != null) _selfPassivationBeanMap.put(pass.getId(), bean);
public NormalScopedBeanInterceptorHandler(BeanManager beanManager, Bean<?> bean) { this.beanManager = beanManager; this.bean = bean; if (bean instanceof PassivationCapable) { beanPassivationId = ((PassivationCapable) bean).getId(); } }
public ProxyMethodHandler(String contextId, BeanInstance beanInstance, Bean<?> bean) { this.beanInstance = beanInstance; this.bean = bean; this.contextId = contextId; if (bean instanceof CommonBean<?>) { this.beanId = ((CommonBean<?>) bean).getIdentifier(); } else if (bean instanceof PassivationCapable) { this.beanId = new StringBeanIdentifier(((PassivationCapable) bean).getId()); } else { this.beanId = null; } }
public void processAfterValidation(@Observes AfterDeploymentValidation event) { ArrayList<StartupItem> startupBeans = new ArrayList<StartupItem>(_pendingService); _pendingService.clear(); ArrayList<Bean<?>> runningBeans = new ArrayList<Bean<?>>(); Bean<?> bean; while ((bean = nextStartup(startupBeans, runningBeans)) != null) { CreationalContext<?> env = _cdiManager.createCreationalContext(bean); Object value = _cdiManager.getReference(bean, bean.getBeanClass(), env); if (value instanceof ScopeProxy) ((ScopeProxy) value).__caucho_getDelegate(); if (bean instanceof ScheduleBean) { ((ScheduleBean) bean).scheduleTimers(value); } if (value instanceof HandleAware && bean instanceof PassivationCapable) { String id = ((PassivationCapable) bean).getId(); ((HandleAware) value).setSerializationHandle(new SingletonHandle(id)); } } }
public String getId() { if (delegate instanceof PassivationCapable) { return DefaultBean.class.getName() + "-" + ((PassivationCapable) delegate).getId(); } return DefaultBean.class.getName() + "-" + types.toString() + "-QUALIFIERS-" + delegate.getQualifiers().toString(); }
calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType, false); proxyFactory = webBeansContext.getInterceptorDecoratorProxyFactory(); if (bean instanceof PassivationCapable) passivationId = passivationCapable.getId();
private Class convertToKey(Contextual<?> contextual) { if (!(contextual instanceof Bean)) { if (contextual instanceof PassivationCapable) { final String id = ((PassivationCapable) contextual).getId(); contextual = beanManager.getPassivationCapableBean(id); } else { throw new IllegalArgumentException( contextual.getClass().getName() + " is not of type " + Bean.class.getName()); } } final Bean<?> bean = (Bean<?>) contextual; return bean.getQualifiers() .stream() .filter(annotation -> annotation instanceof RouteScopeOwner) .map(annotation -> (Class) (((RouteScopeOwner) annotation).value())) .findFirst() .orElse(bean.getBeanClass()); }
private void validateBean(Bean<?> bean) { if (bean.getBeanClass() == null) { throw BeanLogger.LOG.beanMethodReturnsNull("getBeanClass", bean); } if (bean.getInjectionPoints() == null) { throw BeanLogger.LOG.beanMethodReturnsNull("getInjectionPoints", bean); } if (bean instanceof PassivationCapable) { PassivationCapable passivationCapable = (PassivationCapable) bean; if (passivationCapable.getId() == null) { throw BeanLogger.LOG.passivationCapableBeanHasNullId(bean); } } if (bean instanceof Interceptor<?>) { validateInterceptor((Interceptor<?>) bean); } else if (bean instanceof Decorator<?>) { validateDecorator((Decorator<?>) bean); } }
/** * If the context is a passivating scope then we return * the passivationId of the Bean. Otherwise we use * the Bean directly. * @return the key to use in the context map */ public <T> Object getBeanKey(Contextual<T> bean) { return ((PassivationCapable) bean).getId(); }
public ProxyMethodHandler(String contextId, BeanInstance beanInstance, Bean<?> bean) { this.beanInstance = beanInstance; this.bean = bean; this.contextId = contextId; if (bean instanceof CommonBean<?>) { this.beanId = ((CommonBean<?>) bean).getIdentifier(); } else if (bean instanceof PassivationCapable) { this.beanId = new StringBeanIdentifier(((PassivationCapable) bean).getId()); } else { this.beanId = null; } }
public String getId() { if (delegate instanceof PassivationCapable) { return DefaultBean.class.getName() + "-" + ((PassivationCapable) delegate).getId(); } return DefaultBean.class.getName() + "-" + types.toString() + "-QUALIFIERS-" + delegate.getQualifiers().toString(); }
@Override public boolean accept(final Bean<?> bean) { if (BuiltInOwbBean.class.isInstance(bean) || ExtensionBean.class.isInstance(bean)) { return false; } if (OwbBean.class.isInstance(bean)) { final OwbBean owbBean = OwbBean.class.cast(bean); if (owbBean.isPassivationCapable()) { if (hasBean(owbBean.getId())) { return false; } } } else if (PassivationCapable.class.isInstance(bean)) { if (hasBean(PassivationCapable.class.cast(bean).getId())) { return false; } } final Set<Annotation> qualifiers = bean.getQualifiers(); return beanManager.getBeans( bean.getBeanClass(), qualifiers.isEmpty() ? EMPTY_ANNOTATIONS : qualifiers.toArray(new Annotation[qualifiers.size()])).isEmpty(); }
private void validateBean(Bean<?> bean) { if (bean.getBeanClass() == null) { throw BeanLogger.LOG.beanMethodReturnsNull("getBeanClass", bean); } if (bean.getInjectionPoints() == null) { throw BeanLogger.LOG.beanMethodReturnsNull("getInjectionPoints", bean); } if (bean instanceof PassivationCapable) { PassivationCapable passivationCapable = (PassivationCapable) bean; if (passivationCapable.getId() == null) { throw BeanLogger.LOG.passivationCapableBeanHasNullId(bean); } } if (bean instanceof Interceptor<?>) { validateInterceptor((Interceptor<?>) bean); } else if (bean instanceof Decorator<?>) { validateDecorator((Decorator<?>) bean); } }
private Object getContextualId(Contextual<?> contextual) { if (contextual instanceof PassivationCapable) { PassivationCapable passivationCapable = (PassivationCapable) contextual; return passivationCapable.getId(); } else { return contextual; } }
public ProxyMethodHandler(String contextId, BeanInstance beanInstance, Bean<?> bean) { this.beanInstance = beanInstance; this.bean = bean; this.contextId = contextId; if (bean instanceof CommonBean<?>) { this.beanId = ((CommonBean<?>) bean).getIdentifier(); } else if (bean instanceof PassivationCapable) { this.beanId = new StringBeanIdentifier(((PassivationCapable) bean).getId()); } else { this.beanId = null; } }
public String getId() { if (delegate instanceof PassivationCapable) { return DefaultBean.class.getName() + "-" + ((PassivationCapable) delegate).getId(); } return DefaultBean.class.getName() + "-" + types.toString() + "-QUALIFIERS-" + delegate.getQualifiers().toString(); }