Skip to content

Commit 7697578

Browse files
v-kkhuang“v_kkhuang”
andauthored
support azure (#5214)
* support azure * remove file * add azure conf --------- Co-authored-by: “v_kkhuang” <“[email protected]”>
1 parent 75f23a1 commit 7697578

File tree

8 files changed

+498
-3
lines changed

8 files changed

+498
-3
lines changed

linkis-commons/linkis-storage/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@
105105
<version>1.12.261</version>
106106
</dependency>
107107

108+
<dependency>
109+
<groupId>com.azure</groupId>
110+
<artifactId>azure-storage-blob</artifactId>
111+
</dependency>
112+
<dependency>
113+
<groupId>com.azure</groupId>
114+
<artifactId>azure-storage-common</artifactId>
115+
</dependency>
116+
<dependency>
117+
<groupId>com.azure</groupId>
118+
<artifactId>azure-identity</artifactId>
119+
</dependency>
108120
<dependency>
109121
<groupId>org.apache.parquet</groupId>
110122
<artifactId>parquet-avro</artifactId>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.linkis.storage.factory.impl;
18+
19+
import org.apache.linkis.common.io.Fs;
20+
import org.apache.linkis.storage.factory.BuildFactory;
21+
import org.apache.linkis.storage.fs.impl.AzureBlobFileSystem;
22+
import org.apache.linkis.storage.utils.StorageUtils;
23+
import org.slf4j.Logger;
24+
import org.slf4j.LoggerFactory;
25+
26+
import java.io.IOException;
27+
28+
public class BuildAzureBlobFileSystem implements BuildFactory {
29+
private static final Logger LOG = LoggerFactory.getLogger(BuildAzureBlobFileSystem.class);
30+
31+
@Override
32+
public Fs getFs(String user, String proxyUser) {
33+
AzureBlobFileSystem fs = new AzureBlobFileSystem();
34+
try {
35+
fs.init(null);
36+
} catch (IOException e) {
37+
LOG.warn("get file system failed", e);
38+
}
39+
fs.setUser(user);
40+
return fs;
41+
}
42+
43+
@Override
44+
public Fs getFs(String user, String proxyUser, String label) {
45+
AzureBlobFileSystem fs = new AzureBlobFileSystem();
46+
try {
47+
fs.init(null);
48+
} catch (IOException e) {
49+
LOG.warn("get file system failed", e);
50+
}
51+
fs.setUser(user);
52+
return fs;
53+
}
54+
55+
@Override
56+
public String fsName() {
57+
return StorageUtils.BLOB;
58+
}
59+
}

0 commit comments

Comments
 (0)