Class AutoScalingConfig
- java.lang.Object
-
- org.apache.solr.client.solrj.cloud.autoscaling.AutoScalingConfig
-
- All Implemented Interfaces:
MapSerializable,MapWriter,NavigableObject
public class AutoScalingConfig extends Object implements MapWriter
Bean representation ofautoscaling.json, which parses data lazily.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAutoScalingConfig.ActionConfigBean representation of trigger action configuration.static classAutoScalingConfig.TriggerConfigBean representation of trigger config.static classAutoScalingConfig.TriggerListenerConfigBean representation of trigger listener config.-
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
MapWriter.EntryWriter
-
-
Constructor Summary
Constructors Constructor Description AutoScalingConfig(byte[] utf8)Construct from bytes that represent a UTF-8 JSON string.AutoScalingConfig(Map<String,Object> jsonMap)Construct from a JSON map representation.AutoScalingConfig(Policy policy, Map<String,AutoScalingConfig.TriggerConfig> triggerConfigs, Map<String,AutoScalingConfig.TriggerListenerConfig> listenerConfigs, Map<String,Object> properties, int zkVersion)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()booleanequals(Object o)PolicygetPolicy()GetPolicyconfiguration.Map<String,Object>getProperties()Map<String,AutoScalingConfig.TriggerConfig>getTriggerConfigs()Get trigger configurations.Map<String,AutoScalingConfig.TriggerListenerConfig>getTriggerListenerConfigs()Get listener configurations.intgetZkVersion()Return the znode version that was used to create this configuration.booleanhasTriggerForEvents(TriggerEventType... types)Check whether triggers for specific event type exist.booleanisEmpty()Return true if the sourceautoscaling.jsonwas empty, false otherwise.StringtoString()AutoScalingConfigwithoutTriggerConfig(String name)Create a copy of the config without a trigger configuration.AutoScalingConfigwithoutTriggerListenerConfig(String name)Create a copy of the config without a trigger listener configuration.AutoScalingConfigwithPolicy(Policy policy)Create a copy of the config with replaced policy.AutoScalingConfigwithProperties(Map<String,Object> properties)Create a copy of the config with replaced properties.AutoScalingConfigwithTriggerConfig(AutoScalingConfig.TriggerConfig config)Create a copy of the config with replaced trigger configurationAutoScalingConfigwithTriggerConfigs(Map<String,AutoScalingConfig.TriggerConfig> configs)Create a copy of the config with replaced trigger configurations.AutoScalingConfigwithTriggerListenerConfig(AutoScalingConfig.TriggerListenerConfig config)Create a copy of the config with replaced trigger listener configuration.AutoScalingConfigwithTriggerListenerConfigs(Map<String,AutoScalingConfig.TriggerListenerConfig> configs)Create a copy of the config with replaced trigger listener configurations.voidwriteMap(MapWriter.EntryWriter ew)-
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr
-
-
-
-
Constructor Detail
-
AutoScalingConfig
public AutoScalingConfig(byte[] utf8)
Construct from bytes that represent a UTF-8 JSON string.- Parameters:
utf8- config data
-
AutoScalingConfig
public AutoScalingConfig(Map<String,Object> jsonMap)
Construct from a JSON map representation.- Parameters:
jsonMap- JSON map representation of the config. Note that this map is evaluated lazily, and outside modifications may cause unpredictable behavior.
-
AutoScalingConfig
public AutoScalingConfig(Policy policy, Map<String,AutoScalingConfig.TriggerConfig> triggerConfigs, Map<String,AutoScalingConfig.TriggerListenerConfig> listenerConfigs, Map<String,Object> properties, int zkVersion)
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Return true if the sourceautoscaling.jsonwas empty, false otherwise.
-
getTriggerConfigs
public Map<String,AutoScalingConfig.TriggerConfig> getTriggerConfigs()
Get trigger configurations.
-
hasTriggerForEvents
public boolean hasTriggerForEvents(TriggerEventType... types)
Check whether triggers for specific event type exist.- Parameters:
types- list of event types- Returns:
- true if there's at least one trigger matching at least one event type, false otherwise,
-
getTriggerListenerConfigs
public Map<String,AutoScalingConfig.TriggerListenerConfig> getTriggerListenerConfigs()
Get listener configurations.
-
withProperties
public AutoScalingConfig withProperties(Map<String,Object> properties)
Create a copy of the config with replaced properties.- Parameters:
properties- the new properties map- Returns:
- modified copy of the configuration
-
withPolicy
public AutoScalingConfig withPolicy(Policy policy)
Create a copy of the config with replaced policy.- Parameters:
policy- new policy- Returns:
- modified copy of the configuration
-
withTriggerConfigs
public AutoScalingConfig withTriggerConfigs(Map<String,AutoScalingConfig.TriggerConfig> configs)
Create a copy of the config with replaced trigger configurations.- Parameters:
configs- new trigger configurations- Returns:
- modified copy of the configuration
-
withTriggerConfig
public AutoScalingConfig withTriggerConfig(AutoScalingConfig.TriggerConfig config)
Create a copy of the config with replaced trigger configuration- Parameters:
config- new trigger configuration- Returns:
- modified copy of the configuration
-
withoutTriggerConfig
public AutoScalingConfig withoutTriggerConfig(String name)
Create a copy of the config without a trigger configuration.- Parameters:
name- trigger configuration name- Returns:
- modified copy of the configuration, even if the specified config name didn't exist.
-
withTriggerListenerConfigs
public AutoScalingConfig withTriggerListenerConfigs(Map<String,AutoScalingConfig.TriggerListenerConfig> configs)
Create a copy of the config with replaced trigger listener configurations.- Parameters:
configs- new trigger listener configurations- Returns:
- modified copy of the configuration
-
withTriggerListenerConfig
public AutoScalingConfig withTriggerListenerConfig(AutoScalingConfig.TriggerListenerConfig config)
Create a copy of the config with replaced trigger listener configuration.- Parameters:
config- new trigger listener configuration- Returns:
- modified copy of the configuration
-
withoutTriggerListenerConfig
public AutoScalingConfig withoutTriggerListenerConfig(String name)
Create a copy of the config without a trigger listener configuration.- Parameters:
name- trigger listener configuration name- Returns:
- modified copy of the configuration, even if the specified config name didn't exist.
-
getZkVersion
public int getZkVersion()
Return the znode version that was used to create this configuration.
-
writeMap
public void writeMap(MapWriter.EntryWriter ew) throws IOException
- Specified by:
writeMapin interfaceMapWriter- Throws:
IOException
-
-