// Note: It's a little bit hacky based on the uri schema to create the LocationFactory, refactor it later.
URI appDir = URI.create(System.getenv(EnvKeys.TWILL_APP_DIR));
try {
if ("file".equals(appDir.getScheme())) {
return new LocalLocationFactory().create(appDir);
}
if ("hdfs".equals(appDir.getScheme())) {
if (UserGroupInformation.isSecurityEnabled()) {
return new HDFSLocationFactory(FileSystem.get(conf)).create(appDir);