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 class
AutoScalingConfig.ActionConfig
Bean representation of trigger action configuration.static class
AutoScalingConfig.TriggerConfig
Bean representation of trigger config.static class
AutoScalingConfig.TriggerListenerConfig
Bean 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 Object
clone()
boolean
equals(Object o)
Policy
getPolicy()
GetPolicy
configuration.Map<String,Object>
getProperties()
Map<String,AutoScalingConfig.TriggerConfig>
getTriggerConfigs()
Get trigger configurations.Map<String,AutoScalingConfig.TriggerListenerConfig>
getTriggerListenerConfigs()
Get listener configurations.int
getZkVersion()
Return the znode version that was used to create this configuration.boolean
hasTriggerForEvents(TriggerEventType... types)
Check whether triggers for specific event type exist.boolean
isEmpty()
Return true if the sourceautoscaling.json
was empty, false otherwise.String
toString()
AutoScalingConfig
withoutTriggerConfig(String name)
Create a copy of the config without a trigger configuration.AutoScalingConfig
withoutTriggerListenerConfig(String name)
Create a copy of the config without a trigger listener configuration.AutoScalingConfig
withPolicy(Policy policy)
Create a copy of the config with replaced policy.AutoScalingConfig
withProperties(Map<String,Object> properties)
Create a copy of the config with replaced properties.AutoScalingConfig
withTriggerConfig(AutoScalingConfig.TriggerConfig config)
Create a copy of the config with replaced trigger configurationAutoScalingConfig
withTriggerConfigs(Map<String,AutoScalingConfig.TriggerConfig> configs)
Create a copy of the config with replaced trigger configurations.AutoScalingConfig
withTriggerListenerConfig(AutoScalingConfig.TriggerListenerConfig config)
Create a copy of the config with replaced trigger listener configuration.AutoScalingConfig
withTriggerListenerConfigs(Map<String,AutoScalingConfig.TriggerListenerConfig> configs)
Create a copy of the config with replaced trigger listener configurations.void
writeMap(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.json
was 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:
writeMap
in interfaceMapWriter
- Throws:
IOException
-
-