@Override public void execute(final BootstrapContext context) { final ErraiServiceConfiguratorImpl config = (ErraiServiceConfiguratorImpl) context.getConfig(); if (isAutoScanEnabled(config)) { log.debug("begin meta data scanning ..."); // meta data scanner MetaDataScanner scanner = context.getScanner(); // setup processors which are applied to the meta data MetaDataProcessor[] processors = new MetaDataProcessor[]{ new ServiceProcessor(), }; // execute meta data processing for (MetaDataProcessor proc : processors) { proc.process(context, scanner); } } else { log.debug("auto-discovery of services disabled."); } }
private void processServiceClass(final Class<?> loadClass, final BootstrapContext context, final ErraiServiceConfiguratorImpl config) { ServiceParser svcParser; try { svcParser = new ServiceTypeParser(loadClass); } catch (NotAService ex) { // Diagnose Errai-111 StringBuilder sb = new StringBuilder(); sb.append("Service annotation cannot be loaded. (See https://jira.jboss.org/browse/ERRAI-111)\n"); sb.append(loadClass.getSimpleName()).append(" loader: ").append(loadClass.getClassLoader()).append("\n"); sb.append("@Service loader:").append(Service.class.getClassLoader()).append("\n"); log.warn(sb.toString()); return; } Class<?> remoteImpl = ((ServiceTypeParser) svcParser).getRemoteImplementation(); if (remoteImpl != null) { createRPCScaffolding(remoteImpl, loadClass, context); } processService(svcParser, context); }
private static Class getRemoteImplementation(Class type) { for (Class iface : type.getInterfaces()) { if (iface.isAnnotationPresent(Remote.class)) { return iface; } else if (iface.getInterfaces().length != 0 && ((iface = getRemoteImplementation(iface)) != null)) { return iface; } } return null; }
@Override public void process(final BootstrapContext context, MetaDataScanner reflections) { final ErraiServiceConfiguratorImpl config = (ErraiServiceConfiguratorImpl) context.getConfig(); final Set<Class<?>> services = reflections.getTypesAnnotatedWithExcluding(Service.class, CLIENT_PKG_REGEX); final Set<Method> methodServices = reflections.getMethodsAnnotatedWithExcluding(Service.class, CLIENT_PKG_REGEX); for (Class<?> loadClass : services) { processServiceClass(loadClass, context, config); } for (Method loadMethod : methodServices) { processServiceMethod(loadMethod, context, config); } }
private void processServiceMethod(final Method loadMethod, final BootstrapContext context, final ErraiServiceConfiguratorImpl config) { ServiceParser svcParser; try { svcParser = new ServiceMethodParser(loadMethod); } catch (NotAService ex) { // Diagnose Errai-111 StringBuilder sb = new StringBuilder(); sb.append("Service annotation cannot be loaded. (See https://jira.jboss.org/browse/ERRAI-111)\n"); sb.append(loadMethod.getName()).append(" class: ").append(loadMethod.getClass().getSimpleName()); sb.append(" loader: ").append(loadMethod.getClass().getClassLoader()).append("\n"); sb.append("@Service loader:").append(Service.class.getClassLoader()).append("\n"); log.warn(sb.toString()); return; } processService(svcParser, context); }
log.debug("discovered service: " + clazz.getName()); try { svc = createServiceInjector(clazz, context, config, true); } catch (Throwable t) { t.printStackTrace(); svc = createServiceInjector(loadClass, context, config, false);
@Override public void process(final BootstrapContext context, MetaDataScanner reflections) { final ErraiServiceConfiguratorImpl config = (ErraiServiceConfiguratorImpl) context.getConfig(); final Set<Class<?>> services = reflections.getTypesAnnotatedWithExcluding(Service.class, CLIENT_PKG_REGEX); final Set<Method> methodServices = reflections.getMethodsAnnotatedWithExcluding(Service.class, CLIENT_PKG_REGEX); for (Class<?> loadClass : services) { processServiceClass(loadClass, context, config); } for (Method loadMethod : methodServices) { processServiceMethod(loadMethod, context, config); } }
private void processServiceMethod(final Method loadMethod, final BootstrapContext context, final ErraiServiceConfiguratorImpl config) { ServiceParser svcParser; try { svcParser = new ServiceMethodParser(loadMethod); } catch (NotAService ex) { // Diagnose Errai-111 StringBuilder sb = new StringBuilder(); sb.append("Service annotation cannot be loaded. (See https://jira.jboss.org/browse/ERRAI-111)\n"); sb.append(loadMethod.getName()).append(" class: ").append(loadMethod.getClass().getSimpleName()); sb.append(" loader: ").append(loadMethod.getClass().getClassLoader()).append("\n"); sb.append("@Service loader:").append(Service.class.getClassLoader()).append("\n"); log.warn(sb.toString()); return; } processService(svcParser, context); }
log.debug("discovered service: " + clazz.getName()); try { svc = createServiceInjector(clazz, context, config, true); } catch (Throwable t) { t.printStackTrace(); svc = createServiceInjector(loadClass, context, config, false);
private void processServiceClass(final Class<?> loadClass, final BootstrapContext context, final ErraiServiceConfiguratorImpl config) { ServiceParser svcParser; try { svcParser = new ServiceTypeParser(loadClass); } catch (NotAService ex) { // Diagnose Errai-111 StringBuilder sb = new StringBuilder(); sb.append("Service annotation cannot be loaded. (See https://jira.jboss.org/browse/ERRAI-111)\n"); sb.append(loadClass.getSimpleName()).append(" loader: ").append(loadClass.getClassLoader()).append("\n"); sb.append("@Service loader:").append(Service.class.getClassLoader()).append("\n"); log.warn(sb.toString()); return; } Class<?> remoteImpl = ((ServiceTypeParser) svcParser).getRemoteImplementation(); if (remoteImpl != null) { createRPCScaffolding(remoteImpl, loadClass, context); } processService(svcParser, context); }
private static Class getRemoteImplementation(Class type) { for (Class iface : type.getInterfaces()) { if (iface.isAnnotationPresent(Remote.class)) { return iface; } else if (iface.getInterfaces().length != 0 && ((iface = getRemoteImplementation(iface)) != null)) { return iface; } } return null; }
@Override public void execute(final BootstrapContext context) { final ErraiServiceConfiguratorImpl config = (ErraiServiceConfiguratorImpl) context.getConfig(); if (isAutoScanEnabled(config)) { log.debug("begin meta data scanning ..."); // meta data scanner MetaDataScanner scanner = context.getScanner(); // setup processors which are applied to the meta data MetaDataProcessor[] processors = new MetaDataProcessor[]{ new ServiceProcessor(), }; // execute meta data processing for (MetaDataProcessor proc : processors) { proc.process(context, scanner); } } else { log.debug("auto-discovery of services disabled."); } }