@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 Project project = 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( project.getKModuleXMLPath() ); return path.startsWith( kmoduleFilePath ); }
@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 Project project = 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( project.getPomXMLPath() ); return path.startsWith( pomFilePath ); }
@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 ); }
@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 ); }
if ( pResource.startsWith( pSrcJavaResources ) ) { return makeProjectPackageList( resource, projectRootPath ); if ( pResource.startsWith( pSrcResources ) ) { return makeProjectPackageList( resource, projectRootPath ); if ( pResource.startsWith( pTestJavaResources ) ) { return makeProjectPackageList( resource, projectRootPath ); if ( pResource.startsWith( pTestResources ) ) { return makeProjectPackageList( resource, projectRootPath );
private Path doResolveSrcPackage( final Path resource, final Path projectRoot ) { //The pom.xml and kmodule.xml files are not within a package if ( isPom( resource ) || isKModule( resource ) ) { return null; } //The Path must be within a Project's src/main/java or src/main/resources path boolean resolved = false; org.kie.commons.java.nio.file.Path path = paths.convert( resource ).normalize(); final org.kie.commons.java.nio.file.Path srcJavaPath = paths.convert( projectRoot ).resolve( SOURCE_JAVA_PATH ); final org.kie.commons.java.nio.file.Path srcResourcesPath = paths.convert( projectRoot ).resolve( SOURCE_RESOURCES_PATH ); //Check if path resides within a Java or Resources path if ( path.startsWith( srcJavaPath ) ) { resolved = true; } else if ( path.startsWith( srcResourcesPath ) ) { resolved = true; } if ( !resolved ) { return null; } //If the Path is already a folder simply return it if ( Files.isDirectory( path ) ) { return resource; } path = path.getParent(); return paths.convert( path ); }
private Path doResolveTestPackage( final Path resource, final Path projectRoot ) { //The pom.xml and kmodule.xml files are not within a package if ( isPom( resource ) || isKModule( resource ) ) { return null; } //The Path must be within a Project's src/test/java or src/test/resources path boolean resolved = false; org.kie.commons.java.nio.file.Path path = paths.convert( resource ).normalize(); final org.kie.commons.java.nio.file.Path testJavaPath = paths.convert( projectRoot ).resolve( TEST_JAVA_PATH ); final org.kie.commons.java.nio.file.Path testResourcesPath = paths.convert( projectRoot ).resolve( TEST_RESOURCES_PATH ); //Check if path resides within a Java or Resources path if ( path.startsWith( testJavaPath ) ) { resolved = true; } else if ( path.startsWith( testResourcesPath ) ) { resolved = true; } if ( !resolved ) { return null; } //If the Path is already a folder simply return it if ( Files.isDirectory( path ) ) { return resource; } path = path.getParent(); return paths.convert( path ); }
if ( nioResource.startsWith( nioMainSrcPath ) ) { packagePath = nioMainSrcPath.relativize( nioResource ); packageName = packagePath.toString().replaceAll( "/", "." ); } else if ( nioResource.startsWith( nioTestSrcPath ) ) { packagePath = nioTestSrcPath.relativize( nioResource ); packageName = packagePath.toString().replaceAll( "/", "." ); } else if ( nioResource.startsWith( nioMainResourcesPath ) ) { packagePath = nioMainResourcesPath.relativize( nioResource ); packageName = packagePath.toString().replaceAll( "/", "." ); } else if ( nioResource.startsWith( nioTestResourcesPath ) ) { packagePath = nioTestResourcesPath.relativize( nioResource ); packageName = packagePath.toString().replaceAll( "/",