public static boolean getBooleanProperty( Properties defaultProperties, Map<Object, Object> properties, String property, boolean defaultValue ) { String result; if( defaultProperties == null ) result = getProperty( properties, property ); else result = getProperty( properties, property, defaultProperties.getProperty( property ) ); if( isEmpty( result ) ) return defaultValue; return Boolean.parseBoolean( result ); }
public CascadingServices( Map<Object, Object> properties ) { this.properties = PropertyUtil.createProperties( properties, defaultProperties ); this.enableContainer = PropertyUtil.getProperty( properties, CONTAINER_ENABLED, defaultProperties.getProperty( CONTAINER_ENABLED, "false" ) ).equalsIgnoreCase( "true" ); }
public static int getIntProperty( Properties defaultProperties, Map<Object, Object> properties, String property, int defaultValue ) { String result; if( defaultProperties == null ) result = getProperty( properties, property ); else result = getProperty( properties, property, defaultProperties.getProperty( property ) ); if( isEmpty( result ) ) return defaultValue; return Integer.parseInt( result ); }
@Override public String get( String key ) { return getProperty( properties, key ); } } );
@Override public void configRuleRegistryDefaults( RuleRegistry ruleRegistry ) { super.configRuleRegistryDefaults( ruleRegistry ); ruleRegistry.addDefaultElementFactory( IntermediateTapElementFactory.TEMP_TAP, new TempTapElementFactory() ); if( PropertyUtil.getBooleanProperty( getDefaultProperties(), FlowConnectorProps.ENABLE_DECORATE_ACCUMULATED_TAP, true ) ) ruleRegistry.addDefaultElementFactory( IntermediateTapElementFactory.ACCUMULATED_TAP, new TempTapElementFactory( DistCacheTap.class.getName() ) ); }
/** * Method buildProperties returns a new {@link Properties} instance with all property values for this type * using the given Iterable<Map.Entry<String, String>> of property values as defaults. The given Iterable will not be modified. * <p> * If no values have been set, all default properties and values will be returned. * * @return a new Properties instance */ public Properties buildProperties( Iterable<Map.Entry<String, String>> defaultProperties ) { return buildProperties( PropertyUtil.createProperties( defaultProperties ) ); }
public int getIntProperty( String property, int defaultValue ) { return PropertyUtil.getIntProperty( System.getProperties(), properties, property, defaultValue ); }
/** * Method getProperties returns the properties of this FlowConnector object. The returned Map instance * is immutable to prevent changes to the underlying property values in this FlowConnector instance. * <p> * If a {@link Properties} instance was passed to the constructor, the returned object will be a flattened * {@link Map} instance. * * @return the properties (type Map) of this FlowConnector object. */ public Map<Object, Object> getProperties() { // Sub-classes of FlowConnector should rely on PropertyUtil to manage access to properties objects internally. return Collections.unmodifiableMap( PropertyUtil.asFlatMap( properties ) ); }
public String getStringProperty( String property ) { return PropertyUtil.getStringProperty( System.getProperties(), properties, property ); }
public static String getApplicationName( Map<Object, Object> properties ) { return PropertyUtil.getProperty( properties, APP_NAME, (String) null ); }
@Override public void configRuleRegistryDefaults( RuleRegistry ruleRegistry ) { super.configRuleRegistryDefaults( ruleRegistry ); ruleRegistry.addDefaultElementFactory( IntermediateTapElementFactory.TEMP_TAP, new TempTapElementFactory() ); if( PropertyUtil.getBooleanProperty( getDefaultProperties(), FlowConnectorProps.ENABLE_DECORATE_ACCUMULATED_TAP, true ) ) ruleRegistry.addDefaultElementFactory( IntermediateTapElementFactory.ACCUMULATED_TAP, new TempTapElementFactory( DistCacheTap.class.getName() ) ); }
/** * Method buildProperties returns a new {@link Properties} instance with all property values for this type * using the given Map of property values as defaults. The given Map will not be modified. * <p> * If no values have been set, all default properties and values will be returned. * * @return a new Properties instance */ public Properties buildProperties( Map<Object, Object> defaultProperties ) { return buildProperties( PropertyUtil.createProperties( defaultProperties, null ) ); }
private static void setFetchLimit( Configuration configuration ) { if( fetchLimit > -1 ) return; fetchLimit = PropertyUtil.getIntProperty( HadoopUtil.createProperties( configuration ), TIMELINE_FETCH_LIMIT, DEFAULT_FETCH_LIMIT ); if( fetchLimit < 2 ) { LOG.warn( "property: {}, was set to: {}, may not be less than 2, setting to 2", TIMELINE_FETCH_LIMIT, fetchLimit ); fetchLimit = 2; } }
@Override public Map<Object, Object> getProperties() { return PropertyUtil.asFlatMap( properties ); }
public static String getStringProperty( Map<Object, Object> properties, String property ) { return getStringProperty( System.getProperties(), properties, property ); }
public static String getProperty( Map<Object, Object> properties, String property ) { return getProperty( properties, property, (String) null ); }
@Override public void configRuleRegistryDefaults( RuleRegistry ruleRegistry ) { super.configRuleRegistryDefaults( ruleRegistry ); ruleRegistry.addDefaultElementFactory( IntermediateTapElementFactory.TEMP_TAP, new TempTapElementFactory() ); ruleRegistry.addDefaultElementFactory( BoundaryElementFactory.BOUNDARY_PIPE, new IntermediateBoundaryElementFactory() ); if( PropertyUtil.getBooleanProperty( getDefaultProperties(), FlowConnectorProps.ENABLE_DECORATE_ACCUMULATED_TAP, true ) ) ruleRegistry.addDefaultElementFactory( IntermediateTapElementFactory.ACCUMULATED_TAP, new TempTapElementFactory( DistCacheTap.class.getName() ) ); }
private LocalFlowProcess tapFlowProcess( Tap tap ) { Properties defaultProperties = ( (LocalFlowProcess) flowProcess ).getConfig(); Properties tapProperties = step.getPropertiesMap().get( tap ); tapProperties = PropertyUtil.createProperties( tapProperties, defaultProperties ); return new LocalFlowProcess( (LocalFlowProcess) flowProcess, tapProperties ); } }
private static void setFetchLimit( Configuration configuration ) { if( fetchLimit > -1 ) return; fetchLimit = PropertyUtil.getIntProperty( HadoopUtil.createProperties( configuration ), TIMELINE_FETCH_LIMIT, DEFAULT_FETCH_LIMIT ); if( fetchLimit < 2 ) { LOG.warn( "property: {}, was set to: {}, may not be less than 2, setting to 2", TIMELINE_FETCH_LIMIT, fetchLimit ); fetchLimit = 2; } }
protected BaseFlow( PlatformInfo platformInfo, Map<Object, Object> properties, Config defaultConfig, FlowDef flowDef ) { properties = PropertyUtil.asFlatMap( properties ); if( platformInfo != null ) this.platformInfo = platformInfo; this.name = flowDef.getName(); this.tags = flowDef.getTags(); this.runID = flowDef.getRunID(); this.classPath = flowDef.getClassPath(); if( !flowDef.getFlowDescriptor().isEmpty() ) this.flowDescriptor = new LinkedHashMap<>( flowDef.getFlowDescriptor() ); addSessionProperties( properties ); initConfig( properties, defaultConfig ); setSources( flowDef.getSourcesCopy() ); setSinks( flowDef.getSinksCopy() ); setTraps( flowDef.getTrapsCopy() ); setCheckpoints( flowDef.getCheckpointsCopy() ); initFromTaps(); retrieveSourceFields(); retrieveSinkFields(); }