@Test public void testCreateIgnoresLocation() throws IOException { DatasetDescriptor created = provider.create(NAMESPACE, NAME, testDescriptor); Assert.assertNull("Created descriptor should not have a location", created.getLocation()); }
@Override public DatasetDescriptor create(String namespace, String name, DatasetDescriptor descriptor) { Preconditions.checkNotNull(namespace, "Namespace cannot be null"); Preconditions.checkNotNull(name, "Dataset name cannot be null"); Preconditions.checkNotNull(descriptor, "Descriptor cannot be null"); Compatibility.check(namespace, name, descriptor); LOG.debug("Saving dataset metadata name:{} descriptor:{}", name, descriptor); Path metadataLocation = pathForMetadata(namespace, name); try { if (rootFileSystem.exists(metadataLocation)) { throw new DatasetExistsException( "Descriptor directory already exists: " + metadataLocation); } rootFileSystem.mkdirs(metadataLocation); } catch (IOException e) { throw new DatasetIOException( "Unable to create metadata directory: " + metadataLocation + " for dataset: " + name, e); } writeDescriptor(rootFileSystem, metadataLocation, name, descriptor); return descriptor; }
FileSystemMetadataProvider extends AbstractMetadataProvider { @Override public DatasetDescriptor create(String namespace, String name, DatasetDescriptor descriptor) { Preconditions.checkNotNull(namespace, "Namespace cannot be null"); Preconditions.checkNotNull(name, "Dataset name cannot be null"); Preconditions.checkNotNull(descriptor, "Descriptor cannot be null"); Compatibility.check(namespace, name, descriptor); LOG.debug("Saving dataset metadata name:{} descriptor:{}", name, descriptor); Path metadataLocation = pathForMetadata(namespace, name); try { if (rootFileSystem.exists(metadataLocation)) { throw new DatasetExistsException( "Descriptor directory already exists: " + metadataLocation); } rootFileSystem.mkdirs(metadataLocation); } catch (IOException e) { throw new DatasetIOException( "Unable to create metadata directory: " + metadataLocation + " for dataset: " + name, e); } writeDescriptor(rootFileSystem, metadataLocation, name, descriptor); return descriptor; } }
FileSystemMetadataProvider extends AbstractMetadataProvider { @Override public DatasetDescriptor create(String namespace, String name, DatasetDescriptor descriptor) { Preconditions.checkNotNull(namespace, "Namespace cannot be null"); Preconditions.checkNotNull(name, "Dataset name cannot be null"); Preconditions.checkNotNull(descriptor, "Descriptor cannot be null"); Compatibility.check(namespace, name, descriptor); LOG.debug("Saving dataset metadata name:{} descriptor:{}", name, descriptor); Path metadataLocation = pathForMetadata(namespace, name); try { if (rootFileSystem.exists(metadataLocation)) { throw new DatasetExistsException( "Descriptor directory already exists: " + metadataLocation); } rootFileSystem.mkdirs(metadataLocation); } catch (IOException e) { throw new DatasetIOException( "Unable to create metadata directory: " + metadataLocation + " for dataset: " + name, e); } writeDescriptor(rootFileSystem, metadataLocation, name, descriptor); return descriptor; } FileSystemMetadataProvider(Configuration conf, Path rootDirectory); }
FileSystemMetadataProvider extends AbstractMetadataProvider { @Override public DatasetDescriptor create(String namespace, String name, DatasetDescriptor descriptor) { Preconditions.checkNotNull(namespace, "Namespace cannot be null"); Preconditions.checkNotNull(name, "Dataset name cannot be null"); Preconditions.checkNotNull(descriptor, "Descriptor cannot be null"); Compatibility.check(namespace, name, descriptor); LOG.debug("Saving dataset metadata name:{} descriptor:{}", name, descriptor); Path metadataLocation = pathForMetadata(namespace, name); try { if (rootFileSystem.exists(metadataLocation)) { throw new DatasetExistsException( "Descriptor directory already exists: " + metadataLocation); } rootFileSystem.mkdirs(metadataLocation); } catch (IOException e) { throw new DatasetIOException( "Unable to create metadata directory: " + metadataLocation + " for dataset: " + name, e); } writeDescriptor(rootFileSystem, metadataLocation, name, descriptor); return descriptor; } FileSystemMetadataProvider(Configuration conf, Path rootDirectory); @Override DatasetDescriptor load(String namespace, String name); @Override DatasetDescriptor create(String namespace, String name, DatasetDescriptor descriptor); @Override DatasetDescriptor update(String namespace, String name, DatasetDescriptor descriptor); @Override boolean delete(String namespace, String name); @Override boolean moveToTrash(String namespace, String name); @Override boolean exists(String namespace, String name); @SuppressWarnings("deprecation") @Override Set<String> namespaces(); @SuppressWarnings("deprecation") @Override Set<String> datasets(String namespace); @Override String toString(); }
FileSystemMetadataProvider extends AbstractMetadataProvider { @Override public DatasetDescriptor create(String namespace, String name, DatasetDescriptor descriptor) { Preconditions.checkNotNull(namespace, "Namespace cannot be null"); Preconditions.checkNotNull(name, "Dataset name cannot be null"); Preconditions.checkNotNull(descriptor, "Descriptor cannot be null"); Compatibility.check(namespace, name, descriptor); LOG.debug("Saving dataset metadata name:{} descriptor:{}", name, descriptor); Path metadataLocation = pathForMetadata(namespace, name); try { if (rootFileSystem.exists(metadataLocation)) { throw new DatasetExistsException( "Descriptor directory already exists: " + metadataLocation); } rootFileSystem.mkdirs(metadataLocation); } catch (IOException e) { throw new DatasetIOException( "Unable to create metadata directory: " + metadataLocation + " for dataset: " + name, e); } writeDescriptor(rootFileSystem, metadataLocation, name, descriptor); return descriptor; } FileSystemMetadataProvider(Configuration conf, Path rootDirectory); @Override DatasetDescriptor load(String namespace, String name); @Override DatasetDescriptor create(String namespace, String name, DatasetDescriptor descriptor); @Override DatasetDescriptor update(String namespace, String name, DatasetDescriptor descriptor); @Override boolean delete(String namespace, String name); @Override boolean moveToTrash(String namespace, String name); @Override boolean exists(String namespace, String name); @SuppressWarnings("deprecation") @Override Set<String> namespaces(); @SuppressWarnings("deprecation") @Override Set<String> datasets(String namespace); @Override String toString();  }