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

📄 joramadapter.java

📁 一个类似于openJMS分布在ObjectWeb之下的JMS消息中间件。
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
        String shortName = removePrefix(name);        Queue queue = Queue.create(serverId,                                   shortName,                                   className,                                   prop);        queue.setFreeReading();        queue.setFreeWriting();        if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.INFO))          AdapterTracing.dbgAdapter.log(BasicLevel.INFO,                                        "  - Queue [" + shortName + "] has been created.");        bind(name, queue);        return queue;      } catch (ConnectException exc2) {        throw new AdminException("createQueue() failed: admin connection "                                 + "has been lost.");      }    }  }  /**   * Creates or retrieves a queue destination on the underlying JORAM server,   * (re)binds the corresponding <code>Queue</code> instance.   *   * @param serverId   The identifier of the server where deploying the queue.   * @param name       The name of the queue.   *   * @exception AdminException   If the creation fails.   */  public Destination createQueue(int serverId, String name)    throws AdminException {    return createQueue(serverId,                       name,                       "org.objectweb.joram.mom.dest.Queue",                       null);  }  /**   * Creates or retrieves a queue destination on the underlying JORAM server,   * (re)binds the corresponding <code>Queue</code> instance.   *   * @param name       The name of the queue.   *   * @exception AdminException   If the creation fails.   */  public Destination createQueue(String name)    throws AdminException {    try {      return createQueue(joramAdmin.getPlatformAdmin().getLocalServerId(),                         name,                         "org.objectweb.joram.mom.dest.Queue",                         null);    } catch (ConnectException exc2) {      throw new AdminException("createQueue() failed: admin connection "                               + "has been lost.");    }  }  /**   * Creates or retrieves a topic destination on the underlying JORAM server,   * (re)binds the corresponding <code>Topic</code> instance.   *   * @param serverId   The identifier of the server where deploying the topic.   * @param name       The name of the topic.   * @param className  The topic class name.   * @param prop       The topic properties.   *   * @exception AdminException   If the creation fails.   */  public Destination createTopic(int serverId,                                 String name,                                 String className,                                 Properties prop)    throws AdminException {    try {      Context ctx = new InitialContext();      return (Topic) ctx.lookup(name);    } catch (javax.naming.NamingException exc) {      try {        String shortName = removePrefix(name);        Topic topic = Topic.create(serverId,                                   shortName,                                   className,                                   prop);        topic.setFreeReading();        topic.setFreeWriting();        if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.INFO))          AdapterTracing.dbgAdapter.log(BasicLevel.INFO,                                        "  - Topic [" + shortName + "] has been created.");        bind(name, topic);        return topic;      } catch (ConnectException exc2) {        throw new AdminException("createTopic() failed: admin connection "                                 + "has been lost.");      }    }  }  /**   * Creates or retrieves a topic destination on the underlying JORAM server,   * (re)binds the corresponding <code>Topic</code> instance.   *   * @param serverId   The identifier of the server where deploying the topic.   * @param name       The name of the topic.   *   * @exception AdminException   If the creation fails.   */  public Destination createTopic(int serverId, String name)    throws AdminException {    return createTopic(serverId,                       name,                       "org.objectweb.joram.mom.dest.Topic",                       null);  }  /**   * Creates or retrieves a topic destination on the underlying JORAM server,   * (re)binds the corresponding <code>Topic</code> instance.   *   * @param name       The name of the topic.   *   * @exception AdminException   If the creation fails.   */  public Destination createTopic(String name)    throws AdminException {    try {      return createTopic(joramAdmin.getPlatformAdmin().getLocalServerId(),                         name,                         "org.objectweb.joram.mom.dest.Topic",                         null);    } catch (ConnectException exc2) {      throw new AdminException("createTopic() failed: admin connection "                               + "has been lost.");    }  }  /**   * Remove a destination on the underlying JORAM server   *   * @param name       The name of the destination.   */  public void removeDestination(String name)    throws AdminException {    try {      Context ctx = new InitialContext();      Destination dest = (Destination) ctx.lookup(name);      ctx.close();      if (dest instanceof org.objectweb.joram.client.jms.Destination)        ((org.objectweb.joram.client.jms.Destination) dest).delete();      unbind(name);    } catch (Exception exc) {      throw new AdminException("removeDestination(" + name +                               ") failed: use Destination.delete()");    }  }  /** Binds an object to the JNDI context. */  void bind(String name, Object obj) {    try {      Context ctx = new InitialContext();      ctx.rebind(name, obj);      if (! boundNames.contains(name))        boundNames.add(name);    } catch (Exception e) {      if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.WARN))        AdapterTracing.dbgAdapter.log(BasicLevel.WARN,                                      "Binding failed:  bind(" + name +"," + obj +")", e);    }  }  /** Unbinds an object from the JNDI context. */  void unbind(String name) {    try {      Context ctx = new InitialContext();      ctx.unbind(name);      boundNames.remove(name);    }    catch (Exception exc) {}  }  /** Deserializing method. */  private void readObject(java.io.ObjectInputStream in)          throws java.io.IOException, ClassNotFoundException  {    in.defaultReadObject();    consumers = new Hashtable();    producers = new Vector();  }  // ------------------------------------------  // --- JavaBean setter and getter methods ---  // ------------------------------------------  public void setPlatformConfigDir(java.lang.String platformConfigDir) {    this.platformConfigDir = platformConfigDir;  }  public void setPersistentPlatform(java.lang.Boolean persistentPlatform) {    this.persistentPlatform = persistentPlatform.booleanValue();  }  public void setServerId(java.lang.Short serverId) {    this.serverId = serverId.shortValue();  }  public void setClusterId(java.lang.Short clusterId) {    this.clusterId = clusterId.shortValue();    if (this.clusterId != AgentServer.NULL_ID){        this.isHa = true;    }  }  public void setServerName(java.lang.String serverName) {    this.serverName = serverName;  }  public void setAdminFile(java.lang.String adminFile) {    this.adminFile = adminFile;  }  public void setAdminFileXML(java.lang.String adminFileXML) {    this.adminFileXML = adminFileXML;  }  public void setCollocatedServer(java.lang.Boolean collocatedServer) {    collocated = collocatedServer.booleanValue();  }  public void setHostName(java.lang.String hostName) {    this.hostName = hostName;  }  public void setServerPort(java.lang.Integer serverPort) {    this.serverPort = serverPort.intValue();  }  public void setConnectingTimer(java.lang.Integer connectingTimer) {    this.connectingTimer = connectingTimer.intValue();  }  public void setTxPendingTimer(java.lang.Integer txPendingTimer) {    this.txPendingTimer = txPendingTimer.intValue();  }  public void setCnxPendingTimer(java.lang.Integer cnxPendingTimer) {    this.cnxPendingTimer = cnxPendingTimer.intValue();  }  public void setQueueMessageReadMax(java.lang.Integer queueMessageReadMax) {    this.queueMessageReadMax = queueMessageReadMax.intValue();  }  public void setTopicAckBufferMax(java.lang.Integer topicAckBufferMax) {    this.topicAckBufferMax = topicAckBufferMax.intValue();  }  public void setTopicPassivationThreshold(java.lang.Integer topicPassivationThreshold) {    this.topicPassivationThreshold = topicPassivationThreshold.intValue();  }  public void setTopicActivationThreshold(java.lang.Integer topicActivationThreshold) {    this.topicActivationThreshold = topicActivationThreshold.intValue();  }  public void setAsyncSend(java.lang.Boolean asyncSend) {    this.asyncSend = asyncSend.booleanValue();  }  public void setMultiThreadSync(java.lang.Boolean multiThreadSync) {    this.multiThreadSync = multiThreadSync.booleanValue();  }  public void setMultiThreadSyncDelay(java.lang.Integer multiThreadSyncDelay) {    this.multiThreadSyncDelay = multiThreadSyncDelay.intValue();  }  public java.lang.String getPlatformConfigDir() {    return platformConfigDir;  }  public java.lang.Boolean getPersistentPlatform() {    return new Boolean(persistentPlatform);  }  public Short getServerId() {    return new Short(serverId);  }  public java.lang.String getServerName() {    return serverName;  }  public java.lang.String getAdminFile() {    return adminFile;  }  public java.lang.String getAdminFileXML() {    return adminFileXML;  }  public java.lang.String getAdminFileExportXML() {      return adminFileExportXML;  }  public java.lang.Boolean getCollocatedServer() {    return new Boolean(collocated);  }  public java.lang.String getHostName() {    return hostName;  }  public java.lang.Integer getServerPort() {    return new Integer(serverPort);  }  public java.lang.Integer getConnectingTimer() {    return new Integer(connectingTimer);  }  public java.lang.Integer getTxPendingTimer() {    return new Integer(txPendingTimer);  }  public java.lang.Integer getCnxPendingTimer() {    return new Integer(cnxPendingTimer);  }  public java.lang.Integer getQueueMessageReadMax() {    return new Integer(queueMessageReadMax);  }  public java.lang.Integer getTopicAckBufferMax() {    return new Integer(topicAckBufferMax);  }  public java.lang.Integer getTopicPassivationThreshold() {    return new Integer(topicPassivationThreshold);  }  public java.lang.Integer getTopicActivationThreshold() {    return new Integer(topicActivationThreshold);  }  public java.lang.Boolean getAsyncSend() {    return new Boolean(asyncSend);  }  public java.lang.Boolean getMultiThreadSync() {    return new Boolean(multiThreadSync);  }  public java.lang.Integer getMultiThreadSyncDelay() {    return new Integer(multiThreadSyncDelay);  }  /**   * Export the repository content to an XML file   * - only the destinations objects are retrieved in this version   * - xml script format of the admin objects (joramAdmin.xml)   * @param exportDir target directory where the export file will be put   * @throws AdminException if an error occurs   */  public void exportRepositoryToFile(String exportDir) throws AdminException {      joramAdmin.exportRepositoryToFile(exportDir);  }  /**   * Reload the joramAdmin.xml file   * @param the path for the joramAdmin file   * @throws AdminException if an error occurs   */  public boolean executeXMLAdminJMX(String path)    throws Exception {      boolean executeAdmin = joramAdmin.executeXMLAdmin(path);      adminConnect();      return executeAdmin;  }}

⌨️ 快捷键说明

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