コード例 #1
0
ファイル: RmiUnbindAction.java プロジェクト: pcdavid/fscript
  public Object apply(List<Object> args, Context ctx) throws ScriptExecutionError {
    NamingService ns = (NamingService) ctx.getGlobal("*rmiregistry*");
    if (ns == null) {
      Diagnostic err =
          Diagnostic.error(UNKNOWN, "rmi_bind: not connected to a Fractal RMI registry.");
      throw new ScriptExecutionError(err);
    }

    String name = (String) args.get(0);
    ns.unbind(name);
    return null;
  }
コード例 #2
0
ファイル: WSBindAction.java プロジェクト: moliva/gcmscript
 /**
  * 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;
 }
コード例 #3
0
 public void report(Diagnostic diag) {
   Preconditions.checkNotNull(diag, "diagnostic");
   switch (diag.getSeverity()) {
     case INFORMATION:
       reportInformation(diag.getLocation(), diag.getMessage());
       break;
     case WARNING:
       reportWarning(diag.getLocation(), diag.getMessage());
       break;
     case ERROR:
       reportError(diag.getLocation(), diag.getMessage());
       break;
     default:
       throw new AssertionError("Unhandled severity: " + diag.getSeverity());
   }
 }