Skip to content

Commit 569b6ff

Browse files
committed
preliminary support 6.1.0
1 parent e02ad1c commit 569b6ff

File tree

107 files changed

+1972
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+1972
-7
lines changed

commons/src/main/java/tech/beshu/ror/commons/settings/BasicSettings.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import tech.beshu.ror.commons.Constants;
2222
import tech.beshu.ror.commons.Verbosity;
2323
import tech.beshu.ror.commons.shims.es.LoggerShim;
24+
import tech.beshu.ror.commons.utils.ReflecUtils;
2425

2526
import java.nio.file.Files;
2627
import java.nio.file.Path;
@@ -123,6 +124,10 @@ private static String slurpFile(LoggerShim logger, String filePath) {
123124
return slurped[0];
124125
}
125126

127+
public static BasicSettings fromFileObj(LoggerShim logger, Path configPath, Object settingsObject) {
128+
return fromFile(logger, configPath, (Map<String, ?>) ReflecUtils.invokeMethodCached(settingsObject, settingsObject.getClass(), "getAsStructuredMap"));
129+
}
130+
126131
public static BasicSettings fromFile(LoggerShim logger, Path configPath, Map<String, ?> fallback) {
127132
try {
128133
final String baseConfigDirPath = configPath.toAbsolutePath().toString();

commons/src/main/java/tech/beshu/ror/commons/utils/ReflecUtils.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.security.AccessController;
2929
import java.security.PrivilegedAction;
3030
import java.util.HashMap;
31+
import java.util.Map;
3132
import java.util.Set;
3233
import java.util.function.Function;
3334

@@ -40,25 +41,26 @@ public class ReflecUtils {
4041
private static final HashMap<String, Method> methodsCache = new HashMap<>(128);
4142

4243
public static Object invokeMethodCached(Object o, Class c, String method) {
44+
System.out.println(c.getSimpleName());
4345
final Object[] result = new Object[1];
44-
String cacheKey = c.getName() + method;
46+
String cacheKey = c.getName() + "#" + method;
4547

46-
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
48+
return AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
4749
try {
4850
Method m = methodsCache.get(cacheKey);
4951
if (m != null) {
5052
result[0] = m.invoke(o);
5153
return null;
5254
}
53-
m = c.getMethod(method);
55+
m = c.getDeclaredMethod(method);
56+
m.setAccessible(true);
5457
methodsCache.put(cacheKey, m);
55-
result[0] = m.invoke(o);
58+
return m.invoke(o);
5659
} catch (Exception e) {
5760
e.printStackTrace();
61+
return null;
5862
}
59-
return null;
6063
});
61-
return result[0];
6264
}
6365

6466
public static String[] extractStringArrayFromPrivateMethod(String methodName, Object o, ESContext context) {

es61x/build.gradle

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/*
2+
* This file is part of ReadonlyREST.
3+
*
4+
* ReadonlyREST is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* ReadonlyREST is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with ReadonlyREST. If not, see http://www.gnu.org/licenses/
16+
*/
17+
18+
buildscript {
19+
ext {
20+
publishedPluginVersion = rootProject.properties['pluginVersion']
21+
pluginVersion = rootProject.properties['pluginVersion']
22+
esVersion = project.properties['esVersion']
23+
pluginName = rootProject.properties['pluginName']
24+
}
25+
repositories {
26+
mavenLocal()
27+
mavenCentral()
28+
jcenter()
29+
}
30+
31+
dependencies {
32+
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.10.0'
33+
}
34+
}
35+
36+
repositories {
37+
mavenCentral()
38+
}
39+
40+
group = 'org.elasticsearch.plugin'
41+
version = pluginVersion + '_es' + esVersion
42+
def pluginFullName = pluginName + '-' + version
43+
44+
apply plugin: 'java'
45+
apply plugin: 'idea'
46+
apply plugin: 'maven'
47+
apply plugin: 'license'
48+
49+
dependencies {
50+
compile project(':core')
51+
// compile project(':core2')
52+
compile project(':commons')
53+
compile 'org.elasticsearch:elasticsearch:' + esVersion
54+
compile 'org.elasticsearch.plugin:transport-netty4-client:' + esVersion
55+
}
56+
57+
license {
58+
header rootProject.file('ReadonlyRESTLicenseHeader.txt')
59+
skipExistingHeaders true
60+
useDefaultMappings = false
61+
mapping {
62+
java = 'SLASHSTAR_STYLE'
63+
}
64+
}
65+
66+
tasks.withType(Zip) { task ->
67+
task.doLast {
68+
ant.checksum file: it.archivePath, algorithm: 'sha1'
69+
}
70+
}
71+
72+
configurations {
73+
wagon
74+
distJars {
75+
extendsFrom runtime
76+
exclude group: 'org.elasticsearch'
77+
exclude group: 'lucene-core'
78+
exclude group: 'org.apache.logging.log4j'
79+
exclude group: 'lucene-analyzers-common'
80+
exclude group: 'org.apache.commons'
81+
exclude group: 'org.yaml'
82+
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core'
83+
}
84+
}
85+
86+
task cleanOldData {
87+
doLast {
88+
delete 'build/tmp/' + pluginFullName
89+
}
90+
}
91+
92+
task jarHellCheck(type: JavaExec) {
93+
outputs.upToDateWhen { false }
94+
main = "org.elasticsearch.bootstrap.JarHell"
95+
classpath = project.sourceSets.main.compileClasspath.filter { it.exists() }
96+
}
97+
98+
task configureEsVersion() {
99+
doLast {
100+
if (project.hasProperty('esVersion')) {
101+
esVersion = project.properties['esVersion']
102+
}
103+
}
104+
}
105+
106+
task resolvePluginDescriptorTemplate(type: Copy, dependsOn: configureEsVersion) {
107+
outputs.upToDateWhen { false }
108+
from '../plugin-metadata'
109+
into 'build/tmp/' + pluginFullName
110+
expand([
111+
'descriptor': [
112+
'name' : pluginName,
113+
'pluginVersion': project.properties['pluginVersion'],
114+
'esVersion' : project.properties['esVersion']
115+
]
116+
])
117+
}
118+
119+
task ror(type: Zip, dependsOn: [cleanOldData, jarHellCheck, jar, resolvePluginDescriptorTemplate]) {
120+
outputs.upToDateWhen { false }
121+
archivesBaseName = pluginName
122+
into('elasticsearch') {
123+
from configurations.distJars
124+
from 'build/libs/' + pluginFullName + '.jar'
125+
from 'build/tmp/' + pluginFullName
126+
}
127+
}

es61x/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
esVersion=6.1.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
c592b500269bfde36096641b01238a8350f8aa31

es61x/licenses/accessors-smart-LICENSE.txt

Whitespace-only changes.

es61x/licenses/accessors-smart-NOTICE.txt

Whitespace-only changes.

es61x/licenses/asm-5.0.4.jar.sha1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0da08b8cce7bbf903602a25a3a163ae252435795

es61x/licenses/asm-LICENSE.txt

Whitespace-only changes.

es61x/licenses/asm-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4b95f4897fa13f2cd904aee711aeafc0c5295cd8

es61x/licenses/commons-codec-LICENSE.txt

Whitespace-only changes.

es61x/licenses/commons-codec-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f

es61x/licenses/commons-logging-LICENSE.txt

Whitespace-only changes.

es61x/licenses/commons-logging-NOTICE.txt

Whitespace-only changes.

es61x/licenses/core-1.15.0.jar.sha1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3c85bc3679f3f2187101c349134b84d46e7fc4da

es61x/licenses/core-LICENSE.txt

Whitespace-only changes.

es61x/licenses/core-NOTICE.txt

Whitespace-only changes.

es61x/licenses/guava-21.0.jar.sha1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3a3d111be1be1b745edfa7d91678a12d7ed38709

es61x/licenses/guava-LICENSE.txt

Whitespace-only changes.

es61x/licenses/guava-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
95aa3e6fb520191a0970a73cf09f62948ee614be

es61x/licenses/httpasyncclient-LICENSE.txt

Whitespace-only changes.

es61x/licenses/httpasyncclient-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
733db77aa8d9b2d68015189df76ab06304406e50

es61x/licenses/httpclient-LICENSE.txt

Whitespace-only changes.

es61x/licenses/httpclient-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e7501a1b34325abb00d17dde96150604a0658b54

es61x/licenses/httpcore-LICENSE.txt

Whitespace-only changes.

es61x/licenses/httpcore-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f4be009e7505f6ceddf21e7960c759f413f15056

es61x/licenses/httpcore-nio-LICENSE.txt

Whitespace-only changes.

es61x/licenses/httpcore-nio-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
45b426f7796b741035581a176744d91090e2e6fb

es61x/licenses/jackson-annotations-LICENSE.txt

Whitespace-only changes.

es61x/licenses/jackson-annotations-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1f12816593c1422be957471c98a80bfbace60fa2

es61x/licenses/jackson-databind-LICENSE.txt

Whitespace-only changes.

es61x/licenses/jackson-databind-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
598244f595db5c5fb713731eddbb1c91a58d959b

es61x/licenses/javassist-LICENSE.txt

Whitespace-only changes.

es61x/licenses/javassist-NOTICE.txt

Whitespace-only changes.

es61x/licenses/jjwt-0.7.0.jar.sha1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f042fe2676bfdc2091545152e47d77e11999946d

es61x/licenses/jjwt-LICENSE.txt

Whitespace-only changes.

es61x/licenses/jjwt-NOTICE.txt

Whitespace-only changes.

es61x/licenses/jool-0.9.12.jar.sha1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ea41cf9e2020fd655a734d1d6fe91ee6533d64b9

es61x/licenses/jool-LICENSE.txt

Whitespace-only changes.

es61x/licenses/jool-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22290d17944bd239fabf5ac69005a60a7ecbbbcb

es61x/licenses/json-path-LICENSE.txt

Whitespace-only changes.

es61x/licenses/json-path-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
007396407491352ce4fa30de92efb158adb76b5b

es61x/licenses/json-smart-LICENSE.txt

Whitespace-only changes.

es61x/licenses/json-smart-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
65e89b4d0737cf1ed3eac2916ebf365f5312294c

es61x/licenses/netty-buffer-LICENSE.txt

Whitespace-only changes.

es61x/licenses/netty-buffer-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
b3ecd69e7ab0eb2054b26ad3efb13c34204ffe19

es61x/licenses/netty-codec-LICENSE.txt

Whitespace-only changes.

es61x/licenses/netty-codec-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9f957998c651e7b73d6dc878f704d81b4c085387

es61x/licenses/netty-codec-http-LICENSE.txt

Whitespace-only changes.

es61x/licenses/netty-codec-http-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
06766071efa0426fb33101d1758a8d0e09d16ac7

es61x/licenses/netty-common-LICENSE.txt

Whitespace-only changes.

es61x/licenses/netty-common-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6f7dfa01c1af4280c154213b6d548405df352df9

es61x/licenses/netty-handler-LICENSE.txt

Whitespace-only changes.

es61x/licenses/netty-handler-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
077734f94029b47887f6f9392d1fc62729e155aa

es61x/licenses/netty-resolver-LICENSE.txt

Whitespace-only changes.

es61x/licenses/netty-resolver-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
469e86d4dda1dca8b88d2b1faa8e0f078243ba12

es61x/licenses/netty-transport-LICENSE.txt

Whitespace-only changes.

es61x/licenses/netty-transport-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4c686033d918ec1727e329b7222fcb020152e32b

es61x/licenses/reflections-LICENSE.txt

Whitespace-only changes.

es61x/licenses/reflections-NOTICE.txt

Whitespace-only changes.

es61x/licenses/rest-5.3.2.jar.sha1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7cb6a2759c02f89c79546046c643c0ece0764f07

es61x/licenses/rest-LICENSE.txt

Whitespace-only changes.

es61x/licenses/rest-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
139535a69a4239db087de9bab0bee568bf8e0b70

es61x/licenses/slf4j-api-LICENSE.txt

Whitespace-only changes.

es61x/licenses/slf4j-api-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
b628afefa7dc39ccb8f401fee27631d3a39d6709

es61x/licenses/transport-netty4-client-LICENSE.txt

Whitespace-only changes.

es61x/licenses/transport-netty4-client-NOTICE.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f76725e5a215ea468ecda06a8d66a809281e685f

es61x/licenses/unboundid-ldapsdk-LICENSE.txt

Whitespace-only changes.

es61x/licenses/unboundid-ldapsdk-NOTICE.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)