本文整理了Java中org.uberfire.java.nio.file.Path.getRoot()
方法的一些代码示例,展示了Path.getRoot()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.getRoot()
方法的具体详情如下:
包路径:org.uberfire.java.nio.file.Path
类名称:Path
方法名:getRoot
暂无
代码示例来源:origin: kiegroup/appformer
@Override
public void setHadCommitOnBatchState(final Path path,
final boolean hadCommitOnBatchState) {
final Path root = checkNotNull("path",
path).getRoot();
this.hadCommitOnBatchState.put(root.getRoot(),
hadCommitOnBatchState);
}
代码示例来源:origin: kiegroup/appformer
@Override
public boolean isHadCommitOnBatchState(final Path path) {
final Path root = checkNotNull("path",
path).getRoot();
return hadCommitOnBatchState.containsKey(root) ? hadCommitOnBatchState.get(root) : false;
}
代码示例来源:origin: org.uberfire/uberfire-metadata-commons-io
void cleanupIfDeletedBranch(Path path) {
if (path.equals(path.getRoot())) {
indexEngine.delete(KObjectUtil.toKCluster(path));
}
}
代码示例来源:origin: kiegroup/appformer
void cleanupIfDeletedBranch(Path path) {
if (path.equals(path.getRoot())) {
indexEngine.delete(KObjectUtil.toKCluster(path));
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-backend
private void fireNewBranchEvent(final Path targetRoot,
final org.uberfire.java.nio.file.Path nioTargetRepositoryRoot) {
final Repository repository = repoService.getRepository(targetRoot);
final Optional<Branch> branch = repository.getBranch(Paths.convert(nioTargetRepositoryRoot.getRoot()));
if (branch.isPresent()) {
newBranchEvent.fire(new NewBranchEvent(repository,
branch.get().getName(),
sessionInfo.getIdentity()));
} else {
throw new IllegalStateException("Could not find a branch that was just created. The Path used was " + nioTargetRepositoryRoot.getRoot());
}
}
代码示例来源:origin: kiegroup/appformer
private void fireNewBranchEvent(final Path targetRoot,
final org.uberfire.java.nio.file.Path nioTargetRepositoryRoot) {
configuredRepositories.reloadRepositories();
final Repository repository = repositoryService.getRepository(targetRoot);
final Optional<Branch> branch = repository.getBranch(Paths.convert(nioTargetRepositoryRoot.getRoot()));
if (branch.isPresent()) {
newBranchEventEvent.fire(new NewBranchEvent(repository,
branch.get().getName(),
sessionInfo.getIdentity()));
} else {
throw new IllegalStateException("Could not find a branch that was just created. The Path used was " + nioTargetRepositoryRoot.getRoot());
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-backend
List<FolderItem> getSegmentSiblings(final Path path) {
final List<FolderItem> result = new ArrayList<>();
final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);
if (nioPath.equals(nioPath.getRoot())) {
result.add(explorerServiceHelper.toFolderItem(nioPath));
} else {
final org.uberfire.java.nio.file.Path nioParentPath = nioPath.getParent();
for (org.uberfire.java.nio.file.Path sibling : getDirectoryIterator(nioParentPath)) {
result.add(explorerServiceHelper.toFolderItem(sibling));
}
}
return result;
}
代码示例来源:origin: kiegroup/appformer
private void fireNewBranchEvent(final Space space,
final Path targetRoot,
final org.uberfire.java.nio.file.Path nioTargetRepositoryRoot) {
configuredRepositories.reloadRepositories();
final Repository repository = repositoryService.getRepository(space, targetRoot);
final Optional<Branch> branch = repository.getBranch(Paths.convert(nioTargetRepositoryRoot.getRoot()));
if (branch.isPresent()) {
newBranchEventEvent.fire(new NewBranchEvent(repository,
branch.get().getName(),
sessionInfo.getIdentity()));
} else {
throw new IllegalStateException("Could not find a branch that was just created. The Path used was " + nioTargetRepositoryRoot.getRoot());
}
}
代码示例来源:origin: org.uberfire/uberfire-nio2-jgit
@Test
public void testGetComplexPath() {
final URI newRepo = URI.create("git://new-complex-get-repo-name");
provider.newFileSystem(newRepo,
EMPTY_ENV);
final Path path = provider.getPath(URI.create("git://origin/master@new-complex-get-repo-name/home"));
AssertionsForClassTypes.assertThat(path).isNotNull();
assertThat(path.getRoot().toString()).isEqualTo("/");
assertThat(path.toString()).isEqualTo("/home");
final Path pathRelative = provider.getPath(URI.create("git://origin/master@new-complex-get-repo-name/:home"));
AssertionsForClassTypes.assertThat(pathRelative).isNotNull();
assertThat(pathRelative.getRoot().toString()).isEqualTo("");
assertThat(pathRelative.toString()).isEqualTo("home");
}
代码示例来源:origin: kiegroup/appformer
@Test
public void testGetComplexPath() {
final URI newRepo = URI.create("git://new-complex-get-repo-name");
provider.newFileSystem(newRepo,
EMPTY_ENV);
final Path path = provider.getPath(URI.create("git://origin/master@new-complex-get-repo-name/home"));
AssertionsForClassTypes.assertThat(path).isNotNull();
assertThat(path.getRoot().toString()).isEqualTo("/");
assertThat(path.toString()).isEqualTo("/home");
final Path pathRelative = provider.getPath(URI.create("git://origin/master@new-complex-get-repo-name/:home"));
AssertionsForClassTypes.assertThat(pathRelative).isNotNull();
assertThat(pathRelative.getRoot().toString()).isEqualTo("");
assertThat(pathRelative.toString()).isEqualTo("home");
}
代码示例来源:origin: org.uberfire/uberfire-nio2-jgit
@Test
public void checkRootPath() {
URI composedName = URI.create("git://dora-repo/subdir1");
FileSystem fsComposedName = provider.newFileSystem(composedName,
EMPTY_ENV);
Path path = provider.getPath(URI.create("git://dora-repo/subdir1/file.txt"));
Path path1 = provider.getPath(URI.create("git://origin/bla@dora-repo/subdir1/file2.txt"));
assertEquals(fsComposedName,
path.getRoot().getFileSystem());
assertEquals(fsComposedName,
path1.getRoot().getFileSystem());
}
代码示例来源:origin: kiegroup/appformer
@Test
public void checkRootPath() {
URI composedName = URI.create("git://dora-repo/subdir1");
FileSystem fsComposedName = provider.newFileSystem(composedName,
EMPTY_ENV);
Path path = provider.getPath(URI.create("git://dora-repo/subdir1/file.txt"));
Path path1 = provider.getPath(URI.create("git://origin/bla@dora-repo/subdir1/file2.txt"));
assertEquals(fsComposedName,
path.getRoot().getFileSystem());
assertEquals(fsComposedName,
path1.getRoot().getFileSystem());
}
代码示例来源:origin: org.uberfire/uberfire-nio2-jgit
@Test
public void testGetComplexPathFileSystemNameIncludedInPath() {
final URI newRepo = URI.create("default://default-new-complex-get-repo-name");
FileSystem fs = provider.newFileSystem(newRepo,
EMPTY_ENV);
final Path path = provider.getPath(URI.create("default://origin/master@default-new-complex-get-repo-name/home/default-new-complex-get-repo-name/somefolder"));
assertThat(path).isNotNull();
assertThat(path.getRoot().toString()).isEqualTo("/");
assertThat(path.toString()).isEqualTo("/home/default-new-complex-get-repo-name/somefolder");
assertThat(path.toUri().getScheme()).isEqualTo("default");
fs.close();
}
}
代码示例来源:origin: org.uberfire/uberfire-project-backend
@Override
public WorkspaceProject resolveProject(final Space space,
final Path path) {
final org.uberfire.java.nio.file.Path repositoryRoot = Paths.convert(path).getRoot();
final Repository repository = repositoryService.getRepository(space,
Paths.convert(repositoryRoot));
final Branch branch = resolveBranch(repositoryRoot,
repository);
return new WorkspaceProject(organizationalUnitService.getOrganizationalUnit(repository.getSpace().getName()),
repository,
branch,
moduleService.resolveModule(Paths.convert(Paths.convert(branch.getPath()).getRoot())));
}
代码示例来源:origin: kiegroup/appformer
@Test
public void testGetComplexPathFileSystemNameIncludedInPath() {
final URI newRepo = URI.create("default://default-new-complex-get-repo-name");
FileSystem fs = provider.newFileSystem(newRepo,
EMPTY_ENV);
final Path path = provider.getPath(URI.create("default://origin/master@default-new-complex-get-repo-name/home/default-new-complex-get-repo-name/somefolder"));
assertThat(path).isNotNull();
assertThat(path.getRoot().toString()).isEqualTo("/");
assertThat(path.toString()).isEqualTo("/home/default-new-complex-get-repo-name/somefolder");
assertThat(path.toUri().getScheme()).isEqualTo("default");
fs.close();
}
}
代码示例来源:origin: kiegroup/appformer
@Override
public WorkspaceProject resolveProject(final Space space,
final Path path) {
final org.uberfire.java.nio.file.Path repositoryRoot = Paths.convert(path).getRoot();
final Repository repository = repositoryService.getRepository(space,
Paths.convert(repositoryRoot));
final Branch branch = resolveBranch(repositoryRoot,
repository);
return new WorkspaceProject(organizationalUnitService.getOrganizationalUnit(repository.getSpace().getName()),
repository,
branch,
moduleService.resolveModule(Paths.convert(Paths.convert(branch.getPath()).getRoot())));
}
代码示例来源:origin: org.uberfire/uberfire-nio2-jgit
@Test
public void testSimpleBranchedGit() {
final Path path = JGitPathImpl.create(fs,
"",
"master@my-host",
false);
assertThat(path).isNotNull();
assertThat(path.isAbsolute()).isTrue();
assertThat(path.toString()).isEqualTo("/");
assertThat(path.toUri().toString()).isEqualTo("git://master@my-host/");
assertThat(path.getRoot()).isEqualTo(path);
assertThat(path.getNameCount()).isEqualTo(0);
assertThat(path.getRoot()).isEqualTo(path);
}
代码示例来源:origin: kiegroup/appformer
@Test
public void testSimpleBranchedGit() {
final Path path = JGitPathImpl.create(fs,
"",
"master@my-host",
false);
assertThat(path).isNotNull();
assertThat(path.isAbsolute()).isTrue();
assertThat(path.toString()).isEqualTo("/");
assertThat(path.toUri().toString()).isEqualTo("git://master@my-host/");
assertThat(path.getRoot()).isEqualTo(path);
assertThat(path.getNameCount()).isEqualTo(0);
assertThat(path.getRoot()).isEqualTo(path);
}
代码示例来源:origin: org.uberfire/uberfire-nio2-jgit
@Test
public void testSimpleBranchedGitRoot() {
when(fs.getSeparator()).thenReturn("/");
final Path path = JGitPathImpl.create(fs,
"/",
"master@my-host",
false);
assertThat(path).isNotNull();
assertThat(path.isAbsolute()).isTrue();
assertThat(path.toString()).isEqualTo("/");
assertThat(path.toUri().toString()).isEqualTo("git://master@my-host/");
assertThat(path.getRoot().toString()).isEqualTo("/");
assertThat(path.getNameCount()).isEqualTo(0);
}
代码示例来源:origin: org.uberfire/uberfire-nio2-jgit
@Test
public void testSimpleBranchedGitRelative() {
when(fs.getSeparator()).thenReturn("/");
final Path path = JGitPathImpl.create(fs,
"home",
"master@my-host",
false);
assertThat(path).isNotNull();
assertThat(path.isAbsolute()).isFalse();
assertThat(path.toString()).isEqualTo("home");
assertThat(path.toUri().toString()).isEqualTo("git://master@my-host/:home");
assertThat(path.getRoot().toString()).isEqualTo("");
assertThat(path.getNameCount()).isEqualTo(1);
}
内容来源于网络,如有侵权,请联系作者删除!