Class CommandLinePasswordManager

  • All Implemented Interfaces:
    com.nomagic.magicdraw.teamwork2.esi.protect.PasswordManager

    @OpenApiAll
    public class CommandLinePasswordManager
    extends java.lang.Object
    implements com.nomagic.magicdraw.teamwork2.esi.protect.PasswordManager
    Password manager implementation for command line utilities
    Version:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.nomagic.ci.persistence.ProjectDescriptor descriptor  
    • Constructor Summary

      Constructors 
      Constructor Description
      CommandLinePasswordManager​(com.nomagic.ci.persistence.ProjectDescriptor descriptor, com.nomagic.magicdraw.teamwork2.esi.protect.PasswordCheckingImpl implementation)
      Creates and initializes a new AbstractPasswordManager from specified parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean askPasswordIfProtected()
      If the specified resource is password protected then the method asks the user to enter a password.
      boolean isProtected()
      Checks whether the project is password protected.
      boolean isValidPassword​(char[] password)
      Returns true if the specified password is valid.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • descriptor

        protected final com.nomagic.ci.persistence.ProjectDescriptor descriptor
    • Constructor Detail

      • CommandLinePasswordManager

        public CommandLinePasswordManager​(com.nomagic.ci.persistence.ProjectDescriptor descriptor,
                                          com.nomagic.magicdraw.teamwork2.esi.protect.PasswordCheckingImpl implementation)
        Creates and initializes a new AbstractPasswordManager from specified parameters.
        Parameters:
        descriptor - a project descriptor.
        implementation - password checking implementation.
    • Method Detail

      • askPasswordIfProtected

        public boolean askPasswordIfProtected()
        Description copied from interface: com.nomagic.magicdraw.teamwork2.esi.protect.PasswordManager
        If the specified resource is password protected then the method asks the user to enter a password.
        Specified by:
        askPasswordIfProtected in interface com.nomagic.magicdraw.teamwork2.esi.protect.PasswordManager
        Returns:
        true if the resource is not package protected or the user entered a correct password, otherwise - false.
      • isProtected

        public boolean isProtected()
                            throws com.nomagic.magicdraw.teamwork2.esi.protect.PasswordProtectException
        Checks whether the project is password protected.
        Specified by:
        isProtected in interface com.nomagic.magicdraw.teamwork2.esi.protect.PasswordManager
        Returns:
        true if the project is password protected, otherwise - false.
        Throws:
        com.nomagic.magicdraw.teamwork2.esi.protect.PasswordProtectException - if checking fails.
      • isValidPassword

        public boolean isValidPassword​(char[] password)
                                throws com.nomagic.magicdraw.teamwork2.esi.protect.PasswordProtectException
        Description copied from interface: com.nomagic.magicdraw.teamwork2.esi.protect.PasswordManager
        Returns true if the specified password is valid.
        Specified by:
        isValidPassword in interface com.nomagic.magicdraw.teamwork2.esi.protect.PasswordManager
        Parameters:
        password - the project password.
        Returns:
        true if valid.
        Throws:
        com.nomagic.magicdraw.teamwork2.esi.protect.PasswordProtectException - if checking whether the project password is valid fails.