Allow to define custom prefix for settings when components do not use the org.elasticsearch package
This commit is contained in:
parent
bd5260a4f8
commit
9464c390ac
|
@ -48,6 +48,14 @@ public abstract class AbstractIndexComponent implements IndexComponent {
|
|||
this.logger = Loggers.getLogger(getClass(), indexSettings, index);
|
||||
}
|
||||
|
||||
protected AbstractIndexComponent(Index index, @IndexSettings Settings indexSettings, String prefixSettings) {
|
||||
this.index = index;
|
||||
this.indexSettings = indexSettings;
|
||||
this.componentSettings = indexSettings.getComponentSettings(prefixSettings, getClass());
|
||||
|
||||
this.logger = Loggers.getLogger(getClass(), indexSettings, index);
|
||||
}
|
||||
|
||||
@Override public Index index() {
|
||||
return this.index;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.slf4j.Logger;
|
|||
import static org.elasticsearch.index.shard.IndexShardManagement.*;
|
||||
|
||||
/**
|
||||
* @author kimchy (Shay Banon)
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public abstract class AbstractIndexShardComponent implements IndexShardComponent {
|
||||
|
||||
|
@ -48,6 +48,14 @@ public abstract class AbstractIndexShardComponent implements IndexShardComponent
|
|||
this.logger = Loggers.getLogger(getClass(), indexSettings, shardId);
|
||||
}
|
||||
|
||||
protected AbstractIndexShardComponent(ShardId shardId, @IndexSettings Settings indexSettings, String prefixSettings) {
|
||||
this.shardId = shardId;
|
||||
this.indexSettings = indexSettings;
|
||||
this.componentSettings = indexSettings.getComponentSettings(prefixSettings, getClass());
|
||||
|
||||
this.logger = Loggers.getLogger(getClass(), indexSettings, shardId);
|
||||
}
|
||||
|
||||
@Override public ShardId shardId() {
|
||||
return this.shardId;
|
||||
}
|
||||
|
|
|
@ -40,18 +40,36 @@ public class AbstractComponent {
|
|||
this.componentSettings = settings.getComponentSettings(getClass());
|
||||
}
|
||||
|
||||
public AbstractComponent(Settings settings, String prefixSettings) {
|
||||
this.logger = Loggers.getLogger(getClass(), settings);
|
||||
this.settings = settings;
|
||||
this.componentSettings = settings.getComponentSettings(prefixSettings, getClass());
|
||||
}
|
||||
|
||||
public AbstractComponent(Settings settings, Class customClass) {
|
||||
this.logger = Loggers.getLogger(customClass, settings);
|
||||
this.settings = settings;
|
||||
this.componentSettings = settings.getComponentSettings(customClass);
|
||||
}
|
||||
|
||||
public AbstractComponent(Settings settings, String prefixSettings, Class customClass) {
|
||||
this.logger = Loggers.getLogger(customClass, settings);
|
||||
this.settings = settings;
|
||||
this.componentSettings = settings.getComponentSettings(prefixSettings, customClass);
|
||||
}
|
||||
|
||||
public AbstractComponent(Settings settings, Class loggerClass, Class componentClass) {
|
||||
this.logger = Loggers.getLogger(loggerClass, settings);
|
||||
this.settings = settings;
|
||||
this.componentSettings = settings.getComponentSettings(componentClass);
|
||||
}
|
||||
|
||||
public AbstractComponent(Settings settings, String prefixSettings, Class loggerClass, Class componentClass) {
|
||||
this.logger = Loggers.getLogger(loggerClass, settings);
|
||||
this.settings = settings;
|
||||
this.componentSettings = settings.getComponentSettings(prefixSettings, componentClass);
|
||||
}
|
||||
|
||||
public String nodeName() {
|
||||
return settings.get("name", "");
|
||||
}
|
||||
|
|
|
@ -46,6 +46,18 @@ public abstract class AbstractLifecycleComponent<T> extends AbstractComponent im
|
|||
super(settings, loggerClass, componentClass);
|
||||
}
|
||||
|
||||
protected AbstractLifecycleComponent(Settings settings, String prefixSettings) {
|
||||
super(settings, prefixSettings);
|
||||
}
|
||||
|
||||
protected AbstractLifecycleComponent(Settings settings, String prefixSettings, Class customClass) {
|
||||
super(settings, prefixSettings, customClass);
|
||||
}
|
||||
|
||||
protected AbstractLifecycleComponent(Settings settings, String prefixSettings, Class loggerClass, Class componentClass) {
|
||||
super(settings, prefixSettings, loggerClass, componentClass);
|
||||
}
|
||||
|
||||
@Override public Lifecycle.State lifecycleState() {
|
||||
return this.lifecycle.state();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue