PHP Класс Jackalope\Transport\Jackrabbit\Client

This class handles the communication between Jackalope and Jackrabbit over Davex. Once the login method has been called, the workspace is set and can not be changed anymore. We make one exception to the rule that nothing may be cached in the transport: Repository descriptors are considered immutable and cached (because they are also used in startup to check the backend version is compatible).
Автор: Christian Stocker ([email protected])
Автор: David Buchmann ([email protected])
Автор: Tobias Ebnöther ([email protected])
Автор: Roland Schilter ([email protected])
Автор: Uwe Jäger ([email protected])
Автор: Lukas Kahwe Smith ([email protected])
Автор: Daniel Barsotti ([email protected])
Автор: Markus Schmucker ([email protected])
Наследование: extends Jackalope\Transport\BaseTransport, implements Jackalope\Transport\QueryInterface, implements Jackalope\Transport\PermissionInterface, implements Jackalope\Transport\WritingInterface, implements Jackalope\Transport\VersioningInterface, implements Jackalope\Transport\NodeTypeCndManagementInterface, implements Jackalope\Transport\LockingInterface, implements Jackalope\Transport\ObservationInterface, implements Jackalope\Transport\WorkspaceManagementInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$checkLoginOnServer boolean Check if an initial PROPFIND should be send to check if repository exists This is according to the JCR specifications and set to true by default
$credentials PHPCR\SimpleCredentials Set once login() has been executed and may not be changed later on.
$curl Jackalope\Transport\Jackrabbit\curl The cURL resource handle
$defaultHeaders array[]string A list of additional HTTP headers to be sent on each request
$descriptors This is our exception to the rule that nothing may be cached in transport.
$factory Jackalope\FactoryInterface The factory to instantiate objects
$jsopBody
$nodeTypeManager Jackalope\NodeType\NodeTypeManager
$sendExpect Send Expect: 100-continue header
$server string i.e http://localhost:8080/server/ constructor ensures the trailing slash /
$typeXmlConverter Jackalope\NodeType\NodeTypeXmlConverter
$userData
$valueConverter PHPCR\Util\ValueConverter
$workspace string Set once login() has been executed and may not be changed later on.
$workspaceUri string "$server/$workspace" without trailing slash
$workspaceUriRoot string "$server/$workspace/jcr%3aroot (make sure you never hardcode the jcr%3aroot, its ugly)

Открытые методы

Метод Описание
__construct ( Jackalope\FactoryInterface $factory, string $serverUri ) Create a transport pointing to a server url.
__destruct ( ) Tidies up the current cUrl connection.
addCurlOptions ( array $options ) : array Add global curl-options.
addDefaultHeader ( string $header ) Add a HTTP header which is sent on each Request.
addVersionLabel ( $versionPath, $label, $moveLabel )
checkinItem ( $path ) {@inheritDoc}
checkoutItem ( $path ) {@inheritDoc}
cloneFrom ( $srcWorkspace, $srcAbsPath, $destAbsPath, $removeExisting ) {@inheritDoc}
copyNode ( $srcAbsPath, $dstAbsPath, $srcWorkspace = null ) {@inheritDoc}
createWorkspace ( $name, $srcWorkspace = null ) {@inheritDoc}
deleteNodeImmediately ( $path ) {@inheritDoc}
deleteNodes ( array $operations ) {@inheritDoc}
deleteProperties ( array $operations ) {@inheritDoc}
deletePropertyImmediately ( $path ) {@inheritDoc}
deleteWorkspace ( $name )
fetchEventData ( $date ) : array Internal method to fetch event data.
finishSave ( ) {@inheritDoc}
forceHttpVersion10 ( $forceHttpVersion10 = true ) Set to true to force HTTP version 1.0
getAccessibleWorkspaceNames ( ) {@inheritDoc}
getBinaryStream ( $path ) {@inheritDoc}
getEvents ( $date, PHPCR\Observation\EventFilterInterface $filter, PHPCR\SessionInterface $session ) {@inheritDoc}
getNamespaces ( ) {@inheritDoc}
getNode ( $path ) {@inheritDoc}
getNodeByIdentifier ( $uuid ) {@inheritDoc}
getNodePathForIdentifier ( $uuid, $workspace = null ) {@inheritDoc}
getNodeTypes ( $nodeTypes = [] ) {@inheritDoc}
getNodes ( $paths, $query = ':include' ) {@inheritDoc}
getNodesByIdentifier ( $identifiers ) {@inheritDoc}
getPermissions ( $path ) {@inheritDoc}
getProperty ( $path ) {@inheritDoc}
getReferences ( $path, $name = null ) {@inheritDoc}
getRepositoryDescriptors ( ) {@inheritDoc}
getSupportedQueryLanguages ( ) {@inheritDoc}
getUserData ( ) : mixed
getWeakReferences ( $path, $name = null ) {@inheritDoc}
getWorkspaceUri ( ) : null | string Return the URL to the workspace determined during login
isLocked ( $absPath ) {@inheritDoc}
lockNode ( $absPath, $isDeep, $isSessionScoped, $timeoutHint = PHP_INT_MAX, $ownerInfo = null ) {@inheritDoc}
login ( PHPCR\CredentialsInterface $credentials = null, $workspaceName = null ) {@inheritDoc}
logout ( ) {@inheritDoc}
moveNodeImmediately ( $srcAbsPath, $dstAbsPath ) {@inheritDoc}
moveNodes ( array $operations ) {@inheritDoc}
prepareSave ( ) {@inheritDoc}
query ( Query $query ) {@inheritDoc}
registerNamespace ( $prefix, $uri ) {@inheritDoc}
registerNodeTypesCnd ( $cnd, $allowUpdate ) {@inheritDoc}
removeVersion ( $versionPath, $versionName ) {@inheritDoc}
removeVersionLabel ( $versionPath, $label )
reorderChildren ( Node $node ) {@inheritDoc}
restoreItem ( $removeExisting, $versionPath, $path ) {@inheritDoc}
rollbackSave ( ) {@inheritDoc}
sendExpect ( boolean $send = true ) If you want to send the "Expect: 100-continue" header on larger PUT and POST requests, set this to true.
setCheckLoginOnServer ( $bool ) Configure whether to check if we are logged in before doing a request.
setNodeTypeManager ( $nodeTypeManager ) {@inheritDoc}
setUserData ( $userData ) {@inheritDoc}
storeNodes ( array $operations ) {@inheritDoc}
unlock ( $absPath, $lockToken ) {@inheritDoc}
unregisterNamespace ( $prefix ) {@inheritDoc}
updateNode ( Node $node, $srcWorkspace ) {@inheritDoc}
updateProperties ( Node $node ) {@inheritDoc}

Защищенные методы

Метод Описание
addWorkspacePathToUri ( string $uri ) : string Prepends the workspace root to the uris that contain an absolute path
buildLocateRequest ( string $uuid ) : string Build REPORT XML request for locating a node path by uuid
buildNodeTypesRequest ( array $nodeTypes ) : string Returns the XML required to request nodetypes
buildPropfindRequest ( array $properties ) : string Build PROPFIND request XML for the specified property names
buildRegisterNamespaceRequest ( array $mappings ) Build the xml to update the namespaces
buildRegisterNodeTypeRequest ( string $cnd, $allowUpdate ) : string Build the xml required to register node types
buildReportRequest ( string $name ) : string Build a REPORT XML request string
checkForExistingNode ( $srcWorkspace, $srcAbsPath, $destAbsPath ) Prevent accidental creation of same name siblings during clone operation.
createNodeJsop ( string $path, array $properties ) : string create the node markup and a list of value dispatches for multivalue properties
deleteItem ( string $path ) Record that we need to delete the item at $path
encodeAndValidatePathForDavex ( string $path ) : string Checks if the path is absolute and valid, and properly urlencodes special characters
generateLockFromDavResponse ( DOMElement $response, boolean $sessionOwning = false, string $path = null ) : Lock Extract the information from a LOCK DAV response and create the corresponding Lock object.
getCurl ( )
getMimePart ( $name, $value, $mime_boundary )
getNodeReferences ( string $path, string $name = null, boolean $weak_reference = false ) : array
getRequest ( $method, $uri, $addWorkspacePathToUri = true ) : Request Makes sure there is an open curl connection.
getRequiredDomElementByTagNameNS ( DOMNode $dom, string $namespace, string $element, string $errorMessage = '' ) : boolean | DOMNode Retrieve a child DOM element from a DOM element.
isStringValid ( $string ) : boolean Checks for occurrence of invalid UTF characters, that can not occur in valid XML document.
parseTimeout ( string $timeoutValue ) : integer Parse the timeout value from a WebDAV response and calculate the expire timestamp.
propertyToJsopString ( Property $property ) : mixed | string This method is used when building a JSOP of the properties
setJsopBody ( $value, $key = ":diff", $type = null )
stripServerRootFromUri ( string $uri ) : string remove the server and workspace part from an uri, leaving the absolute path inside the current workspace
updateLastModified ( Node $node ) Update the lastModified fields if they where not set manually.

Приватные методы

Метод Описание
copyNodeOtherWorkspace ( string $srcAbsPath, $dstAbsPath, string $srcWorkspace ) For copy from a different workspace, needs to be a JSOP.
copyNodeSameWorkspace ( string $srcAbsPath, $dstAbsPath ) For copy within the same workspace, this is a COPY request.
decodeBinaryDom ( string $xml ) : array parse the multivalue binary response (a list of base64 encoded values)
getDcrValue ( DOMElement $node ) : mixed Get the value of a dcr:value node in the right format specified by the dcr type.
removeTrailingSlash ( string $path ) : string Remove the trailing slash if present. Used for backend responses when jackrabbit is sloppy
storeProperty ( Property $property )

Описание методов

__construct() публичный Метод

Create a transport pointing to a server url.
public __construct ( Jackalope\FactoryInterface $factory, string $serverUri )
$factory Jackalope\FactoryInterface the object factory
$serverUri string location of the server

__destruct() публичный Метод

Tidies up the current cUrl connection.
public __destruct ( )

addCurlOptions() публичный Метод

This options will be used foreach curl-request.
public addCurlOptions ( array $options ) : array
$options array
Результат array all curl-options

addDefaultHeader() публичный Метод

This is used for example for a session identifier header to help a proxy to route all requests from the same session to the same server. This is a Jackrabbit Davex specific option called from the repository factory.
public addDefaultHeader ( string $header )
$header string a valid HTTP header to add to each request

addVersionLabel() публичный Метод

public addVersionLabel ( $versionPath, $label, $moveLabel )

addWorkspacePathToUri() защищенный Метод

Prepends the workspace root to the uris that contain an absolute path
protected addWorkspacePathToUri ( string $uri ) : string
$uri string The absolute path in the current workspace or server uri
Результат string The server uri with this path

buildLocateRequest() защищенный Метод

Build REPORT XML request for locating a node path by uuid
protected buildLocateRequest ( string $uuid ) : string
$uuid string Unique identifier of the node to be asked for.
Результат string XML sring representing the content of the request.

buildNodeTypesRequest() защищенный Метод

Returns the XML required to request nodetypes
protected buildNodeTypesRequest ( array $nodeTypes ) : string
$nodeTypes array
Результат string XML with the request information.

buildPropfindRequest() защищенный Метод

Build PROPFIND request XML for the specified property names
protected buildPropfindRequest ( array $properties ) : string
$properties array names of the properties to search for
Результат string XML to post in the body

buildRegisterNamespaceRequest() защищенный Метод

You need to repeat all existing node type plus add your new ones
protected buildRegisterNamespaceRequest ( array $mappings )
$mappings array hashmap of prefix => uri for all existing and new namespaces

buildRegisterNodeTypeRequest() защищенный Метод

Build the xml required to register node types
Автор: david at liip.ch
protected buildRegisterNodeTypeRequest ( string $cnd, $allowUpdate ) : string
$cnd string the node type definition
Результат string XML with register request

buildReportRequest() защищенный Метод

Build a REPORT XML request string
protected buildReportRequest ( string $name ) : string
$name string Name of the resource to be requested.
Результат string XML string representing the head of the request.

checkForExistingNode() защищенный Метод

Jackrabbit supports them, but jackalope does not.
protected checkForExistingNode ( $srcWorkspace, $srcAbsPath, $destAbsPath )
$srcWorkspace
$srcAbsPath
$destAbsPath

checkinItem() публичный Метод

{@inheritDoc}
public checkinItem ( $path )

checkoutItem() публичный Метод

{@inheritDoc}
public checkoutItem ( $path )

cloneFrom() публичный Метод

{@inheritDoc}
public cloneFrom ( $srcWorkspace, $srcAbsPath, $destAbsPath, $removeExisting )

copyNode() публичный Метод

{@inheritDoc}
public copyNode ( $srcAbsPath, $dstAbsPath, $srcWorkspace = null )

createNodeJsop() защищенный Метод

create the node markup and a list of value dispatches for multivalue properties
protected createNodeJsop ( string $path, array $properties ) : string
$path string path to the current node with the last path segment being the node name
$properties array of this node
Результат string the xml for the node

createWorkspace() публичный Метод

{@inheritDoc}
public createWorkspace ( $name, $srcWorkspace = null )

deleteItem() защищенный Метод

Record that we need to delete the item at $path
protected deleteItem ( string $path )
$path string path to node or property

deleteNodeImmediately() публичный Метод

{@inheritDoc}
public deleteNodeImmediately ( $path )

deleteNodes() публичный Метод

{@inheritDoc}
public deleteNodes ( array $operations )
$operations array

deleteProperties() публичный Метод

{@inheritDoc}
public deleteProperties ( array $operations )
$operations array

deletePropertyImmediately() публичный Метод

{@inheritDoc}
public deletePropertyImmediately ( $path )

deleteWorkspace() публичный Метод

public deleteWorkspace ( $name )

encodeAndValidatePathForDavex() защищенный Метод

This is to be used in the Davex headers. The XML requests can cope with unencoded stuff
protected encodeAndValidatePathForDavex ( string $path ) : string
$path string to check
Результат string the cleaned path

fetchEventData() публичный Метод

Internal method to fetch event data.
public fetchEventData ( $date ) : array
$date
Результат array hashmap with 'data' containing unfiltered DOM of xml atom feed of events, 'nextMillis' is the next timestamp if there are more events to be found, false otherwise.

finishSave() публичный Метод

{@inheritDoc}
public finishSave ( )

forceHttpVersion10() публичный Метод

Set to true to force HTTP version 1.0
Устаревший: use addCurlOptions([CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0]) instead
public forceHttpVersion10 ( $forceHttpVersion10 = true )

generateLockFromDavResponse() защищенный Метод

Extract the information from a LOCK DAV response and create the corresponding Lock object.
protected generateLockFromDavResponse ( DOMElement $response, boolean $sessionOwning = false, string $path = null ) : Lock
$response DOMElement
$sessionOwning boolean whether the current session is owning the lock (aka we created it in this request)
$path string the owning node path, if we created this node
Результат Jackalope\Lock\Lock

getAccessibleWorkspaceNames() публичный Метод

{@inheritDoc}

getBinaryStream() публичный Метод

{@inheritDoc}
public getBinaryStream ( $path )

getCurl() защищенный Метод

protected getCurl ( )

getEvents() публичный Метод

{@inheritDoc}
public getEvents ( $date, PHPCR\Observation\EventFilterInterface $filter, PHPCR\SessionInterface $session )
$filter PHPCR\Observation\EventFilterInterface
$session PHPCR\SessionInterface

getMimePart() защищенный Метод

protected getMimePart ( $name, $value, $mime_boundary )

getNamespaces() публичный Метод

{@inheritDoc}
public getNamespaces ( )

getNode() публичный Метод

{@inheritDoc}
public getNode ( $path )

getNodeByIdentifier() публичный Метод

{@inheritDoc}
public getNodeByIdentifier ( $uuid )

getNodePathForIdentifier() публичный Метод

{@inheritDoc}
public getNodePathForIdentifier ( $uuid, $workspace = null )

getNodeReferences() защищенный Метод

protected getNodeReferences ( string $path, string $name = null, boolean $weak_reference = false ) : array
$path string the path for which we need the references
$name string the name of the referencing properties or null for all
$weak_reference boolean whether to get weak or strong references
Результат array list of paths to nodes that reference $path

getNodeTypes() публичный Метод

{@inheritDoc}
public getNodeTypes ( $nodeTypes = [] )

getNodes() публичный Метод

{@inheritDoc}
public getNodes ( $paths, $query = ':include' )

getNodesByIdentifier() публичный Метод

{@inheritDoc}
public getNodesByIdentifier ( $identifiers )

getPermissions() публичный Метод

{@inheritDoc}
public getPermissions ( $path )

getProperty() публичный Метод

{@inheritDoc}
public getProperty ( $path )

getReferences() публичный Метод

{@inheritDoc}
public getReferences ( $path, $name = null )

getRepositoryDescriptors() публичный Метод

{@inheritDoc}

getRequest() защищенный Метод

Makes sure there is an open curl connection.
protected getRequest ( $method, $uri, $addWorkspacePathToUri = true ) : Request
Результат Request The Request

getRequiredDomElementByTagNameNS() защищенный Метод

If the element is not found and $errorMessage is set, then a RepositoryException is thrown. If the element is not found and $errorMessage is empty, then false is returned.
protected getRequiredDomElementByTagNameNS ( DOMNode $dom, string $namespace, string $element, string $errorMessage = '' ) : boolean | DOMNode
$dom DOMNode The DOM element which content should be searched
$namespace string The namespace of the searched element
$element string The name of the searched element
$errorMessage string The error message in case the element is not found
Результат boolean | DOMNode

getSupportedQueryLanguages() публичный Метод

{@inheritDoc}

getUserData() публичный Метод

public getUserData ( ) : mixed
Результат mixed null or string

getWeakReferences() публичный Метод

{@inheritDoc}
public getWeakReferences ( $path, $name = null )

getWorkspaceUri() публичный Метод

Return the URL to the workspace determined during login
public getWorkspaceUri ( ) : null | string
Результат null | string

isLocked() публичный Метод

{@inheritDoc}
public isLocked ( $absPath )

isStringValid() защищенный Метод

If occurrence is found, returns false, otherwise true. Invalid characters were taken from this list: http://en.wikipedia.org/wiki/Valid_characters_in_XML#XML_1.0 Uses regexp mentioned here: http://stackoverflow.com/a/961504
protected isStringValid ( $string ) : boolean
$string string value
Результат boolean true if string is OK, false otherwise.

lockNode() публичный Метод

{@inheritDoc}
public lockNode ( $absPath, $isDeep, $isSessionScoped, $timeoutHint = PHP_INT_MAX, $ownerInfo = null )

login() публичный Метод

{@inheritDoc}
public login ( PHPCR\CredentialsInterface $credentials = null, $workspaceName = null )
$credentials PHPCR\CredentialsInterface

logout() публичный Метод

{@inheritDoc}
public logout ( )

moveNodeImmediately() публичный Метод

{@inheritDoc}
public moveNodeImmediately ( $srcAbsPath, $dstAbsPath )

moveNodes() публичный Метод

{@inheritDoc}
public moveNodes ( array $operations )
$operations array

parseTimeout() защищенный Метод

The timeout value follows the syntax defined in RFC2518: Timeout Header. Here we just parse the values in the form "Second-XXXX" or "Infinite". Any other value will produce an error. The function returns the unix epoch timestamp for the second when this lock will expire in case of normal timeout, or PHP_INT_MAX in case of an "Infinite" timeout.
protected parseTimeout ( string $timeoutValue ) : integer
$timeoutValue string The timeout in seconds or PHP_INT_MAX for infinite
Результат integer the expire timestamp to be used with Lock::setExpireTime, that is when this lock expires in seconds since 1970 or null for inifinite

prepareSave() публичный Метод

{@inheritDoc}
public prepareSave ( )

propertyToJsopString() защищенный Метод

This method is used when building a JSOP of the properties
protected propertyToJsopString ( Property $property ) : mixed | string
$property Jackalope\Property
Результат mixed | string

query() публичный Метод

{@inheritDoc}
public query ( Query $query )
$query Jackalope\Query\Query

registerNamespace() публичный Метод

{@inheritDoc}
public registerNamespace ( $prefix, $uri )

registerNodeTypesCnd() публичный Метод

{@inheritDoc}
public registerNodeTypesCnd ( $cnd, $allowUpdate )

removeVersion() публичный Метод

{@inheritDoc}
public removeVersion ( $versionPath, $versionName )

removeVersionLabel() публичный Метод

public removeVersionLabel ( $versionPath, $label )

reorderChildren() публичный Метод

{@inheritDoc}
public reorderChildren ( Node $node )
$node Jackalope\Node

restoreItem() публичный Метод

{@inheritDoc}
public restoreItem ( $removeExisting, $versionPath, $path )

rollbackSave() публичный Метод

{@inheritDoc}
public rollbackSave ( )

sendExpect() публичный Метод

This is a Jackrabbit Davex specific option.
public sendExpect ( boolean $send = true )
$send boolean Whether to send the header or not

setCheckLoginOnServer() публичный Метод

Will improve error reporting at the cost of some round trips.
public setCheckLoginOnServer ( $bool )

setJsopBody() защищенный Метод

protected setJsopBody ( $value, $key = ":diff", $type = null )

setNodeTypeManager() публичный Метод

{@inheritDoc}
public setNodeTypeManager ( $nodeTypeManager )

setUserData() публичный Метод

{@inheritDoc}
public setUserData ( $userData )

storeNodes() публичный Метод

{@inheritDoc}
public storeNodes ( array $operations )
$operations array

stripServerRootFromUri() защищенный Метод

remove the server and workspace part from an uri, leaving the absolute path inside the current workspace
protected stripServerRootFromUri ( string $uri ) : string
$uri string a full uri including the server path, workspace and jcr%3aroot
Результат string absolute path in the current work space

unlock() публичный Метод

{@inheritDoc}
public unlock ( $absPath, $lockToken )

unregisterNamespace() публичный Метод

{@inheritDoc}
public unregisterNamespace ( $prefix )

updateLastModified() защищенный Метод

Note that we can drop this if this jackrabbit issue ever gets implemented https://issues.apache.org/jira/browse/JCR-2233
protected updateLastModified ( Node $node )
$node Jackalope\Node

updateNode() публичный Метод

{@inheritDoc}
public updateNode ( Node $node, $srcWorkspace )
$node Jackalope\Node

updateProperties() публичный Метод

{@inheritDoc}
public updateProperties ( Node $node )
$node Jackalope\Node

Описание свойств

$checkLoginOnServer защищенное свойство

Check if an initial PROPFIND should be send to check if repository exists This is according to the JCR specifications and set to true by default
См. также: setCheckLoginOnServer
protected bool $checkLoginOnServer
Результат boolean

$credentials защищенное свойство

Set once login() has been executed and may not be changed later on.
protected SimpleCredentials,PHPCR $credentials
Результат PHPCR\SimpleCredentials

$curl защищенное свойство

The cURL resource handle
protected curl,Jackalope\Transport\Jackrabbit $curl
Результат Jackalope\Transport\Jackrabbit\curl

$defaultHeaders защищенное свойство

A list of additional HTTP headers to be sent on each request
protected array[]string $defaultHeaders
Результат array[]string

$descriptors защищенное свойство

This is our exception to the rule that nothing may be cached in transport.
protected $descriptors

$factory защищенное свойство

The factory to instantiate objects
protected FactoryInterface,Jackalope $factory
Результат Jackalope\FactoryInterface

$jsopBody защищенное свойство

protected $jsopBody

$nodeTypeManager защищенное свойство

protected NodeTypeManager,Jackalope\NodeType $nodeTypeManager
Результат Jackalope\NodeType\NodeTypeManager

$sendExpect защищенное свойство

Send Expect: 100-continue header
protected $sendExpect

$server защищенное свойство

i.e http://localhost:8080/server/ constructor ensures the trailing slash /
protected string $server
Результат string

$typeXmlConverter защищенное свойство

protected NodeTypeXmlConverter,Jackalope\NodeType $typeXmlConverter
Результат Jackalope\NodeType\NodeTypeXmlConverter

$userData защищенное свойство

protected $userData

$valueConverter защищенное свойство

protected ValueConverter,PHPCR\Util $valueConverter
Результат PHPCR\Util\ValueConverter

$workspace защищенное свойство

Set once login() has been executed and may not be changed later on.
protected string $workspace
Результат string

$workspaceUri защищенное свойство

"$server/$workspace" without trailing slash
protected string $workspaceUri
Результат string

$workspaceUriRoot защищенное свойство

"$server/$workspace/jcr%3aroot (make sure you never hardcode the jcr%3aroot, its ugly)
protected string $workspaceUriRoot
Результат string