⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adminmodule.java

📁 一个类似于openJMS分布在ObjectWeb之下的JMS消息中间件。
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    throws ConnectException, AdminException {    addServer(      sid,      hostName,      domainName,      port,      serverName,      null, null);  }  /**   * Adds a server to the platform.   *   * @param serverId Id of the added server   * @param hostName Address of the host where the added server is started   * @param domainName Name of the domain where the server is added   * @param port Listening port of the server in the specified domain   * @param serverName Name of the added server   * @param serviceNames Names of the service to start within the server   * @param args Services' arguments   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  If the request fails.   */  public static void addServer(int sid,                               String hostName,                               String domainName,                               int port,                               String serverName,                               String[] serviceNames,                               String[] serviceArgs)    throws ConnectException, AdminException {    if (serviceNames != null &&        serviceArgs != null) {      if (serviceNames.length != serviceArgs.length)        throw new AdminException(          "Same number of service names and arguments expected");    } else {      if (serviceNames == null) throw new AdminException(        "Expected service names");      if (serviceArgs == null) throw new AdminException(        "Expected service arguments");    }    doRequest(new AddServerRequest(                sid,                hostName,                domainName,                port,                serverName,                serviceNames,                serviceArgs));  }  /**   * Removes a server from the platform.   *   * @param sid Id of the removed server   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  If the request fails.   */  public static void removeServer(int sid)    throws ConnectException, AdminException {    doRequest(new RemoveServerRequest(sid));  }  /**   * Adds a domain to the platform.   *   * @param domainName Name of the added domain   * @param sid Id of the router server that   *            gives access to the added domain   * @param port Listening port in the added domain of the   *             router server   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  If the request fails.   */  public static void addDomain(String domainName,                               int sid,                               int port)    throws ConnectException, AdminException {    doRequest(new AddDomainRequest(                domainName,                sid,                port));  }  /**   * Removes a domain from the platform.   *   * @param domainName Name of the added domain   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  If the request fails.   */  public static void removeDomain(String domainName)    throws ConnectException, AdminException {    doRequest(new RemoveDomainRequest(                domainName));  }  /**   * Returns the current servers configuration (a3servers.xml).   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  If the request fails.   */  public static String getConfiguration()    throws ConnectException, AdminException {    return doRequest(new GetConfigRequest()).getInfo();  }  /**   * Sets a given dead message queue as the default DMQ for a given server   * (<code>null</code> for unsetting previous DMQ).   * <p>   * The request fails if the target server does not belong to the platform.   *   * @param serverId  The identifier of the server.   * @param dmq  The dmq to be set as the default one.   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  If the request fails.   */  public static void setDefaultDMQ(int serverId, DeadMQueue dmq)    throws ConnectException, AdminException    {      doRequest(new SetDefaultDMQ(serverId, dmq.getName()));    }  /**   * Sets a given dead message queue as the default DMQ for the local server   * (<code>null</code> for unsetting previous DMQ).   *   * @param dmq  The dmq to be set as the default one.   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  Never thrown.   */  public static void setDefaultDMQ(DeadMQueue dmq)    throws ConnectException, AdminException    {      setDefaultDMQ(localServer, dmq);    }  /**   * Sets a given value as the default threshold for a given server (-1 for   * unsetting previous value).   * <p>   * The request fails if the target server does not belong to the platform.   *   * @param serverId  The identifier of the server.   * @param threshold  The threshold value to be set.   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  If the request fails.   */  public static void setDefaultThreshold(int serverId, int threshold)    throws ConnectException, AdminException    {      doRequest(new SetDefaultThreshold(serverId, threshold));    }  /**   * Sets a given value as the default threshold for the local server (-1 for   * unsetting previous value).   *   * @param threshold  The threshold value to be set.   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  Never thrown.   */  public static void setDefaultThreshold(int threshold)    throws ConnectException, AdminException    {      setDefaultThreshold(localServer, threshold);    }  /**   * Returns the list of the platform's servers' identifiers.   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  Never thrown.   */  public static List getServersIds() throws ConnectException, AdminException    {      return getServersIds(null);    }  /**   * Returns the list of the servers' identifiers that belong   * to the specified domain   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  Never thrown.   */  public static List getServersIds(String domainName)    throws ConnectException, AdminException {    Monitor_GetServersIds request =      new Monitor_GetServersIds(        AdminModule.getLocalServerId(),        domainName);    Monitor_GetServersIdsRep reply =      (Monitor_GetServersIdsRep) doRequest(request);    int[] serverIds = reply.getIds();    Vector res = new Vector();    for (int i = 0; i < serverIds.length; i++) {      res.addElement(new Integer(serverIds[i]));    }    return res;  }  public static Server[] getServers()    throws ConnectException, AdminException {    return getServers(null);  }  public static Server[] getServers(String domainName)    throws ConnectException, AdminException {    Monitor_GetServersIds request =      new Monitor_GetServersIds(        AdminModule.getLocalServerId(),        domainName);    Monitor_GetServersIdsRep reply =      (Monitor_GetServersIdsRep) doRequest(request);    int[] serverIds = reply.getIds();    String[] serverNames = reply.getNames();    String[] serverHostNames = reply.getHostNames();    Server[] servers = new Server[serverIds.length];    for (int i = 0; i < serverIds.length; i++) {      servers[i] = new Server(serverIds[i],                              serverNames[i],                              serverHostNames[i]);    }    return servers;  }  public static Server getLocalServer()    throws ConnectException, AdminException {    GetLocalServerRep reply =  (GetLocalServerRep)doRequest(      new GetLocalServer());    return new Server(reply.getId(),                      reply.getName(),                      reply.getHostName());  }  /**   * Returns the list of the domain names that   * contains the specified server.   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  Never thrown.   */  public static String[] getDomainNames(int serverId)    throws ConnectException, AdminException {    GetDomainNames request =      new GetDomainNames(serverId);    GetDomainNamesRep reply =      (GetDomainNamesRep) doRequest(request);    return reply.getDomainNames();  }  /**   * Returns the default dead message queue for a given server, null if not   * set.   * <p>   * The request fails if the target server does not belong to the platform.   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  If the request fails.   */  public static DeadMQueue getDefaultDMQ(int serverId)    throws ConnectException, AdminException    {      Monitor_GetDMQSettings request = new Monitor_GetDMQSettings(serverId);      Monitor_GetDMQSettingsRep reply;      reply = (Monitor_GetDMQSettingsRep) doRequest(request);      if (reply.getDMQName() == null)        return null;      else        return new DeadMQueue(reply.getDMQName());    }  /**   * Returns the default dead message queue for the local server, null if not   * set.   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  Never thrown.   */  public static DeadMQueue getDefaultDMQ()    throws ConnectException, AdminException    {      return getDefaultDMQ(localServer);    }  /**   * Returns the default threshold value for a given server, -1 if not set.   * <p>   * The request fails if the target server does not belong to the platform.   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  If the request fails.   */  public static int getDefaultThreshold(int serverId)    throws ConnectException, AdminException    {      Monitor_GetDMQSettings request = new Monitor_GetDMQSettings(serverId);      Monitor_GetDMQSettingsRep reply;      reply = (Monitor_GetDMQSettingsRep) doRequest(request);      if (reply.getThreshold() == null)        return -1;      else        return reply.getThreshold().intValue();    }  /**   * Returns the default threshold value for the local server, -1 if not set.   *   * @exception ConnectException  If the connection fails.   * @exception AdminException  Never thrown.   */  public static int getDefaultThreshold()    throws ConnectException, AdminException    {      return getDefaultThreshold(localServer);    }  /**   * Returns the list of all destinations that exist on a given server,   * or an empty list if none exist.   * <p>   * The request fails if the target server does not belong to the platform.   *   * @exception ConnectException  If the admin connection is closed or broken.   * @exception AdminException  If the request fails.   */  public static List getDestinations(int serverId)    throws ConnectException, AdminException    {      Monitor_GetDestinations request = new Monitor_GetDestinations(serverId);      Monitor_GetDestinationsRep reply =        (Monitor_GetDestinationsRep) doRequest(request);      Vector list = new Vector();      String[] ids = reply.getIds();      String[] names = reply.getNames();      String[] types = reply.getTypes();      for (int i = 0; i < types.length; i++) {        list.addElement(Destination.newInstance(                          ids[i], names[i], types[i]));      }      return list;    }  /**   * Returns the list of all destinations that exist on the local server,   * or an empty list if none exist.   *   * @exception ConnectException  If the admin connection is closed or broken.   * @exception AdminException  Never thrown.   */  public static List getDestinations() throws ConnectException, AdminException    {      return getDestinations(localServer);    }  /**   * Returns the list of all destinations that exist on a given server,   * or an empty list if none exist.   * The request is abort after delay.   *   * @exception ConnectException  If the admin connection is closed or broken.   * @exception AdminException  If the request fails.   */  public static List getDestinations(int serverId, long delay)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -