Package org.codehaus.plexus.util

Examples of org.codehaus.plexus.util.DirectoryScanner


            File ebaSourceDir = ebaSourceDirectory;
            if ( ebaSourceDir.exists() )
            {
                getLog().info( "Copy eba resources to " + getBuildDir().getAbsolutePath() );

                DirectoryScanner scanner = new DirectoryScanner();
                scanner.setBasedir( ebaSourceDir.getAbsolutePath() );
                scanner.setIncludes( DEFAULT_INCLUDES );
                scanner.addDefaultExcludes();
                scanner.scan();

                String[] dirs = scanner.getIncludedDirectories();

                for ( int j = 0; j < dirs.length; j++ )
                {
                    new File( getBuildDir(), dirs[j] ).mkdirs();
                }

                String[] files = scanner.getIncludedFiles();

                for ( int j = 0; j < files.length; j++ )
                {
                    File targetFile = new File( getBuildDir(), files[j] );
View Full Code Here


      getLog().debug("JCasGen: Adding to classpath '" + element + "'");
    }
    String classpath = classpathBuilder.toString();

    // Locate the files to include
    DirectoryScanner ds = new DirectoryScanner();
    ds.setIncludes(typeSystemIncludes);
    ds.setExcludes(typeSystemExcludes);
    ds.setBasedir(project.getBasedir());
    ds.setCaseSensitive(true);
    getLog().debug("JCasGen: Scanning for descriptors in '" + ds.getBasedir() + "'");
    ds.scan();

    // Create a merged type system and check if any of the files has a delta
    TypeSystemDescription typeSystem = new TypeSystemDescription_impl();
    List<Import> imports = new ArrayList<Import>();
    boolean contextDelta = false;
    for (String descriptorLocation : ds.getIncludedFiles()) {
      File descriptorFile = new File(ds.getBasedir(), descriptorLocation);
      this.getLog().info("JCasGen: Found descriptor '" + descriptorFile.getAbsolutePath() + "'");
      Import imp = new Import_impl();
      // setLocation takes a string which must be a URL
      // https://issues.apache.org/jira/browse/UIMA-2983
      URL url;
      try {
        url = descriptorFile.toURI().toURL();
      } catch (MalformedURLException e) {
        throw new RuntimeException(e); // this should never happen for files
      }
      imp.setLocation(url.toString());
      imports.add(imp);

      contextDelta |= this.buildContext.hasDelta(new File(ds.getBasedir(), descriptorLocation));
    }
    Import[] importArray = new Import[imports.size()];
    typeSystem.setImports(imports.toArray(importArray));

    // Save type system to a file so we can pass it to the Jg
View Full Code Here

        List<String> includes = resource.getIncludes();
        if (includes.isEmpty()) {
          includes = Arrays.asList("**");
        }
        List<String> excludes = resource.getExcludes();
        DirectoryScanner scanner = new DirectoryScanner();
        scanner.setBasedir(resourceDir);
        scanner.setIncludes(includes.toArray(new String[includes.size()]));
        scanner.setExcludes(excludes.toArray(new String[excludes.size()]));
        scanner.scan();

        // map each of the resources from its target location to its source location
        String targetPath = resource.getTargetPath();
        for (String filePath : scanner.getIncludedFiles()) {
          File sourceFile = new File(resourceDir, filePath);
          File baseDirectory = targetPath != null ? new File(buildOutputDirectory, targetPath)
                  : buildOutputDirectory;
          File targetFile = new File(baseDirectory, filePath);
          targetToSource.put(targetFile, sourceFile);
View Full Code Here

    private void addResourceArgs( CompilerConfiguration config, List args )
    {
        File filteredResourceDir = this.findResourceDir( config );
        if ( ( filteredResourceDir != null ) && filteredResourceDir.exists() )
        {
            DirectoryScanner scanner = new DirectoryScanner();
            scanner.setBasedir( filteredResourceDir );
            scanner.setIncludes( DEFAULT_INCLUDES );
            scanner.addDefaultExcludes();
            scanner.scan();

            List includedFiles = Arrays.asList( scanner.getIncludedFiles() );
            for ( Iterator iter = includedFiles.iterator(); iter.hasNext(); )
            {
                String name = (String) iter.next();
                File filteredResource = new File( filteredResourceDir, name );
                String assemblyResourceName = this.convertNameToAssemblyResourceName( name );
View Full Code Here

        return DefaultCSharpCompilerParser.parseLine( line );
    }

    protected static Set getSourceFilesForSourceRoot( CompilerConfiguration config, String sourceLocation )
    {
        DirectoryScanner scanner = new DirectoryScanner();

        scanner.setBasedir( sourceLocation );

        Set includes = config.getIncludes();

        if ( includes != null && !includes.isEmpty() )
        {
            String[] inclStrs = (String[]) includes.toArray( new String[includes.size()] );
            scanner.setIncludes( inclStrs );
        }
        else
        {
            scanner.setIncludes( new String[]{"**/*.cs"} );
        }

        Set excludes = config.getExcludes();

        if ( excludes != null && !excludes.isEmpty() )
        {
            String[] exclStrs = (String[]) excludes.toArray( new String[excludes.size()] );
            scanner.setIncludes( exclStrs );
        }

        scanner.scan();

        String[] sourceDirectorySources = scanner.getIncludedFiles();

        Set sources = new HashSet();

        for ( int j = 0; j < sourceDirectorySources.length; j++ )
        {
View Full Code Here

            File resourceDirectory = new File(resource.getDirectory());
            if (!resourceDirectory.exists()) {
                continue;
            }
   
            DirectoryScanner scanner = new DirectoryScanner();
   
            scanner.setBasedir(resource.getDirectory());
            if (resource.getIncludes() != null && !resource.getIncludes().isEmpty()) {
                scanner.setIncludes((String[])resource.getIncludes().toArray(new String[]{}));
            } else {
                scanner.setIncludes(new String[]{"**/**"});
            }
            if (resource.getExcludes() != null && !resource.getExcludes().isEmpty()) {
                scanner.setExcludes((String[])resource.getExcludes().toArray(new String[]{}));
            }

            scanner.addDefaultExcludes();
            scanner.scan();
   
            List<String> includedFiles = Arrays.asList(scanner.getIncludedFiles());
            String targetPath = resource.getTargetPath();
            for (String source: includedFiles) {
                String target;
                if (source.endsWith(".java")) {
                    target = source.substring(0, source.length() - 5) + ".class";
View Full Code Here

    {
        getLogger().debug( "Creating Archetype/Module files from " + basedir + " to " + archetypeFilesDirectory );

        for ( FileSet fileSet : fileSets )
        {
            DirectoryScanner scanner = new DirectoryScanner();
            scanner.setBasedir( basedir );
            scanner.setIncludes( (String[]) concatenateToList( fileSet.getIncludes(), fileSet.getDirectory() ).toArray(
                new String[fileSet.getIncludes().size()] ) );
            scanner.setExcludes( (String[]) fileSet.getExcludes().toArray( new String[fileSet.getExcludes().size()] ) );
            scanner.addDefaultExcludes();
            getLogger().debug( "Using fileset " + fileSet );
            scanner.scan();

            List<String> fileSetResources = Arrays.asList( scanner.getIncludedFiles() );
            getLogger().debug( "Scanned " + fileSetResources.size() + " resources" );

            if ( fileSet.isFiltered() )
            {
                processFileSet( basedir, archetypeFilesDirectory, fileSet.getDirectory(), fileSetResources,
View Full Code Here

  public MavenProject getProject() {
    return project;
  }

  protected String[] getThemeFiles(File sourceDir) {
    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setBasedir(sourceDir);
    scanner.setIncludes(new String[]{"**"});
    scanner.setExcludes(new String [] {"META-INF/**/*",
        "**/*.properties", "**/*.xml", "**/*.class"});
    scanner.scan();
    return scanner.getIncludedFiles();
  }
View Full Code Here

        throws IOException
    {
        if ( !directory.isDirectory() )
            throw new IllegalArgumentException( "File is not a directory" );

        DirectoryScanner scanner = new DirectoryScanner();

        scanner.setBasedir( directory );
        scanner.setIncludes( CLASS_INCLUDES );

        scanner.scan();

        String[] paths = scanner.getIncludedFiles();

        for ( int i = 0; i < paths.length; i++ )
        {
            String path = paths[i].replace( File.separatorChar, '/' );
View Full Code Here

        if ( !directory.isDirectory() )
        {
            throw new IllegalArgumentException( "File is not a directory" );
        }

        DirectoryScanner scanner = new DirectoryScanner();

        scanner.setBasedir( directory );
        scanner.setIncludes( CLASS_INCLUDES );

        scanner.scan();

        String[] paths = scanner.getIncludedFiles();

        for ( String path : paths )
        {
            path = path.replace( File.separatorChar, '/' );
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.util.DirectoryScanner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.