Class ProcedureManager


  • public class ProcedureManager
    extends java.lang.Object
    A DatabaseConnection procedure manager. This controls adding, updating, deleting and querying/calling stored procedures.
    Author:
    Tobias Downer
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void defineJavaProcedure​(ProcedureName procedure_name, java.lang.String java_specification, TType return_type, TType[] param_types, java.lang.String username)
      Defines a Java stored procedure.
      void deleteProcedure​(ProcedureName procedure_name)
      Deletes the procedure with the given name, or generates an error if the procedure doesn't exist.
      TObject invokeProcedure​(ProcedureName procedure_name, TObject[] params)
      Invokes the procedure with the given name and the given parameters and returns the procedure return value.
      static java.lang.reflect.Method javaProcedureMethod​(java.lang.String location_str, TType[] param_types)
      Given a Java location_str and a list of parameter types, returns an immutable 'Method' object that can be used to invoke a Java stored procedure.
      static java.lang.String[] parseJavaLocationString​(java.lang.String str)
      Given a location string as defined for a Java stored procedure, this parses the string into the various parts.
      boolean procedureExists​(ProcedureName procedure_name)
      Returns true if the procedure with the given name exists.
      boolean procedureExists​(TableName procedure_name)
      Returns true if the procedure with the given table name exists.
      • Methods inherited from class java.lang.Object

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

      • parseJavaLocationString

        public static java.lang.String[] parseJavaLocationString​(java.lang.String str)
        Given a location string as defined for a Java stored procedure, this parses the string into the various parts. For example, given the string 'com.mycompany.storedprocedures.MyFunctions.minFunction()' this will parse the string out to the class called 'com.mycompany.storedprocedures.MyFunctions' and the method 'minFunction' with no arguments. This function will work event if the method name is not given, or the method name does not have an arguments specification.
      • procedureExists

        public boolean procedureExists​(ProcedureName procedure_name)
        Returns true if the procedure with the given name exists.
      • procedureExists

        public boolean procedureExists​(TableName procedure_name)
        Returns true if the procedure with the given table name exists.
      • defineJavaProcedure

        public void defineJavaProcedure​(ProcedureName procedure_name,
                                        java.lang.String java_specification,
                                        TType return_type,
                                        TType[] param_types,
                                        java.lang.String username)
                                 throws DatabaseException
        Defines a Java stored procedure. If the procedure with the name has not been defined it is defined. If the procedure has been defined then it is overwritten with this information.

        If 'return_type' is null then the procedure does not return a value.

        Throws:
        DatabaseException
      • invokeProcedure

        public TObject invokeProcedure​(ProcedureName procedure_name,
                                       TObject[] params)
        Invokes the procedure with the given name and the given parameters and returns the procedure return value.
      • javaProcedureMethod

        public static java.lang.reflect.Method javaProcedureMethod​(java.lang.String location_str,
                                                                   TType[] param_types)
        Given a Java location_str and a list of parameter types, returns an immutable 'Method' object that can be used to invoke a Java stored procedure. The returned object can be cached if necessary. Note that this method will generate an error for the following situations: a) The invokation class or method was not found, b) there is not an invokation method with the required number of arguments or that matches the method specification.

        Returns null if the invokation method could not be found.