예제 #1
0
  @Override
  public IBackend createBackend(final BackendData data) {
    ErlLogger.debug("Create backend " + data.getNodeName());
    if (!data.isManaged() && !data.isAutostart()) {
      ErlLogger.info("Not creating backend for %s", data.getNodeName());
      return null;
    }

    final IBackend b;
    final String erlangHostName = BackendUtils.getErlangHostName(data.isLongName());
    try {
      String nodeName = data.getNodeName();
      final boolean hasHost = nodeName.contains("@");
      nodeName = hasHost ? nodeName : nodeName + "@" + erlangHostName;
      ILaunch launch = data.getLaunch();
      if (launch == null) {
        launch = launchPeer(data);
      }
      final IProcess mainProcess =
          launch.getProcesses().length == 0 ? null : launch.getProcesses()[0];
      final IErlRuntime runtime =
          new ErlRuntime(
              nodeName, data.getCookie(), mainProcess, !data.isTransient(), data.isLongName());
      b =
          data.isInternal()
              ? new InternalBackend(data, runtime)
              : new ExternalBackend(data, runtime);
      b.initialize();
      return b;
    } catch (final BackendException e) {
      e.printStackTrace();
    }
    return null;
  }
예제 #2
0
 public static OtpErlangPid start(final IBackend backend) {
   try {
     final OtpErlangObject r = backend.call("erlide_shell", "start", "p", backend.getEventPid());
     final OtpErlangPid server = (OtpErlangPid) BackendUtils.ok(r);
     return server;
   } catch (final RpcException e) {
     return null;
   }
 }
예제 #3
0
  private BackendData getBuildBackendData(final RuntimeInfo info) {
    final RuntimeInfo myinfo = RuntimeInfo.copy(info, false);

    final BackendData result = new BackendData(runtimeInfoManager, myinfo);
    result.setNodeName(
        info.getVersion().asMajor().toString() + "_" + BackendUtils.getErlideNodeNameTag());
    result.setCookie("erlide");
    result.setDebug(false);
    result.setAutostart(true);
    result.setConsole(false);
    result.setLongName(HostnameUtils.canUseLongNames());
    result.setInternal(true);
    return result;
  }
예제 #4
0
 private String getIdeNodeName() {
   final String dflt = BackendUtils.getErlideNodeNameTag() + "_erlide";
   return getLabelProperty(dflt);
 }