ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
Services.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\ResourceStorage;
22 
45 
51 class Services
52 {
53  protected Subject $events;
54  protected \ILIAS\ResourceStorage\Manager\Manager $manager;
56  protected \ILIAS\ResourceStorage\Consumer\Consumers $consumers;
57  protected \ILIAS\ResourceStorage\Collection\Collections $collections;
58  protected \ILIAS\ResourceStorage\Flavour\Flavours $flavours;
59  protected \ILIAS\ResourceStorage\Preloader\RepositoryPreloader $preloader;
60 
64  public function __construct(
65  StorageHandlerFactory $storage_handler_factory,
66  Repositories $repositories,
67  Artifacts $artifacts,
68  LockHandler $lock_handler,
69  FileNamePolicy $file_name_policy,
70  StreamAccess $stream_access,
71  Factory $machine_factory,
72  SrcBuilder $src_builder = null,
73  RepositoryPreloader $preloader = null
74  ) {
75  $this->events = new Subject();
76  $src_builder ??= new InlineSrcBuilder();
77  $file_name_policy_stack = new FileNamePolicyStack();
78  $file_name_policy_stack->addPolicy($file_name_policy);
79  $resource_builder = new ResourceBuilder(
80  $storage_handler_factory,
81  $repositories,
82  $lock_handler,
83  $stream_access,
84  $file_name_policy_stack
85  );
86  $collection_builder = new CollectionBuilder(
87  $repositories->getCollectionRepository(),
90  $lock_handler
91  );
92  $this->preloader = $preloader ?? new StandardRepositoryPreloader($repositories);
93  $this->manager = new Manager(
94  $resource_builder,
95  $collection_builder,
96  $this->preloader
97  );
98  $this->container_manager = new ContainerManager(
99  $resource_builder,
100  $collection_builder,
101  $this->preloader,
102  $this->events
103  );
104  $this->consumers = new Consumers(
105  new ConsumerFactory(
106  $stream_access,
107  $file_name_policy_stack
108  ),
109  $resource_builder,
110  $collection_builder,
111  $src_builder
112  );
113  $this->collections = new Collections(
114  $resource_builder,
115  $collection_builder,
116  $this->preloader,
117  $this->events
118  );
119 
120  $flavour_builder = new FlavourBuilder(
121  $repositories->getFlavourRepository(),
122  $machine_factory,
123  $resource_builder,
124  $storage_handler_factory,
125  $stream_access,
127  );
128 
129  $this->flavours = new Flavours(
130  $flavour_builder,
131  $resource_builder
132  );
133  }
134 
135  public function manage(): Manager
136  {
137  return $this->manager;
138  }
139 
141  {
143  }
144 
145  public function consume(): Consumers
146  {
147  return $this->consumers;
148  }
149 
150  public function collection(): Collections
151  {
152  return $this->collections;
153  }
154 
155  public function flavours(): Flavours
156  {
157  return $this->flavours;
158  }
159 
160  public function preload(array $identification_strings): void
161  {
162  $this->preloader->preload($identification_strings);
163  }
164 
165  public function events(): Subject
166  {
167  return $this->events;
168  }
169 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS ResourceStorage Collection Collections $collections
Definition: Services.php:57
ILIAS ResourceStorage Manager Manager $manager
Definition: Services.php:54
__construct(StorageHandlerFactory $storage_handler_factory, Repositories $repositories, Artifacts $artifacts, LockHandler $lock_handler, FileNamePolicy $file_name_policy, StreamAccess $stream_access, Factory $machine_factory, SrcBuilder $src_builder=null, RepositoryPreloader $preloader=null)
Services constructor.
Definition: Services.php:64
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS ResourceStorage Consumer Consumers $consumers
Definition: Services.php:56
ILIAS ResourceStorage Flavour Flavours $flavours
Definition: Services.php:58
ILIAS ResourceStorage Preloader RepositoryPreloader $preloader
Definition: Services.php:59
ContainerManager $container_manager
Definition: Services.php:55
preload(array $identification_strings)
Definition: Services.php:160