Skip to content

Commit

Permalink
Merge pull request #5204 from WeDataSphere/master-s3
Browse files Browse the repository at this point in the history
Fix linkis storage ss3 and oss
  • Loading branch information
sjgllgh authored Dec 3, 2024
2 parents bca9fe2 + d67847e commit ebc08a0
Show file tree
Hide file tree
Showing 27 changed files with 1,135 additions and 97 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.linkis.storage.factory.impl;

import org.apache.linkis.common.io.Fs;
import org.apache.linkis.storage.factory.BuildFactory;
import org.apache.linkis.storage.fs.impl.OSSFileSystem;
import org.apache.linkis.storage.utils.StorageUtils;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BuildOSSSystem implements BuildFactory {

private static final Logger LOG = LoggerFactory.getLogger(BuildOSSSystem.class);

/**
* get file system
*
* @param user
* @param proxyUser
* @return
*/
@Override
public Fs getFs(String user, String proxyUser) {
OSSFileSystem fs = new OSSFileSystem();
try {
fs.init(null);
} catch (IOException e) {
LOG.warn("get file system failed", e);
}
fs.setUser(user);
return fs;
}

@Override
public Fs getFs(String user, String proxyUser, String label) {
OSSFileSystem fs = new OSSFileSystem();
try {
fs.init(null);
} catch (IOException e) {
LOG.warn("get file system failed", e);
}
fs.setUser(proxyUser);
fs.setLabel(label);
return fs;
}

@Override
public String fsName() {
return StorageUtils.OSS();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.linkis.storage.factory.impl;

import org.apache.linkis.common.io.Fs;
import org.apache.linkis.storage.factory.BuildFactory;
import org.apache.linkis.storage.fs.impl.S3FileSystem;
import org.apache.linkis.storage.utils.StorageUtils;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BuildS3FileSystem implements BuildFactory {
private static final Logger LOG = LoggerFactory.getLogger(BuildS3FileSystem.class);

@Override
public Fs getFs(String user, String proxyUser) {
S3FileSystem fs = new S3FileSystem();
try {
fs.init(null);
} catch (IOException e) {
LOG.warn("get file system failed", e);
}
fs.setUser(user);
return fs;
}

@Override
public Fs getFs(String user, String proxyUser, String label) {
S3FileSystem fs = new S3FileSystem();
try {
fs.init(null);
} catch (IOException e) {
LOG.warn("get file system failed", e);
}
fs.setUser(user);
fs.setLabel(label);
return fs;
}

@Override
public String fsName() {
return StorageUtils.S3();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public void init(Map<String, String> properties) throws IOException {
if (fs == null) {
throw new IOException("init HDFS FileSystem failed!");
}
if (StorageConfiguration.FS_CHECKSUM_DISBALE().getValue()) {
if (StorageConfiguration.FS_CHECKSUM_DISBALE()) {
fs.setVerifyChecksum(false);
fs.setWriteChecksum(false);
}
Expand Down
Loading

0 comments on commit ebc08a0

Please sign in to comment.