stub out acknowledge callbacks for commercial plugins
Original commit: elastic/x-pack-elasticsearch@d16f9dc1df
This commit is contained in:
parent
0b9021ee87
commit
ef7d4e2579
|
@ -19,10 +19,7 @@ import org.elasticsearch.license.plugin.core.LicensesService;
|
||||||
import org.elasticsearch.marvel.MarvelPlugin;
|
import org.elasticsearch.marvel.MarvelPlugin;
|
||||||
import org.elasticsearch.marvel.mode.Mode;
|
import org.elasticsearch.marvel.mode.Mode;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
|
public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
|
||||||
|
|
||||||
|
@ -36,6 +33,7 @@ public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
|
||||||
private final LicensesManagerService managerService;
|
private final LicensesManagerService managerService;
|
||||||
private final LicensesClientService clientService;
|
private final LicensesClientService clientService;
|
||||||
private final Collection<LicensesService.ExpirationCallback> expirationLoggers;
|
private final Collection<LicensesService.ExpirationCallback> expirationLoggers;
|
||||||
|
private final LicensesClientService.AcknowledgementCallback acknowledgementCallback;
|
||||||
|
|
||||||
private volatile Mode mode;
|
private volatile Mode mode;
|
||||||
|
|
||||||
|
@ -77,11 +75,20 @@ public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
this.acknowledgementCallback = new LicensesClientService.AcknowledgementCallback() {
|
||||||
|
@Override
|
||||||
|
public List<String> acknowledge(License currentLicense, License newLicense) {
|
||||||
|
// TODO: add messages to be acknowledged when installing newLicense from currentLicense
|
||||||
|
// NOTE: currentLicense can be null, as a license registration can happen before
|
||||||
|
// a trial license could be generated
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStart() throws ElasticsearchException {
|
protected void doStart() throws ElasticsearchException {
|
||||||
clientService.register(FEATURE_NAME, TRIAL_LICENSE_OPTIONS, expirationLoggers, null, new InternalListener(this));
|
clientService.register(FEATURE_NAME, TRIAL_LICENSE_OPTIONS, expirationLoggers, acknowledgementCallback, new InternalListener(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,6 +18,8 @@ import org.elasticsearch.license.plugin.core.LicensesClientService;
|
||||||
import org.elasticsearch.shield.ShieldPlugin;
|
import org.elasticsearch.shield.ShieldPlugin;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +37,7 @@ public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
|
||||||
private final LicensesClientService licensesClientService;
|
private final LicensesClientService licensesClientService;
|
||||||
private final LicenseEventsNotifier notifier;
|
private final LicenseEventsNotifier notifier;
|
||||||
private final Collection<LicensesClientService.ExpirationCallback> expirationLoggers;
|
private final Collection<LicensesClientService.ExpirationCallback> expirationLoggers;
|
||||||
|
private final LicensesClientService.AcknowledgementCallback acknowledgementCallback;
|
||||||
|
|
||||||
private boolean enabled = false;
|
private boolean enabled = false;
|
||||||
|
|
||||||
|
@ -78,6 +81,15 @@ public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
this.acknowledgementCallback = new LicensesClientService.AcknowledgementCallback() {
|
||||||
|
@Override
|
||||||
|
public List<String> acknowledge(License currentLicense, License newLicense) {
|
||||||
|
// TODO: add messages to be acknowledged when installing newLicense from currentLicense
|
||||||
|
// NOTE: currentLicense can be null, as a license registration can happen before
|
||||||
|
// a trial license could be generated
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean enabled() {
|
public synchronized boolean enabled() {
|
||||||
|
@ -87,7 +99,7 @@ public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
|
||||||
@Override
|
@Override
|
||||||
protected void doStart() throws ElasticsearchException {
|
protected void doStart() throws ElasticsearchException {
|
||||||
if (settings.getGroups("tribe", true).isEmpty()) {
|
if (settings.getGroups("tribe", true).isEmpty()) {
|
||||||
licensesClientService.register(FEATURE_NAME, TRIAL_LICENSE_OPTIONS, expirationLoggers, null, new InternalListener());
|
licensesClientService.register(FEATURE_NAME, TRIAL_LICENSE_OPTIONS, expirationLoggers, acknowledgementCallback, new InternalListener());
|
||||||
} else {
|
} else {
|
||||||
//TODO currently we disable licensing on tribe node. remove this once es core supports merging cluster
|
//TODO currently we disable licensing on tribe node. remove this once es core supports merging cluster
|
||||||
new InternalListener().onEnabled(null);
|
new InternalListener().onEnabled(null);
|
||||||
|
|
|
@ -17,9 +17,7 @@ import org.elasticsearch.license.plugin.core.LicensesClientService;
|
||||||
import org.elasticsearch.license.plugin.core.LicensesService;
|
import org.elasticsearch.license.plugin.core.LicensesService;
|
||||||
import org.elasticsearch.watcher.WatcherPlugin;
|
import org.elasticsearch.watcher.WatcherPlugin;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -35,6 +33,7 @@ public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
|
||||||
|
|
||||||
private final LicensesClientService clientService;
|
private final LicensesClientService clientService;
|
||||||
private final Collection<LicensesService.ExpirationCallback> expirationLoggers;
|
private final Collection<LicensesService.ExpirationCallback> expirationLoggers;
|
||||||
|
private final LicensesClientService.AcknowledgementCallback acknowledgementCallback;
|
||||||
|
|
||||||
private volatile boolean enabled;
|
private volatile boolean enabled;
|
||||||
|
|
||||||
|
@ -80,11 +79,20 @@ public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
this.acknowledgementCallback = new LicensesClientService.AcknowledgementCallback() {
|
||||||
|
@Override
|
||||||
|
public List<String> acknowledge(License currentLicense, License newLicense) {
|
||||||
|
// TODO: add messages to be acknowledged when installing newLicense from currentLicense
|
||||||
|
// NOTE: currentLicense can be null, as a license registration can happen before
|
||||||
|
// a trial license could be generated
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStart() throws ElasticsearchException {
|
protected void doStart() throws ElasticsearchException {
|
||||||
clientService.register(FEATURE_NAME, TRIAL_LICENSE_OPTIONS, expirationLoggers, null, new InternalListener(this));
|
clientService.register(FEATURE_NAME, TRIAL_LICENSE_OPTIONS, expirationLoggers, acknowledgementCallback, new InternalListener(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue