Class CoreAdmin

java.lang.Object
com.pathomation.CoreAdmin

public class CoreAdmin extends Object
Intended for PMA.core interactions related to administrative operations. Does NOT apply to PMA.start / PMA.core.lite
  • Constructor Details

    • CoreAdmin

      public CoreAdmin()
  • Method Details

    • setDebugFlag

      public static void setDebugFlag(boolean flag)
      This method is used to determine whether the Java SDK runs in debugging mode or not. When in debugging mode (flag = true), extra output is produced when certain conditions in the code are not met
      Parameters:
      flag - Debugging mode (activated or deactivated)
    • checkForPMAStart

      public static void checkForPMAStart(String method, String url, String session) throws Exception
      This method is under construction
      Parameters:
      method - default value(""),
      url - default value(null),
      session - default value(null), Session ID
      Throws:
      Exception - If something goes wrong
    • checkForPMAStart

      public static void checkForPMAStart(String method, String url) throws Exception
      Throws:
      Exception
    • checkForPMAStart

      public static void checkForPMAStart(String method) throws Exception
      Throws:
      Exception
    • checkForPMAStart

      public static void checkForPMAStart() throws Exception
      Throws:
      Exception
    • httpPost

      public static String httpPost(String url, String data)
      This method is used to cache results from requested URLs (POST method)
      Parameters:
      url - URL to request
      data - JSON input
      Returns:
      Data returned following a request to a specific URL
    • adminConnect

      public static String adminConnect(String pmaCoreURL, String pmaCoreAdmUsername, String pmaCoreAdmPassword) throws Exception
      This method is used to authenticate & connect as an admin to a PMA.core instance using admin credentials
      Parameters:
      pmaCoreURL - url of PMA.core instance
      pmaCoreAdmUsername - default value(""), username for PMA.core instance
      pmaCoreAdmPassword - default value(""), password for PMA.core instance
      Returns:
      session's ID if session was created successfully, otherwise null
      Throws:
      Exception - If target instance isn't a PMA.core instance
    • adminConnect

      public static String adminConnect(String pmaCoreURL, String pmaCoreAdmUsername) throws Exception
      Throws:
      Exception
    • adminConnect

      public static String adminConnect(String pmaCoreURL) throws Exception
      Throws:
      Exception
    • adminConnect

      public static String adminConnect() throws Exception
      Throws:
      Exception
    • adminDisconnect

      public static boolean adminDisconnect(String adminSessionID)
      This method is used to disconnect an admin session from a PMA.core instance
      Parameters:
      adminSessionID - First optional argument(String), default
      Returns:
      True if successfully disconnected, false otherwise
    • adminDisconnect

      public static boolean adminDisconnect()
    • sendEmailReminder

      public static String sendEmailReminder(String admSessionID, String login, String subject)
      This method is used to send out an email reminder to the address associated with user login
      Parameters:
      admSessionID - admin session ID
      login - user login
      subject - First argument(String) - email subject.
      Returns:
      Empty string if operation successful, an error message otherwise
    • sendEmailReminder

      public static String sendEmailReminder(String admSessionID, String login)
    • addUser

      public static boolean addUser(String admSessionID, String login, String firstName, String lastName, String email, String pwd, Boolean canAnnotate, Boolean isAdmin, Boolean isSuspended)
      This method is used to create a new user on PMA.core
      Parameters:
      admSessionID - admin session ID
      login - user login
      firstName - user's first name
      lastName - user's last name
      email - user's email
      pwd - user's password
      canAnnotate - Defines whether the user can annotate slides or not
      isAdmin - Defines whether the user is an administrator or not
      isSuspended - Defines whether the user is suspended or not
      Returns:
      True if the creation has succeeded, false otherwise
    • addUser

      public static boolean addUser(String admSessionID, String login, String firstName, String lastName, String email, String pwd)
    • addUser

      public static boolean addUser(String admSessionID, String login, String firstName, String lastName, String email, String pwd, Boolean canAnnotate)
    • addUser

      public static boolean addUser(String admSessionID, String login, String firstName, String lastName, String email, String pwd, Boolean canAnnotate, Boolean isAdmin)
    • userExists

      public static boolean userExists(String admSessionID, String query)
      This method is used to check if a user exists
      Parameters:
      admSessionID - admin session ID
      query - keyword for the User to search for
      Returns:
      True if the user exists, false otherwise
    • resetPassword

      public static boolean resetPassword(String sessionID, String username, String newPassword)
      This method is used to reset a user's password
      Parameters:
      sessionID - session ID
      username - username to update
      newPassword - new password
      Returns:
      True if password reset successfully, false otherwise
    • createDirectory

      public static boolean createDirectory(String sessionID, String path) throws IOException
      This method is used to create a new directory on PMA.core
      Parameters:
      sessionID - an admin session ID
      path - path to create the new directory in
      Returns:
      true if directory was created successfully, false otherwise
      Throws:
      IOException
    • renameDirectory

      public static boolean renameDirectory(String admSessionID, String originalPath, String newName)
      This method is used to rename a directory on PMA.core
      Parameters:
      admSessionID - an admin session ID
      originalPath - Old path
      newName - New name
      Returns:
      true if directory was renamed successfully, false otherwise
    • deleteDirectory

      public static boolean deleteDirectory(String admSessionID, String path)
      This method is used to delete a directory on PMA.core
      Parameters:
      admSessionID - an admin session ID
      path - path of the directory to delete
      Returns:
      true if directory was successfully deleted, false otherwise
    • reverseUID

      public static String reverseUID(String admSessionID, String slideRefUid) throws Exception
      This method is used to lookup the reverse path of a UID for a specific slide
      Parameters:
      admSessionID - an admin session ID
      slideRefUid - slide UID
      Returns:
      The reverse path of the slide
      Throws:
      Exception - If something goes wrong
    • reverseRootDirectory

      public static String reverseRootDirectory(String admSessionID, String alias) throws Exception
      This method is used to lookup the reverse path of a root-directory
      Parameters:
      admSessionID - an admin session ID
      alias - root directory alias
      Returns:
      The reverse path of the root directory it's a file system one, empty string if it's a S3 one
      Throws:
      Exception - If something goes wrong
    • renameSlide

      public static boolean renameSlide(String admSessionID, String originalPath, String newName)
      This method is used to rename a slide on PMA.core
      Parameters:
      admSessionID - an admin session ID
      originalPath - Old path
      newName - New name
      Returns:
      true if slide was renamed successfully, false otherwise
    • deleteSlide

      public static boolean deleteSlide(String admSessionID, String path)
      This method is used to delete a slide on PMA.core
      Parameters:
      admSessionID - an admin session ID
      path - path of the slide to delete
      Returns:
      true if slide was successfully deleted, false otherwise
    • createAmazons3MountingPoint

      public static String createAmazons3MountingPoint(String accessKey, String secretKey, String path, Integer instanceId, Integer chunkSize, String serviceUrl)
      This method is used to create an Amazon S3 mounting point. A list of these is to be used to supply method create_root_directory()
      Parameters:
      accessKey - AWS Access key
      secretKey - AWS secret key
      path - path
      instanceId - instance ID
      chunkSize - default value(1048576), chunk size
      serviceUrl - default value(null), service URL
      Returns:
      Amazon S3 mounting point
    • createAmazons3MountingPoint

      public static String createAmazons3MountingPoint(String accessKey, String secretKey, String path, Integer instanceId, Integer chunkSize)
    • createAmazons3MountingPoint

      public static String createAmazons3MountingPoint(String accessKey, String secretKey, String path, Integer instanceId)
    • createFileSystemMountingPoint

      public static String createFileSystemMountingPoint(String username, String password, String domainName, String path, Integer instanceId)
      This method is used to create an FileSystem mounting point. A list of these is to be used to supply method create_root_directory()
      Parameters:
      username - user name
      password - password
      domainName - domain name
      path - path
      instanceId - instance ID
      Returns:
      Filesystem mounting point
    • createRootDirectory

      public static String createRootDirectory(String admSessionID, String alias, List<String> amazonS3MountingPoints, List<String> fileSystemMountingPoints, String description, Boolean isPublic, Boolean isOffline)
      Parameters:
      admSessionID - Admin session ID
      alias - Root directory Alias
      amazonS3MountingPoints - List of amazon S3 mounting points
      fileSystemMountingPoints - List of file system mounting points
      description - (String), default value("Root dir created through pma_java"), Root directory description
      isPublic - (Boolean) defines whether the root directory is public or not
      isOffline - (Boolean) defines whether the root directory is offline or not
      Returns:
      Response code of the corresponding API call
    • createRootDirectory

      public static String createRootDirectory(String admSessionID, String alias)
    • createRootDirectory

      public static String createRootDirectory(String admSessionID, String alias, List<String> amazonS3MountingPoints)
    • createRootDirectory

      public static String createRootDirectory(String admSessionID, String alias, List<String> amazonS3MountingPoints, List<String> fileSystemMountingPoints)
    • createRootDirectory

      public static String createRootDirectory(String admSessionID, String alias, List<String> amazonS3MountingPoints, List<String> fileSystemMountingPoints, String description)
    • createRootDirectory

      public static String createRootDirectory(String admSessionID, String alias, List<String> amazonS3MountingPoints, List<String> fileSystemMountingPoints, String description, Boolean isPublic)