當前位置: 首頁>>代碼示例>>Java>>正文


Java FileSet.getDir方法代碼示例

本文整理匯總了Java中org.apache.tools.ant.types.FileSet.getDir方法的典型用法代碼示例。如果您正苦於以下問題:Java FileSet.getDir方法的具體用法?Java FileSet.getDir怎麽用?Java FileSet.getDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.tools.ant.types.FileSet的用法示例。


在下文中一共展示了FileSet.getDir方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Override
public void execute() throws BuildException {
    BasicStyleCheckerEngine engine = new BasicStyleCheckerEngine();
    
    try {
        for (FileSet fileset: filesets) {
            final DirectoryScanner scanner =
                    fileset.getDirectoryScanner(getProject());
            
            for (String filename: scanner.getIncludedFiles()) {
                final File file =
                        new File(fileset.getDir(getProject()), filename);
                
                System.out.println(file.getCanonicalPath());
                engine.check(file);
            }
        }
    } catch (IOException e) {
        throw new BuildException(e);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:BasicStyleCheckerTask.java

示例2: execute

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Override
public void execute() throws BuildException {
	log( "Starting Hibernate EnhancementTask execution", Project.MSG_INFO );

	// we use the CtClass stuff here just as a simple vehicle for obtaining low level information about
	// the class(es) contained in a file while still maintaining easy access to the underlying byte[]
	final Project project = getProject();

	for ( FileSet fileSet : filesets ) {
		final File fileSetBaseDir = fileSet.getDir( project );
		final DirectoryScanner directoryScanner = fileSet.getDirectoryScanner( project );
		for ( String relativeIncludedFileName : directoryScanner.getIncludedFiles() ) {
			final File javaClassFile = new File( fileSetBaseDir, relativeIncludedFileName );
			if ( ! javaClassFile.exists() ) {
				continue;
			}

			processClassFile( javaClassFile);
		}
	}

}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:EnhancementTask.java

示例3: execute

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * Invoke the Hadoop record compiler on each record definition file
 */
@Override
public void execute() throws BuildException {
  if (src == null && filesets.size()==0) {
    throw new BuildException("There must be a file attribute or a fileset child element");
  }
  if (src != null) {
    doCompile(src);
  }
  Project myProject = getProject();
  for (int i = 0; i < filesets.size(); i++) {
    FileSet fs = filesets.get(i);
    DirectoryScanner ds = fs.getDirectoryScanner(myProject);
    File dir = fs.getDir(myProject);
    String[] srcs = ds.getIncludedFiles();
    for (int j = 0; j < srcs.length; j++) {
      doCompile(new File(dir, srcs[j]));
    }
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:23,代碼來源:RccTask.java

示例4: collect

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * Collects all files from the supplied FileSet.
 * 
 * @param receiver    The Collection to receive the files (and implied directories). Not <code>null</code>.
 * @param unmanaged   The Collection to receive unmanaged directories. Not <code>null</code>.
 * @param fileset     The FileSet which has to be traversed. Not <code>null</code>.
 */
private void collect( List<File> receiver, List<File> unmanaged, FileSet fileset ) {
    
    DirectoryScanner scanner = fileset.getDirectoryScanner( getProject() );
    File             dir     = fileset.getDir( getProject() );
    
    
    if( incfiledirs ) {
        // we're including directories which are implied by the FileSet
        String[] dirs   = scanner.getIncludedDirectories();
        for( String includeddir : dirs ) {
            File directory = new File( dir, includeddir );
            collectUnmanaged( unmanaged, dir, directory, false );
            receiver.add( directory );
        }
    }
    
    String[]         files   = scanner.getIncludedFiles();
    for( String includedfile : files ) {
        File file = new File( dir, includedfile );
        collectUnmanaged( unmanaged, dir, file.getParentFile(), false );
        receiver.add( file );
    }
}
 
開發者ID:subclipse,項目名稱:svnant,代碼行數:31,代碼來源:ResourceSetSvnCommand.java

示例5: getInputFiles

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * Returns the list of input files ({@link java.io.File} objects) to process.
 * Note that this does not check that the file is a valid and useful XML file.
 * 
 * @return The input files
 */
private List getInputFiles()
{
	ArrayList result = new ArrayList();

    for (Iterator it = _fileSets.iterator(); it.hasNext();)
    {
        FileSet          fileSet    = (FileSet)it.next();
        File             fileSetDir = fileSet.getDir(getProject());
        DirectoryScanner scanner    = fileSet.getDirectoryScanner(getProject());
        String[]         files      = scanner.getIncludedFiles();

        for (int idx = 0; (files != null) && (idx < files.length); idx++)
        {
        	File file = new File(fileSetDir, files[idx]);

            if (file.isFile() && file.canRead())
            {
            	result.add(file);
            }
        }
    }
    return result;
}
 
開發者ID:gemxd,項目名稱:gemfirexd-oss,代碼行數:30,代碼來源:TestSummaryCreatorTask.java

示例6: execute

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Override
public void execute() throws BuildException {
	try {
		List<File> files = new ArrayList<File>();
		for (FileSet fs : fileSets) {
			String[] fileNames = fs.getDirectoryScanner().getIncludedFiles();
			for (String fname : fileNames) {
				File file = new File(fs.getDir(), fname);
				if (file.getName().endsWith(".class")) {
					files.add(file);
				}
			}
		}
		
		Instrumenter instr = new Instrumenter(files, destDir, stackPackageName);
		instr.setDisabled(disabled);
		instr.setSingleThread(singleThread);
		instr.setIsolated(isolated);
		instr.process();
	}
	catch (IOException e) {
		throw new BuildException(e);
	}
}
 
開發者ID:warlockcodes,項目名稱:Null-Engine,代碼行數:25,代碼來源:InstrumentationTask.java

示例7: execute

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * Invoke the Hadoop record compiler on each record definition file
 */
public void execute() throws BuildException {
  if (src == null && filesets.size()==0) {
    throw new BuildException("There must be a file attribute or a fileset child element");
  }
  if (src != null) {
    doCompile(src);
  }
  Project myProject = getProject();
  for (int i = 0; i < filesets.size(); i++) {
    FileSet fs = filesets.get(i);
    DirectoryScanner ds = fs.getDirectoryScanner(myProject);
    File dir = fs.getDir(myProject);
    String[] srcs = ds.getIncludedFiles();
    for (int j = 0; j < srcs.length; j++) {
      doCompile(new File(dir, srcs[j]));
    }
  }
}
 
開發者ID:rhli,項目名稱:hadoop-EAR,代碼行數:22,代碼來源:RccTask.java

示例8: execute

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
public void execute() throws BuildException {
	if ( isExtended() ) {
		collectClassNames();
	}
	logger.info( "starting instrumentation" );
	Project project = getProject();
	Iterator filesets = filesets();
	while ( filesets.hasNext() ) {
		FileSet fs = ( FileSet ) filesets.next();
		DirectoryScanner ds = fs.getDirectoryScanner( project );
		String[] includedFiles = ds.getIncludedFiles();
		File d = fs.getDir( project );
		for ( int i = 0; i < includedFiles.length; ++i ) {
			File file = new File( d, includedFiles[i] );
			try {
				processFile( file );
			}
			catch ( Exception e ) {
				throw new BuildException( e );
			}
		}
	}
}
 
開發者ID:cacheonix,項目名稱:cacheonix-core,代碼行數:24,代碼來源:BasicInstrumentationTask.java

示例9: collectClassNames

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private void collectClassNames() {
	logger.info( "collecting class names for extended instrumentation determination" );
	Project project = getProject();
	Iterator filesets = filesets();
	while ( filesets.hasNext() ) {
		FileSet fs = ( FileSet ) filesets.next();
		DirectoryScanner ds = fs.getDirectoryScanner( project );
		String[] includedFiles = ds.getIncludedFiles();
		File d = fs.getDir( project );
		for ( int i = 0; i < includedFiles.length; ++i ) {
			File file = new File( d, includedFiles[i] );
			try {
				collectClassNames( file );
			}
			catch ( Exception e ) {
				throw new BuildException( e );
			}
		}
	}
	logger.info( classNames.size() + " class(es) being checked" );
}
 
開發者ID:cacheonix,項目名稱:cacheonix-core,代碼行數:22,代碼來源:BasicInstrumentationTask.java

示例10: processExtraClassPathFileSets

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private void processExtraClassPathFileSets() throws BuildException {

		for (Iterator jarIter = mExtraClassPathFileSets.iterator(); jarIter
				.hasNext();) {
			FileSet fs = (FileSet) jarIter.next();
			Project p = fs.getProject();
			File srcDir = fs.getDir(p);
			FileScanner ds = fs.getDirectoryScanner(p);
			fs.setupDirectoryScanner(ds, p);
			ds.scan();

			String[] files = ds.getIncludedFiles();

			for (int i = 0; i < files.length; i++) {
				File f = new File(srcDir, files[i]);
				String path = f.getPath().replace(File.separatorChar, '/');
				bundleProperties.addToExtraClassPath(path);
			}
		}
	}
 
開發者ID:UltraMixer,項目名稱:JarBundler,代碼行數:21,代碼來源:JarBundler.java

示例11: collectSpecifiedFiles

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private Set collectSpecifiedFiles() {
	HashSet files = new HashSet();
	Project project = getProject();
	Iterator filesets = filesets();
	while ( filesets.hasNext() ) {
		FileSet fs = ( FileSet ) filesets.next();
		DirectoryScanner ds = fs.getDirectoryScanner( project );
		String[] includedFiles = ds.getIncludedFiles();
		File d = fs.getDir( project );
		for ( int i = 0; i < includedFiles.length; ++i ) {
			files.add( new File( d, includedFiles[i] ) );
		}
	}
	return files;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:16,代碼來源:BasicInstrumentationTask.java

示例12: processJarFileSets

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private void processJarFileSets() throws BuildException {

		for (Iterator jarIter = mJarFileSets.iterator(); jarIter.hasNext();) {

			FileSet fs = (FileSet) jarIter.next();

			Project p = fs.getProject();
			File srcDir = fs.getDir(p);
			FileScanner ds = fs.getDirectoryScanner(p);
			fs.setupDirectoryScanner(ds, p);
			ds.scan();

			String[] files = ds.getIncludedFiles();

			try {

				for (int i = 0; i < files.length; i++) {
					String fileName = files[i];
					File src = new File(srcDir, fileName);
					File dest = new File(mJavaDir, fileName);

					if (mVerbose)
						log("Copying JAR file to \"" + bundlePath(dest) + "\"");

					mFileUtils.copyFile(src, dest);
					bundleProperties.addToClassPath(fileName);
				}

			} catch (IOException ex) {
				throw new BuildException("Cannot copy jar file: " + ex);
			}
		}
	}
 
開發者ID:UltraMixer,項目名稱:JarBundler,代碼行數:34,代碼來源:JarBundler.java

示例13: processCopyingFileSets

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private void processCopyingFileSets(List fileSets, File targetdir, boolean setExec) {
	for (Iterator execIter = fileSets.iterator(); execIter.hasNext();) {
		FileSet fs = (FileSet) execIter.next();
		Project p = fs.getProject();
		File srcDir = fs.getDir(p);
		FileScanner ds = fs.getDirectoryScanner(p);
		fs.setupDirectoryScanner(ds, p);
		ds.scan();

		String[] files = ds.getIncludedFiles();

		if (files.length == 0) {
			// this is probably an error -- warn about it
			System.err
					.println("WARNING: fileset for copying from directory "
							+ srcDir + ": no files found");
		} else {
			try {
				for (int i = 0; i < files.length; i++) {
					String fileName = files[i];
					File src = new File(srcDir, fileName);
					File dest = new File(targetdir, fileName);
					
					if (mVerbose) 
						log("Copying "
								+ (setExec ? "exec" : "resource")
								+ " file to \"" + bundlePath(dest) +"\"");
					
					mFileUtils.copyFile(src, dest);
					if (setExec)
						setExecutable(dest);
				}
			} catch (IOException ex) {
				throw new BuildException("Cannot copy file: " + ex);
			}
		}
	}
}
 
開發者ID:UltraMixer,項目名稱:JarBundler,代碼行數:39,代碼來源:JarBundler.java

示例14: execute

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * Executes the task.
 * <p>
 * Builds a command line to execute ccm and then calls Exec's run method
 * to execute the command line.
 * </p>
 * @throws BuildException on error
 */
@Override
public void execute() throws BuildException {

    if (file == null && filesets.isEmpty()) {
        throw new BuildException(
            "Specify at least one source - a file or a fileset.");
    }

    if (file != null && file.exists() && file.isDirectory()) {
        throw new BuildException("CCMCheck cannot be generated for directories");
    }

    if (file != null && !filesets.isEmpty()) {
        throw new BuildException("Choose between file and fileset !");
    }

    if (getFile() != null) {
        doit();
        return;
    }

    for (FileSet fs : filesets) {
        final File basedir = fs.getDir(getProject());
        DirectoryScanner ds = fs.getDirectoryScanner(getProject());
        for (String srcFile : ds.getIncludedFiles()) {
            setFile(new File(basedir, srcFile));
            doit();
        }
    }
}
 
開發者ID:apache,項目名稱:ant,代碼行數:39,代碼來源:CCMCheck.java

示例15: findLinks

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * Find all the links in all supplied filesets.
 *
 * <p>This method is invoked when the action attribute is
 * &quot;record&quot;. This means that filesets are interpreted
 * as the directories in which links may be found.</p>
 *
 * @param fileSets The filesets specified by the user.
 * @return A Set of <code>File</code> objects containing the
 * links (with canonical parent directories).
 */
private Set<File> findLinks(List<FileSet> fileSets) {
    final Set<File> result = new HashSet<>();
    for (FileSet fs : fileSets) {
        DirectoryScanner ds = fs.getDirectoryScanner(getProject());

        File dir = fs.getDir(getProject());

        Stream.of(ds.getIncludedFiles(), ds.getIncludedDirectories())
                .flatMap(Stream::of).forEach(path -> {
                    try {
                        final File f = new File(dir, path);
                        final File pf = f.getParentFile();
                        final String name = f.getName();
                        // we use the canonical path of the parent dir in which the (potential)
                        // link resides
                        final File parentDirCanonicalizedFile = new File(pf.getCanonicalPath(), name);
                        if (Files.isSymbolicLink(parentDirCanonicalizedFile.toPath())) {
                            result.add(parentDirCanonicalizedFile);
                        }
                    } catch (IOException e) {
                        handleError("IOException: " + path + " omitted");
                    }
        });
    }
    return result;
}
 
開發者ID:apache,項目名稱:ant,代碼行數:38,代碼來源:Symlink.java


注:本文中的org.apache.tools.ant.types.FileSet.getDir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。