ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilRPCServerSettings Class Reference

Class for storing all rpc communication settings. More...

+ Collaboration diagram for ilRPCServerSettings:

Public Member Functions

 isEnabled ()
 Returns true if server ip and port are set. More...
 
 getServerUrl ()
 
 getHost ()
 
 setHost ($a_host)
 
 getPort ()
 
 setPort (string $a_port)
 
 getPath ()
 
 update ()
 
 pingServer ()
 

Static Public Member Functions

static getInstance ()
 

Data Fields

string $rpc_host = ''
 
string $rpc_port = ''
 

Private Member Functions

 __construct ()
 

Private Attributes

const RPC_SERVER_PATH = "/RPC2"
 
ilLogger $log
 
ilSetting $settings
 

Static Private Attributes

static ilRPCServerSettings $instance = null
 

Detailed Description

Class for storing all rpc communication settings.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 25 of file class.ilRPCServerSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilRPCServerSettings::__construct ( )
private

Definition at line 37 of file class.ilRPCServerSettings.php.

38 {
39 global $DIC;
40
41 $this->log = $DIC->logger()->wsrv();
42 $this->settings = $DIC->settings();
43 }
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ getHost()

ilRPCServerSettings::getHost ( )

Definition at line 66 of file class.ilRPCServerSettings.php.

66 : string
67 {
68 if ($this->rpc_host !== '') {
69 return $this->rpc_host;
70 }
71 return $this->rpc_host = (string) $this->settings->get('rpc_server_host');
72 }

References $rpc_host, and ILIAS\Repository\settings().

Referenced by getServerUrl(), isEnabled(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstance()

static ilRPCServerSettings::getInstance ( )
static

Definition at line 45 of file class.ilRPCServerSettings.php.

46 {
47 if (self::$instance) {
48 return self::$instance;
49 }
50 return self::$instance = new ilRPCServerSettings();
51 }
Class for storing all rpc communication settings.
static ilRPCServerSettings $instance

References $instance.

Referenced by ilCertificateActiveValidator\__construct(), ilRpcClientFactory\factory(), and ilRPCServerSettingsTest\testConstruct().

+ Here is the caller graph for this function:

◆ getPath()

ilRPCServerSettings::getPath ( )

Definition at line 92 of file class.ilRPCServerSettings.php.

92 : string
93 {
95 }

References RPC_SERVER_PATH.

◆ getPort()

ilRPCServerSettings::getPort ( )

Definition at line 79 of file class.ilRPCServerSettings.php.

79 : string
80 {
81 if ($this->rpc_port !== '') {
82 return $this->rpc_port;
83 }
84 return $this->rpc_port = (string) $this->settings->get('rpc_server_port');
85 }

References $rpc_port, and ILIAS\Repository\settings().

Referenced by getServerUrl(), isEnabled(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getServerUrl()

ilRPCServerSettings::getServerUrl ( )

Definition at line 61 of file class.ilRPCServerSettings.php.

61 : string
62 {
63 return 'http://' . $this->getHost() . ':' . $this->getPort() . '/' . self::RPC_SERVER_PATH;
64 }

References getHost(), getPort(), and RPC_SERVER_PATH.

+ Here is the call graph for this function:

◆ isEnabled()

ilRPCServerSettings::isEnabled ( )

Returns true if server ip and port are set.

Definition at line 56 of file class.ilRPCServerSettings.php.

56 : bool
57 {
58 return $this->getHost() !== '' && $this->getPort() !== '';
59 }

References getHost(), and getPort().

+ Here is the call graph for this function:

◆ pingServer()

ilRPCServerSettings::pingServer ( )

Definition at line 103 of file class.ilRPCServerSettings.php.

103 : bool
104 {
105 try {
106 ilRpcClientFactory::factory('RPCebug')->ping();
107 return true;
108 } catch (Exception $e) {
109 $this->log->warning('Calling RPC server failed with message: ' . $e->getMessage());
110 return false;
111 }
112 }
static factory(string $a_package, int $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.

References Vendor\Package\$e, and ilRpcClientFactory\factory().

+ Here is the call graph for this function:

◆ setHost()

ilRPCServerSettings::setHost (   $a_host)

Definition at line 74 of file class.ilRPCServerSettings.php.

74 : void
75 {
76 $this->rpc_host = $a_host;
77 }

◆ setPort()

ilRPCServerSettings::setPort ( string  $a_port)

Definition at line 87 of file class.ilRPCServerSettings.php.

87 : void
88 {
89 $this->rpc_port = $a_port;
90 }

◆ update()

ilRPCServerSettings::update ( )

Definition at line 97 of file class.ilRPCServerSettings.php.

97 : void
98 {
99 $this->settings->set('rpc_server_host', $this->getHost());
100 $this->settings->set('rpc_server_port', $this->getPort());
101 }

References getHost(), getPort(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Field Documentation

◆ $instance

ilRPCServerSettings ilRPCServerSettings::$instance = null
staticprivate

Definition at line 29 of file class.ilRPCServerSettings.php.

Referenced by getInstance().

◆ $log

ilLogger ilRPCServerSettings::$log
private

Definition at line 34 of file class.ilRPCServerSettings.php.

◆ $rpc_host

string ilRPCServerSettings::$rpc_host = ''

Definition at line 31 of file class.ilRPCServerSettings.php.

Referenced by getHost().

◆ $rpc_port

string ilRPCServerSettings::$rpc_port = ''

Definition at line 32 of file class.ilRPCServerSettings.php.

Referenced by getPort().

◆ $settings

ilSetting ilRPCServerSettings::$settings
private

Definition at line 35 of file class.ilRPCServerSettings.php.

◆ RPC_SERVER_PATH

const ilRPCServerSettings::RPC_SERVER_PATH = "/RPC2"
private

Definition at line 27 of file class.ilRPCServerSettings.php.

Referenced by getPath(), and getServerUrl().


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