How to use IluProxy interface Step-by-Step

  1. Look up the IluProxy (ORBProxy) Object
  2. First, you have to lookup the IluProxy object started by IluProxyServer.py.

    The easiest way of finding the IluProxy object is to pass its IOR to java program as an argument.

    e.g.

      CORBA.ORB orb = CORBA.ORB.init();
      CORBA.Object obj = orb.string_to_object(args[0])
      IluProxy.ORBProxy proxy = IluProxy.ORBProxy_var.narrow(obj);

    Now you are ready to find ilu object in the DL world.

  3. Find the target Ilu object
  4. To find the Ilu object, use the ORBProxy::bind method.

    e.g.

      IluProxy.IluObject target = proxy.bind("Services/SenseMaker");

    Please note that any Ilu object must be represented in IluObject data type. If you know the IOR of the target object, you can create the IluObject by;

      IluProxy.IluObject target = new IluProxy.IluObject(ior, type);

      * ior is a string representation of the object, and target is a string representation of the type in the form of module.class such as "IluProxy.ORBProxy".

  5. Prepare for the method invocation
  6. When you could successfully find the target object, now let's prepare for the method invocation.

    To invoke a method to the object, you have to create a Request object.

    e.g.

      IluProxy.Request req = proxy.request(obj, "method")

      * method is a name of the method.

    If the method call needs no parameters, you are ready to invoke the method.

    If you need some parameters to this method, do the following step to add the arguments.

    e.g.

      IluProxy.Any arg = new IluProxy.Any((short)0);
      req.add_arg("
      param", arg);

      * param is a name of the parameter. If you don't want to use parameter name, just set the first argument by null string ("").

      For mapping between Python data type and Java data type, please refer to here

      About the IluProxy::Any interface, please refer to here.

  7. Invoke method
  8. To invoke the method, use Request::invoke() method.

    e.g.

      req.invoke()

    If you want to use threaded method invocation, use the following;

    e.g.

      req.send_deferred()

    In this case, you have to check the end of the invocation by either Request::get_responce() or Request::poll_response().

    For more information about invoking the method, please refer to here.

  9. Obtain the result
  10. If the request returns a result, you can obtain the result by Request::result().

    e.g.

      IluProxy.Any result = new IluProxy.Any(req.result());

  11. Another way of invoking the method
  12. For your convenience, ORBProxy has some original implementation of invoking the method. One example is a method call which returns Any type return value directly.

    e.g.

      IluProxy any result = IluProxy.Any(proxy.invoke_with_result(req));

  13. Delete request
  14. As Ilu server does not try to delete the request object even when it turn out to be unnecessary. So please use the ORBProxy::delete() method to delete the Server side request object.

    e.g.

      proxy.delete(req);