当前位置: 首页>>代码示例>>Java>>正文


Java FileUtils类代码示例

本文整理汇总了Java中org.apache.directory.api.util.FileUtils的典型用法代码示例。如果您正苦于以下问题:Java FileUtils类的具体用法?Java FileUtils怎么用?Java FileUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

FileUtils类属于org.apache.directory.api.util包,在下文中一共展示了FileUtils类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setup

import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
    workingDirectory = System.getProperty( "workingDirectory" );

    if ( workingDirectory == null )
    {
        String path = SchemaManagerLoadTest.class.getResource( "" ).getPath();
        int targetPos = path.indexOf( "target" );
        workingDirectory = path.substring( 0, targetPos + 6 );
    }

    // Make sure every test class has its own schema directory
    workingDirectory = new File( workingDirectory, "SchemaManagerLoadTest" ).getAbsolutePath();

    schemaRepository = new File( workingDirectory, "schema" );

    // Cleanup the target directory
    FileUtils.deleteDirectory( schemaRepository );

    SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
    extractor.extractOrCopy();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:SchemaManagerLoadTest.java


示例2: setup

import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
    workingDirectory = System.getProperty( "workingDirectory" );

    if ( workingDirectory == null )
    {
        String path = SchemaManagerDelTest.class.getResource( "" ).getPath();
        int targetPos = path.indexOf( "target" );
        workingDirectory = path.substring( 0, targetPos + 6 );
    }

    // Make sure every test class has its own schema directory
    workingDirectory = new File( workingDirectory, "SchemaManagerDelTest" ).getAbsolutePath();

    schemaRepository = new File( workingDirectory, "schema" );

    // Cleanup the target directory
    FileUtils.deleteDirectory( schemaRepository );

    SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
    extractor.extractOrCopy();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:SchemaManagerDelTest.java


示例3: setup

import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
    workingDirectory = System.getProperty( "workingDirectory" );

    if ( workingDirectory == null )
    {
        String path = SchemaManagerLoadWithDepsTest.class.getResource( "" ).getPath();
        int targetPos = path.indexOf( "target" );
        workingDirectory = path.substring( 0, targetPos + 6 );
    }

    // Make sure every test class has its own schema directory
    workingDirectory = new File( workingDirectory, "SchemaManagerLoadWithDepsTest" ).getAbsolutePath();

    schemaRepository = new File( workingDirectory, "schema" );

    // Cleanup the target directory
    FileUtils.deleteDirectory( schemaRepository );

    SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
    extractor.extractOrCopy();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:SchemaManagerLoadWithDepsTest.java


示例4: setup

import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
    workingDirectory = System.getProperty( "workingDirectory" );

    if ( workingDirectory == null )
    {
        String path = SchemaManagerAddTest.class.getResource( "" ).getPath();
        int targetPos = path.indexOf( "target" );
        workingDirectory = path.substring( 0, targetPos + 6 );
    }

    // Make sure every test class has its own schema directory
    workingDirectory = new File( workingDirectory, "SchemaManagerAddTest" ).getAbsolutePath();

    schemaRepository = new File( workingDirectory, "schema" );

    // Cleanup the target directory
    FileUtils.deleteDirectory( schemaRepository );

    SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
    extractor.extractOrCopy();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:SchemaManagerAddTest.java


示例5: setup

import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
    workingDirectory = System.getProperty( "workingDirectory" );

    if ( workingDirectory == null )
    {
        String path = SchemaManagerEnableDisableLoadTest.class.getResource( "" ).getPath();
        int targetPos = path.indexOf( "target" );
        workingDirectory = path.substring( 0, targetPos + 6 );
    }

    // Make sure every test class has its own schema directory
    workingDirectory = new File( workingDirectory, "SchemaManagerEnableDisableLoadTest" ).getAbsolutePath();

    schemaRepository = new File( workingDirectory, "schema" );

    // Cleanup the target directory
    FileUtils.deleteDirectory( schemaRepository );

    SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
    extractor.extractOrCopy();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:24,代码来源:SchemaManagerEnableDisableLoadTest.java


示例6: setup

import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception
{
    workingDirectory = System.getProperty( "workingDirectory" );

    if ( workingDirectory == null )
    {
        String path = MatchingRuleTest.class.getResource( "" ).getPath();
        int targetPos = path.indexOf( "target" );
        workingDirectory = path.substring( 0, targetPos + 6 );
    }

    schemaRepository = new File( workingDirectory, "schema" );

    // Cleanup the target directory
    FileUtils.deleteDirectory( schemaRepository );

    SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor( new File( workingDirectory ) );
    extractor.extractOrCopy();

    LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
    schemaManager = new DefaultSchemaManager( loader );
    for ( Schema schema : loader.getAllSchemas() )
    {
        schema.enable();
    }
    schemaManager.loadAllEnabled();
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:29,代码来源:MatchingRuleTest.java


示例7: setup

import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws IOException
{
    workingDirectory = System.getProperty( "workingDirectory" );

    if ( workingDirectory == null )
    {
        String path = LdifSchemaLoaderTest.class.getResource( "" ).getPath();
        int targetPos = path.indexOf( "target" );
        workingDirectory = path.substring( 0, targetPos + 6 );
    }

    // Cleanup the target directory
    FileUtils.deleteDirectory( new File( workingDirectory + "/schema" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:16,代码来源:LdifSchemaLoaderTest.java


示例8: setup

import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@BeforeClass
public static void setup() throws IOException
{
    workingDirectory = System.getProperty( "workingDirectory" );

    if ( workingDirectory == null )
    {
        String path = SchemaLdifExtractorTest.class.getResource( "" ).getPath();
        int targetPos = path.indexOf( "target" );
        workingDirectory = path.substring( 0, targetPos + 6 );
    }

    // Cleanup the target directory
    FileUtils.deleteDirectory( new File( workingDirectory + "/schema" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:16,代码来源:SchemaLdifExtractorTest.java


示例9: cleanup

import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@AfterClass
public static void cleanup() throws IOException
{
    // Cleanup the target directory
    FileUtils.deleteDirectory( schemaRepository.getParentFile() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:7,代码来源:SchemaManagerLoadTest.java


示例10: cleanup

import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@AfterClass
public static void cleanup() throws IOException
{
    // Cleanup the target directory
    FileUtils.deleteDirectory( schemaRepository );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:7,代码来源:MatchingRuleTest.java


示例11: cleanup

import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
@AfterClass
public static void cleanup() throws IOException
{
    // Cleanup the target directory
    FileUtils.deleteDirectory( new File( workingDirectory + "/schema" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:7,代码来源:LdifSchemaLoaderTest.java


示例12: init

import org.apache.directory.api.util.FileUtils; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void init(String name) throws Exception {
    if ((directoryService != null) && directoryService.isStarted()) {
        return;
    }

    directoryService.setInstanceId(name);

    // instance layout
    InstanceLayout instanceLayout = new InstanceLayout(System.getProperty("java.io.tmpdir") + "/server-work-" + name);
    if (instanceLayout.getInstanceDirectory().exists()) {
        try {
            FileUtils.deleteDirectory(instanceLayout.getInstanceDirectory());
        } catch (IOException e) {
            LOG.warn("couldn't delete the instance directory before initializing the DirectoryService", e);
        }
    }
    directoryService.setInstanceLayout(instanceLayout);

    // EhCache in disabled-like-mode
    Configuration ehCacheConfig = new Configuration();
    CacheConfiguration defaultCache = new CacheConfiguration("default", 1).eternal(false).timeToIdleSeconds(30)
            .timeToLiveSeconds(30).overflowToDisk(false);
    ehCacheConfig.addDefaultCache(defaultCache);
    CacheService cacheService = new CacheService(new CacheManager(ehCacheConfig));
    directoryService.setCacheService(cacheService);

    // Init the schema
    // SchemaLoader loader = new SingleLdifSchemaLoader();
    SchemaLoader loader = new JarLdifSchemaLoader();
    SchemaManager schemaManager = new DefaultSchemaManager(loader);
    schemaManager.loadAllEnabled();
    ComparatorRegistry comparatorRegistry = schemaManager.getComparatorRegistry();
    for (LdapComparator<?> comparator : comparatorRegistry) {
        if (comparator instanceof NormalizingComparator) {
            ((NormalizingComparator) comparator).setOnServer();
        }
    }
    directoryService.setSchemaManager(schemaManager);
    InMemorySchemaPartition inMemorySchemaPartition = new InMemorySchemaPartition(schemaManager);

    SchemaPartition schemaPartition = new SchemaPartition(schemaManager);
    schemaPartition.setWrappedPartition(inMemorySchemaPartition);
    directoryService.setSchemaPartition(schemaPartition);
    List<Throwable> errors = schemaManager.getErrors();
    if (errors.size() != 0) {
        throw new Exception(I18n.err(I18n.ERR_317, Exceptions.printErrors(errors)));
    }

    // Init system partition
    Partition systemPartition = partitionFactory.createPartition(directoryService.getSchemaManager(),
            directoryService.getDnFactory(), "system", ServerDNConstants.SYSTEM_DN, 500,
            new File(directoryService.getInstanceLayout().getPartitionsDirectory(), "system"));
    systemPartition.setSchemaManager(directoryService.getSchemaManager());
    partitionFactory.addIndex(systemPartition, SchemaConstants.OBJECT_CLASS_AT, 100);
    directoryService.setSystemPartition(systemPartition);

    directoryService.startup();
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:62,代码来源:InMemoryDirectoryServiceFactory.java



注:本文中的org.apache.directory.api.util.FileUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。