org.apache.pig.backend.local.datastorage
Class LocalPath

java.lang.Object
  extended by org.apache.pig.backend.local.datastorage.LocalPath
All Implemented Interfaces:
Comparable<ElementDescriptor>, ElementDescriptor
Direct Known Subclasses:
LocalDir, LocalFile

public abstract class LocalPath
extends Object
implements ElementDescriptor


Field Summary
protected  DataStorage fs
           
protected  File path
           
 
Fields inherited from interface org.apache.pig.backend.datastorage.ElementDescriptor
BLOCK_REPLICATION_KEY, BLOCK_SIZE_KEY, LENGTH_KEY, MODIFICATION_TIME_KEY
 
Constructor Summary
LocalPath(LocalDataStorage fs, File path)
           
LocalPath(LocalDataStorage fs, File parent, File child)
           
LocalPath(LocalDataStorage fs, File parent, String child)
           
LocalPath(LocalDataStorage fs, String path)
           
LocalPath(LocalDataStorage fs, String parent, File child)
           
LocalPath(LocalDataStorage fs, String parent, String child)
           
 
Method Summary
 int compareTo(ElementDescriptor other)
           
 void copy(ElementDescriptor dstName, boolean removeSrc)
           
abstract  void copy(ElementDescriptor dstName, Properties dstConfiguration, boolean removeSrc)
          Copy entity from an existing one, possibly residing in a different Data Storage.
 OutputStream create()
           
abstract  OutputStream create(Properties configuration)
          Opens a stream onto which an entity can be written to.
 void delete()
          Remove entity from the Data Storage.
 boolean exists()
          Checks whether the entity exists or not
 Properties getConfiguration()
          Retrieve configuration information for entity
protected  File getCurPath()
           
 DataStorage getDataStorage()
           
 File getPath()
           
 Map<String,Object> getStatistics()
          List entity statistics
abstract  InputStream open()
           
 void rename(ElementDescriptor newName)
          Changes the name of an entity in the Data Storage
abstract  SeekableInputStream sopen()
           
 boolean systemElement()
          Defines whether the element is visible to users or contains system's metadata
 String toString()
           
 void updateConfiguration(Properties newConfig)
          Update configuration information for this entity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.pig.backend.datastorage.ElementDescriptor
open, sopen
 

Field Detail

fs

protected DataStorage fs

path

protected File path
Constructor Detail

LocalPath

public LocalPath(LocalDataStorage fs,
                 String path)

LocalPath

public LocalPath(LocalDataStorage fs,
                 File path)

LocalPath

public LocalPath(LocalDataStorage fs,
                 String parent,
                 String child)

LocalPath

public LocalPath(LocalDataStorage fs,
                 File parent,
                 File child)

LocalPath

public LocalPath(LocalDataStorage fs,
                 File parent,
                 String child)

LocalPath

public LocalPath(LocalDataStorage fs,
                 String parent,
                 File child)
Method Detail

getCurPath

protected File getCurPath()

getDataStorage

public DataStorage getDataStorage()
Specified by:
getDataStorage in interface ElementDescriptor

getPath

public File getPath()

create

public abstract OutputStream create(Properties configuration)
                             throws IOException
Description copied from interface: ElementDescriptor
Opens a stream onto which an entity can be written to.

Specified by:
create in interface ElementDescriptor
Parameters:
configuration - information at the object level
Returns:
stream where to write
Throws:
DataStorageException
IOException

create

public OutputStream create()
                    throws IOException
Specified by:
create in interface ElementDescriptor
Throws:
IOException

copy

public abstract void copy(ElementDescriptor dstName,
                          Properties dstConfiguration,
                          boolean removeSrc)
                   throws IOException
Description copied from interface: ElementDescriptor
Copy entity from an existing one, possibly residing in a different Data Storage.

Specified by:
copy in interface ElementDescriptor
Parameters:
dstName - name of entity to create
dstConfiguration - configuration for the new entity
removeSrc - if src entity needs to be removed after copying it
Throws:
DataStorageException - for instance, configuration information for new entity is not compatible with configuration information at the Data Storage level, user does not have privileges to read from source entity or write to destination storage...
IOException

copy

public void copy(ElementDescriptor dstName,
                 boolean removeSrc)
          throws IOException
Specified by:
copy in interface ElementDescriptor
Throws:
IOException

open

public abstract InputStream open()
                          throws IOException
Specified by:
open in interface ElementDescriptor
Throws:
IOException

sopen

public abstract SeekableInputStream sopen()
                                   throws IOException
Specified by:
sopen in interface ElementDescriptor
Throws:
IOException

exists

public boolean exists()
               throws IOException
Description copied from interface: ElementDescriptor
Checks whether the entity exists or not

Specified by:
exists in interface ElementDescriptor
Returns:
true if entity exists, false otherwise.
Throws:
IOException

rename

public void rename(ElementDescriptor newName)
            throws IOException
Description copied from interface: ElementDescriptor
Changes the name of an entity in the Data Storage

Specified by:
rename in interface ElementDescriptor
Parameters:
newName - new name of entity
Throws:
DataStorageException
IOException

delete

public void delete()
            throws IOException
Description copied from interface: ElementDescriptor
Remove entity from the Data Storage.

Specified by:
delete in interface ElementDescriptor
Throws:
DataStorageException
IOException

getConfiguration

public Properties getConfiguration()
                            throws IOException
Description copied from interface: ElementDescriptor
Retrieve configuration information for entity

Specified by:
getConfiguration in interface ElementDescriptor
Returns:
configuration
Throws:
IOException

updateConfiguration

public void updateConfiguration(Properties newConfig)
                         throws IOException
Description copied from interface: ElementDescriptor
Update configuration information for this entity

Specified by:
updateConfiguration in interface ElementDescriptor
Parameters:
newConfig - configuration
Throws:
DataStorageException
IOException

getStatistics

public Map<String,Object> getStatistics()
                                 throws IOException
Description copied from interface: ElementDescriptor
List entity statistics

Specified by:
getStatistics in interface ElementDescriptor
Returns:
DataStorageProperties
Throws:
IOException

compareTo

public int compareTo(ElementDescriptor other)
Specified by:
compareTo in interface Comparable<ElementDescriptor>

systemElement

public boolean systemElement()
Description copied from interface: ElementDescriptor
Defines whether the element is visible to users or contains system's metadata

Specified by:
systemElement in interface ElementDescriptor
Returns:
true if this is system file; false otherwise

toString

public String toString()
Overrides:
toString in class Object


Copyright © ${year} The Apache Software Foundation