Class AbstractSlingRepository2

    • Method Detail

      • getDefaultWorkspace

        public final java.lang.String getDefaultWorkspace()
        Returns the default workspace to login to if any of the login and createSession methods is called without an explicit workspace name.

        This method may return null in which case the actual default workspace used depends on the underlying JCR Repository implementation.

        Specified by:
        getDefaultWorkspace in interface SlingRepository
        Returns:
        null if the configured default workspace name is empty, SLING-256
      • login

        public Session login​(Credentials credentials,
                             java.lang.String workspace)
                      throws LoginException,
                             NoSuchWorkspaceException,
                             RepositoryException
        Logs into the repository at the given workspace with the given credentials and returns the session returned from the repository.

        This method logs in as a guest if null credentials are provided. The method may be overwritten to implement a different behaviour as indicated by the JCR specification for this method to use external mechanisms to login instead of leveraging provided credentials.

        This method may be overwritten.

        Specified by:
        login in interface Repository
        Parameters:
        credentials - The Credentials to use to login. If this is null JCR GuestCredentials are used to login.
        workspace - The workspace to access or null to access the default workspace
        Returns:
        a valid session for the user to access the repository.
        Throws:
        LoginException - If login is not possible
        NoSuchWorkspaceException - if the desired workspace is not available
        RepositoryException - If another error occurrs during login
      • getDescriptor

        public java.lang.String getDescriptor​(java.lang.String name)
        Description copied from interface: Repository

        A convenience method. The call

        String s = repository.getDescriptor(key);

        is equivalent to

        Value v = repository.getDescriptorValue(key);
        String s = (v == null) ? null : v.getString();

        Specified by:
        getDescriptor in interface Repository
        Parameters:
        name - a descriptor key.
        Returns:
        a descriptor value in string form.
      • getDescriptorKeys

        public java.lang.String[] getDescriptorKeys()
        Description copied from interface: Repository
        Returns a string array holding all descriptor keys available for this implementation, both the standard descriptors defined by the string constants in this interface and any implementation-specific descriptors. Used in conjunction with Repository.getDescriptorValue(String key) and Repository.getDescriptorValues(String key) to query information about this repository implementation.
        Specified by:
        getDescriptorKeys in interface Repository
        Returns:
        a string array holding all descriptor keys.
      • getDescriptorValue

        public Value getDescriptorValue​(java.lang.String key)
        Description copied from interface: Repository
        The value of a single-value descriptor is found by passing the key for that descriptor to this method. If key is the key of a multi-value descriptor or not a valid key this method returns null.
        Specified by:
        getDescriptorValue in interface Repository
        Parameters:
        key - a descriptor key.
        Returns:
        The value of the indicated descriptor
      • getDescriptorValues

        public Value[] getDescriptorValues​(java.lang.String key)
        Description copied from interface: Repository
        The value array of a multi-value descriptor is found by passing the key for that descriptor to this method. If key is the key of a single-value descriptor then this method returns that value as an array of size one. If key is not a valid key this method returns null.
        Specified by:
        getDescriptorValues in interface Repository
        Parameters:
        key - a descriptor key.
        Returns:
        the value array for the indicated descriptor
      • isSingleValueDescriptor

        public boolean isSingleValueDescriptor​(java.lang.String key)
        Description copied from interface: Repository
        Returns true if key is a valid single-value descriptor; otherwise returns false.
        Specified by:
        isSingleValueDescriptor in interface Repository
        Parameters:
        key - a descriptor key.
        Returns:
        whether the specified desdfriptor is multi-valued.
      • isStandardDescriptor

        public boolean isStandardDescriptor​(java.lang.String key)
        Description copied from interface: Repository
        Returns true if key is a standard descriptor defined by the string constants in this interface and false if it is either a valid implementation-specific key or not a valid key.
        Specified by:
        isStandardDescriptor in interface Repository
        Parameters:
        key - a descriptor key.
        Returns:
        whether key is a standard descriptor.