org.apache.mahout.text
Class ReadOnlyFileSystemDirectory

java.lang.Object
  extended by org.apache.lucene.store.Directory
      extended by org.apache.lucene.store.BaseDirectory
          extended by org.apache.mahout.text.ReadOnlyFileSystemDirectory
All Implemented Interfaces:
Closeable

public class ReadOnlyFileSystemDirectory
extends org.apache.lucene.store.BaseDirectory

This class implements a read-only Lucene Directory on top of a general FileSystem. Currently it does not support locking.

// TODO: Rename to FileSystemReadOnlyDirectory


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.store.Directory
org.apache.lucene.store.Directory.IndexInputSlicer
 
Field Summary
 
Fields inherited from class org.apache.lucene.store.BaseDirectory
isOpen, lockFactory
 
Constructor Summary
ReadOnlyFileSystemDirectory(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path directory, boolean create, org.apache.hadoop.conf.Configuration conf)
          Constructor
 
Method Summary
 void clearLock(String name)
           
 void close()
           
 org.apache.lucene.store.IndexOutput createOutput(String name, org.apache.lucene.store.IOContext context)
           
 void deleteFile(String name)
           
 boolean fileExists(String name)
           
 long fileLength(String name)
           
 org.apache.lucene.store.LockFactory getLockFactory()
           
 String[] list()
           
 String[] listAll()
           
 org.apache.lucene.store.Lock makeLock(String name)
           
 org.apache.lucene.store.IndexInput openInput(String name, org.apache.lucene.store.IOContext context)
           
 void setLockFactory(org.apache.lucene.store.LockFactory lockFactory)
           
 void sync(Collection<String> names)
           
 String toString()
           
 
Methods inherited from class org.apache.lucene.store.BaseDirectory
ensureOpen
 
Methods inherited from class org.apache.lucene.store.Directory
copy, createSlicer, getLockID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReadOnlyFileSystemDirectory

public ReadOnlyFileSystemDirectory(org.apache.hadoop.fs.FileSystem fs,
                                   org.apache.hadoop.fs.Path directory,
                                   boolean create,
                                   org.apache.hadoop.conf.Configuration conf)
                            throws IOException
Constructor

Parameters:
fs - - filesystem
directory - - directory path
create - - if true create the directory
conf - - MR Job Configuration
Throws:
IOException
Method Detail

list

public String[] list()
              throws IOException
Throws:
IOException

listAll

public String[] listAll()
                 throws IOException
Specified by:
listAll in class org.apache.lucene.store.Directory
Throws:
IOException

fileExists

public boolean fileExists(String name)
                   throws IOException
Specified by:
fileExists in class org.apache.lucene.store.Directory
Throws:
IOException

fileLength

public long fileLength(String name)
                throws IOException
Specified by:
fileLength in class org.apache.lucene.store.Directory
Throws:
IOException

deleteFile

public void deleteFile(String name)
                throws IOException
Specified by:
deleteFile in class org.apache.lucene.store.Directory
Throws:
IOException

createOutput

public org.apache.lucene.store.IndexOutput createOutput(String name,
                                                        org.apache.lucene.store.IOContext context)
                                                 throws IOException
Specified by:
createOutput in class org.apache.lucene.store.Directory
Throws:
IOException

sync

public void sync(Collection<String> names)
          throws IOException
Specified by:
sync in class org.apache.lucene.store.Directory
Throws:
IOException

openInput

public org.apache.lucene.store.IndexInput openInput(String name,
                                                    org.apache.lucene.store.IOContext context)
                                             throws IOException
Specified by:
openInput in class org.apache.lucene.store.Directory
Throws:
IOException

makeLock

public org.apache.lucene.store.Lock makeLock(String name)
Overrides:
makeLock in class org.apache.lucene.store.BaseDirectory

clearLock

public void clearLock(String name)
               throws IOException
Overrides:
clearLock in class org.apache.lucene.store.BaseDirectory
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in class org.apache.lucene.store.Directory
Throws:
IOException

setLockFactory

public void setLockFactory(org.apache.lucene.store.LockFactory lockFactory)
                    throws IOException
Overrides:
setLockFactory in class org.apache.lucene.store.BaseDirectory
Throws:
IOException

getLockFactory

public org.apache.lucene.store.LockFactory getLockFactory()
Overrides:
getLockFactory in class org.apache.lucene.store.BaseDirectory

toString

public String toString()
Overrides:
toString in class org.apache.lucene.store.Directory


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.