예제 #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
  public DeployClient(String url, ActorSender client) {
    _bamClient = client;
    _bamManager = new SimpleBamManager(client.getBroker());

    _url = url;

    _deployAddress = DeployActor.ADDRESS;

    _deployProxy = _bamManager.createProxy(DeployActorProxy.class, _deployAddress, _bamClient);
  }