org.apache.pig.backend.datastorage
Interface ElementDescriptor

All Superinterfaces:
Comparable<ElementDescriptor>
All Known Subinterfaces:
ContainerDescriptor
All Known Implementing Classes:
HDirectory, HFile, HPath

public interface ElementDescriptor
extends Comparable<ElementDescriptor>

DataStorageElementDescriptor provides methods necessary to manage an element in a DataStorage.


Field Summary
static String BLOCK_REPLICATION_KEY
          Available from getConfiguration as a String and getStatistics as a Short.
static String BLOCK_SIZE_KEY
          Available from getConfiguration as a String and getStatistics as a Long.
static String LENGTH_KEY
          Available from getStatistics as a Long.
static String MODIFICATION_TIME_KEY
          Available from getStatistics as a Long.
 
Method Summary
 void copy(ElementDescriptor dstName, boolean removeSrc)
           
 void copy(ElementDescriptor dstName, Properties dstConfiguration, boolean removeSrc)
          Copy entity from an existing one, possibly residing in a different Data Storage.
 OutputStream create()
           
 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
 DataStorage getDataStorage()
           
 Map<String,Object> getStatistics()
          List entity statistics
 InputStream open()
           
 InputStream open(Properties configuration)
          Open for read a given entity
 void rename(ElementDescriptor newName)
          Changes the name of an entity in the Data Storage
 SeekableInputStream sopen()
           
 SeekableInputStream sopen(Properties configuration)
          Open an element in the Data Storage with support for random access (seek operations).
 boolean systemElement()
          Defines whether the element is visible to users or contains system's metadata
 void updateConfiguration(Properties newConfig)
          Update configuration information for this entity
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

BLOCK_SIZE_KEY

static final String BLOCK_SIZE_KEY
Available from getConfiguration as a String and getStatistics as a Long.

See Also:
Constant Field Values

BLOCK_REPLICATION_KEY

static final String BLOCK_REPLICATION_KEY
Available from getConfiguration as a String and getStatistics as a Short.

See Also:
Constant Field Values

LENGTH_KEY

static final String LENGTH_KEY
Available from getStatistics as a Long.

See Also:
Constant Field Values

MODIFICATION_TIME_KEY

static final String MODIFICATION_TIME_KEY
Available from getStatistics as a Long.

See Also:
Constant Field Values
Method Detail

getDataStorage

DataStorage getDataStorage()

create

OutputStream create(Properties configuration)
                    throws IOException
Opens a stream onto which an entity can be written to.

Parameters:
configuration - information at the object level
Returns:
stream where to write
Throws:
DataStorageException
IOException

create

OutputStream create()
                    throws IOException
Throws:
IOException

copy

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

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

void copy(ElementDescriptor dstName,
          boolean removeSrc)
          throws IOException
Throws:
IOException

open

InputStream open(Properties configuration)
                 throws IOException
Open for read a given entity

Parameters:
configuration -
Returns:
entity to read from
Throws:
DataStorageExecption - e.g. entity does not exist...
IOException

open

InputStream open()
                 throws IOException
Throws:
IOException

sopen

SeekableInputStream sopen(Properties configuration)
                          throws IOException
Open an element in the Data Storage with support for random access (seek operations).

Parameters:
configuration -
Returns:
a seekable input stream
Throws:
DataStorageException
IOException

sopen

SeekableInputStream sopen()
                          throws IOException
Throws:
IOException

exists

boolean exists()
               throws IOException
Checks whether the entity exists or not

Returns:
true if entity exists, false otherwise.
Throws:
IOException

rename

void rename(ElementDescriptor newName)
            throws IOException
Changes the name of an entity in the Data Storage

Parameters:
newName - new name of entity
Throws:
DataStorageException
IOException

delete

void delete()
            throws IOException
Remove entity from the Data Storage.

Throws:
DataStorageException
IOException

getConfiguration

Properties getConfiguration()
                            throws IOException
Retrieve configuration information for entity

Returns:
configuration
Throws:
IOException

updateConfiguration

void updateConfiguration(Properties newConfig)
                         throws IOException
Update configuration information for this entity

Parameters:
newConfig - configuration
Throws:
DataStorageException
IOException

systemElement

boolean systemElement()
Defines whether the element is visible to users or contains system's metadata

Returns:
true if this is system file; false otherwise

getStatistics

Map<String,Object> getStatistics()
                                 throws IOException
List entity statistics

Returns:
DataStorageProperties
Throws:
IOException


Copyright © 2007-2012 The Apache Software Foundation