|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eodisp.remote.util.NetworkConfigurator
public class NetworkConfigurator
NetworkConfigurator provides a simple programmatic interface to the JXTA configuration (i.e. the PlatformConfig). It provides factory methods to create a NetworkConfiguration instance from an existing PlatfromConfig or to create a typical EDGE, RENDEZVOUS or AD_HOC peer configuration from scratch. (edge, rendezvous, ad hoc etc.).
Read the following for an overview of typical types of peers:
1. Edge Peer
A peer which may or may not be behind a firewall or NAT (i.e. Directly
addressable or not). It is recommended that this class of peer should always
be configured with TCP/IP enabled (both incoming/outgoing, multicast on), and
HTTP enabled outgoing only, it should also use a relay, and a rendezvous. It
is important to note that the JXTAplatform automatically determines whether
directs routes exists between peers, and will prefer such routes over relayed
ones (hence the recommended configuration)
2. Rendezvous/Relay Peer
This class of peers is expected to provide infrastructure services and
typically is directly reachable on the Internet. It is recommended that this
class of peer should always be configured with TCP/IP enabled (both
incoming/outgoing, multicast on), and HTTP enabled incoming only, act as a
relay, and rendezvous.
3. Ad hoc peer
FIXME:
Important Note:
NetworkConfigurator makes use of classes from the
net.jxta.impl.*
packages. Applications are very strongly
encouraged to avoid importing these classes as their interfaces may change
without notice in future JXTA releases. The NetworkConfigurator API abstracts
the configuration implementation details and will provide continuity and
stability i.e. the NetworkConfigurator API won't change and it will
automatically accommodate changes to service configuration.
Nested Class Summary | |
---|---|
static class |
NetworkConfigurator.RendezvousConfig
|
Field Summary | |
---|---|
static int |
ADHOC_NODE
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
protected java.util.Properties |
configProps
|
static int |
EDGE_NODE
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
HTTP_CLIENT
HTTP transport client state |
static int |
HTTP_SERVER
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
IP_MULTICAST
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
PROXY_NODE
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
PROXY_SERVER
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
RDV_AD_HOC
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
RDV_CLIENT
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
RDV_NODE
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
RDV_RELAY_PROXY_NODE
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
RDV_SERVER
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
RELAY_CLIENT
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
RELAY_NODE
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
RELAY_OFF
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
RELAY_SERVER
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
TCP_CLIENT
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
static int |
TCP_SERVER
Deprecated. use the newXXX static factory method and the
setXXX methods instead |
Constructor Summary | |
---|---|
NetworkConfigurator()
Deprecated. use newNetworkConfiguratorEdge() instead. |
|
NetworkConfigurator(int mode,
java.net.URI storeHome)
Deprecated. use the newXXX static factory methods instead |
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property. |
void |
addRdvSeedingURI(java.lang.String seedURIStr)
Adds a rendezvous seeding URI. |
void |
addRdvSeedingURI(java.net.URI seedURI)
Adds a rendezvous seeding URI. |
void |
addRelaySeedingURI(java.lang.String seedURIStr)
Sets the new RelayService seeding URI as a string. |
void |
addRelaySeedingURI(java.net.URI seedURI)
Adds a relay seeding URI. |
void |
addSeedRelay(java.net.URI seedURI)
Adds a relay service peer seed address A relay service seed is defined as a physical endpoint address. |
void |
addSeedRendezvous(java.net.URI seedURI)
Adds rendezvous peer seed, physical endpoint address A RendezVousService seed is defined as a physical endpoint address Examples are http://192.168.1.1:9700 or
tcp://192.168.1.1:9701 ). |
boolean |
exists()
Deprecated. |
java.lang.String |
getDescription()
Returns the description of the peer. |
java.io.File |
getHome()
Returns the current directory for configuration and cache persistent store |
java.lang.String |
getHttpInterfaceAddress()
Returns the address on which the HTTP transport is listening for incoming messages. |
int |
getHttpPort()
Returns the port the HTTP transport is configured to listen on. |
java.lang.String |
getHttpPublicAddress()
Returns the public address under which the peer is reachable by peers from the public network. |
int |
getMode()
Deprecated. Use getter methods instead (e.g. isHttpEnabled() ). |
java.lang.String |
getMulticastAddress()
Returns the IP group multicast address. |
int |
getMulticastPort()
Returns the multicast port. |
int |
getMulticastSize()
Returns the multicast size |
java.lang.String |
getName()
Returns the name of the peer. |
java.lang.String |
getPassword()
Gets the password used to sign the private key of the root certificate. |
net.jxta.peer.PeerID |
getPeerID()
Returns the peer ID of this peer. |
net.jxta.protocol.ConfigParams |
getPlatformConfig()
Returns the PlatformConfig (as ConfigParams ) that can be
used in one of the NetPeerGroupFactory constructors. |
java.lang.String |
getPrincipal()
Gets the Principal for the peer root certificate. |
int |
getRelayMaxClients()
Sets the maximum number of relay clients of this peer. |
NetworkConfigurator.RendezvousConfig |
getRendezvousConfig()
|
int |
getRendezvousMaxClients()
FIXME documentation |
static java.net.URI |
getStoreHome()
Returns the location which will serve as the parent for all stored items used by JXTA. |
int |
getTcpEndPort()
Returns the end port on which the TCP transport is configured to listen for messages. |
java.lang.String |
getTcpInterfaceAddress()
Returns the address on which the TCP transport is listening for incoming messages. |
int |
getTcpPort()
Returns the port the TCP transport is listening. |
java.lang.String |
getTcpPublicAddress()
Returns the public address under which the peer is reachable by peers from the public network. |
int |
getTcpStartPort()
Returns the start port on which the TCP transport is configured to listen for messages. |
boolean |
hasChanges()
Returns a boolean value indicating whether one or more values (fields) have been changed since either loading or the last save. |
boolean |
isHttpEnabled()
Returns if HTTP support is enabled |
boolean |
isHttpIncoming()
Returns if the HTTP transport is listening for messages or not. |
boolean |
isHttpOutgoing()
Returns if the HTTP transport is configured to send messages. |
boolean |
isHttpPublicAddressExclusive()
FIXME documentation |
boolean |
isProxyEnabled()
Returns if Proxy support is enabled |
boolean |
isRelayClient()
Returns if the peer acts as a relay client. |
boolean |
isRelayEnabled()
Returns if Relay support is enabled |
boolean |
isRelayServer()
Returns if the peer acts as a relay server. |
boolean |
isRendezvousEnabled()
Returns if Rendezvous support is enabled |
boolean |
isTcpEnabled()
Returns if TCP support is enabled |
boolean |
isTcpIncoming()
Returns if the TCP transport is listening for messages or not. |
boolean |
isTcpOutgoing()
Returns if the TCP transport is configured to send messages. |
boolean |
isTcpPublicAddressExclusive()
Returns if the public address is exclusive FIXME: Better description of what this means in practice. |
boolean |
isUseMulticast()
Returns if the peer uses multicast to find other peers (FIXME: Is it really just used to find other peers or is it used to send normal data messages too?) |
boolean |
isUseOnlyRelaySeeds()
FIXME documentation |
boolean |
isUseOnlyRendezvousSeeds()
FIXME documentation |
void |
load()
Deprecated. Use the static method loadPlatformConfig(URI)
instead |
void |
load(net.jxta.protocol.ConfigParams platformConfig)
Deprecated. use static load methos #loadPlatfromConfig(ConfigParams) instead |
void |
load(java.net.URI uri)
Deprecated. use te static loadPlatformConfig(URI) instead |
static NetworkConfigurator |
loadPlatformConfig(net.jxta.protocol.ConfigParams platformConfig)
Creates a NetworkConfgurator instance that takes the values from the given platform configuration. |
static NetworkConfigurator |
loadPlatformConfig(java.net.URI platfromConfig)
Creates a NetworkConfgurator instance that takes the values from the given platform configuration. |
static NetworkConfigurator |
newNetworkConfiguratorAdHoc()
Creates a new NetworkConfigurator instance that is
suitable to create a PlatformConfig for a AD_HOC peer. |
static NetworkConfigurator |
newNetworkConfiguratorEdge()
Creates a new NetworkConfigurator instance that is
suitable to create a PlatformConfig for an EDGE peer. |
static NetworkConfigurator |
newNetworkConfiguratorRendezvous()
Creates a new NetworkConfigurator instance that is
suitable to create a PlatformConfig for a RENDEZVOUS peer. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
void |
save()
Deprecated. use save(File) instead. |
void |
save(java.io.File file)
Generates a PlatformConfig (with getPlatformConfig() ) and saves
it in the file given by parameter file . |
void |
savePlatformConfig(java.io.OutputStream out)
Generates a PlatformConfig (with getPlatformConfig() ) and
streams it to the given output stream. |
void |
setDescription(java.lang.String description)
Sets PlaformConfig Peer Description element. |
void |
setHome(java.io.File home)
Deprecated. use NetPeerGroupFactory.NetPeerGroupFactory(ConfigParams, URI)
instead. |
void |
setHttpEnabled(boolean enabled)
Enables or disables the HTTP support. |
void |
setHttpIncoming(boolean incoming)
Toggles the support to receive messages over HTTP. |
void |
setHttpInterfaceAddress(java.lang.String address)
Sets the HTTP interface Address on which the peer listens for incoming HTTP requests. |
void |
setHttpOutgoing(boolean outgoing)
Toggles the support to send messages over HTTP. |
void |
setHttpPort(int port)
Sets the HTTP listening port (default 9901). |
void |
setHttpPublicAddress(java.lang.String address)
Sets the HTTP address the peer is reachable from the public network. |
void |
setHttpPublicAddress(java.lang.String address,
boolean exclusive)
Deprecated. use setHttpPublicAddress(String) and
setHttpPublicAddressExclusive(boolean) instead. |
void |
setHttpPublicAddressExclusive(boolean exclusive)
FIXME documentation |
void |
setInfrastructureDescription(java.lang.String description)
Deprecated. |
void |
setInfrastructureID(net.jxta.id.ID id)
Deprecated. |
void |
setInfrastructureID(java.lang.String idStr)
Deprecated. |
void |
setInfrastructureName(java.lang.String name)
Deprecated. |
void |
setMode(int mode)
Deprecated. Use the setter methods instead. |
void |
setMulticastAddress(java.lang.String mcastAddress)
Sets the IP group multicast address (default: "224.0.1.85" ). |
void |
setMulticastPort(int port)
Sets the IP group multicast port (default 1234). |
void |
setMulticastSize(int size)
Sets the multicast size. |
void |
setName(java.lang.String name)
Sets the name of the peer (default "unknown" ). |
void |
setPassword(java.lang.String password)
Sets the password used to sign the private key of the root certificate. |
void |
setPeerID(net.jxta.peer.PeerID peerID)
Sets the peer ID of this peer. |
void |
setPeerId(java.lang.String peerID)
Sets the peer ID of this peer. |
void |
setPrincipal(java.lang.String principal)
Sets the Principal for the peer root certificate. |
void |
setProxyEnabled(boolean enable)
Enables or disables the Proxy support. |
void |
setRelayClient(boolean enabled)
If true then this peer will act as a relay client. |
void |
setRelayEnabled(boolean enabled)
Enables or disables Relay support. |
void |
setRelayMaxClients(int relayMaxClients)
Sets the maximum number of relay clients of this peer. |
void |
setRelaySeedURIs(java.util.List<java.lang.String> seedURIs)
Sets the List relaySeeds represented as Strings A RelayService seed is defined as a physical endpoint address e.g. |
void |
setRelayServer(boolean enabled)
If true then this peer will act as a relay server. |
void |
setRendezvousConfig(NetworkConfigurator.RendezvousConfig rendezvousConfig)
|
void |
setRendezvousEnabled(boolean enabled)
Enables or disables the Rendezvous support. |
void |
setRendezvousMaxClients(int rdvMaxClients)
Sets the maximum number of rendezvous clients of this peer. |
void |
setRendezvousSeedURIs(java.util.List<java.lang.String> seedURIs)
Sets the List of RendezVousService seeds represented as Strings A RendezvousService seed is defined as a physical endpoint address e.g. |
void |
setTcpEnabled(boolean enabled)
Enables or disables the TCP support. |
void |
setTcpEndPort(int end)
Sets the highest port on which the TCP Transport will listen if configured to do so. |
void |
setTcpIncoming(boolean enabled)
Toggles the support to receive messages over the TCP transport (default is enabled). |
void |
setTcpInterfaceAddress(java.lang.String address)
Sets the TCP interface Address on which the peer listens for incoming requests from the TCP transport. |
void |
setTcpOutgoing(boolean enabled)
Toggles the support to send messages over TCP. |
void |
setTcpPort(int port)
Sets the TCP listening port (default 9701). |
void |
setTcpPublicAddress(java.lang.String address)
Sets the node public address e.g. |
void |
setTcpPublicAddress(java.lang.String address,
boolean exclusive)
Deprecated. use setTcpPublicAddress(String) and
setTcpPublicAddressExclusive(boolean) instead. |
void |
setTcpPublicAddressExclusive(boolean exclusive)
Sets whether the public address is exclusive FIXME: Better description of what this means in practice. |
void |
setTcpStartPort(int start)
Sets the lowest port on which the TCP Transport will listen if configured to do so setTcpIncoming(boolean) is set to true . |
void |
setUseMulticast(boolean enable)
Toggles whether to use IP group multicast (default is true ). |
void |
setUseOnlyRelaySeeds(boolean useOnlyRelaySeeds)
Determines whether to restrict RelayService leases to those defined in the seed list that was set by addRelaySeedingURI(String) or
addSeedRelay(URI) . |
void |
setUseOnlyRendezvousSeeds(boolean useOnlyRendezvouSeeds)
Determines whether to restrict RendezvousService leases to those defined in the seed list that was set by #addRendezvousSeedingURI(URI) or
addSeedRendezvous(URI) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int RELAY_OFF
newXXX
static factory method and the
setXXX methods instead
public static final int RELAY_CLIENT
newXXX
static factory method and the
setXXX methods instead
public static final int RELAY_SERVER
newXXX
static factory method and the
setXXX methods instead
public static final int PROXY_SERVER
newXXX
static factory method and the
setXXX methods instead
public static final int TCP_CLIENT
newXXX
static factory method and the
setXXX methods instead
public static final int TCP_SERVER
newXXX
static factory method and the
setXXX methods instead
public static final int HTTP_CLIENT
public static final int HTTP_SERVER
newXXX
static factory method and the
setXXX methods instead
public static final int IP_MULTICAST
newXXX
static factory method and the
setXXX methods instead
public static final int RDV_SERVER
newXXX
static factory method and the
setXXX methods instead
public static final int RDV_CLIENT
newXXX
static factory method and the
setXXX methods instead
public static final int RDV_AD_HOC
newXXX
static factory method and the
setXXX methods instead
public static final int ADHOC_NODE
newXXX
static factory method and the
setXXX methods instead
public static final int EDGE_NODE
newXXX
static factory method and the
setXXX methods instead
public static final int RDV_NODE
newXXX
static factory method and the
setXXX methods instead
public static final int RELAY_NODE
newXXX
static factory method and the
setXXX methods instead
public static final int PROXY_NODE
newXXX
static factory method and the
setXXX methods instead
public static final int RDV_RELAY_PROXY_NODE
newXXX
static factory method and the
setXXX methods instead
protected transient java.util.Properties configProps
Constructor Detail |
---|
public NetworkConfigurator()
newNetworkConfiguratorEdge()
instead.
newNetworkConfiguratorEdge()
public NetworkConfigurator(int mode, java.net.URI storeHome)
newXXX
static factory methods instead
mode
- the new configuration modestoreHome
- the URI to persistent storesetMode(int)
Method Detail |
---|
public void setMode(int mode)
The default mode is EDGE, unless modified at construction time. A node configuration mode defined a preset configuration parameters based on a operating mode. i.e. an EDGE mode, enable client/server side tcp, multicast, client side http, RelayService client mode.
Valid modes include EDGE, RDV_SERVER, RELAY_OFF, RELAY_CLIENT, RELAY_SERVER, PROXY_SERVER, or any combination of which. e.g. RDV_SERVER + RELAY_SERVER
mode
- the new configuration modegetMode()
public int getMode()
isHttpEnabled()
).
The default mode is EDGE, unless modified at construction time or through
Method setMode(int)
. A node configuration mode
defined a preset configuration parameters based on a operating mode. i.e.
an EDGE mode, enable client/server side tcp, multicast, client side http,
RelayService client mode.
setMode(int)
public static NetworkConfigurator newNetworkConfiguratorEdge()
NetworkConfigurator
instance that is
suitable to create a PlatformConfig for an EDGE peer. The configuration
is provided in detail below:
Peer ID | IDFactory.newPeerID(PeerGroupID.defaultNetPeerGroupID) |
---|---|
Name | "unknown" |
Description | "Default Platform Config Advertisement created by NetworkConfigurator" |
Tcp enabled | true |
Tcp incoming | true |
Tcp outgoing | true |
Tcp Interface Address | null |
Tcp Port | 9701 |
Tcp Start Port | 9701 |
Tcp End Port | 9799 |
Use multicast | true |
Multicast address | "224.0.1.85" |
Multicast port | 1234 |
Multicast size | 16384 |
Tcp public address | null |
Tcp public address exclusive | false |
Http enabled | true |
Http incoming | false |
Http outgoing | true |
Http port | 9700 |
Http public address | null |
Http public address exclusive | false |
Rendezvous enabled | true |
Rendezvous config | RendezvousConfig.EDGE |
Rendezvous seeds | none are configured by default |
Use Only Rendezvous Seeds | false |
Rendezvous max clients | -1 |
Relay enabled | true |
Relay client | true |
Relay server | false |
Relay seeds | none are configured by default |
Use Only Relay Seeds | false |
Proxy enabled | false |
Principal | null |
Password | null |
public static NetworkConfigurator newNetworkConfiguratorRendezvous()
NetworkConfigurator
instance that is
suitable to create a PlatformConfig for a RENDEZVOUS peer. The
configuration is the same as the one created for an EDGE peer (newNetworkConfiguratorEdge()
)
with the following changes:
Rendezvous config | RendezvousConfig.RENDEZVOUS |
---|---|
Http incoming | true |
Http outgoing | false |
Relay server | true |
public static NetworkConfigurator newNetworkConfiguratorAdHoc()
NetworkConfigurator
instance that is
suitable to create a PlatformConfig for a AD_HOC peer. The configuration
is the same as the one created for an EDGE peer (newNetworkConfiguratorEdge()
)
with the following changes (FIXME: Is that configuration suitable for an
AD_HOC client?):
Rendezvous config | RendezvousConfig.AD_HOC |
---|---|
Relay client | false |
public void setPeerID(net.jxta.peer.PeerID peerID)
peerid
- the ID of the peerpublic void setPeerId(java.lang.String peerID)
setPeerID((PeerID) ID.create(URI.create(peerID)))
peerid
- the ID of the peerpublic net.jxta.peer.PeerID getPeerID()
public void setName(java.lang.String name)
"unknown"
).
The name of a peer does not to be unique.
name
- the name of the peerpublic java.lang.String getName()
public void setDescription(java.lang.String description)
description
- Description of the peer.public java.lang.String getDescription()
public void setTcpEnabled(boolean enabled)
enabled
- true
to enable TCP supportpublic boolean isTcpEnabled()
true
if TCP support is enabledpublic void setTcpIncoming(boolean enabled)
enabled
- if true
, the peer will listen for TCP requests
on the port given by setTcpPort(int)
, otherwise
incoming TCP is disabled and the peer does not listen to
request from the TCP transport.public boolean isTcpIncoming()
true
if the TCP transport is configured to listen
for messages.public void setTcpOutgoing(boolean enabled)
enabled
- if true
, the peer can use TCP to send messages
to other peers. Other peers must have enabled
tcpIncoming
to receive data through TCP.public boolean isTcpOutgoing()
true
if the TCP transport is configured to send
messages.public void setTcpPort(int port)
setTcpIncoming(boolean)
is enabled. To set the port of the HTTP
transport use setHttpPort(int)
.
port
- the tcp socket port the peer is listening on for request from
the TCP transportpublic int getTcpPort()
isTcpIncoming()
public void setTcpStartPort(int start)
setTcpIncoming(boolean)
is set to true
.
Valid values are -1
, 0
and
1-65535
. The -1
value is used to signify
that the port range feature should be disabled. The 0
specifies that the Socket API dynamic port allocation should be used. For
values 1-65535
the value must be equal to or less than the
value used for end port. If the start port is set to -1
the end port must be set to -1
too.
start
- the lowest port on which to listen.setTcpEndPort(int)
public int getTcpStartPort()
setTcpStartPort(int)
public void setTcpEndPort(int end)
-1
, 0
and 1-65535
. The -1
value is used to
signify that the port range feature should be disabled. The
0
specifies that the Socket API dynamic port allocation
should be used. For values 1-65535
the value must be equal
to or greater than the value used for start port. If the start port is
set to -1
the end port must be set to -1
too.
end
- the highest port on which to listensetTcpStartPort(int)
public int getTcpEndPort()
setTcpEndPort(int)
public void setTcpInterfaceAddress(java.lang.String address)
setTcpIncoming(boolean)
is enabled. Please see
setTcpPublicAddress(String, boolean)
if the peer is not
reachable through this address from the public network.
address
- An IP address (e.g. "192.168.1.1"
).public java.lang.String getTcpInterfaceAddress()
null
if the interface address is
not set. If the interface address is not set, a peer listens on
all interfaces it can find on the computer (FIXME: is that
true?).public void setTcpPublicAddress(java.lang.String address, boolean exclusive)
setTcpPublicAddress(String)
and
setTcpPublicAddressExclusive(boolean)
instead.
address
- the TCP transport public addressexclusive
- public address advertised exclusivelypublic void setTcpPublicAddress(java.lang.String address)
address
- the TCP transport public addresspublic java.lang.String getTcpPublicAddress()
null
if this address is not
explicitely set, that means it is set to the same value as the
TCP interface address (getTcpInterfaceAddress()
).
FIXME: Correct?public void setTcpPublicAddressExclusive(boolean exclusive)
exclusive
- True, if the address is exclusive, false otherwise.public boolean isTcpPublicAddressExclusive()
public void setUseMulticast(boolean enable)
true
).
enable
- true
to enable multicast for this peer.public boolean isUseMulticast()
true
if the peer uses multicast.public void setMulticastAddress(java.lang.String mcastAddress)
"224.0.1.85"
).
mcastAddress
- the new multicast group addresssetMulticastPort(int)
public java.lang.String getMulticastAddress()
null
if not set.public void setMulticastPort(int port)
port
- the new IP group multicast portsetMulticastAddress(java.lang.String)
public int getMulticastPort()
public void setMulticastSize(int size)
size
- the multicast size.public int getMulticastSize()
public void setHttpEnabled(boolean enabled)
enabled
- true
to enable HTTP supportpublic boolean isHttpEnabled()
true
if HTTP support is enabledpublic void setHttpIncoming(boolean incoming)
incoming
- if true
, the peer will listen for HTTP
requests on the port given by setHttpPort(int)
,
otherwise incoming HTTP is disabled.public boolean isHttpIncoming()
true
if the HTTP transport is configured to listen
for messages.public void setHttpOutgoing(boolean outgoing)
outgoing
- if true
, the peer can use HTTP to send
messages to other peers. Other peers must have enabled
httpIncoming
to receive data through HTTP. Most
of the time, the receiving federate will be a relay peer.public boolean isHttpOutgoing()
true
if the HTTP transport is configured to send
messages.public void setHttpPort(int port)
setHttpIncoming(boolean)
is enabled.
port
- the port the peer is listening for HTTP requests.public int getHttpPort()
isTcpIncoming()
public void setHttpInterfaceAddress(java.lang.String address)
setHttpIncoming(boolean)
is
enabled. See setHttpPublicAddress(String, boolean)
if the peer
is not reachable from the public network by this address.
address
- An IP address (e.g. "192.168.1.1"
).public java.lang.String getHttpInterfaceAddress()
null
if the interface address is
not set. If the interface address is not set, a peer listens on
all interfaces it can find on the computer (FIXME: is that
true?).public void setHttpPublicAddress(java.lang.String address, boolean exclusive)
setHttpPublicAddress(String)
and
setHttpPublicAddressExclusive(boolean)
instead.
host:port
, e.g.
"209.128.126.120:9700"
. The NAT servers needs
to be configured properly for this to work.
address
- the address this peer is reachable from the public networkexclusive
- FIXME: What does this do exactly?public void setHttpPublicAddress(java.lang.String address)
host:port
, e.g.
"209.128.126.120:9700"
. The NAT servers needs
to be configured properly for this to work.
address
- the address this peer is reachable from the public networkpublic java.lang.String getHttpPublicAddress()
null
if this address is not
explicitely set, that means it is set to the same value as the
HTTP interface address (see getHttpInterfaceAddress()
).
FIXME: Correct?public void setHttpPublicAddressExclusive(boolean exclusive)
exclusive
- public boolean isHttpPublicAddressExclusive()
public void setRelayEnabled(boolean enabled)
enabled
- true
to enable Relay supportpublic boolean isRelayEnabled()
true
if Relay support is enabledpublic void setRelayServer(boolean enabled)
true
then this peer will act as a relay server.
enabled
- If true then this peer will act as a relay server.public boolean isRelayServer()
true
if the peer shall act as a relay server.public void setRelayClient(boolean enabled)
enabled
- If true then this peer will act as a relay client.public boolean isRelayClient()
true
if the peer shall act as a relay client, that
means if it can send messages to other peers through a relay
server.public void addRelaySeedingURI(java.net.URI seedURI)
seedURI
- relay service seeding URI
java.lang.IllegalArgumentException
- if parameter seedURI
is null
public int getRelayMaxClients()
relayMaxClients
- -1
means the default maximum of relay client is
used, which currently is set to 150
.
java.lang.IllegalArgumentException
- if
(relayMaxClients != -1) && (relayMaxClients <= 0)
.FIXME
public void setRelayMaxClients(int relayMaxClients)
relayMaxClients
- -1
means the default maximum of relay client is
used, which currently is set to 150
.
java.lang.IllegalArgumentException
- if
(relayMaxClients != -1) && (relayMaxClients <= 0)
.FIXME
public void addRelaySeedingURI(java.lang.String seedURIStr)
seedURIStr
- the new RelayService seed URI as a stringpublic void addSeedRelay(java.net.URI seedURI)
http://192.168.1.1:9700
or
tcp://192.168.1.1:9701
).
seedURI
- the relay seed URI to be added to the list of peer seen
endpoints.public boolean isUseOnlyRelaySeeds()
public void setUseOnlyRelaySeeds(boolean useOnlyRelaySeeds)
addRelaySeedingURI(String)
or
addSeedRelay(URI)
.
FIXME: Is this correct? See Javadoc of relayConfig.setUseOnlySeeds(...).
useOnlyRelaySeeds
- restrict RelayService lease to seed listpublic void setRendezvousEnabled(boolean enabled)
enabled
- true
to enable Rendezvous supportpublic boolean isRendezvousEnabled()
true
if Rendezvous support is enabledpublic void setRendezvousConfig(NetworkConfigurator.RendezvousConfig rendezvousConfig)
public NetworkConfigurator.RendezvousConfig getRendezvousConfig()
public int getRendezvousMaxClients()
public void setRendezvousMaxClients(int rdvMaxClients)
rdvMaxClients
- -1
means the default maximum of rendezvous
client is used, which currently is set to 150
.
java.lang.IllegalArgumentException
- if
(relayMaxClients != -1) && (relayMaxClients <= 0)
.FIXME:
public boolean isUseOnlyRendezvousSeeds()
public void setUseOnlyRendezvousSeeds(boolean useOnlyRendezvouSeeds)
#addRendezvousSeedingURI(URI)
or
addSeedRendezvous(URI)
.
FIXME: Is this correct? See Javadoc of rdvConfig.setUseOnlySeeds(...).
useOnlyRendezvouSeeds
- restrict RendezvousService lease to seed listpublic void addSeedRendezvous(java.net.URI seedURI)
http://192.168.1.1:9700
or
tcp://192.168.1.1:9701
).
seedURI
- the rendezvous seed URI to add to the list of peer seed
endpoints.public void addRdvSeedingURI(java.lang.String seedURIStr)
addRdvSeedingURI(URI.create(seedURIStr))
. The URI should
return a list of rendezvous peer endpoint addresses in the form of an URI
separated by line breaks. For an example try http://rdv.jxtahosts.net/cgi-bin/rendezvous.cgi?2
seedURI
- rendezvous service seeding URI
java.lang.IllegalArgumentException
- if parameter seedURI
is null
public void addRdvSeedingURI(java.net.URI seedURI)
seedURI
- rendezvous service seeding URI
java.lang.IllegalArgumentException
- if parameter seedURI
is null
public void setRelaySeedURIs(java.util.List<java.lang.String> seedURIs)
seedURIs
- the List relaySeeds represented as Stringspublic void setRendezvousSeedURIs(java.util.List<java.lang.String> seedURIs)
seedURIs
- the List rendezvousSeeds represented as Stringspublic void setPrincipal(java.lang.String principal)
null
, no new PSE advertisement will be
created.
principal
- the new principal valuepublic java.lang.String getPrincipal()
null
, even if the
PlatfromConfig contained a PSE configuration.
null
otherwisepublic void setPassword(java.lang.String password)
null
, no new PSE
advertisement will be created.
password
- the new password valuepublic java.lang.String getPassword()
null
, even if the
PlatfromConfig contained a PSE configuration (The password can't be read
once it was set).
public void setProxyEnabled(boolean enable)
enabled
- true
to enable Proxy supportpublic boolean isProxyEnabled()
true
if Proxy support is enabledpublic void setHome(java.io.File home)
NetPeerGroupFactory.NetPeerGroupFactory(ConfigParams, URI)
instead.
//Create an application home
File appHome = new File(System.getProperty("JXTA_HOME", ".cache"));
//Create an instance home under the application home
File instanceHome = new File(appHome, instanceName);
jxtaConfig.setHome(instanceHome);
home
- the new home valuegetHome()
public java.io.File getHome()
setHome(java.io.File)
public static java.net.URI getStoreHome()
PeerGroup.getStoreHome()
public void setInfrastructureID(net.jxta.id.ID id)
id
- the new infrastructure PeerGroupID as a stringPeerGroupFactory.setNetPGID(net.jxta.peergroup.PeerGroupID)
public void setInfrastructureID(java.lang.String idStr)
idStr
- the new infrastructure PeerGroupID as a stringPeerGroupFactory.setNetPGID(net.jxta.peergroup.PeerGroupID)
public void setInfrastructureName(java.lang.String name)
name
- the Infrastructure PeerGroup namePeerGroupFactory.setNetPGName(java.lang.String)
public void setInfrastructureDescription(java.lang.String description)
description
- the infrastructure PeerGroup descriptionPeerGroupFactory.setNetPGDesc(java.lang.String)
public void load(java.net.URI uri) throws java.io.IOException
loadPlatformConfig(URI)
instead
ConfigParams platfromConfig = .... // load PlatfromConfig from disk networkConfigurator.load(platfromConfig);
uri
- the URI to PlatformConfig file
java.io.IOException
- If the PlatformConfig file could not be loaded
java.lang.IllegalArgumentException
- if the URI is null
. As of now it also throws
an exception if the URI can't be transformed into an URL. But
this is probably stupid (FIXME)public void load() throws java.io.IOException, javax.security.cert.CertificateException
loadPlatformConfig(URI)
instead
java.io.IOException
- if an i/o error occurs
javax.security.cert.CertificateException
- if the MemebershipService is invalidpublic boolean exists()
getHome()/PlatfromConfig
public static NetworkConfigurator loadPlatformConfig(net.jxta.protocol.ConfigParams platformConfig)
platformConfig
- the platform config that shall be wrapped by this network
configurator
#loadPlatfromConfig(URI)
public static NetworkConfigurator loadPlatformConfig(java.net.URI platfromConfig) throws java.io.IOException
platformConfig
- the platform config file that shall be wrapped by this network
configurator
java.io.IOException
#loadPlatfromConfig(ConfigParams)
public void load(net.jxta.protocol.ConfigParams platformConfig)
#loadPlatfromConfig(ConfigParams)
instead
platformConfig
- the platform config that shall be loadedload(URI)
public void save(java.io.File file) throws java.io.IOException
getPlatformConfig()
) and saves
it in the file given by parameter file
.
file
- the file the PlatfromConfig should be saved to.
java.io.IOException
- If the file could not be saved to the given file (This
also happens if the the path does not yet exist).getPlatformConfig()
,
load(URI)
public void save() throws java.io.IOException
save(File)
instead.
java.io.IOException
- if an i/o error occursload(java.net.URI)
public void savePlatformConfig(java.io.OutputStream out) throws java.io.IOException
getPlatformConfig()
) and
streams it to the given output stream. UTF-8 is used for the encoding.
out
- the output stream to stream the platform config file to.
java.io.IOException
public net.jxta.protocol.ConfigParams getPlatformConfig()
ConfigParams
) that can be
used in one of the NetPeerGroupFactory
constructors.
public final void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
If listener is null
, no exception is thrown and no action
is performed.
listener
- the PropertyChangeListener to be addedpublic final void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
If listener is null
, no exception is thrown and no action
is performed.
listener
- the PropertyChangeListener to be removedpublic final void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- one of the property names listed abovelistener
- the PropertyChangeListener to be addedpublic final void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
If listener is null
, no exception is thrown and no action
is performed.
propertyName
- a valid property namelistener
- the PropertyChangeListener to be removedpublic boolean hasChanges()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |