org.apache.pig.backend.hadoop.datastorage
Class HPath

java.lang.Object
  extended by org.apache.pig.backend.hadoop.datastorage.HPath
All Implemented Interfaces:
Comparable<ElementDescriptor>, ElementDescriptor
Direct Known Subclasses:
HDirectory, HFile

public abstract class HPath
extends Object
implements ElementDescriptor


Field Summary
protected  HDataStorage fs
           
protected  org.apache.hadoop.fs.Path path
           
 
Fields inherited from interface org.apache.pig.backend.datastorage.ElementDescriptor
BLOCK_REPLICATION_KEY, BLOCK_SIZE_KEY, LENGTH_KEY, MODIFICATION_TIME_KEY
 
Constructor Summary
HPath(HDataStorage fs, org.apache.hadoop.fs.Path path)
           
HPath(HDataStorage fs, org.apache.hadoop.fs.Path parent, org.apache.hadoop.fs.Path child)
           
HPath(HDataStorage fs, org.apache.hadoop.fs.Path parent, String child)
           
HPath(HDataStorage fs, String pathString)
           
HPath(HDataStorage fs, String parent, org.apache.hadoop.fs.Path child)
           
HPath(HDataStorage fs, String parent, String child)
           
 
Method Summary
 int compareTo(ElementDescriptor other)
           
 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()
           
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 equals(Object obj)
           
 boolean exists()
          Checks whether the entity exists or not
 Properties getConfiguration()
          Retrieve configuration information for entity
 DataStorage getDataStorage()
           
 org.apache.hadoop.fs.FileSystem getHFS()
           
 org.apache.hadoop.fs.Path getPath()
           
 Map<String,Object> getStatistics()
          List entity statistics
 int hashCode()
           
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, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.pig.backend.datastorage.ElementDescriptor
open, sopen
 

Field Detail

path

protected org.apache.hadoop.fs.Path path

fs

protected HDataStorage fs
Constructor Detail

HPath

public HPath(HDataStorage fs,
             org.apache.hadoop.fs.Path parent,
             org.apache.hadoop.fs.Path child)

HPath

public HPath(HDataStorage fs,
             String parent,
             String child)

HPath

public HPath(HDataStorage fs,
             org.apache.hadoop.fs.Path parent,
             String child)

HPath

public HPath(HDataStorage fs,
             String parent,
             org.apache.hadoop.fs.Path child)

HPath

public HPath(HDataStorage fs,
             String pathString)

HPath

public HPath(HDataStorage fs,
             org.apache.hadoop.fs.Path path)
Method Detail

getDataStorage

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

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

copy

public 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

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

create

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

copy

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

getPath

public org.apache.hadoop.fs.Path getPath()

getHFS

public org.apache.hadoop.fs.FileSystem getHFS()

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

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

compareTo

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2007-2012 The Apache Software Foundation