File tree 1 file changed +19
-1
lines changed
src/main/java/org/apache/hadoop/fs
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 5
5
import org .apache .hadoop .fs .cosn .Constants ;
6
6
import org .apache .hadoop .fs .cosn .Unit ;
7
7
8
+ import java .io .IOException ;
9
+ import java .io .InputStream ;
10
+ import java .util .Properties ;
11
+
8
12
/**
9
13
* This class contains constants for configuration keys used in the cos file system.
10
14
*/
11
15
@ InterfaceAudience .Private
12
16
@ InterfaceStability .Unstable
13
17
public class CosNConfigKeys extends CommonConfigurationKeys {
14
18
public static final String USER_AGENT = "fs.cosn.user.agent" ;
15
- public static final String DEFAULT_USER_AGENT = "cos-hadoop-plugin-v8.2.0" ;
19
+
20
+ private static String version ;
21
+
22
+ static {
23
+ String path = "META-INF/maven/com.qcloud.cos/hadoop-cos/pom.properties" ;
24
+ Properties properties = new Properties ();
25
+ try (InputStream in = CosNConfigKeys .class .getClassLoader ().getResourceAsStream (path )) {
26
+ properties .load (in );
27
+ version = properties .getProperty ("version" );
28
+ } catch (IOException e ) {
29
+ version = "unknown" ;
30
+ }
31
+ }
32
+
33
+ public static final String DEFAULT_USER_AGENT = "cos-hadoop-plugin-v" + version ;
16
34
17
35
public static final String TENCENT_EMR_VERSION_KEY = "fs.emr.version" ;
18
36
You can’t perform that action at this time.
0 commit comments