/**
  * Creates a new Piece_Flow_Continuation_Server object and configure it.
  *
  * @return Piece_Flow_Continuation_Server
  * @throws PIECE_UNITY_ERROR_INVALID_CONFIGURATION
  */
 function &_createContinuationServer()
 {
     $continuationServer =& new Piece_Flow_Continuation_Server($this->_getConfiguration('enableSingleFlowMode'), $this->_getConfiguration('enableGC'), $this->_getConfiguration('gcExpirationTime'));
     $continuationServer->setCacheDirectory($this->_getConfiguration('cacheDirectory'));
     $continuationServer->setEventNameCallback(array(__CLASS__, 'getEventName'));
     $continuationServer->setFlowExecutionTicketCallback(array(__CLASS__, 'getFlowExecutionTicket'));
     $continuationServer->setFlowIDCallback(array(__CLASS__, 'getFlowID'));
     if ($this->_getConfiguration('useFlowMappings')) {
         $continuationServer->setConfigDirectory($this->_getConfiguration('configDirectory'));
         $continuationServer->setConfigExtension($this->_getConfiguration('configExtension'));
         foreach ($this->_getConfiguration('flowMappings') as $flowMapping) {
             if (array_key_exists('url', $flowMapping)) {
                 $flowMapping['uri'] = $flowMapping['url'];
             }
             Piece_Flow_Error::disableCallback();
             $continuationServer->addFlow($flowMapping['uri'], $flowMapping['flowName'], $flowMapping['isExclusive']);
             Piece_Flow_Error::enableCallback();
             if (Piece_Flow_Error::hasErrors()) {
                 Piece_Unity_Error::push(PIECE_UNITY_ERROR_INVALID_CONFIGURATION, "Failed to configure the plugin [ {$this->_name}.", 'exception', array(), Piece_Flow_Error::pop());
                 $return = null;
                 return $return;
             }
         }
     } else {
         foreach ($this->_getConfiguration('flowDefinitions') as $flowDefinition) {
             Piece_Flow_Error::disableCallback();
             $continuationServer->addFlow($flowDefinition['name'], $flowDefinition['file'], $flowDefinition['isExclusive']);
             Piece_Flow_Error::enableCallback();
             if (Piece_Flow_Error::hasErrors()) {
                 Piece_Unity_Error::push(PIECE_UNITY_ERROR_INVALID_CONFIGURATION, "Failed to configure the plugin [ {$this->_name}.", 'exception', array(), Piece_Flow_Error::pop());
                 $return = null;
                 return $return;
             }
         }
     }
     return $continuationServer;
 }