本文整理匯總了Java中org.apache.tools.ant.types.FileSet.getDirectoryScanner方法的典型用法代碼示例。如果您正苦於以下問題:Java FileSet.getDirectoryScanner方法的具體用法?Java FileSet.getDirectoryScanner怎麽用?Java FileSet.getDirectoryScanner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.tools.ant.types.FileSet
的用法示例。
在下文中一共展示了FileSet.getDirectoryScanner方法的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);
}
}
示例2: execute
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
public void execute() throws BuildException {
for(FileSet fs: filesets) {
FileScanner scanner = fs.getDirectoryScanner(getProject());
File dir = scanner.getBasedir();
String[] files = scanner.getIncludedFiles();
for (int i = 0; i < files.length; i++) {
File helpset = new File(dir, files[i]);
try {
checkHelpSet(helpset);
} catch (BuildException be) {
throw be;
} catch (Exception e) {
throw new BuildException("Error checking helpset", e, new Location(helpset.getAbsolutePath()));
}
}
}
}
示例3: 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);
}
}
}
示例4: 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]));
}
}
}
示例5: 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 );
}
}
示例6: 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;
}
示例7: processFileSet
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private void processFileSet(final FileSet fileSet) throws IOException {
final DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject());
final String[] files = scanner.getIncludedFiles();
String base = fileSet.getDir(getProject()).getCanonicalPath() + "\\";
for (String file : files) {
String lastDir = "";
getDirFileList(lastDir);
int idx = -1;
do {
idx = file.indexOf('\\', idx + 1);
if (idx == -1) break;
lastDir = file.substring(0, idx);
getDirFileList(lastDir);
}
while (true);
List<String> fileList = getDirFileList(lastDir);
final String absolute = base + file;
fileList.add(absolute);
myAbsoluteToRelative.put(absolute, file);
}
}
示例8: 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]));
}
}
}
示例9: getSourceBundleFiles
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
protected List<SourceBundleFile> getSourceBundleFiles(BundleSet bundleSet) {
List<SourceBundleFile> bundleFiles = new LinkedList<SourceBundleFile>();
ResourceType type = bundleSet.getType();
FileSet fs = bundleSet.getSourceFiles();
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] includedFiles = ds.getIncludedFiles();
File base = ds.getBasedir();
for (int i = 0; i < includedFiles.length; i++) {
File bundleFile = new File(base, includedFiles[i]);
bundleFiles.add(
new SourceBundleFile(type, pathToBundleId(type, includedFiles[i]),
bundleFile, includedFiles[i]));
}
return bundleFiles;
}
示例10: 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 );
}
}
}
}
示例11: 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" );
}
示例12: getFiles
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private String[] getFiles() {
List files = new LinkedList();
for ( Iterator i = fileSets.iterator(); i.hasNext(); ) {
FileSet fs = (FileSet) i.next();
DirectoryScanner ds = fs.getDirectoryScanner( getProject() );
String[] dsFiles = ds.getIncludedFiles();
for (int j = 0; j < dsFiles.length; j++) {
File f = new File(dsFiles[j]);
if ( !f.isFile() ) {
f = new File( ds.getBasedir(), dsFiles[j] );
}
files.add( f.getAbsolutePath() );
}
}
return ArrayHelper.toStringArray(files);
}
示例13: execute
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
* ants execute method.
*/
@Override
public void execute() {
try {
for (final FileSet fileset : filesets) {
final DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
final String[] includedFiles = ds.getIncludedFiles();
for (final String filename : includedFiles) {
System.out.println(ds.getBasedir().getAbsolutePath() + File.separator + filename);
convert(ds.getBasedir().getAbsolutePath() + File.separator + filename);
}
}
} catch (final Exception e) {
throw new BuildException(e);
}
}
示例14: execute
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
* ants execute method.
*/
@Override
public void execute() {
try {
for (final FileSet fileset : filesets) {
final DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
final String[] includedFiles = ds.getIncludedFiles();
for (final String filename : includedFiles) {
String signature = sign(ds.getBasedir().getAbsolutePath()
+ File.separator + filename);
System.out.println("file-signature." + filename + "=" + signature);
}
}
} catch (final Exception e) {
throw new BuildException(e);
}
}
示例15: execute
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
* ants execute method.
*/
@Override
public void execute() {
try {
for (final FileSet fileset : filesets) {
final DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
final String[] includedFiles = ds.getIncludedFiles();
for (final String filename : includedFiles) {
System.out.println(ds.getBasedir().getAbsolutePath()
+ File.separator + filename);
convert(ds.getBasedir().getAbsolutePath() + File.separator
+ filename);
}
}
} catch (final Exception e) {
throw new BuildException(e);
}
}