Exemplo n.º 1
0
 static function main()
 {
     $user_method = null;
     $params = null;
     $route = null;
     $user_class = null;
     $base = system_base_Wet_base::get_instance();
     $cache = system_base_Cache::get_instance();
     $profiler = system_base_Profiler::get_instance();
     $cl = null;
     try {
         if (system_base_Router::$instance === null) {
             system_base_Router::$instance = new system_base_Router();
         }
         $route = system_base_Router::$instance;
         if (!$route->decode_route()) {
             if ($route->controller === "_load") {
                 system_base_Cache::load_asset($route->method);
             }
             return;
         }
         if (Index_0($base, $cache, $cl, $params, $profiler, $route, $user_class, $user_method)) {
             return;
         }
         $cl = Type::resolveClass("system.application.controllers." . _hx_string_or_null($route->controller));
         if ($cl === null) {
             throw new HException(new system_base_Http_exception(_hx_string_or_null($route->controller) . " " . "Not found", 404, _hx_anonymous(array("fileName" => "Index.hx", "lineNumber" => 81, "className" => "Index", "methodName" => "main"))));
         } else {
             $user_class = Type::createInstance($cl, new _hx_array(array()));
             $user_method = Reflect::field($user_class, $route->method);
             if ($user_method === null) {
                 throw new HException(new system_base_Http_exception(_hx_string_or_null($route->method) . " " . "Not found", 404, _hx_anonymous(array("fileName" => "Index.hx", "lineNumber" => 89, "className" => "Index", "methodName" => "main"))));
             } else {
                 $user_class->set_params($route->params);
                 Reflect::callMethod($user_class, $user_method, new _hx_array(array()));
                 Reflect::callMethod($user_class, Reflect::field($user_class, "flush"), new _hx_array(array()));
             }
         }
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         if (($e = $_ex_) instanceof system_base_Error) {
         } else {
             throw $__hx__e;
         }
     }
     system_base_Database::close();
 }
 public function updateConfiguration(&$configuration)
 {
     $configuration = $configuration;
     $confClass = com_wiris_system_PropertiesTools::getProperty($configuration, com_wiris_plugin_api_ConfigurationKeys::$CONFIGURATION_CLASS, null);
     if ($confClass !== null && _hx_index_of($confClass, "com.wiris.plugin.servlets.configuration.ParameterServletConfigurationUpdater", null) !== -1) {
         return;
     }
     if ($confClass !== null) {
         $cls = Type::resolveClass($confClass);
         if ($cls === null) {
             throw new HException("Class " . $confClass . " not found.");
         }
         $obj = Type::createInstance($cls, new _hx_array(array()));
         if ($obj === null) {
             throw new HException("Instance from " . Std::string($cls) . " cannot be created.");
         }
         $cu = $obj;
         $this->config->initialize($cu);
         $cu->updateConfiguration($configuration);
     }
 }
Exemplo n.º 3
0
 public function call($classPath, $methodName, $args)
 {
     $cls = null;
     $errorMessage = "";
     try {
         $cls = Type::createInstance(Type::resolveClass($classPath), new _hx_array(array()));
         $cls->event->addListener($cls->eventKeys->complete, isset($this->onCallComplete) ? $this->onCallComplete : array($this, "onCallComplete"));
         $cls->event->addListener($cls->eventKeys->error, isset($this->onCallError) ? $this->onCallError : array($this, "onCallError"));
         try {
             Reflect::callMethod($cls, Reflect::field($cls, $methodName), $args);
         } catch (Exception $__hx__e) {
             $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
             $error = $_ex_;
             $errorMessage = "Call method " . _hx_string_or_null($methodName) . " failed in " . _hx_string_or_null($classPath);
         }
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $error1 = $_ex_;
         $errorMessage = "Not found class " . _hx_string_or_null($classPath);
     }
     if (strlen($errorMessage) > 0) {
         $this->event->dispatchError($this->eventData, $this, "call", $errorMessage);
     }
 }
 public function getStorageAndCache()
 {
     if ($this->store === null) {
         $className = $this->configuration->getProperty(com_wiris_plugin_api_ConfigurationKeys::$STORAGE_CLASS, null);
         if ($className === null || $className === "FolderTreeStorageAndCache") {
             $this->store = new com_wiris_plugin_impl_FolderTreeStorageAndCache();
         } else {
             if ($className === "FileStorageAndCache") {
                 $this->store = new com_wiris_plugin_impl_FileStorageAndCache();
             } else {
                 $cls = Type::resolveClass($className);
                 if ($cls === null) {
                     throw new HException("Class " . $className . " not found.");
                 }
                 $this->store = Type::createInstance($cls, new _hx_array(array()));
                 if ($this->store === null) {
                     throw new HException("Instance from " . Std::string($cls) . " cannot be created.");
                 }
             }
         }
         $this->initialize($this->store, $this->configuration->getFullConfiguration());
     }
     return $this->store;
 }
 public function createInstance($type, $injector)
 {
     return Type::createInstance($type, $this->gatherArgs($type, $injector));
 }