From 4263805c78cdc906939a52d8aa165f55db36eb29 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 2 Dec 2018 15:16:49 -0800 Subject: [PATCH] resolve java jar dependencies --- other/java/client/pom.xml | 8 ++++- .../seaweedfs/client/FilerGrpcClient.java | 4 +-- other/java/hdfs/pom.xml | 33 +++++++++++++++++-- .../java/seaweed/hdfs/SeaweedFileSystem.java | 12 +++---- .../seaweed/hdfs/SeaweedFileSystemStore.java | 3 +- 5 files changed, 48 insertions(+), 12 deletions(-) diff --git a/other/java/client/pom.xml b/other/java/client/pom.xml index 07015145e..2d5e4e31f 100644 --- a/other/java/client/pom.xml +++ b/other/java/client/pom.xml @@ -5,12 +5,13 @@ 4.0.0 seaweedfs - client + seaweedfs-client 1.0-SNAPSHOT 3.5.1 1.16.1 + 26.0-jre @@ -20,6 +21,11 @@ protobuf-java ${protobuf.version} + + com.google.guava + guava + ${guava.version} + io.grpc grpc-netty-shaded diff --git a/other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java b/other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java index 47712bc37..16b7c3249 100644 --- a/other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java +++ b/other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java @@ -16,8 +16,8 @@ public class FilerGrpcClient { private final SeaweedFilerGrpc.SeaweedFilerFutureStub futureStub; - public FilerGrpcClient(String host, int port) { - this(ManagedChannelBuilder.forAddress(host, port).usePlaintext()); + public FilerGrpcClient(String host, int grpcPort) { + this(ManagedChannelBuilder.forAddress(host, grpcPort).usePlaintext()); } public FilerGrpcClient(ManagedChannelBuilder channelBuilder) { diff --git a/other/java/hdfs/pom.xml b/other/java/hdfs/pom.xml index e668e1266..963d3fc17 100644 --- a/other/java/hdfs/pom.xml +++ b/other/java/hdfs/pom.xml @@ -5,7 +5,7 @@ 4.0.0 seaweedfs - hadoop-client + seaweedfs-hadoop-client 1.0-SNAPSHOT @@ -17,6 +17,35 @@ 7 + + org.apache.maven.plugins + maven-shade-plugin + 3.2.1 + + + package + + shade + + + + + + + + com.google + shaded.com.google + + + io.grpc.internal + shaded.io.grpc.internal + + + + + + @@ -32,7 +61,7 @@ seaweedfs - client + seaweedfs-client 1.0-SNAPSHOT diff --git a/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystem.java b/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystem.java index 5599c5683..83a4938f5 100644 --- a/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystem.java +++ b/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystem.java @@ -18,8 +18,8 @@ import java.net.URI; public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem { public static final int FS_SEAWEED_DEFAULT_PORT = 8333; - public static final String FS_SEAWEED_HOST = "fs.seaweed.host"; - public static final String FS_SEAWEED_HOST_PORT = "fs.seaweed.host.port"; + public static final String FS_SEAWEED_FILER_HOST = "fs.seaweed.filer.host"; + public static final String FS_SEAWEED_FILER_PORT = "fs.seaweed.filer.port"; private URI uri; private Path workingDirectory = new Path("/"); @@ -30,7 +30,7 @@ public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem { } public String getScheme() { - return "seaweed"; + return "seaweedfs"; } @Override @@ -39,16 +39,16 @@ public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem { // get host information from uri (overrides info in conf) String host = uri.getHost(); - host = (host == null) ? conf.get(FS_SEAWEED_HOST, null) : host; + host = (host == null) ? conf.get(FS_SEAWEED_FILER_HOST, "localhost") : host; if (host == null) { throw new IOException("Invalid host specified"); } - conf.set(FS_SEAWEED_HOST, host); + conf.set(FS_SEAWEED_FILER_HOST, host); // get port information from uri, (overrides info in conf) int port = uri.getPort(); port = (port == -1) ? FS_SEAWEED_DEFAULT_PORT : port; - conf.setInt(FS_SEAWEED_HOST_PORT, port); + conf.setInt(FS_SEAWEED_FILER_PORT, port); setConf(conf); this.uri = uri; diff --git a/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java b/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java index d890762a0..0ab17a2b5 100644 --- a/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java +++ b/other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java @@ -22,7 +22,8 @@ public class SeaweedFileSystemStore { private FilerGrpcClient filerGrpcClient; public SeaweedFileSystemStore(String host, int port) { - filerGrpcClient = new FilerGrpcClient(host, port); + int grpcPort = 10000 + port; + filerGrpcClient = new FilerGrpcClient(host, grpcPort); } public boolean createDirectory(final Path path, UserGroupInformation currentUser,