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

📄 configurator.java

📁 JXTA源文件
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    /**     * Clears and resets the RendezVous addresses.     *     * @param      rendezVous               RendezVous addresses      * @throws     ConfiguratorException    {@link net.jxta.exception.ConfigurationException}     *                                      chained list of configuration errors     */        public void setRendezVous(List rendezVous)    throws ConfiguratorException {        this.rdvConfig.clearSeedRendezvous();        addRendezVous(rendezVous);    }        /**     * Add a RendezVous address.     *     * @param       rendezVous              RendezVous address     * @throws      ConfiguratorException   {@link net.jxta.exception.ConfiguratorException}     *                                      chained list of configuration errors     */        public void addRendezVous(URI rendezVous)    throws ConfiguratorException {        addRendezVous(Collections.singletonList(rendezVous));    }        /**     * Adds a {@link java.util.List} of RendezVous addresses.     *     * @param       rendezVous              RendezVousService addresses     * @throws      ConfiguratorException   {@link net.jxta.exception.ConfiguratorException}     *                                      chained list of configuration errors     */        public void addRendezVous(List rendezVous)    throws ConfiguratorException {        for (Iterator r = rendezVous.iterator(); r.hasNext();) {            URI u = (URI)r.next();                        if (Util.validateAddress(u, false).trim().length() == 0) {                this.rdvConfig.addSeedRendezvous(u);            } else {                throw new ConfiguratorException("invalid address: " + u);            }        }    }        /**     * Remove a RendezVous address.     *     * @param   rendezVous  RendezVousService address     * @return              removed RendezVous address     */        public URI removeRendezVous(URI rendezVous) {        URI u = null;                if (this.rdvConfig != null) {            this.rdvConfig.removeSeedRendezvous(rendezVous);                        u = rendezVous;        }                return u;    }        /**     * Remove all RendezVous addresses.     */        public void clearRendezVous() {        if (this.rdvConfig != null) {            this.rdvConfig.clearSeedRendezvous();        }    }        /**     * Accessor to the RendezVous AutoStart enabler.     *     * <p>The AutoStart feature allows the JXTA Peer to opt to variably provision     * the {@link net.jxta.rendezvous.RendezVousService} in the event no other,     * or not enough, RendezVous are found within the specified time interval.     *     * @deprecated  use {@link net.jxta.ext.config.Configurator#getRendezVousAutoStart()}     * @return      the RendezVous AutoStart value     */        public boolean isRendezVousAutoStart() {        return (this.rdvConfig.getAutoRendezvousCheckInterval() != 0);    }        /**     * Accessor to the RendezVous AutoStart value measured in milliseconds.     *     * <p>The RendezVous AutoStart feature allows the JXTA instance to opt to     * variably provision the {@link net.jxta.rendezvous.RendezVousService}     * in the event no other, or not enough, RendezVous are found within the     * specified time interval.     *     * @return      RendezVous AutoStart value in milliseconds     */        public long getRendezVousAutoStart() {        return this.rdvConfig.getAutoRendezvousCheckInterval();    }        /**     * Specifies the RendezVous AutoStart value in milliseconds.     *     * @param   autoStart   RendezVous AutoStart value     */        public void setRendezVousAutoStart(long autoStart) {        this.rdvConfig.setAutoRendezvousCheckInterval(autoStart);    }        /**     * Accessor to the Relay Service enabler which indicates as to whether     * or not the to be configured instance is to provision the Relay Service.     *     * @return      Relay enabler     */        public boolean isRelay() {        return this.relayConfig.isClientEnabled() ||	    this.relayConfig.isServerEnabled();    }        /**     * Specify the Relay enabler.     *     * @param   isEnabled    Relay enabler     */        public void setRelay(boolean isEnabled) {//         throw new UnsupportedOperationException("this doesn't work");    }        /**     * Accessor to the configured Relay addresses in the form of {@link java.net.URI}.     *     * @return      Relays as a {@link java.util.List} of {@link java.net.URI}     */        public List getRelays() {        List allSeeds = Arrays.asList( this.relayConfig.getSeedRelays() );        List result = new ArrayList(allSeeds.size());                for (Iterator si = allSeeds.iterator(); si.hasNext(); ) {            try {                result.add(new URI(si.next().toString()));            } catch(URISyntaxException ignored) {            }        }                return result;    }        /**     * Clears and resets the Relay address.     *     * @param       relay                   Relay address     * @throws      ConfiguratorException   {@link net.jxta.exception.ConfiguratorException}     *                                      chained list of configuration errors     */        public void setRelay(URI relay)    throws ConfiguratorException {        this.relayConfig.clearSeedRelays();        this.relayConfig.addSeedRelay(relay.toString());    }        /**     * Clears and resets the Relay addresses.     *     * @param      relays                   Relay addresses      * @throws     ConfiguratorException    {@link net.jxta.exception.ConfigurationException}     *                                      chained list of configuration errors     */        public void setRelays(List relays)    throws ConfiguratorException {        this.relayConfig.clearSeedRelays();                addRelays(relays);    }        /**     * Add a Relay address.     *     * @param       relay                   Relay address     * @throws      ConfiguratorException   {@link net.jxta.exception.ConfiguratorException}     *                                      chained list of configuration errors     */        public void addRelay(URI relay)    throws ConfiguratorException {        try {            this.relayConfig.addSeedRelay(relay.toString());        } catch (Exception all) {            throw new ConfiguratorException("Bad relay", all);        }    }        /**     * Adds a {@link java.util.List} of Relay addresses.     *     * @param       relays                  Relay addresses     * @throws      ConfiguratorException   {@link net.jxta.exception.ConfiguratorException}     *                                      chained list of configuration errors     */        public void addRelays(List relays)    throws ConfiguratorException {        for (Iterator ri = relays.iterator(); ri.hasNext(); ) {            addRelay((URI)ri.next());        }    }        // xxx: ?we can't remove a relay?    /**     * Remove a Relay address.     *     * @param   relay       Relay address     * @return              removed Relay address     */        public URI removeRelay(URI relay) {        throw new UnsupportedOperationException("this doesn't work");    }        /**     * Remove all Relay addresses.     */         public void clearRelays() {        if (this.relayConfig != null) {        this.relayConfig.clearSeedRelays();    }    }        /**     * Accessor to Relay incoming attribute.     *     * <p>An incoming attribute indicates the associated service accepts inbound     * communications.     *     * @return      the Relay incoming attribute     */        public boolean isRelayIncoming() {        return this.relayConfig.isServerEnabled();    }        /**     * Specify the Relay incoming attribute.     *     * @param   isEnabled   Relay incoming attribute     */        public void setRelayIncoming(boolean isEnabled) {        this.relayConfig.setServerEnabled( isEnabled );    }        /**     * Accessor to the Relay incoming maximum connection attribute.     *     * <p>A incoming maximum specifies the amount of maximum incoming connections     * are allowed.     *     * @return      the Relay maximum incoming connection attribute     */        public int getRelayIncomingMaximum() {        return this.relayConfig.getMaxClients( );    }        /**     * Specify the Relay maximum incoming connection attribute.     *     * @param   maximumIncoming     Relay maximum incoming attribute     */        public void setRelayIncomingMaximum(int maximumIncoming) {        this.relayConfig.setMaxClients( maximumIncoming );    }        /**     * Accessor to the Relay incoming lease attribute in milliseconds.     *     * <p>A incoming lease specifies the time, in milliseconds, with which Relay     * leases are held.     *     * @return      the Relay incoming lease attribute in milliseconds.     */        public long getRelayIncomingLease() {        return this.relayConfig.getServerLeaseDuration();    }        /**     * Specify the Relay incoming lease attribute in milliseconds.     *     * @param   incomingLease   the Relay incoming lease attribute in milliseconds.     */        public void setRelayIncomingLease(long incomingLease) {        this.relayConfig.setServerLeaseDuration( incomingLease );    }        /**     * Accessor to the Relay outgoing attribute.     *     * <p>An outgoing attribute indicates the associated service initiates outbound     * communications.     *     * @return      Relay outgoing attribute     */        public boolean isRelayOutgoing() {        return this.relayConfig.isClientEnabled();    }        /**     * Specify the Relay outgoing attribute.     *     * @param   isEnabled   Relay outgoing attribute     */        public void setRelayOutgoing(boolean isEnabled) {        this.relayConfig.setClientEnabled( isEnabled );    }        /**     * Accessor to the Relay outgoing maximum connection attribute.     *     * <p>A outgoing maximum specifies the amount of maximum outgoing connections     * are allowed.     *     * @return      the Relay maximum outgoing connection attribute     */        public int getRelayOutgoingMaximum() {        return this.relayConfig.getMaxRelays();    }        /**     * Specify the Relay maximum outgoing connection attribute.     *     * @param   maximumOutgoing     Relay maximum outgoing attribute     */        public void setRelayOutgoingMaximum(int maximumOutgoing) {        this.relayConfig.setMaxRelays( maximumOutgoing );    }        /**     * Accessor to the Relay outgoing lease attribute in milliseconds.     *     * <p>A outgoing lease specifies the time, in milliseconds, with which Relay     * leases are held.     *     * @return      the Relay outgoing lease attribute in milliseconds.     */        public long getRelayOutgoingLease() {        return this.relayConfig.getClientLeaseDuration();    }        /**     * Specify the Relay outgoing lease attribute in milliseconds.     *     * @param   outgoingLease   the Relay outgoing lease attribute in milliseconds.     */        public void setRelayOutgoingLease(long outgoingLease) {        this.relayConfig.setClientLeaseDuration( outgoingLease );    }        /**     * Accessor to the Relay queue size.     *     * <p>A queue size specifies the overall message buffer size when exceeded     * messages are dropped.     *     * @return      Relay queue size     */        public int getRelayQueueSize() {        return this.relayConfig.getClientMessageQueueSize();    }         /**     * Specify the Relay queue size.     *     * @param   queueSize   the Relay queue size     */        public void setRelayQueueSize(int queueSize) {        this.relayConfig.setClientMessageQueueSize( queueSize );    }        /**     * Accessor to the {@link net.jxta.ext.config.Transport}.     *

⌨️ 快捷键说明

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