1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* AppserverIo\RemoteMethodInvocation\RemoteConnectionFactory |
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 2015 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/rmi |
18
|
|
|
* @link http://www.appserver.io |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace AppserverIo\RemoteMethodInvocation; |
22
|
|
|
|
23
|
|
|
use AppserverIo\Collections\ArrayList; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Connection factory to create a new remote context connection. |
27
|
|
|
* |
28
|
|
|
* @author Tim Wagner <[email protected]> |
29
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
30
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
31
|
|
|
* @link https://github.com/appserver-io/rmi |
32
|
|
|
* @link http://www.appserver.io |
33
|
|
|
*/ |
34
|
|
|
class RemoteConnectionFactory |
35
|
|
|
{ |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Private constructor to use class only in static context. |
39
|
|
|
*/ |
40
|
|
|
private function __construct() |
41
|
|
|
{ |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Simple factory to create a new context connection |
46
|
|
|
* of the requested type. |
47
|
|
|
* |
48
|
|
|
* @return \AppserverIo\RemoteMethodInvocation\ConnectionInterface The requested context connection |
49
|
|
|
*/ |
50
|
|
|
public static function createContextConnection() |
51
|
|
|
{ |
52
|
|
|
|
53
|
|
|
// initialize the remote method call parser and the session storage |
54
|
|
|
$sessions = new ArrayList(); |
55
|
|
|
$parser = new RemoteMethodCallParser(); |
56
|
|
|
|
57
|
|
|
// initialize the remote context connection |
58
|
|
|
$contextConnection = new RemoteContextConnection(); |
59
|
|
|
$contextConnection->injectParser($parser); |
60
|
|
|
$contextConnection->injectSessions($sessions); |
61
|
|
|
|
62
|
|
|
// return the initialized connection |
63
|
|
|
return $contextConnection; |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|