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

📄 addressbase.java

📁 java开源的企业总线.xmlBlaster
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
   }   /**    * Plugins may query their properties here    * @param key  The property, e.g. "SOLingerTimeout" (WITHOUT any prefix like "plugin/socket/")    */   public PropString getEnv(String key, String defaultValue) {      PropString tmp = new PropString(key, this.pluginInfoParameters.getProperty(key,defaultValue));      if (this.pluginAttributes != null) {         Object val = this.pluginAttributes.get(key, (String)null);         if (val != null) {            tmp.setValue((String)val, PropEntry.CREATED_BY_SETTER); // or by client's ConnectQos            return tmp;         }      }      tmp.setFromEnv(this.glob, this.nodeId, context, className, this.instanceName, this.envPrefix+key);      return tmp;   }   /**    * Plugins may query their properties here    * @param key  The property, e.g. "SOLingerTimeout" (WITHOUT any prefix like "plugin/socket/")    */   public PropInt getEnv(String key, int defaultValue) {      String defaultStr = this.pluginInfoParameters.getProperty(key,""+defaultValue);      defaultValue = Integer.valueOf(defaultStr).intValue();      PropInt tmp = new PropInt(key, defaultValue);      if (this.pluginAttributes != null) {         Object val = this.pluginAttributes.get(key, (String)null);         if (val != null) {            tmp.setValue((String)val, PropEntry.CREATED_BY_SETTER);            return tmp;         }      }      tmp.setFromEnv(this.glob, this.nodeId, context, className, this.instanceName, this.envPrefix+key);      return tmp;   }   /**    * Plugins may query their properties here    * @param key  The property, e.g. "SOLingerTimeout" (WITHOUT any prefix like "plugin/socket/")    */   public PropLong getEnv(String key, long defaultValue) {      String defaultStr = this.pluginInfoParameters.getProperty(key,""+defaultValue);      defaultValue = Long.valueOf(defaultStr).longValue();      PropLong tmp = new PropLong(key, defaultValue);      if (this.pluginAttributes != null) {         Object val = this.pluginAttributes.get(key, (String)null);         if (val != null) {            tmp.setValue((String)val, PropEntry.CREATED_BY_SETTER);            return tmp;         }      }      tmp.setFromEnv(this.glob, this.nodeId, context, className, this.instanceName, this.envPrefix+key);      return tmp;   }   /**    * Plugins may query their properties here    * @param key  The property, e.g. "SOLingerTimeout" (WITHOUT any prefix like "plugin/socket/")    */   public PropBoolean getEnv(String key, boolean defaultValue) {      String defaultStr = this.pluginInfoParameters.getProperty(key,""+defaultValue);      defaultValue = Boolean.valueOf(defaultStr).booleanValue();      PropBoolean tmp = new PropBoolean(key, defaultValue);      if (this.pluginAttributes != null) {         Object val = this.pluginAttributes.get(key, (String)null);         if (val != null) {            tmp.setValue((String)val, PropEntry.CREATED_BY_SETTER);            return tmp;         }      }      tmp.setFromEnv(this.glob, this.nodeId, context, className, this.instanceName, this.envPrefix+key);      return tmp;   }   /**    * Returns the completed key which was found and chosen.     * @return For "responseTimeout" it could be "dispatch/connection/plugin/socket/responseTimeout"    */   public String getEnvLookupKey(String key) {      PropString tmp = new PropString("");      String k = tmp.setFromEnv(this.glob, this.nodeId, context, className, this.instanceName, this.envPrefix+key);      if (k != null && k.length() > 0)         return k;      return key;   }   /**    * A nice human readable name for this address (used for logging)    */   public final String getName() {      return getLogId();   }   /**    * Check if supplied address would connect to the address of this instance    */   public final boolean isSameAddress(AddressBase other) {      if (other.getType().equals(getType())) {  // what about two different SOCKET connections??         String or = other.getRawAddress();         if (or != null && or.length() > 0) {            if (or.equals(getRawAddress())) {               return true;            }            else {               return false;            }         }         String oh = other.getBootstrapHostname();         int op = other.getBootstrapPort();         if (op > 0 && oh != null) {            if (op == getBootstrapPort() && oh.equals(getBootstrapHostname()))               return true;            else               return false;         }      }      return false;   }   /**    * Sets the root xml tag, &lt;callback> or &lt;address>    */   private final void setRootTag(String rootTag) {      this.rootTag = rootTag;   }   /**    * Show some important settings for logging    */   public String getSettings() {      StringBuffer buf = new StringBuffer(126);      buf.append("type=").append(getType()).append(" oneway=").append(oneway()).append(" dispatcherActive=").append(isDispatcherActive()).append(" burstMode.collectTime=").append(getCollectTime());      return buf.toString();   }   /**    * NOTE: This setting has precedence over all environment or command line settings    * @param type    The protocol type, e.g. "IOR", "EMAIL", "XMLRPC"    *                If you pass null the value is reset to its default setting    */   public final void setType(String type) {      if (type == null) this.type.setValue(this.type.getDefaultValue(), PropEntry.CREATED_BY_DEFAULT);      else this.type.setValue(type);   }   /**    * @param version   The protocol version, e.g. "1.0"    */   public final void setVersion(String version) {      this.version.setValue(version);   }   /**    * @return A human readable address for logging only    */   public String getLogId() {      if (getRawAddress() != null && getRawAddress().length() > 0 && getRawAddress().length() < 50) {         return getRawAddress();      }      return getBootstrapUrl();   }   /**    * Updates the internal address as well.     * <p>NOTE:</p>    * <p>This bootstrapping bootstrapPort is currently only used by the CORBA plugin.</p>    * <p>To set other protocols try e.g.:</p>    * <pre>    *  String[] args = { "-protocol", "SOCKET",    *                    "-dispatch/connection/plugin/socket/hostname", "myHost",    *                    "-dispatch/connection/plugin/socket/port", "7666",    *                    "-dispatch/connection/plugin/socket/localHostname", "myHost",   // optional    *                    "-dispatch/connection/plugin/socket/localPort", "8888" };       // optional    *  glob.init(args);    * </pre>    * @param host An IP or DNS    */   public final void setBootstrapHostname(String host) {      if (host == null) this.bootstrapHostname.setValue("");      else this.bootstrapHostname.setValue(host);   }   public final void setDefaultBootstrapHostname(String host) {      if (host == null) this.bootstrapHostname.setValue("", PropEntry.CREATED_BY_DEFAULT);      else this.bootstrapHostname.setValue(host, PropEntry.CREATED_BY_DEFAULT);   }   /**    * Check if a bootstrapHostname is set already    */   public boolean hasBootstrapHostname() {      return (this.bootstrapHostname.getValue().length() > 0);   }   /**    * @return The Hostname, IP or "" if not known    */   public final String getBootstrapHostname() {      if (!hasBootstrapHostname()) {         this.bootstrapHostname.setValue(glob.getLocalIP(), PropEntry.CREATED_BY_DEFAULT);      }      return this.bootstrapHostname.getValue();   }   /**    * Returns a URL markup of the bootstrap server, currently it looks like    * <i>xmlBlaster://myServer.com:3412</i> but will probably change in a future release.    */   public final String getBootstrapUrl() {      return "xmlBlaster://" + getBootstrapHostname() + ":" + getBootstrapPort(); // + "/" + getType();   }   /**    * Set the bootstrapping port.     * Updates the internal address as well.     * <p>NOTE:</p>    * <p>This bootstrapping bootstrapPort is currently only used by the CORBA plugin.</p>    * <p>To set other protocols try e.g.:</p>    * <pre>    *  String[] args = { "-protocol", "SOCKET",    *                    "-dispatch/connection/plugin/socket/hostname", "myHost",    *                    "-dispatch/connection/plugin/socket/port", "7666",    *                    "-dispatch/connection/plugin/socket/localHostname", "myHost",   // optional    *                    "-dispatch/connection/plugin/socket/localPort", "8888" };       // optional    *  glob.init(args);    * </pre>    */   public final void setBootstrapPort(int bootstrapPort) {      this.bootstrapPort.setValue(bootstrapPort);   }   public final int getBootstrapPort() {      return this.bootstrapPort.getValue();   }   /**    * The creation default will be overwritten by the given defaultPort.     * <p>    * If the bootstrapPort was changed by environment setting, this setting has precedence    * over the given defaultPort and nothing happens.    * </p>    * <p>    * This is used by the protocol plugins which all have different defaults    * </p>    */   public final void setDefaultBootstrapPort(int defaultBootstrapPort) {      if (this.bootstrapPort.isDefault()) {         this.bootstrapPort.setValue(defaultBootstrapPort, PropEntry.CREATED_BY_DEFAULT);      }   }   /**    * Set the callback address, it should fit to the protocol-type.     *    * <p>    * If you set an address here you need to set it compatible to the    * protocol from getType().<br />    * For XmlRpc it looks typically like <i>http://myServer:8080</i>    * for CORBA like <i>IOR:00005395....</i> and    * for SOCKET like <i>socket://128.56.44.12:7608</i>    * </p>    * <p>    * Setting the address here has precedence over any environment settings    * like <i>-dispatch/connection/plugin/socket/port 7666</i> on command line    * or    * <pre>    *  String[] args = { "-protocol", "SOCKET",    *                    "-dispatch/connection/plugin/socket/hostname", "myHost",    *                    "-dispatch/connection/plugin/socket/port", "7666",    *                    "-dispatch/connection/plugin/socket/localHostname", "myHost",   // optional    *                    "-dispatch/connection/plugin/socket/localPort", "8888" };       // optional    *  glob.init(args);    * </pre>    * @param rawAddress The address specific for the protocol, e.g. "et@mars.univers" for EMAIL    */   public final void setRawAddress(String rawAddress) {      if (rawAddress == null) rawAddress = "";      this.rawAddress.setValue(rawAddress);      if (log.isLoggable(Level.FINE)) log.fine("setRawAddress=" + this.rawAddress.getValue());   }   /**    * Returns the rawAddress which is specific for each protocol.     * @return e.g. "IOR:00001100022...." or "et@universe.com" or "" (never null)    */   public final String getRawAddress() {      return this.rawAddress.getValue();   }

⌨️ 快捷键说明

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