XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
XCube_ServiceManager.class.php
1<?php
22
23if ( ! defined( 'XCUBE_CORE_PATH' ) ) {
24 define( 'XCUBE_CORE_PATH', __DIR__ );
25}
26
27require_once XCUBE_CORE_PATH . '/XCube_Delegate.class.php';
28
30 public function isXSD( $typeName ) {
31 return 'string' === $typeName || 'int' === $typeName;
32 }
33}
34
35
42 public $mServices = [];
43
50 public $mCreateClient;
51
55 public $mCreateServer;
56
57 public function __construct() {
58 $this->mCreateClient = new XCube_Delegate();
59 $this->mCreateClient->register( 'XCube_ServiceManager.CreateClient' );
60
61 $this->mCreateServer = new XCube_Delegate();
62 $this->mCreateServer->register( 'XCube_ServiceManager.CreateServer' );
63 }
64
74 public function addService( $name, &$service ) {
75 if ( isset( $this->mServices[ $name ] ) ) {
76 return false;
77 }
78
79 $this->mServices[ $name ] =& $service;
80
81 return true;
82 }
83
93 public function addWSDL( $name, $url ) {
94 if ( isset( $this->mServices[ $name ] ) ) {
95 return false;
96 }
97
98 $this->mServices[ $name ] =& $url;
99
100 return true;
101 }
102
113 public function addXCubeService( $name, &$service ) {
114 return $this->addService( $name, $service );
115 }
116
117 public function &getService( $name ) {
118 $ret = null;
119
120 if ( isset( $this->mServices[ $name ] ) ) {
121 return $this->mServices[ $name ];
122 }
123
124 return $ret;
125 }
126
136 public function &searchXCubeService( $name ) {
137 return $this->getService( $name );
138 }
139
151 public function &createClient( &$service ) {
152 $client = null;
153 $this->mCreateClient->call( new XCube_Ref( $client ), new XCube_Ref( $service ) );
154
155 return $client;
156 }
157
158 public function &createServer( &$service ) {
159 $server = null;
160 $this->mCreateServer->call( new XCube_Ref( $server ), new XCube_Ref( $service ) );
161
162 return $server;
163 }
164}
[Final] Used for the simple mechanism for common delegation in XCube.