PHP Classes

File: ANYEM_CLIENT/anyem.client.impl/ClientConnectionImpl.php

Recommend this page to a friend!
  Packages of Anis Halayem   Anyem   ANYEM_CLIENT/anyem.client.impl/ClientConnectionImpl.php   Download  
File: ANYEM_CLIENT/anyem.client.impl/ClientConnectionImpl.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Anyem
Exchange variable values between PHP servers
Author: By
Last change:
Date: 11 years ago
Size: 1,745 bytes
 

 

Contents

Class file image Download
<?php
require_once (__DIR__ . '/../../ANYEM_SHARED/' . 'anyem.utils/AnyemConfigReaderimpl.php');
require_once (__DIR__ . '/../anyem.client.api/IClientConnection.php');

/**
 * Description of ClientConnectionImpl
 *
 * @author Anis.Halayem
 */
class ClientConnectionImpl implements IClientConnection{
    private $_server_addr               ;
    private $_server_port               ;
    private $_max_res_serialized_length ;
    
    public function __construct ($server_addr, $server_port, $max_res_serialized_length) {
        $this->_server_addr                 =   $server_addr;
        $this->_server_port                 =   $server_port;
        $this->_max_res_serialized_length   =   $max_res_serialized_length;
    }
    
    public static function newClient () {
        $anyemConfigReader  = new AnyemConfigReaderImpl (__DIR__ . '/../config/anyem_config.properties')    ;
        $anyemConfigReader2 = new AnyemConfigReaderImpl (__DIR__ . '/../../ANYEM_SHARED/'                   .   
                            'config/anyem_config_shared.properties')            ;
        $clientConnection   = new ClientConnectionImpl  ($anyemConfigReader->readConfig  (self::SERVER_ADDRESS),
                                                         $anyemConfigReader2->readConfig (self::SERVER_PORT),
                                                         $anyemConfigReader2->readConfig (self::SERVER_MAX_RESOURCE_SERIALIZED_LENGTH));
        return $clientConnection;
        
    }
    
    public function getServerAddr() {
        return $this->_server_addr;
    }
    public function getServerPort() {
        return $this->_server_port;
    }
    public function getMaxResourceSerializedLength() {
        return $this->_max_res_serialized_length;
    }
}