ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 32 of file class.ilRPCServerSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilRPCServerSettings::__construct ( )
private

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

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

45  {
46  global $DIC;
47 
48  $this->log = $DIC->logger()->wsrv();
49  $this->settings = $DIC->settings();
50  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ getHost()

ilRPCServerSettings::getHost ( )

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

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

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

73  : string
74  {
75  if ($this->rpc_host !== '') {
76  return $this->rpc_host;
77  }
78  return $this->rpc_host = (string) $this->settings->get('rpc_server_host');
79  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstance()

static ilRPCServerSettings::getInstance ( )
static

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

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

53  {
54  if (self::$instance) {
55  return self::$instance;
56  }
57  return self::$instance = new ilRPCServerSettings();
58  }
Class for storing all rpc communication settings.
+ Here is the caller graph for this function:

◆ getPath()

ilRPCServerSettings::getPath ( )

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

99  : string
100  {
101  return self::RPC_SERVER_PATH;
102  }

◆ getPort()

ilRPCServerSettings::getPort ( )

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

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

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

86  : string
87  {
88  if ($this->rpc_port !== '') {
89  return $this->rpc_port;
90  }
91  return $this->rpc_port = (string) $this->settings->get('rpc_server_port');
92  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getServerUrl()

ilRPCServerSettings::getServerUrl ( )

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

References getHost(), and getPort().

68  : string
69  {
70  return 'http://' . $this->getHost() . ':' . $this->getPort() . '/' . self::RPC_SERVER_PATH;
71  }
+ Here is the call graph for this function:

◆ isEnabled()

ilRPCServerSettings::isEnabled ( )

Returns true if server ip and port are set.

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

References getHost(), and getPort().

63  : bool
64  {
65  return $this->getHost() !== '' && $this->getPort() !== '';
66  }
+ Here is the call graph for this function:

◆ pingServer()

ilRPCServerSettings::pingServer ( )

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

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

110  : bool
111  {
112  try {
113  ilRpcClientFactory::factory('RPCebug')->ping();
114  return true;
115  } catch (Exception $e) {
116  $this->log->warning('Calling RPC server failed with message: ' . $e->getMessage());
117  return false;
118  }
119  }
static factory(string $a_package, int $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
+ Here is the call graph for this function:

◆ setHost()

ilRPCServerSettings::setHost (   $a_host)

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

81  : void
82  {
83  $this->rpc_host = $a_host;
84  }

◆ setPort()

ilRPCServerSettings::setPort ( string  $a_port)

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

94  : void
95  {
96  $this->rpc_port = $a_port;
97  }

◆ update()

ilRPCServerSettings::update ( )

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

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

104  : void
105  {
106  $this->settings->set('rpc_server_host', $this->getHost());
107  $this->settings->set('rpc_server_port', $this->getPort());
108  }
+ Here is the call graph for this function:

Field Documentation

◆ $instance

ilRPCServerSettings ilRPCServerSettings::$instance = null
staticprivate

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

◆ $log

ilLogger ilRPCServerSettings::$log
private

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

◆ $rpc_host

string ilRPCServerSettings::$rpc_host = ''

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

Referenced by getHost().

◆ $rpc_port

string ilRPCServerSettings::$rpc_port = ''

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

Referenced by getPort().

◆ $settings

ilSetting ilRPCServerSettings::$settings
private

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

◆ RPC_SERVER_PATH

const ilRPCServerSettings::RPC_SERVER_PATH = "/RPC2"
private

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


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