public function registerMessageQueues(ApplicationInterface $application)
    {

        // initialize the array for the creating the subdirectories
        $this->directories = new GenericStackable();
        $this->directories[] = $application->getNamingDirectory();

        // check META-INF + subdirectories for XML files with MQ definitions
        /** @var \AppserverIo\Appserver\Core\Api\DeploymentService $service */
        $service = $application->newService('AppserverIo\Appserver\Core\Api\DeploymentService');
        $xmlFiles = $service->globDir(AppEnvironmentHelper::getEnvironmentAwareGlobPattern($this->getWebappPath(), 'META-INF' . DIRECTORY_SEPARATOR . 'message-queues'));

        // load the configuration service instance
        /** @var \AppserverIo\Appserver\Core\Api\ConfigurationService $configurationService */
        $configurationService = $application->newService('AppserverIo\Appserver\Core\Api\ConfigurationService');

        // load the container node to initialize the system properties
        /** @var \AppserverIo\Psr\ApplicationServer\Configuration\ContainerConfigurationInterface $containerNode */
        $containerNode = $application->getContainer()->getContainerNode();

        // gather all the deployed web applications
        foreach ($xmlFiles as $file) {
            try {
                // validate the file here, but skip if the validation fails
                $configurationService->validateFile($file, null, true);

                // load the system properties
                $properties = $service->getSystemProperties($containerNode);

                // append the application specific properties
                $properties->add(SystemPropertyKeys::WEBAPP, $webappPath = $application->getWebappPath());
                $properties->add(SystemPropertyKeys::WEBAPP_NAME, basename($webappPath));
                $properties->add(SystemPropertyKeys::WEBAPP_DATA, $application->getDataDir());
                $properties->add(SystemPropertyKeys::WEBAPP_CACHE, $application->getCacheDir());
                $properties->add(SystemPropertyKeys::WEBAPP_SESSION, $application->getSessionDir());

                // create a new message queue node instance and replace the properties
                $messageQueuesNode = new MessageQueuesNode();
                $messageQueuesNode->initFromFile($file);
                $messageQueuesNode->replaceProperties($properties);

                // register the entity managers found in the configuration
                foreach ($messageQueuesNode->getMessageQueues() as $messageQueueNode) {
                    $this->registeMessageQueue($messageQueueNode);
                }

            } catch (InvalidConfigurationException $e) {
                // try to load the system logger instance
                /** @var \Psr\Log\LoggerInterface $systemLogger */
                if ($systemLogger = $this->getApplication()->getInitialContext()->getSystemLogger()) {
                    $systemLogger->error($e->getMessage());
                    $systemLogger->critical(sprintf('Persistence configuration file %s is invalid, needed queues might be missing.', $file));
                }

            } catch (\Exception $e) {
                // try to load the system logger instance
                /** @var \Psr\Log\LoggerInterface $systemLogger */
                if ($systemLogger = $this->getApplication()->getInitialContext()->getSystemLogger()) {
                    $systemLogger->error($e->__toString());
                }
            }
        }
    }
public function registerMessageQueues(ApplicationInterface $application)
    {

        // initialize the array for the creating the subdirectories
        $this->directories = new GenericStackable();
        $this->directories[] = $application->getNamingDirectory();

        // check META-INF + subdirectories for XML files with MQ definitions
        /** @var \AppserverIo\Appserver\Core\Api\DeploymentService $service */
        $service = $application->newService('AppserverIo\Appserver\Core\Api\DeploymentService');
        $xmlFiles = $service->globDir(AppEnvironmentHelper::getEnvironmentAwareGlobPattern($this->getWebappPath(), 'META-INF' . DIRECTORY_SEPARATOR . 'message-queues'));

        // load the configuration service instance
        /** @var \AppserverIo\Appserver\Core\Api\ConfigurationService $configurationService */
        $configurationService = $application->newService('AppserverIo\Appserver\Core\Api\ConfigurationService');

        // load the container node to initialize the system properties
        /** @var \AppserverIo\Psr\ApplicationServer\Configuration\ContainerConfigurationInterface $containerNode */
        $containerNode = $application->getContainer()->getContainerNode();

        // gather all the deployed web applications
        foreach ($xmlFiles as $file) {
            try {
                // validate the file here, but skip if the validation fails
                $configurationService->validateFile($file, null, true);

                // load the system properties
                $properties = $service->getSystemProperties($containerNode);

                // append the application specific properties
                $properties->add(SystemPropertyKeys::WEBAPP, $webappPath = $application->getWebappPath());
                $properties->add(SystemPropertyKeys::WEBAPP_NAME, basename($webappPath));
                $properties->add(SystemPropertyKeys::WEBAPP_DATA, $application->getDataDir());
                $properties->add(SystemPropertyKeys::WEBAPP_CACHE, $application->getCacheDir());
                $properties->add(SystemPropertyKeys::WEBAPP_SESSION, $application->getSessionDir());

                // create a new message queue node instance and replace the properties
                $messageQueuesNode = new MessageQueuesNode();
                $messageQueuesNode->initFromFile($file);
                $messageQueuesNode->replaceProperties($properties);

                // register the entity managers found in the configuration
                foreach ($messageQueuesNode->getMessageQueues() as $messageQueueNode) {
                    $this->registeMessageQueue($messageQueueNode);
                }

            } catch (InvalidConfigurationException $e) {
                // try to load the system logger instance
                /** @var \Psr\Log\LoggerInterface $systemLogger */
                if ($systemLogger = $this->getApplication()->getInitialContext()->getSystemLogger()) {
                    $systemLogger->error($e->getMessage());
                    $systemLogger->critical(sprintf('Persistence configuration file %s is invalid, needed queues might be missing.', $file));
                }

            } catch (\Exception $e) {
                // try to load the system logger instance
                /** @var \Psr\Log\LoggerInterface $systemLogger */
                if ($systemLogger = $this->getApplication()->getInitialContext()->getSystemLogger()) {
                    $systemLogger->error($e->__toString());
                }
            }
        }
    }
public function registerMessageQueues ( ApplicationInterface $ application ) { // initialize the array for the creating the subdirectories $ this -> directories = new GenericStackable ( ) ; $ this -> directories [ ] = $ application -> getNamingDirectory ( ) ; // check META-INF + subdirectories for XML files with MQ definitions /** @var \AppserverIo\Appserver\Core\Api\DeploymentService $service */ $ service = $ application -> newService ( 'AppserverIo\Appserver\Core\Api\DeploymentService' ) ; $ xmlFiles = $ service -> globDir ( AppEnvironmentHelper :: getEnvironmentAwareGlobPattern ( $ this -> getWebappPath ( ) , 'META-INF' . DIRECTORY_SEPARATOR . 'message-queues' ) ) ; // load the configuration service instance /** @var \AppserverIo\Appserver\Core\Api\ConfigurationService $configurationService */ $ configurationService = $ application -> newService ( 'AppserverIo\Appserver\Core\Api\ConfigurationService' ) ; // load the container node to initialize the system properties /** @var \AppserverIo\Psr\ApplicationServer\Configuration\ContainerConfigurationInterface $containerNode */ $ containerNode = $ application -> getContainer ( ) -> getContainerNode ( ) ; // gather all the deployed web applications foreach ( $ xmlFiles as $ file ) { try { // validate the file here, but skip if the validation fails $ configurationService -> validateFile ( $ file , null , true ) ; // load the system properties $ properties = $ service -> getSystemProperties ( $ containerNode ) ; // append the application specific properties $ properties -> add ( SystemPropertyKeys :: WEBAPP , $ webappPath = $ application -> getWebappPath ( ) ) ; $ properties -> add ( SystemPropertyKeys :: WEBAPP_NAME , basename ( $ webappPath ) ) ; $ properties -> add ( SystemPropertyKeys :: WEBAPP_DATA , $ application -> getDataDir ( ) ) ; $ properties -> add ( SystemPropertyKeys :: WEBAPP_CACHE , $ application -> getCacheDir ( ) ) ; $ properties -> add ( SystemPropertyKeys :: WEBAPP_SESSION , $ application -> getSessionDir ( ) ) ; // create a new message queue node instance and replace the properties $ messageQueuesNode = new MessageQueuesNode ( ) ; $ messageQueuesNode -> initFromFile ( $ file ) ; $ messageQueuesNode -> replaceProperties ( $ properties ) ; // register the entity managers found in the configuration foreach ( $ messageQueuesNode -> getMessageQueues ( ) as $ messageQueueNode ) { $ this -> registeMessageQueue ( $ messageQueueNode ) ; } } catch ( InvalidConfigurationException $ e ) { // try to load the system logger instance /** @var \Psr\Log\LoggerInterface $systemLogger */ if ( $ systemLogger = $ this -> getApplication ( ) -> getInitialContext ( ) -> getSystemLogger ( ) ) { $ systemLogger -> error ( $ e -> getMessage ( ) ) ; $ systemLogger -> critical ( sprintf ( 'Persistence configuration file %s is invalid, needed queues might be missing.' , $ file ) ) ; } } catch ( \ Exception $ e ) { // try to load the system logger instance /** @var \Psr\Log\LoggerInterface $systemLogger */ if ( $ systemLogger = $ this -> getApplication ( ) -> getInitialContext ( ) -> getSystemLogger ( ) ) { $ systemLogger -> error ( $ e -> __toString ( ) ) ; } } } }
Deploys the message queues.

@param \AppserverIo\Psr\Application\ApplicationInterface|\AppserverIo\Psr\Naming\NamingDirectoryInterface $application The application instance

@return void
Deploys the message queues .