PHP Class AppserverIo\Appserver\Core\Api\AbstractService

Author: Tim Wagner ([email protected])
Author: Bernhard Wick ([email protected])
Inheritance: implements AppserverIo\Appserver\Core\Api\ServiceInterface
Show file Open project: appserver-io/appserver Class Usage Examples

Protected Properties

Property Type Description
$initialContext AppserverIo\Appserver\Core\InitialContext The initial context instance containing the system configuration.
$node AppserverIo\Configuration\Interfaces\NodeInterface; The initialized base directory node.
$normalizer AppserverIo\Appserver\Core\Api\NormalizerInterface The normalizer instance to use.

Public Methods

Method Description
__construct ( InitialContext $initialContext ) Initializes the service with the initial context instance and the default normalizer instance.
getBaseDirectory ( string | null $directoryToAppend = null ) : string Returns the application servers base directory.
getConfDir ( string $relativePathToAppend = '' ) : string Return's the server's main configuration directory.
getConfdDir ( string $relativePathToAppend = '' ) : string Return's the server's configuration subdirectory.
getDeployDir ( AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode, string $relativePathToAppend = '' ) : string Returns the servers deploy directory.
getDirectories ( ) : array Returns the directory structure to be created at first start.
getEtcDir ( string $relativePathToAppend = '' ) : string Return's the server's base configuration directory.
getFiles ( ) : array Returns the files to be created at first start.
getInitialContext ( ) : InitialContext (non-PHPdoc)
getLogDir ( string $relativePathToAppend = '' ) : string Returns the servers log directory.
getOsIdentifier ( ) : string Will return a three character OS identifier e.g. WIN or LIN
getServerSignature ( ) : string Returns the real server signature depending on the installed appserver version and the PHP version we're running on, for example:
getSystemConfiguration ( ) : AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface (non-PHPdoc)
getSystemProperties ( AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode = null ) : AppserverIo\Properties\Properties Returns the system proprties. If a container node has been passed, the container properties will also be appended.
getSystemTmpDir ( string $relativePathToAppend = '' ) : string Return's the system's temporary directory.
getTmpDir ( AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode, string $relativePathToAppend = '' ) : string Returns the servers tmp directory, append with the passed directory.
getWebappsDir ( AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode, string $relativePathToAppend = '' ) : string Returns the servers webapps directory.
globDir ( string $pattern, integer $flags, boolean $recursive = true ) : array Parses and returns the directories and files that matches the passed glob pattern in a recursive way (if wanted).
makePathAbsolute ( string $path = '' ) : string Makes the path an absolute path or returns null if passed path is empty.
newInstance ( string $className, array $args = [] ) : object (non-PHPdoc)
newService ( string $className ) : AppserverIo\Appserver\Core\Api\ServiceInterface (non-PHPdoc)
persist ( AppserverIo\Configuration\Interfaces\NodeInterface $node ) : void Persists the system configuration.
realpath ( string $relativePathToAppend ) : string Returns the absolute path to the passed directory, also working on Windows.
setSystemConfiguration ( AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface $systemConfiguration ) : AppserverIo\Appserver\Core\Api\ServiceInterface (non-PHPdoc)

Method Details

__construct() public method

Initializes the service with the initial context instance and the default normalizer instance.
public __construct ( InitialContext $initialContext )
$initialContext AppserverIo\Appserver\Core\InitialContext The initial context instance

getBaseDirectory() public method

Returns the application servers base directory.
public getBaseDirectory ( string | null $directoryToAppend = null ) : string
$directoryToAppend string | null Append this directory to the base directory before returning it
return string The base directory

getConfDir() public method

Return's the server's main configuration directory.
public getConfDir ( string $relativePathToAppend = '' ) : string
$relativePathToAppend string A relative path to append
return string The server's main configuration directory

getConfdDir() public method

Return's the server's configuration subdirectory.
public getConfdDir ( string $relativePathToAppend = '' ) : string
$relativePathToAppend string A relative path to append
return string The server's configuration subdirectory

getDeployDir() public method

Returns the servers deploy directory.
public getDeployDir ( AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode, string $relativePathToAppend = '' ) : string
$containerNode AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface The container to return the deployment directory for
$relativePathToAppend string A relative path to append
return string

getDirectories() public method

Returns the directory structure to be created at first start.
public getDirectories ( ) : array
return array The directory structure to be created if necessary

getEtcDir() public method

Return's the server's base configuration directory.
public getEtcDir ( string $relativePathToAppend = '' ) : string
$relativePathToAppend string A relative path to append
return string The server's base configuration directory

getFiles() public method

Returns the files to be created at first start.
public getFiles ( ) : array
return array The files to be created if necessary

getInitialContext() public method

(non-PHPdoc)
See also: ServiceInterface::getInitialContext()
public getInitialContext ( ) : InitialContext
return AppserverIo\Appserver\Core\InitialContext The initial Context

getLogDir() public method

Returns the servers log directory.
public getLogDir ( string $relativePathToAppend = '' ) : string
$relativePathToAppend string A relative path to append
return string

getOsIdentifier() public method

Will return a three character OS identifier e.g. WIN or LIN
public getOsIdentifier ( ) : string
return string

getServerSignature() public method

appserver/1.0.1-45 (darwin) PHP/5.5.21
public getServerSignature ( ) : string
return string The server signature

getSystemConfiguration() public method

(non-PHPdoc)
See also: AppserverIo\Appserver\Core\Api\ServiceInterface::getSystemConfiguration()
public getSystemConfiguration ( ) : AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface
return AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface The system configuration

getSystemProperties() public method

Returns the system proprties. If a container node has been passed, the container properties will also be appended.
public getSystemProperties ( AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode = null ) : AppserverIo\Properties\Properties
$containerNode AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface The container to return the system properties for
return AppserverIo\Properties\Properties The system properties

getSystemTmpDir() public method

Return's the system's temporary directory.
public getSystemTmpDir ( string $relativePathToAppend = '' ) : string
$relativePathToAppend string A relative path to append
return string The system's temporary directory

getTmpDir() public method

Returns the servers tmp directory, append with the passed directory.
public getTmpDir ( AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode, string $relativePathToAppend = '' ) : string
$containerNode AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface The container to return the temporary directory for
$relativePathToAppend string A relative path to append
return string

getWebappsDir() public method

Returns the servers webapps directory.
public getWebappsDir ( AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $containerNode, string $relativePathToAppend = '' ) : string
$containerNode AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface The container to return the temporary directory for
$relativePathToAppend string A relative path to append
return string

globDir() public method

Parses and returns the directories and files that matches the passed glob pattern in a recursive way (if wanted).
public globDir ( string $pattern, integer $flags, boolean $recursive = true ) : array
$pattern string The glob pattern used to parse the directories
$flags integer The flags passed to the glob function
$recursive boolean Whether or not to parse directories recursively
return array The directories matches the passed glob pattern

makePathAbsolute() public method

Makes the path an absolute path or returns null if passed path is empty.
public makePathAbsolute ( string $path = '' ) : string
$path string A path to absolute
return string The absolute path

newInstance() public method

(non-PHPdoc)
See also: AppserverIo\Appserver\Core\InitialContext::newInstance()
public newInstance ( string $className, array $args = [] ) : object
$className string The fully qualified class name to return the instance for
$args array Arguments to pass to the constructor of the instance
return object The instance itself

newService() public method

(non-PHPdoc)
See also: AppserverIo\Appserver\Core\InitialContext::newService()
public newService ( string $className ) : AppserverIo\Appserver\Core\Api\ServiceInterface
$className string The API service class name to return the instance for
return AppserverIo\Appserver\Core\Api\ServiceInterface The service instance

persist() public method

Persists the system configuration.
public persist ( AppserverIo\Configuration\Interfaces\NodeInterface $node ) : void
$node AppserverIo\Configuration\Interfaces\NodeInterface A node to persist
return void

realpath() public method

Returns the absolute path to the passed directory, also working on Windows.
public realpath ( string $relativePathToAppend ) : string
$relativePathToAppend string The relativ path to return the absolute path for
return string The absolute path of the passed directory

setSystemConfiguration() public method

(non-PHPdoc)
See also: AppserverIo\Appserver\Core\Api\ServiceInterface::setSystemConfiguration()
public setSystemConfiguration ( AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface $systemConfiguration ) : AppserverIo\Appserver\Core\Api\ServiceInterface
$systemConfiguration AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface The system configuration
return AppserverIo\Appserver\Core\Api\ServiceInterface

Property Details

$initialContext protected property

The initial context instance containing the system configuration.
protected InitialContext,AppserverIo\Appserver\Core $initialContext
return AppserverIo\Appserver\Core\InitialContext

$node protected property

The initialized base directory node.
protected NodeInterface;,AppserverIo\Configuration\Interfaces $node
return AppserverIo\Configuration\Interfaces\NodeInterface;

$normalizer protected property

The normalizer instance to use.
protected NormalizerInterface,AppserverIo\Appserver\Core\Api $normalizer
return AppserverIo\Appserver\Core\Api\NormalizerInterface