Search in sources :

Example 1 with IClassInventory

use of org.eclipse.scout.rt.platform.inventory.IClassInventory in project scout.rt by eclipse.

the class RegisterTunnelToServerPlatformListener method stateChanged.

@Override
public void stateChanged(PlatformEvent event) {
    if (event.getState() == IPlatform.State.BeanManagerPrepared) {
        if (!isEnabled()) {
            return;
        }
        // register all tunnels to server
        final IBeanManager beanManager = event.getSource().getBeanManager();
        final IClassInventory classInventory = ClassInventory.get();
        registerTunnelToServerProxies(beanManager, classInventory);
    }
}
Also used : IClassInventory(org.eclipse.scout.rt.platform.inventory.IClassInventory) IBeanManager(org.eclipse.scout.rt.platform.IBeanManager)

Example 2 with IClassInventory

use of org.eclipse.scout.rt.platform.inventory.IClassInventory in project scout.rt by eclipse.

the class RegisterTunnelToServerPlatformListenerTest method registerTunnelToServerBeans.

private void registerTunnelToServerBeans(Class<?>... classes) {
    Set<IClassInfo> classInfos = new LinkedHashSet<>();
    for (Class<?> c : classes) {
        classInfos.add(s_classInventory.getClassInfo(c));
    }
    IClassInventory classInventory = mock(IClassInventory.class);
    when(classInventory.getKnownAnnotatedTypes(TunnelToServer.class)).thenReturn(classInfos);
    m_registrator.registerTunnelToServerProxies(m_beanManager, classInventory);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) IClassInventory(org.eclipse.scout.rt.platform.inventory.IClassInventory) IClassInfo(org.eclipse.scout.rt.platform.inventory.IClassInfo)

Example 3 with IClassInventory

use of org.eclipse.scout.rt.platform.inventory.IClassInventory in project scout.rt by eclipse.

the class PermissionService method getPermissionsFromInventory.

/**
 * @return Permission classes from class inventory. By default all direct subclasses of {@link Permission} and
 *         {@link BasicPermission} that are available in the {@link ClassInventory} are returned.
 */
protected Set<IClassInfo> getPermissionsFromInventory() {
    IClassInventory inv = ClassInventory.get();
    // get BasicPermssion subclasses are not found directly, because jdk is not scanned by jandex.
    Set<IClassInfo> classes = inv.getAllKnownSubClasses(Permission.class);
    classes.addAll(inv.getAllKnownSubClasses(BasicPermission.class));
    return classes;
}
Also used : BasicPermission(java.security.BasicPermission) IClassInventory(org.eclipse.scout.rt.platform.inventory.IClassInventory) IClassInfo(org.eclipse.scout.rt.platform.inventory.IClassInfo)

Example 4 with IClassInventory

use of org.eclipse.scout.rt.platform.inventory.IClassInventory in project scout.rt by eclipse.

the class PlatformImplementor method createBeanManager.

protected BeanManagerImplementor createBeanManager() {
    BeanManagerImplementor beanManager = new BeanManagerImplementor();
    IClassInventory inv = ClassInventory.get();
    long t0 = System.nanoTime();
    Set<Class> allBeans = new BeanFilter().collect(inv);
    long t1 = System.nanoTime();
    LOG.info("Collected {} beans in {} ms", allBeans.size(), StringUtility.formatNanos(t1 - t0));
    for (Class<?> bean : allBeans) {
        beanManager.registerClass(bean);
    }
    long t2 = System.nanoTime();
    LOG.info("Registered {} beans in {} ms", allBeans.size(), StringUtility.formatNanos(t2 - t1));
    return beanManager;
}
Also used : IClassInventory(org.eclipse.scout.rt.platform.inventory.IClassInventory)

Aggregations

IClassInventory (org.eclipse.scout.rt.platform.inventory.IClassInventory)4 IClassInfo (org.eclipse.scout.rt.platform.inventory.IClassInfo)2 BasicPermission (java.security.BasicPermission)1 LinkedHashSet (java.util.LinkedHashSet)1 IBeanManager (org.eclipse.scout.rt.platform.IBeanManager)1