/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { Repository } from "../../types/javax/jcr/Repository"; import type { String } from "../../types/java/lang/String"; import type { Object } from "../../types/java/lang/Object"; import type { Workspace } from "../../types/javax/jcr/Workspace"; import type { Node } from "../../types/javax/jcr/Node"; import type { Credentials } from "../../types/javax/jcr/Credentials"; import type { Item } from "../../types/javax/jcr/Item"; import type { Property } from "../../types/javax/jcr/Property"; import type { ValueFactory } from "../../types/javax/jcr/ValueFactory"; import type { InputStream } from "../../types/java/io/InputStream"; import type { OutputStream } from "../../types/java/io/OutputStream"; import type { AccessControlManager } from "../../types/javax/jcr/security/AccessControlManager"; import type { RetentionManager } from "../../types/javax/jcr/retention/RetentionManager"; /** * The Session object provides read and (in level 2) write access * to the content of a particular workspace in the repository. *

* The Session object is returned by {@link * Repository#login(Credentials, String) Repository.login()}. It encapsulates * both the authorization settings of a particular user (as specified by the * passed Credentials) and a binding to the workspace specified by * the workspaceName passed on login. *

* Each Session object is associated one-to-one with a * Workspace object. The Workspace object represents a * "view" of an actual repository workspace entity as seen through the * authorization settings of its associated Session. * *

Session instance retrieval in Sitevision

*

* An instance of this interface can be obtained via the request attribute "sitevision.jcr.session". * Below is an example of how to get hold of a Session instance from your custom JSR 286 portlet: *

*

 *     Session jcrSession = (Session) aPortletRequest.getAttribute("sitevision.jcr.session");
 *  
*

* This interface is annotated with {@link senselogic.sitevision.api.base.Requireable} so in server-side JavaScript you would typically obtain an instance of this interface via the require function: *

*

 *     var session = require('Session');
 *  
*

* In JCR capable portlets that are bundled with Sitevision and exposes a "Custom template", you typically have a Session instance * available as "$jcrSession" on the VelocityContext: *

*

 *     $jcrSession
 *  
*

* If $jcrSession is not available on the VelocityContext, use the portlet request (if available) to retrieve it. : *

*

 *     #set ($jcrSession = $request.getAttribute('sitevision.jcr.session'))
 *  
*/ export interface Session { /** * A constant representing the read action string, used to * determine if this Session has permission to retrieve an item * (and read the value, in the case of a property). * @see #hasPermission(String, String) * @see #checkPermission(String, String) * @since JCR 2.0 */ ACTION_READ: "read"; /** * A constant representing the add_node action string, used to * determine if this Session has permission to add a new node. * @see #hasPermission(String, String) * @see #checkPermission(String, String) * @since JCR 2.0 */ ACTION_ADD_NODE: "add_node"; /** * A constant representing the set_property action string, used * to determine if this Session has permission to set (add or * modify) a property. * @see #hasPermission(String, String) * @see #checkPermission(String, String) * @since JCR 2.0 */ ACTION_SET_PROPERTY: "set_property"; /** * A constant representing the remove action string, used to * determine if this Session has permission to remove an item. * @see #hasPermission(String, String) * @see #checkPermission(String, String) * @since JCR 2.0 */ ACTION_REMOVE: "remove"; /** * Returns the Repository object through which this session was * acquired. * @return a {@link Repository} object. */ getRepository(): Repository; /** * Gets the user ID associated with this Session. How the user * ID is set is up to the implementation, it may be a string passed in as * part of the credentials or it may be a string acquired in some other way. * This method is free to return an "anonymous user ID" or * null. * @return the user ID associated with this Session. */ getUserID(): string; /** * Returns the names of the attributes set in this session as a result of * the Credentials that were used to acquire it. Not all * Credentials implementations will contain attributes (though, * for example, SimpleCredentials does allow for them). This * method returns an empty array if the Credentials instance * did not provide attributes. * @return A string array containing the names of all attributes passed in the credentials used to acquire this session. */ getAttributeNames(): string; /** * Returns the value of the named attribute as an Object, or * null if no attribute of the given name exists. See {@link * Session#getAttributeNames}. * @param name the name of an attribute passed in the credentials used to acquire this session. * @return the value of the attribute or null if no attribute of the given name exists. */ getAttribute(name: String | string): unknown; /** * Returns the Workspace attached to this * Session. * @return a {@link Workspace} object. */ getWorkspace(): Workspace; /** * Returns the root node of the workspace, "/". This node is the main access * point to the content of the workspace. * @return The root node of the workspace: a {@link Node} object. * @throws RepositoryException if an error occurs. */ getRootNode(): Node; /** * Returns a new session in accordance with the specified (new) Credentials. * Allows the current user to "impersonate" another using incomplete or * relaxed credentials requirements (perhaps including a user name but no * password, for example), assuming that this Session gives * them that permission. *

* The new Session is tied to a new Workspace * instance. In other words, Workspace instances are not * re-used. However, the Workspace instance returned represents * the same actual persistent workspace entity in the repository as is * represented by the Workspace object tied to this * Session. * @param credentials A Credentials object * @return a Session object * @throws LoginException if the current session does not have sufficient access to perform the operation. * @throws RepositoryException if another error occurs. */ impersonate(credentials: Credentials): Session; /** * Returns the node specified by the given identifier. Applies to both * referenceable and non-referenceable nodes. * @param id An identifier. * @return A Node. * @throws ItemNotFoundException if no node with the specified identifier exists or if this Session does not have read access to the node with the specified identifier. * @throws RepositoryException if another error occurs. * @since JCR 2.0 */ getNodeByIdentifier(id: String | string): Node; /** * Returns the node at the specified absolute path in the workspace. If no * such node exists, then it returns the property at the specified path. *

* This method should only be used if the application does not know whether * the item at the indicated path is property or node. In cases where the * application has this information, either {@link #getNode} or {@link * #getProperty} should be used, as appropriate. In many repository * implementations the node and property-specific methods are likely to be * more efficient than getItem. * @param absPath An absolute path. * @return the specified Item. * @throws PathNotFoundException if no accessible item is found at the specified path. * @throws RepositoryException if another error occurs. */ getItem(absPath: String | string): Item; /** * Returns the node at the specified absolute path in the workspace. * @param absPath An absolute path. * @return the specified Node. * @throws PathNotFoundException If no accessible node is found at the specifed path. * @throws RepositoryException If another error occurs. * @since JCR 2.0 */ getNode(absPath: String | string): Node; /** * Returns the property at the specified absolute path in the workspace. * @param absPath An absolute path. * @return the specified Property. * @throws PathNotFoundException If no accessible property is found at the specified path. * @throws RepositoryException if another error occurs. * @since JCR 2.0 */ getProperty(absPath: String | string): Property; /** * Returns true if an item exists at absPath and * this Session has read access to it; otherwise returns * false. * @param absPath An absolute path. * @return a boolean * @throws RepositoryException if absPath is not a well-formed absolute path. */ itemExists(absPath: String | string): boolean; /** * Returns true if a node exists at absPath and * this Session has read access to it; otherwise returns * false. * @param absPath An absolute path. * @return a boolean * @throws RepositoryException if absPath is not a well-formed absolute path. * @since JCR 2.0 */ nodeExists(absPath: String | string): boolean; /** * Returns true if a property exists at absPath * and this Session has read access to it; otherwise returns * false. * @param absPath An absolute path. * @return a boolean * @throws RepositoryException if absPath is not a well-formed absolute path. * @since JCR 2.0 */ propertyExists(absPath: String | string): boolean; /** * This method returns a ValueFactory that is used to create * Value objects for use when setting repository properties. * @since Sitevision 3.0 * @return a ValueFactory * @throws UnsupportedRepositoryOperationException if writing to the repository is not supported. * @throws RepositoryException if another error occurs. */ getValueFactory(): ValueFactory; /** * Returns all prefixes currently mapped to URIs in this * Session. * @return a string array * @throws RepositoryException if an error occurs */ getNamespacePrefixes(): string; /** * Returns the URI to which the given prefix is mapped as * currently set in this Session. * @param prefix a string * @return a string * @throws NamespaceException if the specified prefix is unknown. * @throws RepositoryException if another error occurs */ getNamespaceURI(prefix: String | string): string; /** * Returns the prefix to which the given uri is mapped as * currently set in this Session. * @param uri a string * @return a string * @throws NamespaceException if the specified uri is unknown. * @throws RepositoryException if another error occurs */ getNamespacePrefix(uri: String | string): string; /** * Releases all resources associated with this Session. This * method should be called when a Session is no longer needed. */ logout(): void; /** * Returns true if this Session object is usable * by the client. Otherwise, returns false. A usable * Session is one that is neither logged-out, timed-out nor in * any other way disconnected from the repository. * @return true if this Session is usable, false otherwise. */ isLive(): boolean; } declare namespace Session {} declare var session: Session; export default session;