private void checkNestedBucketIsUnderMountPoint(String bucketPath) throws S3Exception { // Assure that the bucket is directly under a mount point. AlluxioURI parent = new AlluxioURI(bucketPath).getParent(); try { if (!mFileSystem.getMountTable().containsKey(parent.getPath())) { throw new S3Exception(bucketPath, S3ErrorCode.INVALID_NESTED_BUCKET_NAME); } } catch (Exception e) { throw toBucketS3Exception(e, bucketPath); } }
@Override public int run(CommandLine cl) throws AlluxioException, IOException { String[] args = cl.getArgs(); if (args.length == 0) { Map<String, MountPointInfo> mountTable = mFileSystem.getMountTable(); UfsCommand.printMountInfo(mountTable); return 0; } AlluxioURI alluxioPath = new AlluxioURI(args[0]); AlluxioURI ufsPath = new AlluxioURI(args[1]); MountPOptions.Builder optionsBuilder = MountPOptions.newBuilder(); if (cl.hasOption(READONLY_OPTION.getLongOpt())) { optionsBuilder.setReadOnly(true); } if (cl.hasOption(SHARED_OPTION.getLongOpt())) { optionsBuilder.setShared(true); } if (cl.hasOption(OPTION_OPTION.getLongOpt())) { Properties properties = cl.getOptionProperties(OPTION_OPTION.getLongOpt()); optionsBuilder.putAllProperties(Maps.fromProperties(properties)); } mFileSystem.mount(alluxioPath, ufsPath, optionsBuilder.build()); System.out.println("Mounted " + ufsPath + " at " + alluxioPath); return 0; }
private void checkNestedBucketIsUnderMountPoint(String bucketPath) throws S3Exception { // Assure that the bucket is directly under a mount point. AlluxioURI parent = new AlluxioURI(bucketPath).getParent(); try { if (!mFileSystem.getMountTable().containsKey(parent.getPath())) { throw new S3Exception(bucketPath, S3ErrorCode.INVALID_NESTED_BUCKET_NAME); } } catch (Exception e) { throw toBucketS3Exception(e, bucketPath); } }