Class DB_Roles


  • public class DB_Roles
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      DB_Roles()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void doRoles​(java.sql.Connection conn)
      Generate role definition statements and role grant statements.
      private static void generateRoleDefinitions​(java.sql.ResultSet rs)
      Generate role definition statements
      private static void generateRoleGrants​(java.sql.ResultSet rs)  
      private static java.lang.String roleDefinitionStatement​(java.sql.ResultSet rs, java.lang.String roleName)
      Generate a role definition statement for the current row
      private static java.lang.String roleGrantStatement​(java.sql.ResultSet rs, java.lang.String roleName, java.lang.String grantee, boolean isWithAdminOption)
      Generate role grant statement for the current row
      • Methods inherited from class java.lang.Object

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

      • DB_Roles

        public DB_Roles()
    • Method Detail

      • doRoles

        public static void doRoles​(java.sql.Connection conn)
                            throws java.sql.SQLException
        Generate role definition statements and role grant statements. Note that privileges granted to roles are handled by DB_GrantRevoke, similar to privileges granted to users.
        Parameters:
        conn - Connection to use
        Throws:
        java.sql.SQLException
      • generateRoleDefinitions

        private static void generateRoleDefinitions​(java.sql.ResultSet rs)
                                             throws java.sql.SQLException
        Generate role definition statements
        Parameters:
        rs - Result set holding required information
        Throws:
        java.sql.SQLException
      • roleDefinitionStatement

        private static java.lang.String roleDefinitionStatement​(java.sql.ResultSet rs,
                                                                java.lang.String roleName)
                                                         throws java.sql.SQLException
        Generate a role definition statement for the current row
        Parameters:
        rs -
        roleName - The role defined, already quoted
        Throws:
        java.sql.SQLException
      • generateRoleGrants

        private static void generateRoleGrants​(java.sql.ResultSet rs)
                                        throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • roleGrantStatement

        private static java.lang.String roleGrantStatement​(java.sql.ResultSet rs,
                                                           java.lang.String roleName,
                                                           java.lang.String grantee,
                                                           boolean isWithAdminOption)
                                                    throws java.sql.SQLException
        Generate role grant statement for the current row
        Parameters:
        rs -
        roleName - The role granted, already quoted
        grantee - The authorization id to whom the role is granted (a role or a user), already quoted
        isWithAdminOption -
        Throws:
        java.sql.SQLException