public function Configure($basePath, ORBConfig $orbConfig) { $this->orbConfig = $orbConfig; $this->basePath = $basePath; $this->preConfig(); /*Document*/ $configDoc = null; $dom = new DomDocument(); $dom->load($orbConfig->getFlexConfigPath() . $this->getConfigFileName()); $root = $dom->documentElement; /*String*/ $serviceHandlerClassName = $root->getAttribute("class"); //if( $serviceHandlerClassName == null || strlen($serviceHandlerClassName) == 0 ) $serviceHandlerClassName = $this->getDefaultServiceHandlerName(); /*IServiceHandler*/ $serviceHandler = null; if ($serviceHandlerClassName != null) { try { $serviceHandler = ObjectFactories::createServiceObject($serviceHandlerClassName); } catch (Exception $e) { $serviceHandler = null; } } /*DataServices*/ $dataServices = $orbConfig->getDataServices(); /*List*/ $adapters = $root->getElementsByTagName("adapters"); if ($adapters != null && $adapters->length > 0) { /*Element*/ $adaptersNode = $adapters->item(0); /*List*/ $adaptersDefNodes = $adaptersNode->getElementsByTagName("adapter-definition"); for ($i = 0, $max = count($adaptersDefNodes); $i < $max; $i++) { /*Element*/ $adapterDefinition = $adaptersDefNodes->item($i); /*String*/ $id = $adapterDefinition->getAttribute("id"); /*String*/ $type = $adapterDefinition->getAttribute("class"); if ($type == null) { $type = $adapterDefinition->getAttribute("type"); } if ($type == null || strlen(trim($type)) == 0) { continue; } /*String*/ $defaultAdapterStr = $adapterDefinition->getAttribute("default"); /*boolean*/ $defaultAdapter = $defaultAdapterStr != null && strtolower($defaultAdapterStr) == "true"; try { /*IAdapter*/ $adapter = ObjectFactories::createServiceObject($type); $dataServices->_AddAdapter($id, $adapter, $defaultAdapter); } catch (Exception $e) { if (LOGGING) { Log::log(LoggingConstants::ERROR, "unable to load service adapter " . $type); } } } } /*List*/ $destinationNodes = $root->getElementsByTagName("destination"); for ($i = 0, $max = $destinationNodes->length; $i < $max; $i++) { /*Element*/ $destElement = $destinationNodes->item($i); /*String*/ $destinationId = $destElement->getAttribute("id"); /*IDestination*/ $destination = $this->processDestination($orbConfig, $destinationId, $destElement); $destination->setName($destinationId); /*Element*/ $props = $destElement->getElementsByTagName("properties")->item(0); $destination->setProperties($this->parseProperties($props)); $destination->setConfigServiceHandler(); if ($destination->getServiceHandler() == null) { $destination->setServiceHandler($serviceHandler); } $dataServices->getDestinationManager()->addDestination($destinationId, $destination); } $this->postConfig(); }