@Override public DatasetSpecification reconfigure(String instanceName, DatasetProperties newProperties, DatasetSpecification currentSpec) throws IncompatibleUpdateException { validateProperties(newProperties.getProperties()); boolean wasExternal = FileSetProperties.isDataExternal(currentSpec.getProperties()); boolean isExternal = FileSetProperties.isDataExternal(newProperties.getProperties()); String oldPath = FileSetProperties.getBasePath(currentSpec.getProperties()); String newPath = FileSetProperties.getBasePath(newProperties.getProperties()); // validate that we are not "internalizing" an external location if (wasExternal && !isExternal) { throw new IncompatibleUpdateException( String.format("Cannot convert external file set '%s' to non-external.", instanceName)); } // allow change of path only if the dataset is external if (!Objects.equals(oldPath, newPath) && !isExternal) { throw new IncompatibleUpdateException( String.format("Cannot change the base path of non-external file set '%s'.", instanceName)); } return configure(instanceName, newProperties); }
@Override public DatasetSpecification reconfigure(String instanceName, DatasetProperties newProperties, DatasetSpecification currentSpec) throws IncompatibleUpdateException { validateProperties(newProperties.getProperties()); boolean wasExternal = FileSetProperties.isDataExternal(currentSpec.getProperties()); boolean isExternal = FileSetProperties.isDataExternal(newProperties.getProperties()); String oldPath = FileSetProperties.getBasePath(currentSpec.getProperties()); String newPath = FileSetProperties.getBasePath(newProperties.getProperties()); // validate that we are not "internalizing" an external location if (wasExternal && !isExternal) { throw new IncompatibleUpdateException( String.format("Cannot convert external file set '%s' to non-external.", instanceName)); } // allow change of path only if the dataset is external if (!Objects.equals(oldPath, newPath) && !isExternal) { throw new IncompatibleUpdateException( String.format("Cannot change the base path of non-external file set '%s'.", instanceName)); } return configure(instanceName, newProperties); }
if (!Objects.equals(FileSetProperties.getBasePath(properties), FileSetProperties.getBasePath(oldProperties))) {
if (!Objects.equals(FileSetProperties.getBasePath(properties), FileSetProperties.getBasePath(oldProperties))) {
String basePath = FileSetProperties.getBasePath(spec.getProperties()); if (basePath == null) { basePath = spec.getName().replace('.', '/');
String basePath = FileSetProperties.getBasePath(spec.getProperties()); if (basePath == null) { basePath = spec.getName().replace('.', '/');
spec = framework.getDatasetSpec(MY_DS); Assert.assertNotNull(spec); Assert.assertEquals(baseDir.getPath(), FileSetProperties.getBasePath(spec.getProperties()));