org.kie.commons.java.nio.file.Path.resolve()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中org.kie.commons.java.nio.file.Path.resolve()方法的一些代码示例,展示了Path.resolve()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.resolve()方法的具体详情如下:
包路径:org.kie.commons.java.nio.file.Path
类名称:Path
方法名:resolve

Path.resolve介绍

暂无

代码示例

代码示例来源:origin: org.kie.commons/kie-nio2-model

public static Path dot( final Path path ) {
  if ( path.getFileName() == null ) {
    return path.resolve( ".root" );
  }
  return path.resolveSibling( "." + path.getFileName() );
}

代码示例来源:origin: org.kie.guvnor/guvnor-project-backend

private boolean hasPom( final org.kie.commons.java.nio.file.Path path ) {
  final org.kie.commons.java.nio.file.Path pomPath = path.resolve( POM_PATH );
  return Files.exists( pomPath );
}

代码示例来源:origin: org.kie.guvnor/guvnor-inbox-backend

public String[] listUsers() {
  //TODO: a temporary hack to retrieve user list. Please refactor later.
  List<String> userList = new ArrayList<String>();
  org.kie.commons.java.nio.file.Path userRoot = bootstrapRoot.resolve( "/.metadata/.users/" );
  final Iterator<org.kie.commons.java.nio.file.Path> userIterator = userRoot.iterator();
  if ( userIterator.hasNext() ) {
    org.kie.commons.java.nio.file.Path userDir = userIterator.next();
    userList.add( userDir.getFileName().toString() );
  }
  String[] result = new String[ userList.size() ];
  return userList.toArray( result );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Test(expected = FileAlreadyExistsException.class)
public void copyFileAlreadyExistsException() {
  final Path path = getDirectoryPath().resolveSibling( "alreadyExistsTest" );
  ioService().deleteIfExists( path );
  ioService().createDirectories( path );
  ioService().write( path.resolve( "myFile.txt" ), "ooooo!" );
  ioService().write( path.resolve( "mytarget" ), "xooooo!" );
  ioService().copy( path.resolve( "myFile.txt" ), path.resolve( "mytarget" ) );
}

代码示例来源:origin: org.kie.guvnor/guvnor-scorecard-xls-editor-backend

@Override
protected Path convertPath( final String fileName,
              final String contextPath ) throws URISyntaxException {
  final org.kie.commons.java.nio.file.Path path = ioService.get( new URI( contextPath ) );
  return paths.convert( path.resolve( fileName ),
             false );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Test(expected = FileAlreadyExistsException.class)
public void createDirectoriesFileAlreadyExistsException() {
  final Path path = getDirectoryPath().resolveSibling( "otherDir" ).resolve( "innerDir" );
  ioService().deleteIfExists( path );
  ioService().createDirectories( path );
  ioService().createDirectories( path );
}

代码示例来源:origin: org.kie.guvnor/guvnor-project-backend

private Path getProjectRootPath( final Path fsRoot,
                 final String projectName ) {
  return paths.convert( paths.convert( fsRoot ).resolve( projectName ),
             false );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Test(expected = DirectoryNotEmptyException.class)
public void deleteDirectoryNotEmptyException() {
  final Path path = getDirectoryPath().resolveSibling( "dirToBug" );
  ioService().createDirectories( path );
  ioService().write( path.resolve( "myFile.txt" ), "ooooo!" );
  ioService().delete( path );
}

代码示例来源:origin: org.kie.guvnor/guvnor-project-backend

@Override
public Path newDirectory( final Path contextPath,
             final String dirName ) {
  final Path directoryPath = paths.convert( ioService.createDirectory( paths.convert( contextPath ).resolve( dirName ) ) );
  //Signal creation to interested parties
  resourceAddedEvent.fire( new ResourceAddedEvent( directoryPath ) );
  return directoryPath;
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Test(expected = DirectoryNotEmptyException.class)
public void deleteIfExistsDirectoryNotEmptyException() {
  final Path path = getDirectoryPath().resolveSibling( "dirToBugIfExists" );
  ioService().createDirectories( path );
  ioService().write( path.resolve( "myFile.txt" ), "ooooo!" );
  ioService().deleteIfExists( path );
}

代码示例来源:origin: org.kie.guvnor/guvnor-project-backend

@Override
public Path resolvePathToPom( final Path resource ) {
  final Path projectPath = resolveProject( resource );
  if ( projectPath == null ) {
    return null;
  }
  final org.kie.commons.java.nio.file.Path pom = paths.convert( projectPath ).resolve( POM_PATH );
  if ( pom == null ) {
    return null;
  }
  return paths.convert( pom );
}

代码示例来源:origin: org.kie.commons/kie-nio2-model

@Override
public Path resolveSibling( final Path other ) {
  checkNotNull( "other", other );
  final Path parent = this.getParent();
  if ( parent == null || other.isAbsolute() ) {
    return other;
  }
  return parent.resolve( other );
}

代码示例来源:origin: org.kie.guvnor/guvnor-core-services-backend

@Override
  public Categories getCategoriesFromResource( final Path resource ) {
    final org.kie.commons.java.nio.file.Path categoriesPath = paths.convert( resource ).getRoot().resolve( "categories.xml" );

    return getContent( paths.convert( categoriesPath ) );
  }
}

代码示例来源:origin: org.kie.guvnor/guvnor-project-editor-backend

@Override
public Path pathToRelatedKModuleFileIfAny( final Path pathToPomXML ) {
  final org.kie.commons.java.nio.file.Path directory = paths.convert( pathToPomXML ).getParent();
  final org.kie.commons.java.nio.file.Path pathToKModuleXML = directory.resolve( "src/main/resources/META-INF/kmodule.xml" );
  if ( ioService.exists( pathToKModuleXML ) ) {
    return paths.convert( pathToKModuleXML );
  } else {
    return null;
  }
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path getTargetPath() {
  try {
    final File dir = createTempDirectory();
    return ioService().get( dir.toURI() ).resolve( "myTargetFile.txt" );
  } catch ( IOException e ) {
    throw new RuntimeException( e );
  }
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path getComposedDirectoryPath() {
  try {
    final File dir = createTempDirectory();
    return ioService().get( dir.toURI() ).resolve( "path/to/myDir" );
  } catch ( IOException e ) {
    throw new RuntimeException( e );
  }
}

代码示例来源:origin: org.kie.guvnor/guvnor-project-backend

@Override
public boolean isPom( final Path resource ) {
  //Null resource paths cannot resolve to a Project
  if ( resource == null ) {
    return false;
  }
  //Check if path equals pom.xml
  final Path projectRoot = resolveProject( resource );
  final org.kie.commons.java.nio.file.Path path = paths.convert( resource ).normalize();
  final org.kie.commons.java.nio.file.Path pomFilePath = paths.convert( projectRoot ).resolve( POM_PATH );
  return path.startsWith( pomFilePath );
}

代码示例来源:origin: org.kie.guvnor/guvnor-project-backend

@Override
public boolean isKModule( final Path resource ) {
  //Null resource paths cannot resolve to a Project
  if ( resource == null ) {
    return false;
  }
  //Check if path equals kmodule.xml
  final Path projectRoot = resolveProject( resource );
  final org.kie.commons.java.nio.file.Path path = paths.convert( resource ).normalize();
  final org.kie.commons.java.nio.file.Path kmoduleFilePath = paths.convert( projectRoot ).resolve( KMODULE_PATH );
  return path.startsWith( kmoduleFilePath );
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path getFilePath() {
  try {
    final File dir = createTempDirectory();
    return ioService().get( dir.toURI() ).resolve( "myTempFile.txt" );
  } catch ( IOException e ) {
    throw new RuntimeException( e );
  }
}

代码示例来源:origin: org.kie.commons/kie-commons-io

@Override
public Path getDirectoryPath() {
  try {
    final File dir = createTempDirectory();
    return ioService().get( dir.toURI() ).resolve( "myDir" );
  } catch ( IOException e ) {
    throw new RuntimeException( e );
  }
}

相关文章