|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* AppserverIo\Appserver\Ldap\LdapManagerFactory |
|
5
|
|
|
* |
|
6
|
|
|
* NOTICE OF LICENSE |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
|
9
|
|
|
* that is available through the world-wide-web at this URL: |
|
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
|
11
|
|
|
* |
|
12
|
|
|
* PHP version 5 |
|
13
|
|
|
* |
|
14
|
|
|
* @author Tim Wagner <[email protected]> |
|
15
|
|
|
* @copyright 2019 TechDivision GmbH <[email protected]> |
|
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
17
|
|
|
* @link https://github.com/appserver-io/appserver |
|
18
|
|
|
* @link http://www.appserver.io |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace AppserverIo\Appserver\Ldap; |
|
22
|
|
|
|
|
23
|
|
|
use AppserverIo\Storage\StackableStorage; |
|
24
|
|
|
use AppserverIo\Psr\Application\ApplicationInterface; |
|
25
|
|
|
use AppserverIo\Appserver\Core\Api\Node\ManagerNodeInterface; |
|
26
|
|
|
use AppserverIo\Appserver\Core\Interfaces\ManagerFactoryInterface; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* The LDAP manager factory to create a new LDAP manager instance. |
|
30
|
|
|
* |
|
31
|
|
|
* @author Tim Wagner <[email protected]> |
|
32
|
|
|
* @copyright 2019 TechDivision GmbH <[email protected]> |
|
33
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
34
|
|
|
* @link https://github.com/appserver-io/appserver |
|
35
|
|
|
* @link http://www.appserver.io |
|
36
|
|
|
*/ |
|
37
|
|
|
class LdapManagerFactory implements ManagerFactoryInterface |
|
38
|
|
|
{ |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* The main method that creates new instances in a separate context. |
|
42
|
|
|
* |
|
43
|
|
|
* @param \AppserverIo\Psr\Application\ApplicationInterface $application The application instance to register the class loader with |
|
44
|
|
|
* @param \AppserverIo\Appserver\Core\Api\Node\ManagerNodeInterface $managerConfiguration The manager configuration |
|
45
|
|
|
* |
|
46
|
|
|
* @return void |
|
47
|
|
|
*/ |
|
48
|
|
|
public static function visit(ApplicationInterface $application, ManagerNodeInterface $managerConfiguration) |
|
49
|
|
|
{ |
|
50
|
|
|
|
|
51
|
|
|
// initialize the stackable for the entities and the naming directory |
|
52
|
|
|
$data = new StackableStorage(); |
|
53
|
|
|
|
|
54
|
|
|
// initialize the default settings for the stateful session beans |
|
55
|
|
|
$ldapManagerSettings = new LdapManagerSettings(); |
|
56
|
|
|
$ldapManagerSettings->mergeWithParams($managerConfiguration->getParamsAsArray()); |
|
57
|
|
|
|
|
58
|
|
|
// initialize the bean manager |
|
59
|
|
|
$ldapManager = new LdapManager(); |
|
60
|
|
|
$ldapManager->injectData($data); |
|
61
|
|
|
$ldapManager->injectApplication($application); |
|
62
|
|
|
$ldapManager->injectManagerSettings($ldapManagerSettings); |
|
63
|
|
|
$ldapManager->injectManagerConfiguration($managerConfiguration); |
|
64
|
|
|
|
|
65
|
|
|
// create the naming context and add it the manager |
|
66
|
|
|
$contextFactory = $managerConfiguration->getContextFactory(); |
|
67
|
|
|
$contextFactory::visit($ldapManager); |
|
68
|
|
|
|
|
69
|
|
|
// attach the instance |
|
70
|
|
|
$application->addManager($ldapManager, $managerConfiguration); |
|
|
|
|
|
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|