4343import org .apache .hadoop .fs .Path ;
4444import org .apache .hadoop .fs .PathIsNotEmptyDirectoryException ;
4545import org .apache .hadoop .fs .permission .FsPermission ;
46- import org .apache .hadoop .hdds .conf .OzoneConfiguration ;
4746import org .apache .hadoop .ozone .OmUtils ;
4847import org .apache .hadoop .ozone .om .exceptions .OMException ;
4948import org .apache .hadoop .security .UserGroupInformation ;
@@ -88,20 +87,11 @@ public class BasicOzoneFileSystem extends FileSystem {
8887 private static final Pattern URL_SCHEMA_PATTERN =
8988 Pattern .compile ("([^\\ .]+)\\ .([^\\ .]+)\\ .{0,1}(.*)" );
9089
91- private OzoneConfiguration getOzoneConf (Configuration conf ) {
92-
93- return (conf instanceof OzoneConfiguration ) ?
94- (OzoneConfiguration ) conf : new OzoneConfiguration (conf );
95- }
96-
97- private String getUriExceptionText (Configuration conf ) {
98-
99- return "Ozone file system URL should be one of the following formats: "
100- + "o3fs://bucket.volume/key OR "
101- + "o3fs://bucket.volume.om-host.example.com/key OR "
102- + "o3fs://bucket.volume.om-host.example.com:"
103- + OmUtils .getOmRpcPort (getOzoneConf (conf )) + "/key" ;
104- }
90+ private static final String URI_EXCEPTION_TEXT = "Ozone file system URL " +
91+ "should be one of the following formats: " +
92+ "o3fs://bucket.volume/key OR " +
93+ "o3fs://bucket.volume.om-host.example.com/key OR " +
94+ "o3fs://bucket.volume.om-host.example.com:5678/key" ;
10595
10696 @ Override
10797 public void initialize (URI name , Configuration conf ) throws IOException {
@@ -121,7 +111,7 @@ public void initialize(URI name, Configuration conf) throws IOException {
121111 Matcher matcher = URL_SCHEMA_PATTERN .matcher (authority );
122112
123113 if (!matcher .matches ()) {
124- throw new IllegalArgumentException (getUriExceptionText ( conf ) );
114+ throw new IllegalArgumentException (URI_EXCEPTION_TEXT );
125115 }
126116 String bucketStr = matcher .group (1 );
127117 String volumeStr = matcher .group (2 );
@@ -133,14 +123,14 @@ public void initialize(URI name, Configuration conf) throws IOException {
133123 String [] parts = remaining .split (":" );
134124 // Array length should be either 1(hostname or service id) or 2(host:port)
135125 if (parts .length > 2 ) {
136- throw new IllegalArgumentException (getUriExceptionText ( conf ) );
126+ throw new IllegalArgumentException (URI_EXCEPTION_TEXT );
137127 }
138128 omHost = parts [0 ];
139129 if (parts .length == 2 ) {
140130 try {
141131 omPort = Integer .parseInt (parts [1 ]);
142132 } catch (NumberFormatException e ) {
143- throw new IllegalArgumentException (getUriExceptionText ( conf ) );
133+ throw new IllegalArgumentException (URI_EXCEPTION_TEXT );
144134 }
145135 }
146136 }
0 commit comments