示例#1
0
 public function _getServerTypeForClientClass($clientClass)
 {
     if (array_key_exists($clientClass, $this->m_clientMappings)) {
         return $this->m_clientMappings[$clientClass];
     }
     return TypeLoader::loadType($clientClass);
 }
 private function Validate(ClassMappingItem $newClassMappingItem)
 {
     if ($newClassMappingItem->ServerClass == "") {
         throw new Exception("Server class not defined");
     }
     if ($newClassMappingItem->ClientClass == "") {
         throw new Exception("Client class not defined");
     }
     try {
         if (TypeLoader::loadType($newClassMappingItem->ServerClass) == null) {
             throw new Exception("Unable to load server type " . $newClassMappingItem->ServerClass);
         }
     } catch (Exception $e) {
         throw new Exception("Server type " . $newClassMappingItem->ServerClass . " not found");
     }
 }
 public function inspect($targetObject)
 {
     if (LOGGING) {
         Log::log(LoggingConstants::INFO, "Processing service inspection in " . $this->getName());
     }
     $clazz = TypeLoader::loadType($targetObject);
     // class cannot be found
     if ($clazz == null) {
         if (LOGGING) {
             Log::log(LoggingConstants::INFO, "Unable to find a class coresponding to " . $targetObject);
         }
         return null;
     }
     /*ServiceDescriptor*/
     $serviceDescriptor = ClassInspector::inspectClass($clazz);
     if (LOGGING) {
         Log::log(LoggingConstants::INFO, "PHP object handler has successfully inspected target service");
     }
     return $serviceDescriptor;
 }
 public function configure($parent, $configContext, DOMNode $documentElement)
 {
     $this->setORBConfig($configContext);
     $section = $documentElement->getElementsByTagName("classMappings")->item(0);
     // check required !
     $this->m_configNode = $section;
     foreach ($section->childNodes as $element) {
         if (!$element instanceof DOMElement) {
             continue;
         }
         $elements = $element->getElementsByTagName("clientClass");
         $clientClass = trim($elements->item(0)->nodeValue);
         $elements = $element->getElementsByTagName("serverClass");
         $serverClass = trim($elements->item(0)->nodeValue);
         $type = TypeLoader::loadType($serverClass);
         if (LOGGING) {
             Log::log(LoggingConstants::DEBUG, $clientClass . " : " . $serverClass);
         }
         ORBConfig::getInstance()->getTypeMapper()->_addClientClassMapping($clientClass, $type);
     }
 }
示例#5
0
 protected function getMethodResult($method)
 {
     /*String*/
     $methodString = substr($method, strlen(self::$METHOD_CODE));
     /*String*/
     $serviceString = substr($methodString, 0, strrpos($methodString, "."));
     /*String*/
     $methodName = substr($methodString, strlen($serviceString) + 1, strpos($methodString, "(") - strlen($serviceString) - 1);
     /*String*/
     $parametrsString = substr($methodString, strpos($methodString, "(") + 1, strpos($methodString, ")") - strpos($methodString, "(") - 1);
     /*Array*/
     $args = $this->parseOperands($parametrsString);
     /*ReflectionClass*/
     $class = TypeLoader::loadType($serviceString);
     $object = $class->newInstance();
     /*ReflectionMethod*/
     $method = $class->getMethod($methodName);
     $result = $method->invokeArgs($object, $args);
     return $result;
 }
 private static function getClass($name)
 {
     for ($i = 0; $i <= count(self::$basePath); $i++) {
         try {
             if ($i == count(self::$basePath)) {
                 $result = TypeLoader::loadType($name);
                 return $result;
             } else {
                 $result = TypeLoader::loadType(self::$basePath[$i] . $name);
                 return $result;
             }
         } catch (ReflectionException $e) {
             if ($i == count(self::$basePath)) {
                 return null;
                 throw new Exception("No class found for element [" . $name . "]");
             }
         } catch (Exception $e) {
             if ($i == count(self::$basePath)) {
                 return null;
                 throw new Exception("No class found for element [" . $name . "]");
             }
         }
     }
     return null;
 }
 public static function createServiceObject($objectName)
 {
     return TypeLoader::loadType($objectName)->newInstance();
 }