Returns the {@link InjectionPoint} passed in as a parameter if this {@link InjectionPoint} belongs to a contextual
instance of a session bean. Otherwise, the method wraps the {@link InjectionPoint} to guarantee that getBean() always
returns null.
166359
public static InjectionPoint wrapIfNecessary(InjectionPoint ip) {
        if (ip.getBean() instanceof SessionBean<?>) {
            if (!CONTEXTUAL_SESSION_BEANS.get().contains(ip.getBean().getBeanClass())) {
                return new NonContextualSessionBeanInjectionPoint(ip);
            }
        }
        return ip;
    }
1017886
private <T> BindingInject<T> findBean(Key<T> key)
  {
    for (InjectProvider provider : _providerList) {
      BindingInject<T> bean = (BindingInject) provider.lookup(key.rawClass());

      if (bean != null) {
        return bean;
      }
    }

    return null;
  }
1210544
@Override
    public <T> List<InjectionPoint> getJEEComponentInjectionPoints(Class<T> clazz) throws CDIException {
        InjectionTarget<T> injectionTarget = getJEEComponentInjectionTarget(clazz);
        List<InjectionPoint> injectionPoints = null;

        if (injectionTarget != null) {
            injectionPoints = new ArrayList<InjectionPoint>();
            Set<InjectionPoint> jeeClassInjectionPoints = injectionTarget.getInjectionPoints();
            if (jeeClassInjectionPoints != null && jeeClassInjectionPoints.size() > 0) {
                injectionPoints.addAll(jeeClassInjectionPoints);
            }

            String mainClassName = archive.getClientModuleMainClass();

            if (mainClassName != null) {
                if (clazz.getName().equals(mainClassName)) {
                    List<InjectionPoint> staticInjectionPoints = this.staticInjectionPoints.get(clazz);
                    if (staticInjectionPoints != null) {
                        injectionPoints.addAll(staticInjectionPoints);
                    }
                }
            }
        }

        return injectionPoints;
    }
505710
public void validateInjectionPointForDeploymentProblems(InjectionPoint ij, Bean<?> bean, BeanManagerImpl beanManager) {
        if (ij.isDelegate()) {
            return; // do not validate delegate injection points as these are special
        }
        Set<Bean<?>> resolvedBeans = beanManager.getBeanResolver().resolve(beanManager.getBeans(ij));
        if (!isInjectionPointSatisfied(ij, resolvedBeans, beanManager)) {
            throw ValidatorLogger.LOG.injectionPointHasUnsatisfiedDependencies(
                    ij,
                    Formats.formatAnnotations(ij.getQualifiers()),
                    Formats.formatInjectionPointType(ij.getType()),
                    Formats.formatAsStackTraceElement(ij),
                    InjectionPoints.getUnsatisfiedDependenciesAdditionalInfo(ij, beanManager));
        }
        if (resolvedBeans.size() > 1) {
            throw ValidatorLogger.LOG.injectionPointHasAmbiguousDependencies(
                ij,
                Formats.formatAnnotations(ij.getQualifiers()),
                Formats.formatInjectionPointType(ij.getType()),
                Formats.formatAsStackTraceElement(ij),
                WeldCollections.toMultiRowString(resolvedBeans));
        }
        // Account for the case this is disabled decorator
        if (!resolvedBeans.isEmpty()) {
            Bean<?> resolvedBean = (Bean<?>) resolvedBeans.iterator().next();
            if (beanManager.isNormalScope(resolvedBean.getScope())) {
                UnproxyableResolutionException ue = Proxies.getUnproxyableTypeException(ij.getType(), resolvedBean, beanManager.getServices(), false);
                if (ue != null) {
                    throw ValidatorLogger.LOG.injectionPointHasNonProxyableDependencies(ij, Formats.formatAsStackTraceElement(ij), ue);
                }
            }
            if (bean != null && Beans.isPassivatingScope(bean, beanManager)) {
                validateInjectionPointPassivationCapable(ij, resolvedBean, beanManager);
            }
        }

        for (PlugableValidator validator : plugableValidators) {
            validator.validateInjectionPointForDeploymentProblems(ij, bean, beanManager);
        }

        if (resolvedInjectionPoints != null) {
            // Store result to identify unused beans
            resolvedInjectionPoints.put(resolvedBeans.iterator().next(), Boolean.TRUE);
        }
    }
736093
@SuppressWarnings("unchecked")
	public static <T extends ExtensionPoint<?>> T getExtensionPoint(Class<T> clazz) {
		synchronized (points) {
			for (ExtensionPoint<?> ep : points)
				if (clazz.isAssignableFrom(ep.getClass()))
					return (T)ep;
		}
		return null;
	}
1127477
@Override
    protected InjectionTarget<T> getInjectionTarget(boolean nonContextual) {
        EjbDescriptor<T> ejbDescriptor = getEjbDescriptor();
        InjectionTarget<T> injectionTarget = getBeanManager().createInjectionTarget(ejbDescriptor);
        return injectionTarget;
    }
769983
@Pure
	<CT extends RoadConnection> CT getBeginPoint(Class<CT> connectionClass) {
		final StandardRoadConnection connection = this.firstConnection;
		if (connection == null) {
			return null;
		}
		if (connectionClass.isAssignableFrom(StandardRoadConnection.class)) {
			return connectionClass.cast(connection);
		}
		if (connectionClass.isAssignableFrom(RoadConnectionWithArrivalSegment.class)) {
			return connectionClass.cast(new RoadConnectionWithArrivalSegment(connection, this, true));
		}
		throw new IllegalArgumentException("unsupported RoadConnection class");  //$NON-NLS-1$
	}
174212
private <T> Provider<T> lookupProvider(Key<T> key)
  {
    BindingInject<T> bean = findBean(key);

    if (bean != null) {
      return bean.provider();
    }

    BindingAmp<T> binding = findBinding(key);

    if (binding != null) {
      return binding.provider();
    }

    binding = findObjectBinding(key);

    if (binding != null) {
      return binding.provider(InjectionPoint.of(key));
    }


    return null;
  }
515946
protected ConfigurationWrapper getConfigurationWrapper(InjectionPoint injectionPoint) {
		Configuration configuration = injectionPoint.getAnnotated().getAnnotation(Configuration.class);
		return WrapperFactory.wrap(configuration);
	}
100120
@Produces
	@Configuration
	public InputStream getInputStream(InjectionPoint injectionPoint) {
		// get configuration instance
		ConfigurationWrapper wrapper = this.getConfigurationWrapper(injectionPoint);
		
		// get input streams
		List<ISource> sources = this.locate(wrapper);
		
		// return first available source
		for(ISource source : sources) {
			if(source.available()) {
				return source.stream();
			}
		}
		
		// otherwise just return the first stream
		return sources.get(0).stream();	
	}
598229
private ProctorContext getProctorContext(final HttpServletRequest request) throws IllegalAccessException, InstantiationException {
        final ProctorContext proctorContext = contextClass.newInstance();
        final BeanWrapper beanWrapper = new BeanWrapperImpl(proctorContext);
        for (final PropertyDescriptor descriptor : beanWrapper.getPropertyDescriptors()) {
            final String propertyName = descriptor.getName();
            if (!"class".equals(propertyName)) { // ignore class property which every object has
                final String parameterValue = request.getParameter(propertyName);
                if (parameterValue != null) {
                    beanWrapper.setPropertyValue(propertyName, parameterValue);
                }
            }
        }
        return proctorContext;
    }
1146492
public final SessionTracker
    lazyGetSessionTracker() throws Exception {
    String beanName = getSessionTrackerName();
    SessionTracker sessionTracker =
      (SessionTracker) this.beansMap.get(beanName);
    if (sessionTracker == null) {
      sessionTracker = new SessionTracker();
      sessionTracker.setLogger(lazyGetSecureLogger());
      sessionTracker.setSrvI18n(lazyGetSrvI18n());
      lazyGetLogger().info(null, AFactoryAppBeans.class, beanName
        + " has been created.");
      this.beansMap.put(beanName, sessionTracker);
    }
    return sessionTracker;
  }
733271
@Override
  public <T> T instance(InjectionPoint<T> ip)
  {
    Objects.requireNonNull(ip);

    Provider<T> provider = provider(ip);

    if (provider != null) {
      return provider.get();
    }
    else {
      return null;
    }
  }
927058
protected Object getInjectedObjectFromCXF(Class<?> classType,
                                              Type genericType,
                                              Annotation[] memberAnnotations,
                                              ParamInjectionMetadata paramInjectionMetadata) {
        Parameter p = ResourceUtils.getParameter(0, memberAnnotations, classType);
        Object injectedObject = null;

        Message message = paramInjectionMetadata.getInMessage();
        OperationResourceInfo ori = paramInjectionMetadata.getOperationResourceInfo();
        BeanResourceInfo cri = ori.getClassResourceInfo();
        MultivaluedMap<String, String> values = (MultivaluedMap<String, String>) message.get(URITemplate.TEMPLATE_PARAMETERS);
        if (p.getType() == ParameterType.BEAN && cri instanceof ClassResourceInfo) {
            injectedObject = JAXRSUtils.createBeanParamValue(message, classType, ori);
        } else {
            injectedObject = JAXRSUtils.createHttpParameterValue(p,
                                                                 classType,
                                                                 genericType,
                                                                 memberAnnotations,
                                                                 message,
                                                                 values,
                                                                 ori);
        }
        return injectedObject;
    }
307574
private static Object injectAndPostConstruct(Object injectionProvider, Class Klass, List injectedBeanStorage)
    {
        Object instance = null;
        if (injectionProvider != null)
        {
            try
            {

                Object managedObject = _FactoryFinderProviderFactory.INJECTION_PROVIDER_INJECT_CLASS_METHOD.invoke(injectionProvider, Klass);

                instance = _FactoryFinderProviderFactory.MANAGED_OBJECT_GET_OBJECT_METHOD.invoke(managedObject, null);

                if (instance != null) {

                    Object creationMetaData = _FactoryFinderProviderFactory.MANAGED_OBJECT_GET_CONTEXT_DATA_METHOD.invoke
                                    (managedObject, CreationalContext.class);

                    addBeanEntry(instance, creationMetaData, injectedBeanStorage);

                    _FactoryFinderProviderFactory.INJECTION_PROVIDER_POST_CONSTRUCT_METHOD.invoke(
                                                                                                  injectionProvider, instance, creationMetaData);
                }
            } catch (Exception ex)
            {
                throw new FacesException(ex);
            }
        }
        return instance;
    }
656366
@Produces
	@Configuration
	public List<ISource> getProperties(InjectionPoint injectionPoint) {
		// get configuration instance
		ConfigurationWrapper wrapper = this.getConfigurationWrapper(injectionPoint);
		
		// get input streams
		List<ISource> sources = this.locate(wrapper);
		
		return sources;
	}
822061
private <T> Provider<T> autoProvider(InjectionPoint<T> ip)
  {
    for (InjectAutoBind autoBind : _autoBind) {
      Provider<T> provider = autoBind.provider(this, ip);

      if (provider != null) {
        return provider;
      }
    }

    return providerDefault(ip.key());
  }