Browse Source

resolve java jar dependencies

pull/781/head
Chris Lu 6 years ago
parent
commit
4263805c78
  1. 8
      other/java/client/pom.xml
  2. 4
      other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java
  3. 33
      other/java/hdfs/pom.xml
  4. 12
      other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystem.java
  5. 3
      other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java

8
other/java/client/pom.xml

@ -5,12 +5,13 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>seaweedfs</groupId> <groupId>seaweedfs</groupId>
<artifactId>client</artifactId>
<artifactId>seaweedfs-client</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<properties> <properties>
<protobuf.version>3.5.1</protobuf.version> <protobuf.version>3.5.1</protobuf.version>
<grpc.version>1.16.1</grpc.version> <grpc.version>1.16.1</grpc.version>
<guava.version>26.0-jre</guava.version>
</properties> </properties>
<dependencies> <dependencies>
@ -20,6 +21,11 @@
<artifactId>protobuf-java</artifactId> <artifactId>protobuf-java</artifactId>
<version>${protobuf.version}</version> <version>${protobuf.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency> <dependency>
<groupId>io.grpc</groupId> <groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId> <artifactId>grpc-netty-shaded</artifactId>

4
other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java

@ -16,8 +16,8 @@ public class FilerGrpcClient {
private final SeaweedFilerGrpc.SeaweedFilerFutureStub futureStub; 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) { public FilerGrpcClient(ManagedChannelBuilder<?> channelBuilder) {

33
other/java/hdfs/pom.xml

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>seaweedfs</groupId> <groupId>seaweedfs</groupId>
<artifactId>hadoop-client</artifactId>
<artifactId>seaweedfs-hadoop-client</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<build> <build>
<plugins> <plugins>
@ -17,6 +17,35 @@
<target>7</target> <target>7</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<relocations>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>shaded.com.google</shadedPattern>
</relocation>
<relocation>
<pattern>io.grpc.internal</pattern>
<shadedPattern>shaded.io.grpc.internal</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
@ -32,7 +61,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>seaweedfs</groupId> <groupId>seaweedfs</groupId>
<artifactId>client</artifactId>
<artifactId>seaweedfs-client</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

12
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 class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem {
public static final int FS_SEAWEED_DEFAULT_PORT = 8333; 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 URI uri;
private Path workingDirectory = new Path("/"); private Path workingDirectory = new Path("/");
@ -30,7 +30,7 @@ public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem {
} }
public String getScheme() { public String getScheme() {
return "seaweed";
return "seaweedfs";
} }
@Override @Override
@ -39,16 +39,16 @@ public class SeaweedFileSystem extends org.apache.hadoop.fs.FileSystem {
// get host information from uri (overrides info in conf) // get host information from uri (overrides info in conf)
String host = uri.getHost(); 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) { if (host == null) {
throw new IOException("Invalid host specified"); 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) // get port information from uri, (overrides info in conf)
int port = uri.getPort(); int port = uri.getPort();
port = (port == -1) ? FS_SEAWEED_DEFAULT_PORT : port; port = (port == -1) ? FS_SEAWEED_DEFAULT_PORT : port;
conf.setInt(FS_SEAWEED_HOST_PORT, port);
conf.setInt(FS_SEAWEED_FILER_PORT, port);
setConf(conf); setConf(conf);
this.uri = uri; this.uri = uri;

3
other/java/hdfs/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java

@ -22,7 +22,8 @@ public class SeaweedFileSystemStore {
private FilerGrpcClient filerGrpcClient; private FilerGrpcClient filerGrpcClient;
public SeaweedFileSystemStore(String host, int port) { 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, public boolean createDirectory(final Path path, UserGroupInformation currentUser,

Loading…
Cancel
Save