idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
54,800
public function addApplicationToSystemConfiguration ( ApplicationInterface $ application ) { $ appNode = $ this -> getService ( ) -> loadByWebappPath ( $ application -> getWebappPath ( ) ) ; if ( $ appNode == null ) { $ this -> getService ( ) -> newFromApplication ( $ application ) ; } $ application -> connect ( ) ; }
Connects the passed application to the system configuration .
54,801
public function addApplication ( ApplicationInterface $ application ) { $ this -> applications [ $ application -> getName ( ) ] = $ application ; $ this -> addApplicationToSystemConfiguration ( $ application ) ; }
Append the deployed application to the deployment instance and registers it in the system configuration .
54,802
public function stop ( ) { $ this -> synchronized ( function ( $ self ) { $ self -> containerState = ContainerStateKeys :: get ( ContainerStateKeys :: HALT ) ; } , $ this ) ; do { usleep ( 500000 ) ; $ this -> getInitialContext ( ) -> getSystemLogger ( ) -> info ( sprintf ( 'Wait for container %s to be shutdown' , $ th...
Stops the container instance .
54,803
protected function validateDirectories ( ) { $ appBase = $ this -> getAppBase ( ) ; if ( ! is_dir ( $ appBase ) || ! is_readable ( $ appBase ) ) { $ this -> getInitialContext ( ) -> getSystemLogger ( ) -> critical ( sprintf ( 'Base directory (appBase) %s of container %s is no directory or not readable, can\'t deploy ap...
Validates that the container s application and temporary directory is available .
54,804
protected function registerClassLoaders ( GenericStackable $ classLoaders ) { foreach ( $ this -> getContainerNode ( ) -> getClassLoaders ( ) as $ classLoaderNode ) { $ includePath = array ( ) ; $ appBase = $ this -> getAppBase ( ) ; foreach ( $ classLoaderNode -> getDirectories ( ) as $ directory ) { $ includePath [ ]...
Register s the class loaders configured for this container .
54,805
public function execute ( ) { try { $ classes = $ this -> getEntityManager ( ) -> getMetadataFactory ( ) -> getAllMetadata ( ) ; $ this -> getSchemaTool ( ) -> createSchema ( $ classes ) ; } catch ( \ Exception $ e ) { $ this -> getApplication ( ) -> getInitialContext ( ) -> getSystemLogger ( ) -> error ( $ e -> __toSt...
Executes the functionality for this step in this case the execution of the PHP script defined in the step configuration .
54,806
public function mergeWithParams ( array $ params ) { foreach ( array_keys ( get_object_vars ( $ this ) ) as $ propertyName ) { if ( array_key_exists ( $ propertyName , $ params ) ) { $ this -> $ propertyName = $ params [ $ propertyName ] ; } } }
Merge the passed params with the default settings .
54,807
public function merge ( ManagerNodeInterface $ managerNode ) { if ( strcasecmp ( $ this -> getName ( ) , $ managerNode -> getName ( ) ) !== 0 ) { return ; } $ this -> type = $ managerNode -> getType ( ) ; $ this -> factory = $ managerNode -> getFactory ( ) ; $ this -> contextFactory = $ managerNode -> getContextFactory...
This method merges the configuration of the passed manager node into this one .
54,808
public function findAll ( ) { $ deploymentNodes = array ( ) ; foreach ( $ this -> getSystemConfiguration ( ) -> getContainers ( ) as $ container ) { $ deploymentNode = $ container -> getDeployment ( ) ; $ deploymentNodes [ $ deploymentNode -> getUuid ( ) ] = $ deploymentNode ; } return $ deploymentNodes ; }
Returns all deployment configurations .
54,809
public function load ( $ uuid ) { $ deploymentNodes = $ this -> findAll ( ) ; if ( array_key_exists ( $ uuid , $ deploymentNodes ) ) { return $ deploymentNodes [ $ uuid ] ; } }
Returns the deployment with the passed UUID .
54,810
public function loadContextInstance ( ContainerConfigurationInterface $ containerNode , $ webappPath ) { $ contextPath = basename ( $ webappPath ) ; $ properties = $ this -> getSystemProperties ( $ containerNode ) ; $ properties -> add ( SystemPropertyKeys :: WEBAPP , $ webappPath ) ; $ properties -> add ( SystemProper...
Initializes the context instance for the passed webapp path .
54,811
public function loadContextInstancesByContainer ( ContainerInterface $ container ) { $ contextInstances = array ( ) ; foreach ( glob ( $ container -> getAppBase ( ) . '/*' , GLOB_ONLYDIR ) as $ webappPath ) { $ context = $ this -> loadContextInstance ( $ container -> getContainerNode ( ) , $ webappPath ) ; $ contextIns...
Initializes the available application contexts and returns them .
54,812
protected function prepareSystemProperties ( PropertiesInterface $ properties , $ webappPath ) { $ properties -> add ( SystemPropertyKeys :: WEBAPP , $ webappPath ) ; $ properties -> add ( SystemPropertyKeys :: WEBAPP_NAME , basename ( $ webappPath ) ) ; }
Prepares the system properties for the actual mode .
54,813
public function loadContainerInstances ( ) { $ systemConfiguration = $ this -> getSystemConfiguration ( ) ; if ( $ systemConfiguration -> getAllowApplicationConfiguration ( ) === false ) { return $ systemConfiguration ; } foreach ( $ systemConfiguration -> getContainers ( ) as $ containerNode ) { $ containerAppBase = $...
Loads the containers defined by the applications merges them into the system configuration and returns the merged system configuration .
54,814
public function getDatasourcesAsArray ( ) { $ datasources = array ( ) ; foreach ( $ this -> getDatasources ( ) as $ datasource ) { $ datasources [ $ datasource -> getPrimaryKey ( ) ] = $ datasource ; } return $ datasources ; }
Return s an array with the datasources .
54,815
public function addEntityManagerName ( $ entityManagerName ) { $ this -> getEntityManagerNames ( ) -> set ( sizeof ( $ this -> getEntityManagerNames ( ) -> getAllKeys ( ) ) , $ entityManagerName ) ; }
Add the passed entity manager name to the persistenc manager .
54,816
public function registerEntityManagers ( ApplicationInterface $ application ) { $ metaInfDir = $ this -> getWebappPath ( ) . DIRECTORY_SEPARATOR . 'META-INF' ; if ( is_dir ( $ metaInfDir ) === false ) { return ; } $ service = $ application -> newService ( 'AppserverIo\Appserver\Core\Api\DeploymentService' ) ; $ xmlFile...
Registers the entity managers at startup .
54,817
public function registerEntityManager ( ApplicationInterface $ application , PersistenceUnitConfigurationInterface $ persistenceUnitNode ) { $ application -> getNamingDirectory ( ) -> bind ( sprintf ( 'php:global/%s/%s' , $ application -> getUniqueName ( ) , $ lookupName = $ persistenceUnitNode -> getName ( ) ) , array...
Deploys the entity manager described by the passed XML node .
54,818
public function lookupProxy ( $ lookupName ) { $ sessions = new ArrayList ( ) ; $ connection = new DoctrineLocalContextConnection ( ) ; $ connection -> injectSessions ( $ sessions ) ; $ connection -> injectApplication ( $ this -> getApplication ( ) ) ; $ session = $ connection -> createContextSession ( ) ; $ session ->...
This returns a proxy to the requested session bean .
54,819
public function run ( ) { try { require SERVER_AUTOLOADER ; set_error_handler ( array ( & $ this , 'errorHandler' ) ) ; register_shutdown_function ( array ( & $ this , 'shutdown' ) ) ; $ application = $ this -> application ; $ application -> registerClassLoaders ( ) ; $ application -> registerAnnotationRegistries ( ) ;...
The thread s main method .
54,820
public function getCertificatesAsArray ( ) { $ certificates = array ( ) ; foreach ( $ this -> getCertificates ( ) as $ certificateNode ) { $ certificates [ ] = array ( 'domain' => $ certificateNode -> getDomain ( ) , 'certPath' => $ certificateNode -> getCertPath ( ) ) ; } return $ certificates ; }
Returns the certificates as an associative array .
54,821
protected function getCacheImpl ( CacheConfigurationInterface $ cacheConfiguration ) { $ factory = $ cacheConfiguration -> getFactory ( ) ; $ cache = $ factory :: get ( $ cacheConfiguration -> getParams ( ) ) ; $ cache -> setNamespace ( sprintf ( 'dc2_%s_' , md5 ( $ this -> getPersistenceUnitNode ( ) -> getName ( ) ) )...
Factory method to create a new cache instance from the passed configuration .
54,822
protected function createConfiguration ( ) { $ persistenceUnitNode = $ this -> getPersistenceUnitNode ( ) ; $ metadataConfiguration = $ persistenceUnitNode -> getMetadataConfiguration ( ) ; $ absolutePaths = $ metadataConfiguration -> getDirectoriesAsArray ( ) ; $ proxyDir = $ metadataConfiguration -> getParam ( Metada...
Create s and return s a new Doctrine ORM configuration instance .
54,823
public function factory ( ) { $ application = $ this -> getApplication ( ) ; $ persistenceUnitNode = $ this -> getPersistenceUnitNode ( ) ; $ configuration = $ this -> createConfiguration ( ) ; if ( $ application -> hasAttribute ( $ persistenceUnitNode -> getName ( ) ) === false ) { foreach ( $ persistenceUnitNode -> g...
Creates a new entity manager instance based on the given configuration .
54,824
public function createParser ( ParserNodeInterface $ parserNode , ManagerInterface $ manager ) { $ reflectionClass = new ReflectionClass ( $ parserNode -> getType ( ) ) ; return $ reflectionClass -> newInstanceArgs ( array ( $ parserNode , $ manager ) ) ; }
Creates and returns a new parser instance from the passed configuration .
54,825
public function send ( RemoteMethodInterface $ remoteMethod ) { return $ this -> getApplication ( ) -> search ( PersistenceContextInterface :: IDENTIFIER ) -> invoke ( $ remoteMethod , $ this -> getSessions ( ) ) ; }
Sends the remote method call to the container instance .
54,826
public function getModulesAsArray ( ) { $ modules = array ( ) ; foreach ( $ this -> getModules ( ) as $ module ) { $ modules [ $ module -> getUuid ( ) ] = $ module -> getType ( ) ; } return $ modules ; }
Returns the modules as an associative array
54,827
public function backupArchive ( ContainerConfigurationInterface $ containerNode , \ SplFileInfo $ archive ) { if ( $ this -> getExtractorNode ( ) -> isCreateBackups ( ) === false ) { return ; } $ pharPathname = $ archive -> getPathname ( ) ; $ webappFolderName = $ this -> getWebappsDir ( $ containerNode ) . DIRECTORY_S...
Creates a backup of files that are NOT part of the passed archive .
54,828
public static function get ( Configuration $ configuration , array $ paths = array ( ) , array $ params = array ( ) ) { $ useSimpleAnnotationReader = false ; if ( isset ( $ params [ DriverKeys :: USE_SIMPLE_ANNOTATION_READER ] ) ) { $ useSimpleAnnotationReader = $ params [ DriverKeys :: USE_SIMPLE_ANNOTATION_READER ] ;...
Return s the new driver instance .
54,829
public function getUrlPatternsAsArray ( ) { $ urlPatterns = array ( ) ; foreach ( $ this -> getUrlPatterns ( ) as $ urlPatternNode ) { $ urlPatterns [ ] = $ urlPatternNode -> __toString ( ) ; } return $ urlPatterns ; }
Returns the URL patterns as an associative array
54,830
public function getHttpMethodsAsArray ( ) { $ httpMethods = array ( ) ; foreach ( $ this -> getHttpMethods ( ) as $ httpMethodNode ) { $ httpMethods [ ] = strtoupper ( $ httpMethodNode -> __toString ( ) ) ; } return $ httpMethods ; }
Returns the HTTP methods as an associative array .
54,831
public function getHttpMethodOmissionsAsArray ( ) { $ httpMethodOmissions = array ( ) ; foreach ( $ this -> getHttpMethodOmissions ( ) as $ httpMethodOmissionNode ) { $ httpMethodOmissions [ ] = strtoupper ( $ httpMethodOmissionNode -> __toString ( ) ) ; } return $ httpMethodOmissions ; }
Returns the HTTP method omissions as an associative array .
54,832
public function run ( ) { require SERVER_AUTOLOADER ; $ manager = $ this -> manager ; if ( method_exists ( $ manager , 'getApplication' ) && $ application = $ manager -> getApplication ( ) ) { $ application -> registerClassLoaders ( ) ; $ application -> registerAnnotationRegistries ( ) ; } if ( method_exists ( $ manage...
Handles the clean manager shutdown .
54,833
public static function get ( $ state ) { if ( in_array ( $ state , EnumState :: getStates ( ) ) ) { return new EnumState ( $ state ) ; } throw new InvalidStateException ( sprintf ( 'Requested state %s is not available (choose on of: %s)' , $ state , implode ( ',' , EnumState :: getStates ( ) ) ) ) ; }
Factory method to create a new state instance .
54,834
public function init ( ServletConfigInterface $ servletConfig ) { $ this -> poweredBy = get_class ( $ this ) ; $ this -> webappPath = $ servletConfig -> getWebappPath ( ) ; $ this -> appBase = $ servletConfig -> getServletContext ( ) -> getAppBase ( ) ; $ this -> baseDirectory = $ servletConfig -> getServletContext ( )...
Initializes the servlet with the passed configuration .
54,835
public function service ( ServletRequestInterface $ servletRequest , ServletResponseInterface $ servletResponse ) { $ poweredBy = $ this -> getPoweredBy ( ) ; if ( $ servletResponse -> hasHeader ( HttpProtocol :: HEADER_X_POWERED_BY ) ) { $ poweredBy = $ servletResponse -> getHeader ( HttpProtocol :: HEADER_X_POWERED_B...
Processes the DHTML file specified as servlet name .
54,836
protected function initDefaultFiles ( ) { $ logDir = $ this -> getParam ( DirectoryKeys :: VAR_LOG ) . DIRECTORY_SEPARATOR ; $ this -> setParam ( FileKeys :: APPSERVER_ERRORS_LOG , ParamNode :: TYPE_STRING , $ logDir . 'appserver-errors.log' ) ; $ this -> setParam ( FileKeys :: APPSERVER_ACCESS_LOG , ParamNode :: TYPE_...
Initialize the default files .
54,837
protected function initDefaultInitialContext ( ) { $ description = new DescriptionNode ( new NodeValue ( 'The initial context configuration.' ) ) ; $ storage = new StorageNode ( 'AppserverIo\Storage\StackableStorage' ) ; $ this -> initialContext = new InitialContextNode ( 'AppserverIo\Appserver\Core\InitialContext' , $...
Initializes the default initial context configuration .
54,838
public function getContainer ( $ name ) { foreach ( $ this -> getContainers ( ) as $ container ) { if ( fnmatch ( $ name , $ container -> getName ( ) ) ) { return $ container ; } } }
Returns the container with the passed name .
54,839
public function getContainersAsArray ( ) { $ containers = array ( ) ; foreach ( $ this -> getContainers ( ) as $ container ) { $ containers [ $ container -> getName ( ) ] = $ container ; } return $ containers ; }
Returns the containers as array with the container name as key .
54,840
public function findAllByName ( $ name ) { $ datasourceNodes = array ( ) ; foreach ( $ this -> findAll ( ) as $ datasourceNode ) { if ( $ datasourceNode -> getName ( ) === $ name ) { $ datasourceNodes [ $ datasourceNode -> getPrimaryKey ( ) ] = $ datasourceNode ; } } return $ datasourceNodes ; }
Returns an array with the datasources with the passed name .
54,841
public function findByName ( $ name ) { foreach ( $ this -> findAll ( ) as $ datasourceNode ) { if ( $ datasourceNode -> getName ( ) === $ name ) { return $ datasourceNode ; } } }
Returns the datasource with the passed name .
54,842
public function load ( $ uuid ) { foreach ( $ this -> findAll ( ) as $ datasourceNode ) { if ( $ datasourceNode -> getPrimaryKey ( ) == $ uuid ) { return $ datasourceNode ; } } }
Returns the datasource with the passed UUID .
54,843
public function persist ( NodeInterface $ datasourceNode ) { $ systemConfiguration = $ this -> getSystemConfiguration ( ) ; $ systemConfiguration -> attachDatasource ( $ datasourceNode ) ; $ this -> setSystemConfiguration ( $ systemConfiguration ) ; }
Persists the passed datasource .
54,844
public function factory ( ) { foreach ( $ this -> persistenceUnitNode -> getAnnotationRegistries ( ) as $ annotationRegistry ) { AnnotationRegistry :: registerAutoloadNamespace ( $ annotationRegistry -> getNamespace ( ) , $ annotationRegistry -> getDirectoriesAsArray ( $ this -> application -> getWebappPath ( ) ) ) ; }...
Creates a new entity manager instance based on the passed configuration .
54,845
public function schedule ( TimerInterface $ timer ) { $ this -> synchronized ( function ( TimerInterface $ t ) { $ this -> scheduledTimers [ $ timerId = $ t -> getId ( ) ] = $ t -> getTimerService ( ) -> getPrimaryKey ( ) ; $ timerTaskWrapper = new \ stdClass ( ) ; $ timerTaskWrapper -> executeAt = microtime ( true ) +...
Adds the passed timer task to the schedule .
54,846
public function collectGarbage ( ) { $ this -> synchronized ( function ( ) { foreach ( $ this -> timerTasks as $ taskId => $ timerTask ) { if ( $ timerTask -> isRunning ( ) ) { continue ; } else { unset ( $ this -> timerTasks [ $ taskId ] ) ; } } } ) ; }
Collect the finished timer task jobs .
54,847
public function sleep ( $ timeout ) { $ this -> synchronized ( function ( $ self ) use ( $ timeout ) { $ self -> wait ( $ timeout ) ; } , $ this ) ; }
Let the daemon sleep for the passed value of miroseconds .
54,848
public function lookup ( ServiceContextInterface $ serviceContext , $ serviceIdentifier , array $ args = array ( ) ) { if ( $ serviceContext -> getServices ( ) -> has ( $ serviceIdentifier ) === false ) { throw new EnterpriseBeansException ( sprintf ( 'Requested service %s to handle %s is not available' , $ serviceCont...
Tries to lookup the service with the passed identifier .
54,849
public function hasLogger ( $ loggerType ) { try { $ this -> getContainer ( ) -> getNamingDirectory ( ) -> search ( sprintf ( 'php:global/log/%s' , $ loggerType ) ) ; return true ; } catch ( NamingException $ ne ) { return false ; } }
Queries if the requested logger type is registered or not .
54,850
public function getLogger ( $ loggerType = self :: DEFAULT_LOGGER_TYPE ) { try { return $ this -> getContainer ( ) -> getNamingDirectory ( ) -> search ( sprintf ( 'php:global/log/%s' , $ loggerType ) ) ; } catch ( NamingException $ ne ) { throw new ServerException ( "Logger name '$loggerType' does not exist." , 500 ) ;...
Returns the logger instance with the passed type .
54,851
public function merge ( ContextNode $ contextNode ) { if ( $ type = $ contextNode -> getType ( ) ) { $ this -> setType ( $ type ) ; } if ( $ factory = $ contextNode -> getFactory ( ) ) { $ this -> setFactory ( $ factory ) ; } if ( $ webappPath = $ contextNode -> getWebappPath ( ) ) { $ this -> setWebappPath ( $ webappP...
This method merges the installation steps of the passed provisioning node into the steps of this instance . If a installation node with the same type already exists the one of this instance will be overwritten .
54,852
public function getAttributes ( ) { $ attributes = array ( ) ; $ pattern = sprintf ( '%s-*' , $ this -> getSerial ( ) ) ; foreach ( $ this as $ key => $ value ) { if ( fnmatch ( $ pattern , $ key ) ) { $ attributes [ $ key ] = $ value ; } } return $ attributes ; }
All values registered in the context .
54,853
public function getAllKeys ( ) { $ keys = array ( ) ; $ pattern = sprintf ( '%s-*' , $ this -> getSerial ( ) ) ; foreach ( array_keys ( ( array ) $ this ) as $ key ) { if ( fnmatch ( $ pattern , $ key ) ) { $ keys [ ] = $ this -> unmaskKey ( $ key ) ; } } return $ keys ; }
Returns the keys of the bound attributes .
54,854
public function getAttribute ( $ key ) { if ( isset ( $ this [ $ uid = $ this -> maskKey ( $ key ) ] ) ) { return $ this [ $ uid ] ; } }
Returns the value with the passed name from the context .
54,855
public function removeAttribute ( $ key ) { if ( isset ( $ this [ $ uid = $ this -> maskKey ( $ key ) ] ) ) { unset ( $ this [ $ uid ] ) ; } }
Removes the attribue from the application .
54,856
public function getJob ( $ name ) { foreach ( $ this -> getJobs ( ) as $ job ) { if ( $ job -> getName ( ) === $ name ) { return $ job ; } } }
Returns the job with the passed name .
54,857
public function getClassAnnotation ( ClassInterface $ reflectionClass , $ annotationName ) { return $ this -> getAnnotationReader ( ) -> getClassAnnotation ( $ reflectionClass -> toPhpReflectionClass ( ) , $ annotationName ) ; }
Return s the class annotation with the passed name if available .
54,858
public function register ( ServiceProviderInterface $ instance ) { if ( $ this -> getServices ( ) -> has ( $ pk = $ instance -> getPrimaryKey ( ) ) ) { throw new ServiceAlreadyRegisteredException ( sprintf ( 'It is not allowed to register service %s with primary key %s more than on times' , $ instance -> getServiceName...
Attaches the passed service to the context .
54,859
public function init ( ) { $ this -> bodyStream = '' ; $ this -> exception = null ; $ this -> statusCode = 200 ; $ this -> version = 'HTTP/1.1' ; $ this -> statusReasonPhrase = "OK" ; $ this -> mimeType = "text/plain" ; $ this -> state = HttpResponseStates :: INITIAL ; $ this -> cookies = array ( ) ; $ this -> headers ...
Initialises the response object to default properties .
54,860
protected function initDefaultHeaders ( ) { $ this -> addHeader ( HttpProtocol :: HEADER_EXPIRES , '19 Nov 1981 08:52:00 GMT' ) ; $ this -> addHeader ( HttpProtocol :: HEADER_CACHE_CONTROL , 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0' ) ; $ this -> addHeader ( HttpProtocol :: HEADER_PRAGMA , 'no-ca...
Initializes the response with the default headers .
54,861
public function getCookie ( $ cookieName ) { if ( $ this -> hasCookie ( $ cookieName ) === false ) { throw new HttpException ( "Cookie '$cookieName' not found" ) ; } return $ this -> cookies [ $ cookieName ] ; }
Returns the cookie with the a cookie
54,862
public function copyBodyStream ( $ sourceStream , $ maxlength = null , $ offset = 0 ) { if ( is_resource ( $ sourceStream ) ) { if ( $ offset && $ maxlength ) { $ this -> bodyStream = stream_get_contents ( $ sourceStream , $ maxlength , $ offset ) ; } if ( ! $ offset && $ maxlength ) { $ this -> bodyStream = stream_get...
Copies a source stream to body stream .
54,863
public function getHeadersAsString ( ) { $ headerString = '' ; foreach ( $ this -> getHeaders ( ) as $ name => $ header ) { $ headerString .= $ name . ': ' . $ header . PHP_EOL ; } return $ headerString ; }
Returns the headers as string
54,864
public function addHeader ( $ name , $ value , $ append = false ) { $ name = str_replace ( ' ' , '-' , ucwords ( str_replace ( '-' , ' ' , $ name ) ) ) ; if ( $ this -> hasHeader ( $ name ) && $ append === true ) { if ( is_array ( $ headerValue = $ this -> getHeader ( $ name ) ) ) { $ headerValue [ ] = $ value ; } else...
Adds a header information got from connection . We ve to take care that headers like Set - Cookie header can exist multiple times . To support this create an array that keeps the multiple header values .
54,865
public function setStatusCode ( $ code ) { $ this -> statusCode = $ code ; $ this -> setStatusReasonPhrase ( HttpProtocol :: getStatusReasonPhraseByCode ( $ code ) ) ; }
Sets the http response status code
54,866
public function redirect ( $ url , $ code = 301 ) { $ this -> setStatusCode ( $ code ) ; $ this -> addHeader ( HttpProtocol :: HEADER_LOCATION , $ url ) ; }
Redirects to the passed URL by adding a Location header and setting the appropriate status code by default 301 .
54,867
public static function visit ( ApplicationInterface $ application , ClassLoaderNodeInterface $ configuration = null ) { $ application -> addClassLoader ( SplClassLoader :: factory ( ) ) ; }
Visitor method that adds a initialized class loader to the passed application .
54,868
public function getRewrite ( $ condition ) { foreach ( $ this -> getRewrites ( ) as $ rewriteNode ) { if ( $ rewriteNode -> getCondition ( ) === $ condition ) { return $ rewriteNode ; } } return false ; }
Will return the rewrite node with the specified condition and if nothing could be found we will return false .
54,869
public static function factory ( ApplicationServerInterface $ applicationServer , ContainerConfigurationInterface $ configuration , $ runlevel = ApplicationServerInterface :: NETWORK ) { $ reflectionClass = new \ ReflectionClass ( $ configuration -> getType ( ) ) ; $ params = array ( $ applicationServer -> getInitialCo...
Factory method to create a new container instance .
54,870
public function getRewriteMapsAsArray ( ) { $ rewriteMaps = array ( ) ; foreach ( $ this -> getRewriteMaps ( ) as $ rewriteMapNode ) { $ rewriteMaps [ $ rewriteMapNode -> getType ( ) ] = $ rewriteMapNode -> getParamsAsArray ( ) ; } return $ rewriteMaps ; }
Returns the rewriteMaps as an associative array .
54,871
public function findRequestedApplication ( RequestContextInterface $ requestContext ) { $ webappsDir = $ this -> getServerContext ( ) -> getServerConfig ( ) -> getDocumentRoot ( ) ; $ relativeRequestPath = strstr ( $ requestContext -> getServerVar ( ServerVars :: DOCUMENT_ROOT ) . $ requestContext -> getServerVar ( Ser...
Will try to find the application based on the context path taken from the requested filename . Will return the found application on success and throw an exception if nothing could be found
54,872
public function logDebugException ( \ Exception $ e ) { if ( $ this -> getServerContext ( ) -> hasLogger ( LoggerUtils :: SYSTEM ) ) { $ this -> getServerContext ( ) -> getLogger ( LoggerUtils :: SYSTEM ) -> debug ( $ e -> __toString ( ) ) ; } }
Helper method that writes debug system exceptions to the system logger if configured .
54,873
public function logErrorException ( \ Exception $ e ) { if ( $ this -> getServerContext ( ) -> hasLogger ( LoggerUtils :: SYSTEM ) ) { $ this -> getServerContext ( ) -> getLogger ( LoggerUtils :: SYSTEM ) -> error ( $ e -> __toString ( ) ) ; } }
Helper method that writes system exceptions to the system logger if configured .
54,874
public function logCriticalException ( \ Exception $ e ) { if ( $ this -> getServerContext ( ) -> hasLogger ( LoggerUtils :: SYSTEM ) ) { $ this -> getServerContext ( ) -> getLogger ( LoggerUtils :: SYSTEM ) -> critical ( $ e -> __toString ( ) ) ; } }
Helper method that writes critical system exceptions to the system logger if configured .
54,875
public function toArray ( ) { $ sessionConfiguration = array ( ) ; if ( $ sessionName = $ this -> getSessionName ( ) ) { $ sessionConfiguration [ ServletSessionInterface :: SESSION_NAME ] = ( string ) $ sessionName ; } if ( $ sessionSavePath = $ this -> getSessionSavePath ( ) ) { $ sessionConfiguration [ ServletSession...
Returns the session configuration as associative array .
54,876
public function attach ( \ stdClass $ jobWrapper ) { $ this -> synchronized ( function ( QueueWorker $ self , \ stdClass $ jw ) { $ self -> jobsToExecute [ $ jw -> jobId ] = $ jw ; } , $ this , $ jobWrapper ) ; }
Attaches a job for the passed wrapper to the worker instance .
54,877
public function handleErrors ( RequestHandler $ requestHandler , HttpServletRequestInterface $ servletRequest , HttpServletResponseInterface $ servletResponse ) { if ( sizeof ( $ errors = $ requestHandler -> getErrors ( ) ) === 0 ) { return ; } foreach ( $ errors as $ error ) { $ message = $ this -> prepareMessage ( $ ...
This method finally handles all PHP and user errors as well as the exceptions that have been thrown through the servlet processing .
54,878
public function attach ( MessageInterface $ message ) { $ this -> synchronized ( function ( MessageQueue $ self , MessageInterface $ m ) { $ priority = $ this -> uniqueWorkerName ( $ m -> getPriority ( ) ) ; if ( isset ( $ self -> workers [ $ priority ] ) ) { $ self -> messages [ $ m -> getMessageId ( ) ] = $ m ; $ job...
Attach a new message to the queue .
54,879
public function getRoleNamesAsArray ( ) { $ roleNames = array ( ) ; foreach ( $ this -> getRoleNames ( ) as $ roleName ) { $ roleNames [ ] = $ roleName -> __toString ( ) ; } return $ roleNames ; }
Return s the role names as array .
54,880
public function getConnectionHandlersAsArray ( ) { $ connectionHandlers = array ( ) ; foreach ( $ this -> getConnectionHandlers ( ) as $ connectionHandler ) { $ connectionHandlers [ $ connectionHandler -> getUuid ( ) ] = $ connectionHandler -> getType ( ) ; } return $ connectionHandlers ; }
Returns the connection handlers as an associative array
54,881
public function getServersAsArray ( ) { $ servers = array ( ) ; foreach ( $ this -> getServers ( ) as $ server ) { $ servers [ $ server -> getName ( ) ] = $ server ; } return $ servers ; }
Returns the servers as array with the server name as key .
54,882
public function getServer ( $ name ) { foreach ( $ this -> getServers ( ) as $ server ) { if ( $ name === $ server -> getName ( ) ) { return $ server ; } } }
Returns the server with the passed name .
54,883
public function merge ( ContainerConfigurationInterface $ containerNode ) { foreach ( $ this -> getServers ( ) as $ serverNode ) { foreach ( $ containerNode -> getServers ( ) as $ serverNodeToMerge ) { if ( fnmatch ( $ serverNodeToMerge -> getName ( ) , $ serverNode -> getName ( ) ) ) { $ serverNode -> merge ( $ server...
This method merges the passed container node into this one .
54,884
public function getLocation ( $ condition ) { foreach ( $ this -> getLocations ( ) as $ location ) { if ( $ location -> getCondition ( ) === $ condition ) { return $ location ; } } return false ; }
Will return the location node with the specified condition and if nothing could be found we will return false .
54,885
public function getLocationsAsArray ( ) { $ locations = array ( ) ; foreach ( $ this -> getLocations ( ) as $ locationNode ) { $ locations [ $ locationNode -> getCondition ( ) ] = array ( 'condition' => $ locationNode -> getCondition ( ) , 'params' => $ locationNode -> getParamsAsArray ( ) , 'handlers' => $ locationNod...
Returns the locations as an associative array .
54,886
protected function getUsersPassword ( ) { $ application = RequestHandler :: getApplicationContext ( ) ; $ databaseNode = $ application -> getNamingDirectory ( ) -> search ( $ this -> lookupName ) -> getDatabase ( ) ; $ connection = DriverManager :: getConnection ( ConnectionUtil :: get ( $ application ) -> fromDatabase...
Returns the password for the user from the sharedMap data .
54,887
protected function getRoleSets ( ) { return Util :: getRoleSets ( $ this -> getUsername ( ) , new String ( $ this -> lookupName ) , new String ( $ this -> rolesQuery ) , $ this ) ; }
Execute the rolesQuery against the lookupName to obtain the roles for the authenticated user .
54,888
protected function loadDeploymentDescriptors ( ) { $ webappPath = $ this -> getApplication ( ) -> getWebappPath ( ) ; $ deploymentService = $ this -> getApplication ( ) -> newService ( 'AppserverIo\Appserver\Core\Api\DeploymentService' ) ; $ deploymentDescriptors = array ( $ deploymentService -> getConfdDir ( sprintf (...
Loads the environment aware deployment descriptors for the given manager .
54,889
public function login ( ) { $ this -> loginOk = false ; list ( $ this -> username , $ password ) = $ this -> getUsernameAndPassword ( ) ; if ( $ this -> username === null && $ password === null ) { $ this -> identity = $ this -> unauthenticatedIdentity ; } if ( $ this -> identity === null ) { try { $ this -> identity =...
Perform the authentication of username and password through LDAP .
54,890
protected function getRoleSets ( ) { $ this -> rolesSearch ( $ this -> username , $ this -> userDN ) ; return $ this -> setsMap -> toArray ( ) ; }
Overridden by subclasses to return the Groups that correspond to the to the role sets assigned to the user . Subclasses should create at least a Group named Roles that contains the roles assigned to the user .
54,891
protected function addRole ( $ groupName , $ name ) { $ application = RequestHandler :: getApplicationContext ( ) ; if ( $ this -> setsMap -> exists ( $ groupName ) === false ) { $ group = new SimpleGroup ( new String ( $ groupName ) ) ; $ this -> setsMap -> add ( $ groupName , $ group ) ; } else { $ group = $ this -> ...
Adds a role to the hash map with the roles .
54,892
protected function extractCNFromDN ( $ dn ) { $ splitArray = explode ( ',' , $ dn ) ; $ keyValue = array ( ) ; foreach ( $ splitArray as $ value ) { $ tempArray = explode ( '=' , $ value ) ; $ keyValue [ $ tempArray [ 0 ] ] = array ( ) ; $ keyValue [ $ tempArray [ 0 ] ] [ ] = $ tempArray [ 1 ] ; } return $ keyValue [ L...
Extracts the common name from a distinguished name .
54,893
protected function ldapConnect ( ) { if ( $ ldapConnection = ldap_connect ( $ this -> ldapUrl , $ this -> ldapPort ) ) { if ( $ this -> ldapStartTls ) { ldap_start_tls ( $ ldapConnection ) ; } ldap_set_option ( $ ldapConnection , LDAP_OPT_PROTOCOL_VERSION , 3 ) ; if ( $ this -> allowEmptyPasswords ) { $ bind = ldap_bin...
Creates a new connection to the ldap server binds to the LDAP server and returns the connection
54,894
public function mergeServletContext ( ServletContextInterface $ context ) { if ( $ context -> hasSessionParameters ( ) === true ) { if ( ( $ garbageCollectionProbability = $ context -> getSessionParameter ( ServletSessionInterface :: GARBAGE_COLLECTION_PROBABILITY ) ) !== null ) { $ this -> setGarbageCollectionProbabil...
Merges the values of the passed settings into this instance and overwrites the one of this instance .
54,895
public function process ( RequestInterface $ request , ResponseInterface $ response , RequestContextInterface $ requestContext , $ hook ) { if ( ModuleHooks :: REQUEST_POST !== $ hook ) { return ; } if ( $ requestContext -> getServerVar ( ServerVars :: SERVER_HANDLER ) !== $ this -> getModuleName ( ) ) { return ; } $ a...
Process servlet request .
54,896
public function getFileHandlersAsArray ( ) { $ fileHandlers = array ( ) ; foreach ( $ this -> getFileHandlers ( ) as $ fileHandler ) { $ fileHandlers [ $ fileHandler -> getExtension ( ) ] = array ( 'name' => $ fileHandler -> getName ( ) , 'params' => $ fileHandler -> getParamsAsArray ( ) ) ; } return $ fileHandlers ; }
Returns the file handlers as an associative array .
54,897
public function registerMessageQueues ( ApplicationInterface $ application ) { $ this -> directories = new GenericStackable ( ) ; $ this -> directories [ ] = $ application -> getNamingDirectory ( ) ; $ service = $ application -> newService ( 'AppserverIo\Appserver\Core\Api\DeploymentService' ) ; $ xmlFiles = $ service ...
Deploys the message queues .
54,898
public function registeMessageQueue ( MessageQueueNodeInterface $ messageQueueNode ) { $ type = $ messageQueueNode -> getType ( ) ; $ destination = $ messageQueueNode -> getDestination ( ) -> __toString ( ) ; $ messageQueue = new MessageQueue ( ) ; $ messageQueue -> injectType ( $ type ) ; $ messageQueue -> injectName ...
Deploys the message queue described by the passed node .
54,899
public function createSenderForQueue ( $ lookupName , $ sessionId = null ) { $ application = $ this -> getApplication ( ) ; $ applicationName = $ application -> getName ( ) ; $ webappPath = $ application -> getWebappPath ( ) ; $ properties = null ; if ( $ baseDirectory = $ this -> getManagerSettings ( ) -> getBaseDirec...
Return a new sender for the message queue with the passed lookup name .