@Override protected boolean isRelevantClass(final MetaClass clazz) { return EnvUtil.isPortableType(clazz); } }
public static void recordEnvironmentState() { isJUnitTest(); isDevMode(); isProdMode(); }
public static boolean isUseStaticMarshallers() { if (isForceStaticMarshallers()) return true; if (EnvUtil.isDevMode() && !EnvUtil.isJUnitTest()) return false; if (System.getProperty(USE_STATIC_MARSHALLERS) != null) { return Boolean.getBoolean(USE_STATIC_MARSHALLERS); } final Map<String, String> frameworkProperties = EnvUtil.getEnvironmentConfig().getFrameworkProperties(); if (frameworkProperties.containsKey(USE_STATIC_MARSHALLERS)) { return "true".equals(frameworkProperties.get(USE_STATIC_MARSHALLERS)); } else { return !EnvUtil.isDevMode(); } }
public static boolean isProdMode() { if (_isProdMode != null) return _isProdMode; return _isProdMode = Boolean.valueOf(!isDevMode() && !isJUnitTest()); }
@SuppressWarnings({ "unchecked", "rawtypes" }) public void processObserverMethod(@Observes final ProcessObserverMethod processObserverMethod) { final Type t = processObserverMethod.getObserverMethod().getObservedType(); Class type = null; if (t instanceof Class) { type = (Class) t; } ClassScanner.setReflectionsScanning(true); if (type != null && EnvUtil.isPortableType(type) && !EnvUtil.isLocalEventType(type)) { final Set<Annotation> annotations = processObserverMethod.getObserverMethod().getObservedQualifiers(); final Annotation[] methodQualifiers = annotations.toArray(new Annotation[annotations.size()]); for (final Annotation qualifier : methodQualifiers) { eventQualifiers.put(qualifier.annotationType().getName(), qualifier); } observableEvents.add(type.getName()); } }
callBackBlock = getJsTypeSubscriptionCallback(decorable, controller); else if (EnvUtil.isPortableType(eventType) && !EnvUtil.isLocalEventType(eventType)) { subscribeMethod = "subscribe"; callBackBlock = getSubscriptionCallback(decorable, controller); for (final Class<?> cls : EnvUtil.getAllPortableConcreteSubtypes(eventType.asClass())) { if (!EnvUtil.isLocalEventType(cls)) { final ContextualStatementBuilder routingSubStmt = Stmt.invokeStatic(ErraiBus.class, "get").invoke("subscribe", CDI.getSubjectNameByType(cls.getName()), Stmt.loadStatic(CDI.class, "ROUTING_CALLBACK"));
public static boolean isForceStaticMarshallers() { if (System.getProperty(FORCE_STATIC_MARSHALLERS) != null) { return Boolean.getBoolean(FORCE_STATIC_MARSHALLERS); } final Map<String, String> frameworkProperties = EnvUtil.getEnvironmentConfig().getFrameworkProperties(); if (frameworkProperties.containsKey(FORCE_STATIC_MARSHALLERS)) { return "true".equals(frameworkProperties.get(FORCE_STATIC_MARSHALLERS)); } else { return false; } }
@Override protected boolean isCacheValid() { // This ensures the logged total build time of factories is reset even if // the BootstrapperImpl is not regenerated. FactoryGenerator.resetTotalTime(); Collection<MetaClass> newOrUpdated = MetaClassFactory.getAllNewOrUpdatedClasses(); // filter out generated IOC environment config if (newOrUpdated.size() == 1) { MetaClass clazz = newOrUpdated.iterator().next(); if (clazz.isAssignableTo(IOCEnvironment.class)) { newOrUpdated.clear(); } } boolean hasAnyChanges = !newOrUpdated.isEmpty() || !MetaClassFactory.getAllDeletedClasses().isEmpty(); return hasGenerationCache() && (EnvUtil.isProdMode() || !hasAnyChanges); }
EnvUtil.clearCache(); final EnvironmentConfig environmentConfig = getEnvironmentConfig(); final Set<MetaClass> envExposedClasses = environmentConfig.getExposedClasses();
private static void maybeLoadBootstrapClassCollection(final GeneratorContext context) { if (bootstrapClassCollection == null || EnvUtil.isJUnitTest()) { bootstrapClassCollection = ClassScanner.getTypesAnnotatedWith(IOCBootstrapTask.class, context); } }
private static void processErraiAppPropertiesFiles(final Map<String, String> frameworkProps, final Map<String, String> mappingAliases, final Set<MetaClass> exposedClasses, final Set<MetaClass> nonportableClasses, final Set<String> explicitTypes) { for (final URL url : getErraiAppPropertiesFilesUrls()) { InputStream inputStream = null; try { log.debug("checking " + url.getFile() + " for configured types ..."); inputStream = url.openStream(); final ResourceBundle props = new PropertyResourceBundle(inputStream); processErraiAppPropertiesBundle(frameworkProps, mappingAliases, exposedClasses, nonportableClasses, explicitTypes, props); } catch (final IOException e) { throw new RuntimeException("error reading ErraiApp.properties", e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (final IOException e) { // } } } } }
configuredNonBindableTypes = new HashSet<>(); final Collection<URL> erraiAppProperties = EnvUtil.getErraiAppPropertiesFilesUrls(); for (final URL url : erraiAppProperties) { InputStream inputStream = null;
protected boolean getPropertyValue(final String propName, final String matchValue, final boolean matchByDefault, final boolean caseSensitive) { final String propertyValue = EnvUtil.getEnvironmentConfig().getFrameworkOrSystemProperty(propName); if (propertyValue == null) { return matchByDefault; } else { return caseSensitive ? propertyValue.equals(matchValue) : propertyValue.equalsIgnoreCase(matchValue); } }
@Override protected String generate(final TreeLogger treeLogger, final GeneratorContext context) { logger.info("Generating {}.{}...", SERIALIZER_PACKAGE_NAME, SERIALIZER_CLASS_NAME); final String source = NonGwtEventQualifierSerializerGenerator.generateSource(TranslatableAnnotationUtils.getTranslatableQualifiers(context.getTypeOracle())); logger.info("Generating class file for server."); if (EnvUtil.isProdMode()) { if (OutputDirectoryUtil.OUTPUT_DIR.isPresent()) { logger.info("Output directory set to {}. Attempting to write class file to this directory.", OutputDirectoryUtil.OUTPUT_DIR.get()); generateAndWriteToDir(OutputDirectoryUtil.OUTPUT_DIR.get(), source); } else { logger.info("No output directory set. Attempting to discover target directory and write class file."); generateAndWriteToDiscoveredDirs(context, source); } } else { logger.info("Running in JUnit or Classic Dev Mode. Attempting to generate class in tmp directory {}", OUTPUT_TMP); final String tmpPath = new File(OUTPUT_TMP).getAbsolutePath(); OutputDirectoryUtil.generateClassFileInTmpDir(SERIALIZER_PACKAGE_NAME, SERIALIZER_CLASS_NAME, source, tmpPath); } return source; }
public static boolean isProdMode() { if (_isProdMode != null) return _isProdMode; return _isProdMode = Boolean.valueOf(!isDevMode() && !isJUnitTest()); }
EnvUtil.clearCache(); final EnvironmentConfig environmentConfig = getEnvironmentConfig(); final Set<MetaClass> envExposedClasses = environmentConfig.getExposedClasses();
private static void maybeLoadExtensionConfigurators(final MetaDataScanner scanner) { if (iocExtensions == null || extensionConfigurators == null || EnvUtil.isJUnitTest()) { iocExtensions = scanner .getTypesAnnotatedWith(org.jboss.errai.ioc.client.api.IOCExtension.class); extensionConfigurators = new ArrayList<IOCExtensionConfigurator>(); try { for (final Class<?> clazz : iocExtensions) { final Class<? extends IOCExtensionConfigurator> configuratorClass = clazz.asSubclass(IOCExtensionConfigurator.class); final IOCExtensionConfigurator configurator = configuratorClass.newInstance(); extensionConfigurators.add(configurator); } } catch (Exception e) { throw new ErraiBootstrapFailure("unable to load IOC Extension Configurator: " + e.getMessage(), e); } } }
private static void processErraiAppPropertiesFiles(final Map<String, String> frameworkProps, final Map<String, String> mappingAliases, final Set<MetaClass> exposedClasses, final Set<MetaClass> nonportableClasses, final Set<String> explicitTypes) { for (final URL url : getErraiAppPropertiesFilesUrls()) { InputStream inputStream = null; try { log.debug("checking " + url.getFile() + " for configured types ..."); inputStream = url.openStream(); final ResourceBundle props = new PropertyResourceBundle(inputStream); processErraiAppPropertiesBundle(frameworkProps, mappingAliases, exposedClasses, nonportableClasses, explicitTypes, props); } catch (final IOException e) { throw new RuntimeException("error reading ErraiApp.properties", e); } finally { if (inputStream != null) { try { inputStream.close(); } catch (final IOException e) { // } } } } }
configuredNonBindableTypes = new HashSet<>(); final Collection<URL> erraiAppProperties = EnvUtil.getErraiAppPropertiesFilesUrls(); for (final URL url : erraiAppProperties) { InputStream inputStream = null;
@Override protected boolean isRelevantClass(final MetaClass clazz) { return EnvUtil.isPortableType(clazz); } }