@Test public void testCreateDirectory() throws Exception { final StoregateIdProvider nodeid = new StoregateIdProvider(session).withCache(cache); final Path folder = new StoregateDirectoryFeature(session, nodeid).mkdir( new Path(String.format("/My files/%s", new AlphanumericRandomStringService().random()), EnumSet.of(Path.Type.directory)), null, new TransferStatus()); assertTrue(new DefaultFindFeature(session).find(folder)); new StoregateDeleteFeature(session, nodeid).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback()); assertFalse(new DefaultFindFeature(session).find(folder)); }
@Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { try { final FilesApi files = new FilesApi(session.getClient()); final CreateFolderRequest request = new CreateFolderRequest(); request.setName(folder.getName()); request.setParentID(fileid.getFileid(folder.getParent(), new DisabledListProgressListener())); final File f = files.filesCreateFolder(request); return new Path(folder.getParent(), folder.getName(), folder.getType(), new StoregateAttributesFinderFeature(session, fileid).toAttributes(f)); } catch(ApiException e) { throw new StoregateExceptionMappingService().map("Cannot create folder {0}", e, folder); } }
StoregateDirectoryFeature implements Directory<VersionId> { @Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { try { final FilesApi files = new FilesApi(session.getClient()); final CreateFolderRequest request = new CreateFolderRequest(); request.setName(folder.getName()); request.setParentID(fileid.getFileid(folder.getParent(), new DisabledListProgressListener())); final File f = files.filesCreateFolder(request); return new Path(folder.getParent(), folder.getName(), folder.getType(), new StoregateAttributesFinderFeature(session, fileid).toAttributes(f)); } catch(ApiException e) { throw new StoregateExceptionMappingService().map("Cannot create folder {0}", e, folder); } } }
StoregateDirectoryFeature implements Directory<VersionId> { @Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { try { final FilesApi files = new FilesApi(session.getClient()); final CreateFolderRequest request = new CreateFolderRequest(); request.setName(folder.getName()); request.setParentID(fileid.getFileid(folder.getParent(), new DisabledListProgressListener())); final File f = files.filesCreateFolder(request); return new Path(folder.getParent(), folder.getName(), folder.getType(), new StoregateAttributesFinderFeature(session, fileid).toAttributes(f)); } catch(ApiException e) { throw new StoregateExceptionMappingService().map("Cannot create folder {0}", e, folder); } } StoregateDirectoryFeature(final StoregateSession session, final StoregateIdProvider fileid); }
StoregateDirectoryFeature implements Directory<VersionId> { @Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { try { final FilesApi files = new FilesApi(session.getClient()); final CreateFolderRequest request = new CreateFolderRequest(); request.setName(folder.getName()); request.setParentID(fileid.getFileid(folder.getParent(), new DisabledListProgressListener())); final File f = files.filesCreateFolder(request); return new Path(folder.getParent(), folder.getName(), folder.getType(), new StoregateAttributesFinderFeature(session, fileid).toAttributes(f)); } catch(ApiException e) { throw new StoregateExceptionMappingService().map("Cannot create folder {0}", e, folder); } } StoregateDirectoryFeature(final StoregateSession session, final StoregateIdProvider fileid); @Override Path mkdir(final Path folder, final String region, final TransferStatus status); @Override Directory<VersionId> withWriter(final Write<VersionId> writer); @Override boolean isSupported(final Path workdir, final String name); }
StoregateDirectoryFeature implements Directory<VersionId> { @Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { try { final FilesApi files = new FilesApi(session.getClient()); final CreateFolderRequest request = new CreateFolderRequest(); request.setName(folder.getName()); request.setParentID(fileid.getFileid(folder.getParent(), new DisabledListProgressListener())); final File f = files.filesCreateFolder(request); return new Path(folder.getParent(), folder.getName(), folder.getType(), new StoregateAttributesFinderFeature(session, fileid).toAttributes(f)); } catch(ApiException e) { throw new StoregateExceptionMappingService().map("Cannot create folder {0}", e, folder); } } StoregateDirectoryFeature(final StoregateSession session, final StoregateIdProvider fileid); @Override Path mkdir(final Path folder, final String region, final TransferStatus status); @Override Directory<VersionId> withWriter(final Write<VersionId> writer); @Override boolean isSupported(final Path workdir, final String name);  }