public function setExtbaseConfiguration($pluginName, $controllerClass, $actionName, $extensionName = null)
    {
        // Validate the extension name
        if (!empty($extensionName)) {
            $extensionName = GeneralUtility::camelCaseToLowerCaseUnderscored(trim($extensionName));
            if (!in_array($extensionName, ExtensionManagementUtility::getLoadedExtensionListArray())) {
                throw new \RuntimeException(sprintf('Extension "%s" is not available', $extensionName), 1481645834);
            }
            $this->extbaseExtensionName = $extensionName;
        }

        // Validate the plugin name
        $pluginName = trim($pluginName);
        if (empty($pluginName)) {
            throw new \RuntimeException(sprintf('Invalid plugin name "%s"', $pluginName), 1481646376);
        }
        $this->extbasePlugin = $pluginName;

        // Validate the controller name
        $controllerClass = trim($controllerClass);
        if (empty($controllerClass)
            || !class_exists($controllerClass)
            || !($controllerReflection = new \ReflectionClass($controllerClass))->implementsInterface(
                ControllerInterface::class
            )
        ) {
            throw new \RuntimeException(sprintf('Invalid controller class "%s"', $controllerClass), 1481646376);
        }
        $this->extbaseControllerClass = $controllerClass;
        $this->extbaseController      = preg_replace('/Controller$/', '', $controllerReflection->getShortName());

        // Validate the controller action
        $actionName = trim($actionName);
        if (empty($actionName) || !is_callable([$this->extbaseControllerClass, $actionName.'Action'])) {
            throw new \RuntimeException(sprintf('Invalid controller action "%s"', $actionName), 1481646569);
        }
        $this->extbaseAction = $actionName;

        // Construct the controller argument request prefix
        $this->controllerArgumentRequestPrefix = 'tx_'.strtolower(str_replace('_', '', $this->extbaseExtensionName)).
                                                 '_'.strtolower($this->extbasePlugin);

        // Construct and set the controller request arguments
        $this->request->setControllerObjectName($this->extbaseControllerClass);
        $this->request->setControllerExtensionName($this->extbaseExtensionName);
        $this->request->setControllerName($this->extbaseController);
        $this->request->setControllerActionName($this->extbaseAction);
        $this->request->setPluginName($this->extbasePlugin);
        $this->request->setArgument(
            $this->controllerArgumentRequestPrefix,
            [
                'controller' => $this->extbaseController,
                'action'     => $this->extbaseAction,
            ]
        );

        // Determine the default controller settings
        /** @var ConfigurationManagerInterface $configurationManager */
        $configurationManager     = $this->objectManager->get(ConfigurationManagerInterface::class);
        $this->controllerSettings = $configurationManager->getConfiguration(
            ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS,
            GeneralUtility::underscoredToUpperCamelCase($this->extbaseExtensionName),
            $this->extbasePlugin
        );
    }