Exemplo n.º 1
0
 /**
  * Binds a client interface of a GCM component to a web service.
  *
  * @param args The arguments of the procedure call. Must contain as first element the {@link
  *     GCMInterfaceNode} representing the client interface of the GCM component to bind to the web
  *     service and as second element the web service URL to bind to.
  * @param ctx The execution context in which to execute the procedure.
  * @return <code>null</code>.
  * @throws ScriptExecutionError If any error occurred during the execution of the procedure.
  */
 public Object apply(List<Object> args, Context ctx) throws ScriptExecutionError {
   if (args.get(0) instanceof GCMInterfaceNode) {
     Interface clientItf = ((GCMInterfaceNode) args.get(0)).getInterface();
     String wsURL = (String) args.get(1);
     try {
       BindingController bc = GCM.getBindingController(clientItf.getFcItfOwner());
       bc.bindFc(clientItf.getFcItfName(), wsURL);
     } catch (NoSuchInterfaceException nsie) {
       throw new ScriptExecutionError(
           Diagnostic.error(
               SourceLocation.UNKNOWN,
               "Unable to bind interface \'"
                   + clientItf.getFcItfName()
                   + "\' to the web service located at "
                   + wsURL,
               nsie));
     } catch (IllegalBindingException ibe) {
       throw new ScriptExecutionError(
           Diagnostic.error(
               SourceLocation.UNKNOWN,
               "Unable to bind interface \'"
                   + clientItf.getFcItfName()
                   + "\' to the web service located at "
                   + wsURL,
               ibe));
     } catch (IllegalLifeCycleException ilce) {
       throw new ScriptExecutionError(
           Diagnostic.error(
               SourceLocation.UNKNOWN,
               "Unable to bind interface \'"
                   + clientItf.getFcItfName()
                   + "\' to the web service located at "
                   + wsURL,
               ilce));
     }
   }
   return null;
 }