ADLSLocation.java org::apache::iceberg::azure::adlsv2::ADLSLocation org::apache::iceberg::azure::adlsv2 /* *LicensedtotheApacheSoftwareFoundation(ASF)underone *ormorecontributorlicenseagreements.SeetheNOTICEfile *distributedwiththisworkforadditionalinformation *regardingcopyrightownership.TheASFlicensesthisfile *toyouundertheApacheLicense,Version2.0(the *"License");youmaynotusethisfileexceptincompliance *withtheLicense.YoumayobtainacopyoftheLicenseat * *http://www.apache.org/licenses/LICENSE-2.0 * *Unlessrequiredbyapplicablelaworagreedtoinwriting, *softwaredistributedundertheLicenseisdistributedonan *"ASIS"BASIS,WITHOUTWARRANTIESORCONDITIONSOFANY *KIND,eitherexpressorimplied.SeetheLicenseforthe *specificlanguagegoverningpermissionsandlimitations *undertheLicense. */ packageorg.apache.iceberg.azure.adlsv2; importjava.util.Optional; importjava.util.regex.Matcher; importjava.util.regex.Pattern; importorg.apache.iceberg.exceptions.ValidationException; importorg.apache.iceberg.relocated.com.google.common.base.Preconditions; classADLSLocation{ privatestaticfinalPatternURI_PATTERN=Pattern.compile("^abfss?://([^/?#]+)(.*)?$"); privatefinalStringstorageAccount; privatefinalStringcontainer; privatefinalStringpath; ADLSLocation(Stringlocation){ Preconditions.checkArgument(location!=null,"Invalidlocation:null"); Matchermatcher=URI_PATTERN.matcher(location); ValidationException.check(matcher.matches(),"InvalidADLSURI:%s",location); Stringauthority=matcher.group(1); String[]parts=authority.split("@",-1); if(parts.length>1){ this.container=parts[0]; this.storageAccount=parts[1]; }else{ this.container=null; this.storageAccount=authority; } StringuriPath=matcher.group(2); uriPath=uriPath==null?"":uriPath.startsWith("/")?uriPath.substring(1):uriPath; this.path=uriPath.split("\\?",-1)[0].split("#",-1)[0]; } publicStringstorageAccount(){ returnstorageAccount; } publicOptional<String>container(){ returnOptional.ofNullable(container); } publicStringpath(){ returnpath; } }