Skip to content

Commit

Permalink
Patch trino plugin to work with version 443
Browse files Browse the repository at this point in the history
  • Loading branch information
mattheusv committed Mar 26, 2024
1 parent 50ad9c1 commit da77fc1
Show file tree
Hide file tree
Showing 10 changed files with 239 additions and 147 deletions.
4 changes: 4 additions & 0 deletions agents-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
<version>15.4</version>
</dependency> <dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>${jna.version}</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import org.slf4j.LoggerFactory;

import javax.script.ScriptEngine;
import jdk.nashorn.api.scripting.ClassFilter;
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
import org.openjdk.nashorn.api.scripting.ClassFilter;
import org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory;

public class NashornScriptEngineCreator implements ScriptEngineCreator {
private static final Logger LOG = LoggerFactory.getLogger(NashornScriptEngineCreator.class);
Expand Down
37 changes: 36 additions & 1 deletion distro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
<descriptor>src/main/assembly/plugin-elasticsearch.xml</descriptor>
<descriptor>src/main/assembly/plugin-schema-registry.xml</descriptor>
<descriptor>src/main/assembly/plugin-presto.xml</descriptor>
<descriptor>src/main/assembly/plugin-trino.xml</descriptor>
<descriptor>src/main/assembly/sample-client.xml</descriptor>
</descriptors>
</configuration>
Expand All @@ -141,6 +140,41 @@
</plugins>
</build>
</profile>

<profile>
<id>ranger-jdk21</id>
<activation>
<jdk>21</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${assembly.plugin.version}</version>
<configuration>
<finalName>ranger-${project.version}</finalName>
<outputDirectory>../target</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<skipAssembly>false</skipAssembly>
<descriptors>
<descriptor>src/main/assembly/admin-web.xml</descriptor>
<descriptor>src/main/assembly/solr_audit_conf.xml</descriptor>
<descriptor>src/main/assembly/plugin-trino.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ranger-admin</id>
<build>
Expand Down Expand Up @@ -716,6 +750,7 @@
<descriptor>src/main/assembly/plugin-elasticsearch.xml</descriptor>
<descriptor>src/main/assembly/plugin-schema-registry.xml</descriptor>
<descriptor>src/main/assembly/plugin-presto.xml</descriptor>
<descriptor>src/main/assembly/plugin-trino.xml</descriptor>
</descriptors>
</configuration>
</execution>
Expand Down
10 changes: 5 additions & 5 deletions plugin-nestedstructure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
</properties>

<dependencies>
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
<version>15.4</version>
</dependency>
<dependency>
<groupId>org.apache.ranger</groupId>
<artifactId>ranger-plugins-common</artifactId>
Expand Down Expand Up @@ -68,11 +73,6 @@
<artifactId>json-path</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
<version>15.4</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

package org.apache.ranger.authorization.nestedstructure.authorizer;

import jdk.nashorn.api.scripting.ClassFilter;
import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
import org.openjdk.nashorn.api.scripting.ClassFilter;
import org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -107,4 +107,4 @@ public static boolean filterRow(String user, String filterExpr, String jsonStrin
}
}



17 changes: 17 additions & 0 deletions plugin-trino/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
The Ranger Trino plugin at this branch was patched to work with trino 433. The
base tag used to patch the plugin was `release-ranger-2.4.0`.

## How to build
Ranger admin required PhatonJS to build properly. PhatonJS requires an older
version of openssl to build with TLS support. Since we just need the Trino
plugin we can disable the tls support by settings the evironment variable
`OPENSSL_CONF` to `/dev/null`.

Make sure that you are using the Java version `21.0.1` and maven `3.9.6`.

```bash
OPENSSL_CONF=/dev/null mvn clean compile package -B \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dmaven.test.skip=true -Drat.skip=true -Dpmd.skip=true -Dfindbugs.skip=true \
-Dspotbugs.skip=true -Dcheckstyle.skip=true -P ranger-jdk21
```
Loading

0 comments on commit da77fc1

Please sign in to comment.