eZPublishCommunityProject  2013.4
eZ\Publish\Core\IO\Handler\Dispatcher Class Reference

Handler interface for handling of binary files I/O. More...

+ Inheritance diagram for eZ\Publish\Core\IO\Handler\Dispatcher:
+ Collaboration diagram for eZ\Publish\Core\IO\Handler\Dispatcher:

Public Member Functions

 __construct (IoHandlerInterface $defaultHandler, array $alternativeHandlers)
 Creates new object and validates $config param. More...
 
 create (BinaryFileCreateStruct $createStruct)
 Creates and stores a new BinaryFile based on the BinaryFileCreateStruct $file. More...
 
 delete ($path)
 Deletes the existing BinaryFile with path $path. More...
 
 exists ($path)
 Checks if the BinaryFile with path $path exists. More...
 
 getExternalPath ($path)
 Removes the internal storage path from $path. More...
 
 getFileContents ($uri)
 Returns the contents of the BinaryFile identified by $path. More...
 
 getFileResource ($uri)
 Returns a file resource to the BinaryFile identified by $path. More...
 
 getInternalPath ($path)
 Returns the internal, handler level path for $path. More...
 
 getMetadata (MetadataHandler $metadataHandler, $path)
 Executes $metadataHandler on $path, and returns the metadata array. More...
 
 load ($uri)
 Loads the BinaryFile identified by $path. More...
 
 update ($path, BinaryFileUpdateStruct $updateFileStruct)
 Updates the file identified by $path with data from $updateFile. More...
 
- Public Member Functions inherited from eZ\Publish\Core\IO\Handler
 create (BinaryFileCreateStruct $createStruct)
 Creates and stores a new BinaryFile based on the BinaryFileCreateStruct $file. More...
 

Private Member Functions

 getHandler ($path)
 Returns the appropriate handler for $path. More...
 

Private Attributes

 $alternativeHandlers = array()
 
 $defaultHandler
 

Detailed Description

Handler interface for handling of binary files I/O.

Constructor & Destructor Documentation

eZ\Publish\Core\IO\Handler\Dispatcher::__construct ( IoHandlerInterface  $defaultHandler,
array  $alternativeHandlers 
)

Creates new object and validates $config param.

Parameters
IoHandlerInterface$defaultHandler
array$alternativeHandlersStructure of handlers that follows the following format: array( array( 'handler' => Handler, .. ), .. ) ie: array( array( 'handler' => $handler1, // match conditions: 'prefix' => 'var/original/', 'suffix' => '.gif,.jpg', 'contains' => 'image-versioned' ), (...) )
Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf $config does not contain default handler that implements Handler, handlers is unset or empty (hence you could have used default directly), one of the 'patterns' is unset or empty (hence it could have been default) or a 'handler' item does not implement Handler

Member Function Documentation

eZ\Publish\Core\IO\Handler\Dispatcher::create ( BinaryFileCreateStruct  $createStruct)

Creates and stores a new BinaryFile based on the BinaryFileCreateStruct $file.

Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the target path already exists
Parameters
\eZ\Publish\SPI\IO\BinaryFileCreateStruct$createStruct
Returns
The newly created BinaryFile object
eZ\Publish\Core\IO\Handler\Dispatcher::delete (   $path)

Deletes the existing BinaryFile with path $path.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf the file doesn't exist
Parameters
string$path

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Dispatcher::exists (   $path)

Checks if the BinaryFile with path $path exists.

Parameters
string$path
Returns
boolean

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Dispatcher::getExternalPath (   $path)

Removes the internal storage path from $path.

Parameters
string$path
Returns
string

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Dispatcher::getFileContents (   $uri)

Returns the contents of the BinaryFile identified by $path.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif the file couldn't be found
Parameters
string$uri
Returns
string

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Dispatcher::getFileResource (   $uri)

Returns a file resource to the BinaryFile identified by $path.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf no file identified by $path exists
Parameters
string$uri
Returns
resource

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Dispatcher::getInternalPath (   $path)

Returns the internal, handler level path for $path.

Parameters
string$path
Returns
string

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Dispatcher::getMetadata ( MetadataHandler  $metadataHandler,
  $path 
)

Executes $metadataHandler on $path, and returns the metadata array.

Parameters
MetadataHandler$metadataHandler
string$path
Returns
array

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Dispatcher::load (   $uri)

Loads the BinaryFile identified by $path.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf no file identified by $path exists
Parameters
string$uri
Returns

Implements eZ\Publish\Core\IO\Handler.

eZ\Publish\Core\IO\Handler\Dispatcher::update (   $path,
BinaryFileUpdateStruct  $updateFileStruct 
)

Updates the file identified by $path with data from $updateFile.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf the source path doesn't exist
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the target path already exists
Parameters
string$path
\eZ\Publish\SPI\IO\BinaryFileUpdateStruct$updateFileStruct
Returns
The updated BinaryFile

Implements eZ\Publish\Core\IO\Handler.

Member Data Documentation

eZ\Publish\Core\IO\Handler\Dispatcher::$alternativeHandlers = array()
private
eZ\Publish\Core\IO\Handler\Dispatcher::$defaultHandler
private

The documentation for this class was generated from the following file: