FileDocCategorySizeDatePackage
StorageConfigurator.javaAPI DocApache Lucene 2.1.05033Wed Feb 14 10:46:04 GMT 2007org.apache.lucene.gdata.storage.lucenestorage.configuration

StorageConfigurator

public class StorageConfigurator extends Object
This clas loads the Storage configuration file and sets all properties. If the properties can not be loaded an {@link java.lang.Error} will be thrown. The configuration file lucenestorage.properties.xml should be available in the classpath.
author
Simon Willnauer

Fields Summary
private final int
storageBufferSize
private final int
storagepersistFactor
private final String
storageDirectory
private final boolean
keepRecoveredFiles
private final boolean
recover
private final boolean
ramDirectory
private static StorageConfigurator
INSTANCE
private final int
indexOptimizeInterval
Constructors Summary
private StorageConfigurator()

 
 
       
        InputStream stream = StorageConfigurator.class 
                .getResourceAsStream("/lucenestorage.properties.xml"); 
        Properties properties = new Properties(); 
        try { 
            properties.loadFromXML(stream); 
 
        } catch (Exception e) { 
            throw new StorageConfigurationError("Could not load properties", e); 
        } 
        this.storageBufferSize = Integer.parseInt(properties 
                .getProperty("gdata.server.storage.lucene.buffersize")); 
        this.storagepersistFactor = Integer.parseInt(properties 
                .getProperty("gdata.server.storage.lucene.persistFactor")); 
        this.recover = Boolean.parseBoolean(properties 
                .getProperty("gdata.server.storage.lucene.recover")); 
        this.keepRecoveredFiles = Boolean.parseBoolean(properties 
                .getProperty("gdata.server.storage.lucene.recover.keepFiles")); 
        this.storageDirectory = properties 
                .getProperty("gdata.server.storage.lucene.directory"); 
        this.indexOptimizeInterval = Integer.parseInt(properties 
                .getProperty("gdata.server.storage.lucene.optimizeInterval")); 
        this.ramDirectory = Boolean.parseBoolean(properties 
                .getProperty("gdata.server.storage.lucene.directory.ramDirectory"));
    
Methods Summary
public intgetIndexOptimizeInterval()

return
- the optimize interval
see
org.apache.lucene.gdata.storage.lucenestorage.StorageModifier

 
 
        return this.indexOptimizeInterval; 
    
public intgetStorageBufferSize()

return
- the configured storage buffer size
see
org.apache.lucene.gdata.storage.lucenestorage.StorageBuffer

 
        return this.storageBufferSize; 
    
public static synchronized org.apache.lucene.gdata.storage.lucenestorage.configuration.StorageConfiguratorgetStorageConfigurator()

return
- the storage configurator

 
        if (INSTANCE == null) 
            INSTANCE = new StorageConfigurator(); 
        return INSTANCE; 
    
public java.lang.StringgetStorageDirectory()

return
- the configured storage directory
see
org.apache.lucene.gdata.storage.lucenestorage.StorageModifier

 
        return this.storageDirectory; 
    
public intgetStoragepersistFactor()

return
- the persist factor
see
org.apache.lucene.gdata.storage.lucenestorage.StorageModifier

 
        return this.storagepersistFactor; 
    
public booleanisKeepRecoveredFiles()
Keep recovering files. -- will use a lot of disk space

return
true if the storage is supposed to keep the recovering files.

 
        return this.keepRecoveredFiles; 
    
public booleanisRamDirectory()

return
Returns the ramDirectory.

        return this.ramDirectory;
    
public booleanisRecover()

return
true if the storage is supposed to use recovering.
see
org.apache.lucene.gdata.storage.lucenestorage.StorageModifier

 
        return this.recover;