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);
}
}
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);
}
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;
}
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;
}
Aggregations