Bean types of a session bean.
341023
private static <T> Set<Type> getSessionBeanTypes(EnhancedAnnotated<T, ?> annotated, EjbDescriptor<T> ejbDescriptor) {
        ImmutableSet.Builder<Type> types = ImmutableSet.builder();
        // session beans
        Map<Class<?>, Type> typeMap = new LinkedHashMap<Class<?>, Type>();
        HierarchyDiscovery beanClassDiscovery = HierarchyDiscovery.forNormalizedType(ejbDescriptor.getBeanClass());
        for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces()) {
            // first we need to resolve the local interface
            Type resolvedLocalInterface = beanClassDiscovery.resolveType(Types.getCanonicalType(businessInterfaceDescriptor.getInterface()));
            SessionBeanHierarchyDiscovery interfaceDiscovery = new SessionBeanHierarchyDiscovery(resolvedLocalInterface);
            if (beanClassDiscovery.getTypeMap().containsKey(businessInterfaceDescriptor.getInterface())) {
                // WELD-1675 Only add types also included in Annotated.getTypeClosure()
                for (Entry<Class<?>, Type> entry : interfaceDiscovery.getTypeMap().entrySet()) {
                    if (annotated.getTypeClosure().contains(entry.getValue())) {
                        typeMap.put(entry.getKey(), entry.getValue());
                    }
                }
            } else {
                // Session bean class does not implement the business interface and @javax.ejb.Local applied to the session bean class
                typeMap.putAll(interfaceDiscovery.getTypeMap());
            }
        }
        if (annotated.isAnnotationPresent(Typed.class)) {
            types.addAll(Beans.getTypedTypes(typeMap, annotated.getJavaClass(), annotated.getAnnotation(Typed.class)));
        } else {
            typeMap.put(Object.class, Object.class);
            types.addAll(typeMap.values());
        }
        return Beans.getLegalBeanTypes(types.build(), annotated);
    }
832904
public static final Class[] getParameterTypes(Object bean, String property)
    {
        Type type = (Type) doFor(
            bean, 
            property, 
            null,
            (Object a, int i)->{Object o = Array.get(a, i);return o!=null?o.getClass().getComponentType():null;},
            (List l, int i)->{return l.get(i).getClass().getGenericSuperclass();},
            (Object o, Class c, String p)->{return getField(c, p).getGenericType();}, 
            (Object o, Method m)->{return m.getGenericReturnType();});
        if (type instanceof ParameterizedType)
        {
            ParameterizedType pt = (ParameterizedType) type;
            Type[] ata = pt.getActualTypeArguments();
            if (ata.length > 0)
            {
                Class[] ca = new Class[ata.length];
                for (int ii=0;ii<ca.length;ii++)
                {
                    ca[ii] = (Class) ata[ii];
                }
                return ca;
            }
        }
        if (type instanceof Class)
        {
            Class cls = (Class) type;
            if (cls.isArray())
            {
                cls = cls.getComponentType();
            }
            return new Class[] {cls};
        }
        return null;
    }
133132
public void setBeans(Collection<?> beans)
    {
        if (!CollectionUtils.isEmpty(beans))
        {
            for (Object bean : beans)
            {
                register(bean);
            }
        }
    }
506958
private boolean isBean(byte[] scanRecord) {
        List<UUID> uuids = parseUUIDs(scanRecord);
        return uuids.contains(BEAN_UUID);
    }
693309
private Set<Bean<?>> getBeansForBeanIdentifierIndex() {
        Set<Bean<?>> beans = new HashSet<Bean<?>>();
        for (BeanDeployment beanDeployment : getBeanDeployments()) {
            for (Bean<?> bean : beanDeployment.getBeanManager().getBeans()) {
                if (!(bean instanceof AbstractBuiltInBean<?>)
                        && (bean.getScope().equals(SessionScoped.class) || bean.getScope().equals(ConversationScoped.class))) {
                    beans.add(bean);
                }
            }
        }
        return beans;
    }
1171024
public static <T> T toBean(ServletRequest request, Class<T> beanClass, boolean isIgnoreError) {
		return fillBean(request, ReflectUtil.newInstance(beanClass), isIgnoreError);
	}
959686
public Object castToType(SessionInterface session, Object a, Type type) {
        return convertToType(session, a, type);
    }
188471
@Override
	public List<RecordSessionUrl> getUrlsForType (int type) throws DatabaseException {
    	SqlPreparedStatementWrapper psGetAlluRLSForType = null;
        try {
        	psGetAlluRLSForType = DbSQL.getSingleton().getPreparedStatement("sessionurl.ps.geturlsfortype");
			psGetAlluRLSForType.getPs().setInt(1, type);
			try (ResultSet rs = psGetAlluRLSForType.getPs().executeQuery()) {
				List<RecordSessionUrl> result = new ArrayList<>();
				while (rs.next()) {
					result.add(new RecordSessionUrl(rs.getLong(URLID), rs.getInt(TYPE), rs.getString(URL)));
				}
				return result;
			}
		} catch (SQLException e) {
			throw new DatabaseException(e);
		} finally {
			DbSQL.getSingleton().releasePreparedStatement(psGetAlluRLSForType);
		}
    }
380119
private void instantiateSingletons() {
        if (log.isDebugEnabled()) {
            log.debug("Initializing singletons in " + this);
        }

        Activity activity = context.getDefaultActivity();
        for (BeanRule beanRule : beanRuleRegistry.getIdBasedBeanRules()) {
            instantiateSingleton(beanRule, activity);
        }
        for (Set<BeanRule> beanRuleSet : beanRuleRegistry.getTypeBasedBeanRules()) {
            for (BeanRule beanRule : beanRuleSet) {
                instantiateSingleton(beanRule, activity);
            }
        }
        for (BeanRule beanRule : beanRuleRegistry.getConfigurableBeanRules()) {
            instantiateSingleton(beanRule, activity);
        }
    }
743150
public function collectGarbage()
    {

        // we need the bean manager that handles all the beans
        /** @var \AppserverIo\Psr\EnterpriseBeans\BeanContextInterface $beanManager */
        $beanManager = $this->getApplication()->search(BeanContextInterface::IDENTIFIER);

        // load the map with the stateful session beans
        /** @var \AppserverIo\Storage\StorageInterface $statefulSessionBeans */
        $statefulSessionBeans = $beanManager->getStatefulSessionBeans();

        // initialize the timestamp with the actual time
        $actualTime = time();

        // load the map with the SFSB lifetime data
        $lifetimeMap = $statefulSessionBeans->getLifetime();

        // initialize the counter for the SFSBs
        $counter = 0;

        // iterate over the applications sessions with stateful session beans
        foreach ($lifetimeMap as $identifier => $lifetime) {
            // check the lifetime of the stateful session beans
            if ($lifetime < $actualTime) {
                // if the stateful session bean has timed out, remove it
                $statefulSessionBeans->remove($identifier, array($beanManager, 'destroyBeanInstance'));
                // write a log message
                $this->log(LogLevel::DEBUG, sprintf('Successfully removed SFSB %s', $identifier));
                // reduce CPU load
                usleep(1000);
            } else {
                // raise the counter
                $counter++;
                // write a log message
                $this->log(LogLevel::DEBUG, sprintf('Lifetime %s of SFSB %s is > %s', $lifetime, $identifier, $actualTime));
            }
        }

        // write a log message with size of SFSBs to be garbage collected
        $this->log(LogLevel::DEBUG, sprintf('Found %d SFSBs be garbage collected', $counter));

        // profile the size of the sessions
        /** @var \Psr\Log\LoggerInterface $this->profileLogger */
        if ($this->profileLogger) {
            $this->profileLogger->debug(
                sprintf('Processed standard garbage collector, handling %d SFSBs', sizeof($statefulSessionBeans))
            );
        }
    }
1027957
public static <T> Map<String, T> getBeansOfType(ApplicationContext appContext, Class<T> clazz) {
        try {
            return appContext.getBeansOfType(clazz);
        } catch (BeansException e) {
            return new HashMap<String, T>();
        }
    }
394627
def setAllowedTypes(self, allowed_types):
        """"""
        for (assoc_type, session_type) in allowed_types:
            checkSessionType(assoc_type, session_type)

        self.allowed_types = allowed_types
564217
public function registerNodeTypes(SessionInterface $session)
    {
        $cnd = sprintf(
            '<%s=\'https://github.com/symfony-cmf/content-type\'>',
            $this->encoder->getPrefix(),
            $this->encoder->getUri()
        );

        $nodeTypeManager = $session->getWorkspace()->getNodeTypeManager();
        $nodeTypeManager->registerNodeTypesCnd($cnd, true);
    }
669778
public static <T> CheckResult<T> checkBean(Object bean) {
        return checkBean(bean, new HashMap<>(ValueConsts.TWO_INT));
    }
843522
public static List<Field> getClassFields(Class<?> beanClass) {
		Map<String, Field> resultMap = new HashMap<>();
		LinkedList<Field> results = new LinkedList<>();

		Class<?> currentClass = beanClass;
		while (currentClass != null && currentClass != Object.class) {
			for (Field field : currentClass.getDeclaredFields()) {
				if (!field.isSynthetic()) {
					Field v = resultMap.get(field.getName());
					if (v == null) {
						resultMap.put(field.getName(), field);
						results.add(field);
					}
				}
			}
			currentClass = currentClass.getSuperclass();
		}

		return results;
	}
1184886
public function registerNodeTypes(SessionInterface $session)
    {
        $cnd = <<<CND
// register phpcr_locale namespace
<$this->localeNamespace='$this->localeNamespaceUri'>
// register phpcr namespace
<$this->phpcrNamespace='$this->phpcrNamespaceUri'>
[phpcr:managed]
mixin
- phpcr:class (STRING)
- phpcr:classparents (STRING) multiple
CND;

        $nodeTypeManager = $session->getWorkspace()->getNodeTypeManager();
        $nodeTypeManager->registerNodeTypesCnd($cnd, true);
    }
272017
private void beanToBean(Object providerBean, Object destBean) {
		valueProviderToBean(new BeanValueProvider(providerBean, this.copyOptions.ignoreCase, this.copyOptions.ignoreError), destBean);
	}