Пример #1
0
  public DeployClient(String host, int port, String userName, String password) {
    String url = "http://" + host + ":" + port + "/hmtp";

    _url = url;

    HmtpClient client = new HmtpClient(url);
    try {
      client.setVirtualHost("admin.resin");

      client.connect(userName, password);

      _bamClient = client;
      _bamManager = new SimpleBamManager(_bamClient.getBroker());

      _deployAddress = DeployActor.ADDRESS;

      /*
            BamManager bamManager = server.getAdminBrokerManager();
            return BamProxyFactory.createProxy(api, to, sender);
      */
      _deployProxy = _bamManager.createProxy(DeployActorProxy.class, _deployAddress, _bamClient);
    } catch (RemoteConnectionFailedException e) {
      throw new RemoteConnectionFailedException(
          L.l(
              "Connection to '{0}' failed for remote administration.\n  Ensure the local server has started, or include --server and --port parameters to connect to a remote server.\n  {1}",
              url, e.getMessage()),
          e);
    } catch (RemoteListenerUnavailableException e) {
      throw new RemoteListenerUnavailableException(
          L.l(
              "Connection to '{0}' failed for remote administration because RemoteAdminService (HMTP) is not enabled.\n  Ensure <resin:RemoteAdminService> is enabled in resin.xml.\n  {1}",
              url, e.getMessage()),
          e);
    }
  }
Пример #2
0
  private ActorSender getConnection() {
    if (_conn == null) {
      String url = ("http://" + getWatchdogAddress() + ":" + getWatchdogPort() + "/hmtp");

      HmtpClient client = new HmtpClient(url);

      client.setVirtualHost("admin.resin");

      String uid = "";

      client.setEncryptPassword(true);

      client.connect(uid, getResinSystemAuthKey());

      _conn = client;
    }

    return _conn;
  }