/** Creates a session
*
* Builds the corresponding workspace instance
*
* @param FactoryInterface $factory the object factory
* @param Repository $repository
* @param string $workspaceName the workspace name that is used
* @param SimpleCredentials $credentials the credentials that where
* used to log in, in order to implement Session::getUserID()
* if they are null, getUserID returns null
* @param TransportInterface $transport the transport implementation
*/
public function __construct(FactoryInterface $factory, Repository $repository, $workspaceName, SimpleCredentials $credentials = null, TransportInterface $transport)
{
$this->factory = $factory;
$this->repository = $repository;
$this->objectManager = $this->factory->get('ObjectManager', array($transport, $this));
$this->workspace = $this->factory->get('Workspace', array($this, $this->objectManager, $workspaceName));
$this->credentials = $credentials;
$this->namespaceRegistry = $this->workspace->getNamespaceRegistry();
self::registerSession($this);
$transport->setNodeTypeManager($this->workspace->getNodeTypeManager());
}