@Override public void addOrUpdateSpace(NamespaceKey spacePath, SpaceConfig spaceConfig, NamespaceAttribute... attributes) throws NamespaceException { createOrUpdateEntity(NamespaceEntity.toEntity(SPACE, spacePath, spaceConfig, keyNormalization), attributes); }
@Override public void addOrUpdateFolder(NamespaceKey folderPath, FolderConfig folderConfig, NamespaceAttribute... attributes) throws NamespaceException { createOrUpdateEntity(NamespaceEntity.toEntity(FOLDER, folderPath, folderConfig, keyNormalization), attributes); }
@Override public void addOrUpdateSource(NamespaceKey sourcePath, SourceConfig sourceConfig, NamespaceAttribute... attributes) throws NamespaceException { createOrUpdateEntity(NamespaceEntity.toEntity(SOURCE, sourcePath, sourceConfig, keyNormalization), attributes); }
@Override public void addOrUpdateHome(NamespaceKey homePath, HomeConfig homeConfig) throws NamespaceException { createOrUpdateEntity(NamespaceEntity.toEntity(HOME, homePath, homeConfig, keyNormalization)); }
createOrUpdateEntity(NamespaceEntity.toEntity(DATASET, datasetPath, dataset, keyNormalization), attributes);
protected DatasetConfig doRenameDataset(NamespaceKey oldDatasetPath, NamespaceKey newDatasetPath, List<NameSpaceContainer> oldDatasetParentEntitiesOnPath, List<NameSpaceContainer> newDatasetParentEntitiesOnPath) throws NamespaceException { final String newDatasetName = newDatasetPath.getName(); final NamespaceInternalKey oldKey = new NamespaceInternalKey(oldDatasetPath, keyNormalization); final DatasetConfig datasetConfig = getEntity(oldDatasetPath, DATASET).getDataset(); if (isPhysicalDataset(datasetConfig.getType())) { throw UserException.validationError() .message("Failed to rename %s to %s. Renames on physical datasets are not allowed.", oldDatasetPath, newDatasetPath) .build(logger); } if (datasetConfig.getType() == DatasetType.PHYSICAL_DATASET_HOME_FILE && !newDatasetPath.getPathComponents().get(0).startsWith("@")) { throw UserException.validationError() .message("Failed to rename %s to %s. You cannot move a uploaded file in your home directory to a space.", oldDatasetPath, newDatasetPath) .build(logger); } datasetConfig.setName(newDatasetName); datasetConfig.setFullPathList(newDatasetPath.getPathComponents()); datasetConfig.setCreatedAt(System.currentTimeMillis()); NamespaceEntity newValue = NamespaceEntity.toEntity(DATASET, newDatasetPath, datasetConfig, keyNormalization); // in case of upgrade we may have a version here from previous versions, so clear out datasetConfig.setVersion(null); datasetConfig.setTag(null); namespace.put(newValue.getPathKey().getKey(), newValue.getContainer()); namespace.delete(oldKey.getKey()); return datasetConfig; }