1 Reply Latest reply: Nov 13, 2012 5:46 AM by Alejandro Profet RSS

    invokeMethod() in oracle.jbo.server.ApplicationModuleImpl?

    markoj
      Has anyone had experience with invokeMethod in class oracle.jbo.server.ApplicationModuleImpl?
      http://docs.oracle.com/cd/B14099_19/web.1012/b14022/oracle/jbo/server/ApplicationModuleImpl.html#invokeMethod_java_lang_Object__java_lang_String__java_lang_String____java_lang_Object___

      Documentation is very poor.
      How do you use it? What are the arguments?

      java.lang.Object target,
      java.lang.String methodName,
      java.lang.String[] argTypeNames,
      java.lang.Object[] args

      I want to write a generic method that would get any application module's instance and invoke it's method (client interface) with invokeMethod probably?
      Something like that:
      am = (ApplicationModuleImpl)Configuration.createRootApplicationModule(appModuleDef, conf);
      Object returnObject = am.invokeMethod(?, ?, ?, ?);
       
      Please, any info is appreciated :)
      Regars, Marko
        • 1. Re: invokeMethod() in oracle.jbo.server.ApplicationModuleImpl?
          Alejandro Profet
          Hi Marko,

          There is not much documentation about that method, and when I test it, always throws a UnsupportedOperationException.
          However, you can use reflection in order to invoke a method in your ApplicationModuleImpl (which is precisely what the invokeMethod should do).
          With this class you can invoke methods in safe mode: https://gist.github.com/4031974
          And then you would be able to invoke the method of ApplicationModuleImpl with something like this:
          oracle.jbo.server.ApplicationModuleImpl am = (oracle.jbo.server.ApplicationModuleImpl)Configuration.createRootApplicationModule("model.Model", "AppModuleLocal");
          SafeReflection.invoke(am, "setBindVariables", new Class[] { String.class, String.class, String.class }, new Object[] { "en", "john.doe", "John Doe" });
          Configuration.releaseRootApplicationModule(am, false);
          AP