@Override public void configureDefaults(Configuration configuration) { configuration.load(ReflectionUtils.loadResource(DEFAULT_CONFIG_FILE)); }
/** * Identifies and returns the JAR file declaring the {@link Class} of the given {@code object} or {@code null} if * no such file could be determined. */ public static String getDeclaringJar(Object object) { Validate.notNull(object); return getDeclaringJar(object.getClass()); }
@Override public Class<Iterable<T>> getTypeClass() { return ReflectionUtils.specify(Iterable.class); }
@Override public double getDoubleProperty(String propertyKey, double fallback) { try { return ReflectionUtils.toDouble(ReflectionUtils.getProperty(this.operator, propertyKey)); } catch (Exception e) { logger.error("Could not retrieve property \"{}\" from {}.", propertyKey, this.operator, e); return fallback; } }
if (matcher.matches()) { try { return instantiateDefault(matcher.group(1)); } catch (Exception e) { throw new IllegalArgumentException(String.format("Could not instantiate '%s'.", statement), e); if (matcher.matches()) { try { return executeStaticArglessMethod(matcher.group(1), matcher.group(2)); } catch (Exception e) { throw new IllegalArgumentException(String.format("Could not execute '%s'.", statement), e); if (matcher.matches()) { try { return retrieveStaticVariable(matcher.group(1), matcher.group(2)); } catch (Exception e) { throw new IllegalArgumentException(String.format("Could not execute '%s'.", statement), e);
/** * Retrieve a field as a {@code double}. It must be castable as such. * * @param index the index of the field * @return the {@code double} representation of the field */ public double getDouble(int index) { Object field = this.values[index]; return ReflectionUtils.toDouble(field); }
@Override public Platform deserialize(JSONObject json, Class<? extends Platform> cls) { return ReflectionUtils.evaluate(cls.getCanonicalName() + ".getInstance()"); } };
/** * Loads a specific {@link Platform} implementation. For platforms to interoperate with this method, they must * provide a {@code static}, parameterless method {@code getInstance()} that returns their singleton instance. * * @param platformClassName the class name of the {@link Platform} * @return the {@link Platform} instance */ public static Platform load(String platformClassName) { try { return ReflectionUtils.executeStaticArglessMethod(platformClassName, "getInstance"); } catch (Exception e) { throw new RheemException("Could not load platform: " + platformClassName, e); } }
private static void bootstrapPlugins(Configuration configuration) { configuration.setPlatformProvider(new ExplicitCollectionProvider<>(configuration)); configuration.setMappingProvider(new ExplicitCollectionProvider<>(configuration)); configuration.setChannelConversionProvider(new ExplicitCollectionProvider<>(configuration)); try { Plugin basicPlugin = ReflectionUtils.evaluate(BASIC_PLUGIN); basicPlugin.configure(configuration); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Could not load basic plugin.", e); } else { logger.warn("Could not load basic plugin."); } } }
@Override public void configureDefaults(Configuration configuration) { configuration.load(ReflectionUtils.loadResource(DEFAULT_CONFIG_FILE)); }
public LoopOperator(DataSetType<InputType> inputType, DataSetType<ConvergenceType> convergenceType, PredicateDescriptor.SerializablePredicate<Collection<ConvergenceType>> criterionPredicate, Integer numExpectedIterations) { this(inputType, convergenceType, new PredicateDescriptor<>(criterionPredicate, ReflectionUtils.specify(Collection.class)), numExpectedIterations ); }
if (!sparkContext.isLocal()) { this.registerJarIfNotNull(ReflectionUtils.getDeclaringJar(SparkPlatform.class)); // rheem-spark this.registerJarIfNotNull(ReflectionUtils.getDeclaringJar(RheemBasic.class)); // rheem-basic this.registerJarIfNotNull(ReflectionUtils.getDeclaringJar(RheemContext.class)); // rheem-core final Set<String> udfJarPaths = job.getUdfJarPaths(); if (udfJarPaths.isEmpty()) {
DynamicPlugin.<List<String>>ifPresent(platforms.get("include"), List.class, expressions -> { for (String expression : expressions) { Object eval = ReflectionUtils.evaluate(expression); if (eval instanceof Platform) { plugin.addRequiredPlatform((Platform) eval); DynamicPlugin.<List<String>>ifPresent(platforms.get("exclude"), List.class, expressions -> { for (String expression : expressions) { Object eval = ReflectionUtils.evaluate(expression); if (eval instanceof Platform) { plugin.excludeRequiredPlatform((Platform) eval); DynamicPlugin.<List<String>>ifPresent(mappings.get("include"), List.class, expressions -> { for (String expression : expressions) { Object eval = ReflectionUtils.evaluate(expression); if (eval instanceof Mapping) { plugin.addMapping((Mapping) eval); DynamicPlugin.<List<String>>ifPresent(mappings.get("exclude"), List.class, expressions -> { for (String expression : expressions) { Object eval = ReflectionUtils.evaluate(expression); if (eval instanceof Mapping) { plugin.excludeMapping((Mapping) eval); DynamicPlugin.<List<String>>ifPresent(conversions.get("include"), List.class, expressions -> { for (String expression : expressions) { Object eval = ReflectionUtils.evaluate(expression); if (eval instanceof ChannelConversion) { plugin.addChannelConversion((ChannelConversion) eval);
@Override public void configureDefaults(Configuration configuration) { configuration.load(ReflectionUtils.loadResource(DEFAULT_CONFIG_FILE)); }
public DoWhileOperator(DataSetType<InputType> inputType, DataSetType<ConvergenceType> convergenceType, PredicateDescriptor.SerializablePredicate<Collection<ConvergenceType>> criterionPredicate, Integer numExpectedIterations) { this(inputType, convergenceType, new PredicateDescriptor<>(criterionPredicate, ReflectionUtils.specify(Collection.class)), numExpectedIterations ); }
private static void bootstrapProperties(Configuration configuration) { // Here, we could put some default values. final KeyValueProvider<String, String> defaultProperties = new MapBasedKeyValueProvider<>(configuration, false); configuration.setProperties(defaultProperties); configuration.load(ReflectionUtils.loadResource(DEFAULT_CONFIGURATION_FILE)); // Set some dynamic properties. configuration.setProperty("rheem.core.log.cardinalities", StringUtils.join( Arrays.asList(System.getProperty("user.home"), ".rheem", "cardinalities.json"), File.separator )); configuration.setProperty("rheem.core.log.executions", StringUtils.join( Arrays.asList(System.getProperty("user.home"), ".rheem", "executions.json"), File.separator )); // Supplement with a customizable layer. final KeyValueProvider<String, String> customizableProperties = new MapBasedKeyValueProvider<>(defaultProperties); configuration.setProperties(customizableProperties); }
t -> t, ReflectionUtils.specify(Tuple2.class), ReflectionUtils.specify(Tuple2.class) ); forward.at(epoch); return out; }, ReflectionUtils.specify(Tuple2.class), Long.class, ProbabilisticDoubleInterval.ofExactly(2) ReflectionUtils.specify(Tuple2.class), ReflectionUtils.specify(Tuple2.class) ); adjacencyPreparator.at(epoch); return new Tuple2<>(t1.field0, targetVertices); }, ReflectionUtils.specify(Long.class), ReflectionUtils.specify(Tuple2.class) ); adjacencyCreator.at(epoch); Long.class, ReflectionUtils.specify(Tuple2.class) ); initializeRanks.at(epoch); pageRankOperator.getNumIterations(), ReflectionUtils.specify(Tuple2.class) ); loopHead.at(epoch);
@Override public void setProperties(Configuration configuration) { configuration.load(ReflectionUtils.loadResource(RHEEM_BASIC_DEFAULTS_PROPERTIES)); final File localTempDir = LocalFileSystem.findTempDir(); if (localTempDir != null) { configuration.setProperty(TEMP_DIR_PROPERTY, LocalFileSystem.toURL(localTempDir)); } }