コード例 #1
1
ファイル: SAM_Client.php プロジェクト: psagi/sdo
 /**
  * creates a connection using connection factory
  * @param $connFactory SDO Data object type = msd:ConnectionFactory
  * @return SAMConnection or null
  */
 private function _configConnection($connFactory)
 {
     $optionsarray = array();
     foreach ($connFactory as $key => $value) {
         switch ($key) {
             case "protocol":
                 $protocol = $value;
                 break;
             default:
                 $optionsarray[self::$samOptions[$key]] = $value;
                 break;
         }
     }
     /*check mandatory fields */
     if (!isset($protocol)) {
         throw new SCA_RuntimeException('message binding configuration connectionFactory missing: protocol. ');
     }
     if (self::$test_mode) {
         /*in test mode, use $this::test_queueborker */
         if (is_null(self::$test_queueborker)) {
             self::$test_queueborker = array();
         }
         $connection = null;
     } else {
         /*connecting to a real broker*/
         $connection = new SAMConnection();
         $connection->connect($protocol, $optionsarray);
         if (!$connection) {
             throw new SCA_RuntimeException("SAM connection failed");
         }
     }
     return $connection;
 }