ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManagerImpl Class Reference

Class PreProcessorManagerImpl. More...

+ Inheritance diagram for ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManagerImpl:
+ Collaboration diagram for ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManagerImpl:

Public Member Functions

 with (PreProcessor $processor)
 
 process (FileStream $stream, Metadata $metadata)
 

Private Attributes

array $processors = []
 

Detailed Description

Class PreProcessorManagerImpl.

A pool of preprocessors which can be executed for a particular stream. If once of the processors fail while processing a stream, it will get rejected to protect ILIAS.

Author
Nicolas Schäfli ns@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Since
5.3
Version
1.0

Definition at line 37 of file PreProcessorManagerImpl.php.

Member Function Documentation

◆ process()

ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManagerImpl::process ( FileStream  $stream,
Metadata  $metadata 
)

Implements ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManager.

Definition at line 56 of file PreProcessorManagerImpl.php.

References ILIAS\FileUpload\DTO\ProcessingStatus\DENIED, null, ILIAS\FileUpload\DTO\ProcessingStatus\OK, and ILIAS\FileUpload\DTO\ProcessingStatus\REJECTED.

56  : ProcessingStatus
57  {
58  try {
59  $result = null;
60  foreach ($this->processors as $processor) {
61  $stream->rewind();
62  $result = $processor->process($stream, $metadata);
63  if ($result->getCode() === ProcessingStatus::REJECTED || $result->getCode() === ProcessingStatus::DENIED) {
64  return $result;
65  }
66  }
67 
68  if (is_null($result)) {
69  return new ProcessingStatus(ProcessingStatus::OK, 'No processors were registered.');
70  }
71 
72  return $result;
73  } catch (\Exception $ex) {
74  return new ProcessingStatus(ProcessingStatus::REJECTED, 'Processor failed with exception message "' . $ex->getMessage() . '"');
75  }
76  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ with()

ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManagerImpl::with ( PreProcessor  $processor)

Implements ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManager.

Definition at line 47 of file PreProcessorManagerImpl.php.

47  : void
48  {
49  $this->processors[] = $processor;
50  }

Field Documentation

◆ $processors

array ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManagerImpl::$processors = []
private

Definition at line 42 of file PreProcessorManagerImpl.php.


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