本文整理了Java中net.roboconf.core.utils.Utils.listDirectories()
方法的一些代码示例,展示了Utils.listDirectories()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.listDirectories()
方法的具体详情如下:
包路径:net.roboconf.core.utils.Utils
类名称:Utils
方法名:listDirectories
[英]Lists directories located under a given file.
[中]列出位于给定文件下的目录。
代码示例来源:origin: net.roboconf/roboconf-dm
@Override
public List<TargetWrapperDescriptor> listAllTargets() {
File dir = new File( this.configurationMngr.getWorkingDirectory(), ConfigurationUtils.TARGETS );
List<File> targetDirectories = Utils.listDirectories( dir );
return buildList( targetDirectories, null );
}
代码示例来源:origin: net.roboconf/roboconf-dm
private void restoreAssociationsCache() {
File dir = new File( this.configurationMngr.getWorkingDirectory(), ConfigurationUtils.TARGETS );
for( File f : Utils.listDirectories( dir )) {
// Store the ID
this.targetIds.put( f.getName(), Boolean.TRUE );
// Cache associations for quicker access
File associationFile = new File( f, TARGETS_ASSOC_FILE );
Properties props = Utils.readPropertiesFileQuietly( associationFile, this.logger );
for( Map.Entry<Object,Object> entry : props.entrySet()) {
InstanceContext key = InstanceContext.parse( entry.getKey().toString());
this.instanceToCachedId.put( key, f.getName());
}
}
}
代码示例来源:origin: net.roboconf/roboconf-dm
@Override
public void restoreTemplates() {
File configurationDirectory = this.configurationMngr.getWorkingDirectory();
this.logger.info( "Restoring application templates from " + configurationDirectory + "..." );
this.templates.clear();
File templatesDirectory = new File( configurationDirectory, ConfigurationUtils.TEMPLATES );
for( File dir : Utils.listDirectories( templatesDirectory )) {
try {
loadApplicationTemplate( dir );
} catch( AlreadyExistingException | InvalidApplicationException | UnauthorizedActionException | IOException e ) {
this.logger.warning( "Cannot restore application template in " + dir + " (" + e.getClass().getSimpleName() + ")." );
Utils.logException( this.logger, e );
}
}
this.logger.info( "Application templates restoration from " + configurationDirectory + " has just completed." );
}
代码示例来源:origin: net.roboconf/roboconf-dm
@Override
public List<TargetWrapperDescriptor> listPossibleTargets( AbstractApplication app ) {
// Find the matching targets based on registered hints
String key = new InstanceContext( app ).toString();
String tplKey = null;
if( app instanceof Application )
tplKey = new InstanceContext(((Application) app).getTemplate()).toString();
List<File> targetDirectories = new ArrayList<> ();
File dir = new File( this.configurationMngr.getWorkingDirectory(), ConfigurationUtils.TARGETS );
for( File f : Utils.listDirectories( dir )) {
// If there is no hint for this target, then it is global.
// We can list it.
File hintsFile = new File( f, TARGETS_HINTS_FILE );
if( ! hintsFile.exists()) {
targetDirectories.add( f );
continue;
}
// Otherwise, the key must exist in the file
Properties props = Utils.readPropertiesFileQuietly( hintsFile, this.logger );
if( props.containsKey( key ))
targetDirectories.add( f );
else if( tplKey != null && props.containsKey( tplKey ))
targetDirectories.add( f );
}
// Build the result
return buildList( targetDirectories, app );
}
代码示例来源:origin: roboconf/roboconf-platform
@Test
public void testListDirectories() throws Exception {
File root = new File( "inexisting" );
Assert.assertEquals( 0, Utils.listDirectories( root ).size());
root = this.folder.newFolder();
Assert.assertEquals( 0, Utils.listDirectories( root ).size());
Assert.assertTrue( new File( root, "toto.txt" ).createNewFile());
Assert.assertTrue( new File( root, "dir" ).mkdir());
Assert.assertTrue( new File( root, "dir/dir1" ).mkdir());
List<File> directories = Utils.listDirectories( root );
Assert.assertEquals( 1, directories.size());
Assert.assertEquals( "dir", directories.get( 0 ).getName());
}
代码示例来源:origin: net.roboconf/roboconf-dm
List<File> tplDirectories = Utils.listDirectories( tpl.getDirectory());
List<String> toSkip = Arrays.asList( Constants.PROJECT_DIR_DESC, Constants.PROJECT_DIR_GRAPH, Constants.PROJECT_DIR_INSTANCES );
for( File dir : tplDirectories ) {
代码示例来源:origin: net.roboconf/roboconf-dm
for( File dir : Utils.listDirectories( templatesDirectory )) {
内容来源于网络,如有侵权,请联系作者删除!