本文整理了Java中org.elasticsearch.Version.equals()
方法的一些代码示例,展示了Version.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.equals()
方法的具体详情如下:
包路径:org.elasticsearch.Version
类名称:Version
方法名:equals
暂无
代码示例来源:origin: floragunncom/search-guard
private static void issueWarnings(Client tc) {
NodesInfoResponse nir = tc.admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet();
Version maxVersion = nir.getNodes().stream().max((n1,n2) -> n1.getVersion().compareTo(n2.getVersion())).get().getVersion();
Version minVersion = nir.getNodes().stream().min((n1,n2) -> n1.getVersion().compareTo(n2.getVersion())).get().getVersion();
if(!maxVersion.equals(minVersion)) {
System.out.println("WARNING: Your cluster consists of different node versions. It is not recommended to run sgadmin against a mixed cluster. This may fail.");
System.out.println(" Minimum node version is "+minVersion.toString());
System.out.println(" Maximum node version is "+maxVersion.toString());
} else {
System.out.println("Elasticsearch Version: "+minVersion.toString());
}
if(nir.getNodes().size() > 0) {
List<PluginInfo> pluginInfos = nir.getNodes().get(0).getPlugins().getPluginInfos();
String sgVersion = pluginInfos.stream().filter(p->p.getClassname().equals("com.floragunn.searchguard.SearchGuardPlugin")).map(p->p.getVersion()).findFirst().orElse("<unknown>");
System.out.println("Search Guard Version: "+sgVersion);
}
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
@SuppressWarnings("unchecked") SnapshotRecoverySource that = (SnapshotRecoverySource) o;
return restoreUUID.equals(that.restoreUUID) && snapshot.equals(that.snapshot)
&& index.equals(that.index) && version.equals(that.version);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public AnalyzerProvider<?> get(IndexSettings indexSettings,
Environment environment,
String name,
Settings settings) throws IOException {
Version versionCreated = Version.indexCreated(settings);
if (Version.CURRENT.equals(versionCreated) == false) {
return super.get(indexSettings, environment, name, settings);
} else {
return current;
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
protected AnalyzerProvider<?> create(Version version) {
assert Version.CURRENT.equals(version) == false;
Analyzer analyzer = create.apply(version);
analyzer.setVersion(version.luceneVersion);
return new PreBuiltAnalyzerProvider(getName(), AnalyzerScope.INDICES, analyzer);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Verify the given plugin is compatible with the current Elasticsearch installation.
*/
static void verifyCompatibility(PluginInfo info) {
if (info.getElasticsearchVersion().equals(Version.CURRENT) == false) {
throw new IllegalArgumentException("Plugin [" + info.getName() + "] was built for Elasticsearch version "
+ info.getElasticsearchVersion() + " but version " + Version.CURRENT + " is running");
}
JarHell.checkJavaVersion(info.getName(), info.getJavaVersion());
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Updates the settings and index metadata and notifies all registered settings consumers with the new settings iff at least one
* setting has changed.
*
* @return <code>true</code> iff any setting has been updated otherwise <code>false</code>.
*/
public synchronized boolean updateIndexMetaData(IndexMetaData indexMetaData) {
final Settings newSettings = indexMetaData.getSettings();
if (version.equals(Version.indexCreated(newSettings)) == false) {
throw new IllegalArgumentException("version mismatch on settings update expected: " + version + " but was: " +
Version.indexCreated(newSettings));
}
final String newUUID = newSettings.get(IndexMetaData.SETTING_INDEX_UUID, IndexMetaData.INDEX_UUID_NA_VALUE);
if (newUUID.equals(getUUID()) == false) {
throw new IllegalArgumentException("uuid mismatch on settings update expected: " + getUUID() + " but was: " + newUUID);
}
this.indexMetaData = indexMetaData;
final Settings newIndexSettings = Settings.builder().put(nodeSettings).put(newSettings).build();
if (same(this.settings, newIndexSettings)) {
// nothing to update, same settings
return false;
}
scopedSettings.applySettings(newSettings);
this.settings = newIndexSettings;
return true;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public ClusterState execute(ClusterState currentState) {
MetaData.Builder metaDataBuilder = MetaData.builder(currentState.metaData());
for (Map.Entry<String, Tuple<Version, String>> entry : request.versions().entrySet()) {
String index = entry.getKey();
IndexMetaData indexMetaData = metaDataBuilder.get(index);
if (indexMetaData != null) {
if (Version.CURRENT.equals(indexMetaData.getCreationVersion()) == false) {
// no reason to pollute the settings, we didn't really upgrade anything
metaDataBuilder.put(
IndexMetaData
.builder(indexMetaData)
.settings(
Settings
.builder()
.put(indexMetaData.getSettings())
.put(IndexMetaData.SETTING_VERSION_UPGRADED, entry.getValue().v1()))
.settingsVersion(1 + indexMetaData.getSettingsVersion()));
}
}
}
return ClusterState.builder(currentState).metaData(metaDataBuilder).build();
}
});
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public void readFrom(final StreamInput in) throws IOException {
if (in.getVersion().equals(Version.V_6_0_0)) {
/*
* Resync replication request serialization was broken in 6.0.0 due to the elements of the stream not being prefixed with a
* byte indicating the type of the operation.
*/
throw new IllegalStateException("resync replication request serialization is broken in 6.0.0");
}
super.readFrom(in);
if (in.getVersion().onOrAfter(Version.V_6_4_0)) {
trimAboveSeqNo = in.readZLong();
} else {
trimAboveSeqNo = SequenceNumbers.UNASSIGNED_SEQ_NO;
}
if (in.getVersion().onOrAfter(Version.V_6_5_0)) {
maxSeenAutoIdTimestampOnPrimary = in.readZLong();
} else {
maxSeenAutoIdTimestampOnPrimary = IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP;
}
operations = in.readArray(Translog.Operation::readOperation, Translog.Operation[]::new);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Serializes the given message into a bytes representation
*/
private BytesReference buildMessage(long requestId, byte status, Version nodeVersion, TransportMessage message,
CompressibleBytesOutputStream stream) throws IOException {
final BytesReference zeroCopyBuffer;
if (message instanceof BytesTransportRequest) { // what a shitty optimization - we should use a direct send method instead
BytesTransportRequest bRequest = (BytesTransportRequest) message;
assert nodeVersion.equals(bRequest.version());
bRequest.writeThin(stream);
zeroCopyBuffer = bRequest.bytes;
} else {
message.writeTo(stream);
zeroCopyBuffer = BytesArray.EMPTY;
}
// we have to call materializeBytes() here before accessing the bytes. A CompressibleBytesOutputStream
// might be implementing compression. And materializeBytes() ensures that some marker bytes (EOS marker)
// are written. Otherwise we barf on the decompressing end when we read past EOF on purpose in the
// #validateRequest method. this might be a problem in deflate after all but it's important to write
// the marker bytes.
final BytesReference messageBody = stream.materializeBytes();
final BytesReference header = buildHeader(requestId, status, stream.getVersion(), messageBody.length() + zeroCopyBuffer.length());
return new CompositeBytesReference(header, messageBody, zeroCopyBuffer);
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
@SuppressWarnings("unchecked") SnapshotRecoverySource that = (SnapshotRecoverySource) o;
return snapshot.equals(that.snapshot) && index.equals(that.index) && version.equals(that.version);
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
@SuppressWarnings("unchecked") SnapshotRecoverySource that = (SnapshotRecoverySource) o;
return snapshot.equals(that.snapshot) && index.equals(that.index) && version.equals(that.version);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
@SuppressWarnings("unchecked") SnapshotRecoverySource that = (SnapshotRecoverySource) o;
return snapshot.equals(that.snapshot) && index.equals(that.index) && version.equals(that.version);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
@Override
protected AnalyzerProvider<?> create(Version version) {
assert Version.CURRENT.equals(version) == false;
Analyzer analyzer = create.apply(version);
analyzer.setVersion(version.luceneVersion);
return new PreBuiltAnalyzerProvider(getName(), AnalyzerScope.INDICES, analyzer);
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
public TokenizerFactory get(IndexSettings indexSettings, Environment environment, String name, Settings settings) throws IOException {
Version indexVersion = Version.indexCreated(settings);
if (!Version.CURRENT.equals(indexVersion)) {
PreBuiltTokenizers preBuiltTokenizers = PreBuiltTokenizers.getOrDefault(name, null);
if (preBuiltTokenizers != null) {
return preBuiltTokenizers.getTokenizerFactory(indexVersion);
}
}
return tokenizerFactory;
}
}
代码示例来源:origin: harbby/presto-connectors
@Override
public TokenizerFactory create(String name, Settings settings) {
Version indexVersion = Version.indexCreated(settings);
if (!Version.CURRENT.equals(indexVersion)) {
PreBuiltTokenizers preBuiltTokenizers = PreBuiltTokenizers.getOrDefault(name, null);
if (preBuiltTokenizers != null) {
return preBuiltTokenizers.getTokenizerFactory(indexVersion);
}
}
return tokenizerFactory;
}
}
代码示例来源:origin: harbby/presto-connectors
@Override
public TokenFilterFactory create(String name, Settings settings) {
Version indexVersion = Version.indexCreated(settings);
if (!Version.CURRENT.equals(indexVersion)) {
PreBuiltTokenFilters preBuiltTokenFilters = PreBuiltTokenFilters.getOrDefault(name, null);
if (preBuiltTokenFilters != null) {
return preBuiltTokenFilters.getTokenFilterFactory(indexVersion);
}
}
return tokenFilterFactory;
}
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
@Override
public CharFilterFactory get(IndexSettings indexSettings, Environment environment, String name, Settings settings) throws IOException {
Version indexVersion = Version.indexCreated(settings);
if (!Version.CURRENT.equals(indexVersion)) {
PreBuiltCharFilters preBuiltCharFilters = PreBuiltCharFilters.getOrDefault(name, null);
if (preBuiltCharFilters != null) {
return preBuiltCharFilters.getCharFilterFactory(indexVersion);
}
}
return charFilterFactory;
}
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
public AnalyzerProvider<?> create(String name, Settings settings) {
Version indexVersion = Version.indexCreated(settings);
if (!Version.CURRENT.equals(indexVersion)) {
PreBuiltAnalyzers preBuiltAnalyzers = PreBuiltAnalyzers.getOrDefault(name, null);
if (preBuiltAnalyzers != null) {
Analyzer analyzer = preBuiltAnalyzers.getAnalyzer(indexVersion);
return new PreBuiltAnalyzerProvider(name, AnalyzerScope.INDICES, analyzer);
}
}
return analyzerProvider;
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Verify the given plugin is compatible with the current Elasticsearch installation.
*/
static void verifyCompatibility(PluginInfo info) {
if (info.getElasticsearchVersion().equals(Version.CURRENT) == false) {
throw new IllegalArgumentException("Plugin [" + info.getName() + "] was built for Elasticsearch version "
+ info.getElasticsearchVersion() + " but version " + Version.CURRENT + " is running");
}
JarHell.checkJavaVersion(info.getName(), info.getJavaVersion());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
/**
* Verify the given plugin is compatible with the current Elasticsearch installation.
*/
static void verifyCompatibility(PluginInfo info) {
if (info.getElasticsearchVersion().equals(Version.CURRENT) == false) {
throw new IllegalArgumentException("Plugin [" + info.getName() + "] was built for Elasticsearch version "
+ info.getElasticsearchVersion() + " but version " + Version.CURRENT + " is running");
}
JarHell.checkJavaVersion(info.getName(), info.getJavaVersion());
}
内容来源于网络,如有侵权,请联系作者删除!