stub out acknowledge callbacks for commercial plugins

Original commit: elastic/x-pack-elasticsearch@d16f9dc1df
This commit is contained in:
Areek Zillur 2015-08-21 14:04:30 -04:00
parent 0b9021ee87
commit ef7d4e2579
3 changed files with 37 additions and 10 deletions

View File

@ -19,10 +19,7 @@ import org.elasticsearch.license.plugin.core.LicensesService;
import org.elasticsearch.marvel.MarvelPlugin;
import org.elasticsearch.marvel.mode.Mode;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.*;
public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
@ -36,6 +33,7 @@ public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
private final LicensesManagerService managerService;
private final LicensesClientService clientService;
private final Collection<LicensesService.ExpirationCallback> expirationLoggers;
private final LicensesClientService.AcknowledgementCallback acknowledgementCallback;
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
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

View File

@ -18,6 +18,8 @@ import org.elasticsearch.license.plugin.core.LicensesClientService;
import org.elasticsearch.shield.ShieldPlugin;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
/**
@ -35,6 +37,7 @@ public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
private final LicensesClientService licensesClientService;
private final LicenseEventsNotifier notifier;
private final Collection<LicensesClientService.ExpirationCallback> expirationLoggers;
private final LicensesClientService.AcknowledgementCallback acknowledgementCallback;
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() {
@ -87,7 +99,7 @@ public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
@Override
protected void doStart() throws ElasticsearchException {
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 {
//TODO currently we disable licensing on tribe node. remove this once es core supports merging cluster
new InternalListener().onEnabled(null);

View File

@ -17,9 +17,7 @@ import org.elasticsearch.license.plugin.core.LicensesClientService;
import org.elasticsearch.license.plugin.core.LicensesService;
import org.elasticsearch.watcher.WatcherPlugin;
import java.util.Arrays;
import java.util.Collection;
import java.util.Locale;
import java.util.*;
/**
*
@ -35,6 +33,7 @@ public class LicenseService extends AbstractLifecycleComponent<LicenseService> {
private final LicensesClientService clientService;
private final Collection<LicensesService.ExpirationCallback> expirationLoggers;
private final LicensesClientService.AcknowledgementCallback acknowledgementCallback;
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
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