public NamespacePath(final List<String> path) { final List<String> pathComponents = new ArrayList<>(path); int length = pathComponents.size(); if (length < getMinimumComponents()) { throw new IllegalArgumentException("path too short: " + PathUtils.getPathJoiner().join(pathComponents)); } if (getMaximumComponents() != -1 && length > getMaximumComponents()) { throw new IllegalArgumentException("path too long: " + PathUtils.getPathJoiner().join(pathComponents)); } this.root = getRoot(pathComponents.remove(0)); --length; if (length > 0) { --length; this.leaf = getLeaf(pathComponents.remove(length)); } else { this.leaf = null; } final List<FolderName> folders = new ArrayList<>(); for (final String folder : pathComponents) { folders.add(new FolderName(folder)); } this.folderPath = Collections.unmodifiableList(folders); this.namespaceKey = new NamespaceKey(path); }
protected String resourcePath(DatasetUI datasetUI) { return getPathJoiner() .join( "/dataset", getKeyJoiner().join(datasetUI.getFullPath()) ); }
protected String versionedResourcePath(DatasetUI datasetUI) { return getPathJoiner() .join( "/dataset", getKeyJoiner().join(datasetUI.getFullPath()), "version", datasetUI.getDatasetVersion() ); }
public static Refresh createRefresh(ReflectionId reflectionId, List<String> refreshPath, final long seriesId, final int seriesOrdinal, final long updateId, JobDetails details, MaterializationMetrics metrics, List<DataPartition> dataPartitions) { final String path = PathUtils.getPathJoiner().join(Iterables.skip(refreshPath, 1)); return new Refresh() .setId(new RefreshId(UUID.randomUUID().toString())) .setReflectionId(reflectionId) .setPartitionList(dataPartitions) .setMetrics(metrics) .setCreatedAt(System.currentTimeMillis()) .setSeriesId(seriesId) .setUpdateId(updateId) .setSeriesOrdinal(seriesOrdinal) .setPath(path) .setJob(details); }
protected InitialPreviewResponse transform(DatasetUI datasetUI, TransformBase transformBase) { final Invocation invocation = getBuilder( getAPIv2() .path(getPathJoiner().join( versionedResourcePath(datasetUI), "transformAndPreview") ).queryParam("newVersion", newVersion()) ).buildPost(entity(transformBase, JSON)); return expectSuccess(invocation, InitialPreviewResponse.class); }
protected InitialPreviewResponse getPreview(DatasetUI datasetUI) { final Invocation invocation = getBuilder( getAPIv2() .path(getPathJoiner().join(versionedResourcePath(datasetUI), "preview")) ).buildGet(); return expectSuccess(invocation, InitialPreviewResponse.class); }
protected DatasetUI getVersionedDataset(DatasetVersionResourcePath datasetVersionPath) { final Invocation invocation = getBuilder( getAPIv2() .path(getPathJoiner().join(datasetVersionPath.toString(), "preview")) ).buildGet(); return expectSuccess(invocation, InitialPreviewResponse.class).getDataset(); }
.path(getPathJoiner().join("dataset", "testA.dsA3")); DatasetUI datasetUIA = expectSuccess(getBuilder(pathA).buildGet(), DatasetUI.class); getPathJoiner().join("dataset", "testA.dsA3", "version", datasetUIA.getDatasetVersion(), "preview")) ).buildGet(), InitialPreviewResponse.class); getAPIv2().path(getPathJoiner().join("dataset", "testB.dsB1"))).buildGet(), DatasetUI.class); getPathJoiner().join("dataset", "testB.dsB1", "version", datasetUIB.getDatasetVersion(), "preview")) ).buildGet(), InitialPreviewResponse.class);
expectError(CLIENT_ERROR, getBuilder( getAPIv2() .path(getPathJoiner().join(versionedResourcePath(dataset1), "transformAndPreview")) .queryParam("newVersion", newVersion()) ).buildPost(entity(transform, JSON)), ValidationErrorMessage.class);