JXTA

net.jxta.platform
Class NetworkConfigurator

java.lang.Object
  extended by net.jxta.platform.NetworkConfigurator

public class NetworkConfigurator
extends Object

NetworkConfigurator provides a simple programmatic interface for JXTA configuration.

By default, it defines an edge configuration with TCP in auto mode w/port range 9701-9799, multicast enabled on group "224.0.1.85", and port 1234, HTTP transport with only outgoing enabled.

By default a new PeerID is always generated. This can be overridden via setPeerID(net.jxta.peer.PeerID) method or loading a PlatformConfig via load().

A facility is provided to initialize a configuration by loading from an existing configuration. This provides limited platform configuration lifecycle management as well as configuration change management.

Also by default, this class sets the default platform configurator to net.jxta.impl.peergroup.NullConfigurator. NullConfigurator is a no operation configurator intended to prevent any other configurators from being invoked, including the AWT ConfigDialog.

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.

Configuration example :

     NetworkConfigurator config = new NetworkConfigurator();
     if (!config.exists()) {
         // Create a new configuration with a new name, principal, and pass
         config.setName("New Name");
         config.setPrincipal("username");
         config.setPassword("password");
         try {
             //persist it
             config.save();
         } catch (IOException io) {
             // deal with the io error
         }
      } else {
        // Load the pre-existing configuration
        File pc = new File(config.getHome(), "PlatformConfig");
        try {
            config.load(pc.toURI());
            // make changes if so desired
             ..
             ..
            // store the PlatformConfig under the default home
            config.save();
        } catch (CertificateException ce) {
            // In case the root cert is invalid, this creates a new one
            try {
                  //principal
                  config.setPrincipal("principal");
                  //password to encrypt private key with
                  config.setPassword("password");
                  config.save();
              } catch (Exception e) {
                  e.printStackTrace();
              }
        }
 

Since:
JXTA JSE 2.4

Field Summary
static int ADHOC_NODE
          Default AD-HOC configuration
protected  X509Certificate[] cert
          Public Certificate chain
protected  String description
          Default PlatformConfig Peer Description
static int EDGE_NODE
          Default Edge configuration
static int HTTP_CLIENT
          HTTP transport client Mode
static int HTTP_SERVER
          HTTP transport server Mode
protected  HTTPAdv httpConfig
          HTTP Config Advertisement
protected  boolean httpEnabled
          Default HTTP transport state
protected  PeerGroupConfigAdv infraPeerGroupConfig
          Infrastructure Peer Group Configuration
static int IP_MULTICAST
          IP multicast transport Mode
protected  URI keyStoreLocation
          Freestanding keystore location
protected  int mode
          Default mode
protected  String name
          Default peer name
protected  String password
          Password value used to generate root Certificate and to protect the Certificate's PrivateKey.
protected  PeerID peerid
          Default PeerID
protected  String principal
          Principal value used to generate root certificate
static int PROXY_NODE
          Default Proxy configuration
static int PROXY_SERVER
          Proxy Server Mode
protected  XMLElement proxyConfig
          Proxy Service Document
protected  PSEConfigAdv pseConf
          Personal Security Environment Config Advertisement
static int RDV_AD_HOC
          RendezVousService Ad-Hoc mode
static int RDV_CLIENT
          RendezVousService Client
static int RDV_NODE
          Default Rendezvous configuration
static int RDV_RELAY_PROXY_NODE
          Default Rendezvous/Relay/Proxy configuration
static int RDV_SERVER
          RendezVousService Mode
protected  RdvConfigAdv rdvConfig
          Rendezvous Config Advertisement
protected  URI rdvSeedingURI
          Default Rendezvous Seeding URI
static int RELAY_CLIENT
          Relay client Mode
static int RELAY_NODE
          Default Relay configuration
static int RELAY_OFF
          Relay off Mode
static int RELAY_SERVER
          Relay Server Mode
protected  RelayConfigAdv relayConfig
          Relay Config Advertisement
protected  URI relaySeedingURI
          Default Relay Seeding URI
protected  PrivateKey subjectPkey
          Subject private key
static int TCP_CLIENT
          TCP transport client Mode
static int TCP_SERVER
          TCP transport Server Mode
protected  TCPAdv tcpConfig
          TCP Config Advertisement
protected  boolean tcpEnabled
          Default TCP transport state
 
Constructor Summary
NetworkConfigurator()
          Creates the default NetworkConfigurator.
NetworkConfigurator(int mode, URI storeHome)
          Creates a NetworkConfigurator with the default configuration of the specified mode.
 
Method Summary
 void addRdvSeedingURI(String seedURIStr)
          Sets the new RendezvousService seeding URI as a string.
 void addRdvSeedingURI(URI seedURI)
          Sets Rendezvous Seeding URI

e.g. http://rdv.jxtahosts.net/cgi-bin/rendezvous.cgi?

 void addRelaySeedingURI(String seedURIStr)
          Sets the new RelayService seeding URI as a string.
 void addRelaySeedingURI(URI seedURI)
          Sets the RelayService Seeding URI

e.g. http://rdv.jxtahosts.net/cgi-bin/relays.cgi?

 void addSeedRelay(URI seedURI)
          Adds RelayService peer seed address

A RelayService seed is defined as a physical endpoint address

e.g. http://192.168.1.1:9700, or tcp://192.168.1.1:9701

 void addSeedRendezvous(URI seedURI)
          Adds Rendezvous peer seed, physical endpoint address

A RendezVousService seed is defined as a physical endpoint address

e.g. http://192.168.1.1:9700, or tcp://192.168.1.1:9701

 void clearRelaySeedingURIs()
          Clears the List of RelayService seeding URIs
 void clearRelaySeeds()
          Clears the List of RelayService seeds
 void clearRendezvousSeedingURIs()
          Clears the list of RendezVousService seeding URIs
 void clearRendezvousSeeds()
          Clears the list of RendezVousService seeds
 void clearRendezvousSeedURIs()
          Deprecated. The name of this method is inconsistent with it's function! It clears the seeding URIs and not the seed URIs. Use clearRendezvousSeedingURIs() instead.
protected  HTTPAdv createHttpAdv()
          Creates an HTTP transport advertisement
protected  PeerGroupConfigAdv createInfraConfigAdv()
           
protected  XMLDocument createProxyAdv()
          Creates a ProxyService configuration advertisement
protected  PSEConfigAdv createPSEAdv(String principal, String password)
          Creates Personal Security Environment Config Advertisement

The configuration advertisement can include an optional seed certificate chain and encrypted private key.

protected  PSEConfigAdv createPSEAdv(X509Certificate cert)
          Creates Personal Security Environment Config Advertisement

The configuration advertisement can include an optional seed certificate chain and encrypted private key.

protected  PSEConfigAdv createPSEAdv(X509Certificate[] certificateChain)
          Creates Personal Security Environment Config Advertisement

The configuration advertisement can include an optional seed certificate chain and encrypted private key.

protected  RdvConfigAdv createRdvConfigAdv()
          Creates a RendezVousService configuration advertisement with default values (EDGE)
protected  RelayConfigAdv createRelayConfigAdv()
          Creates a RelayService configuration advertisement with default values (EDGE)
protected  TCPAdv createTcpAdv()
          Creates an TCP transport advertisement with the platform default values.
 boolean exists()
          Returns true if a PlatformConfig file exist under store home
 X509Certificate getCertificate()
          Returns the public Certificate for this configuration.
 X509Certificate[] getCertificateChain()
          Gets the public Certificate chain for this configuration.
 File getHome()
          Returns the current directory for configuration and cache persistent store.
 String getInfrastructureDescriptionStr()
          Returns the infrastructure PeerGroup description meta-data
 String getInfrastructureIDStr()
          Gets the ID which will be used for new net peer group instances.
 String getInfrastructureName()
          Gets the infrastructure PeerGroup name meta-data
 URI getKeyStoreLocation()
          Gets the freestanding keystore location
 int getMode()
          Returns the current configuration mode

The default mode is EDGE, unless modified at construction time or through Method setMode(int).

 int getMulticastSize()
          Gets the IP group multicast packet size
 String getName()
          Gets the node name
protected  XMLDocument getParmDoc(boolean enabled, Advertisement adv)
          Returns a XMLDocument representation of an Advertisement
 String getPassword()
          Gets the password used to sign the private key of the root certificate
 PeerID getPeerID()
          Gets the PeerID
 ConfigParams getPlatformConfig()
          Returns a PlatformConfig which represents a platform configuration.
 String getPrincipal()
          Gets the Principal for the peer root certificate
 PrivateKey getPrivateKey()
          Gets the Subject private key
 URI getRdvACLURI()
          Gets Rendezvous Access Control URI if set

e.g. http://rdv.jxtahosts.net/cgi-bin/rendezvousACL.cgi?

 URI getRelayACLURI()
          Gets Relay Access Control URI if set

e.g. http://rdv.jxtahosts.net/cgi-bin/relayACL.cgi?

 URI getStoreHome()
          Returns the location which will serve as the parent for all stored items used by JXTA.
 ConfigParams load()
          Load a configuration from the specified store home uri

e.g. file:/export/dist/EdgeConfig.xml, e.g. http://configserver.net/configservice?

 ConfigParams load(URI uri)
          Loads a configuration from a specified uri

e.g. file:/export/dist/EdgeConfig.xml, e.g. http://configserver.net/configservice?

static NetworkConfigurator newAdHocConfiguration(URI storeHome)
          Creates NetworkConfigurator instance with default AD-HOC configuration
static NetworkConfigurator newEdgeConfiguration(URI storeHome)
          Creates NetworkConfigurator instance with default Edge configuration
static NetworkConfigurator newProxyConfiguration(URI storeHome)
          Creates NetworkConfigurator instance with default Proxy configuration
static NetworkConfigurator newRdvConfiguration(URI storeHome)
          Creates NetworkConfigurator instance with default Rendezvous configuration
static NetworkConfigurator newRdvRelayConfiguration(URI storeHome)
          Creates NetworkConfigurator instance with default Rendezvous configuration
static NetworkConfigurator newRdvRelayProxyConfiguration(URI storeHome)
          Creates NetworkConfigurator instance with default Rendezvous, Relay, Proxy configuration
static NetworkConfigurator newRelayConfiguration(URI storeHome)
          Creates NetworkConfigurator instance with default Relay configuration
 void save()
          Persists a PlatformConfig advertisement under getStoreHome()+"/PlaformConfig"

Home may be overridden by a call to setHome()

 void setCertificate(X509Certificate cert)
          Sets the public Certificate for this configuration.
 void setCertificateChain(X509Certificate[] certificateChain)
          Sets the public Certificate chain for this configuration.
 void setDescription(String description)
          Sets PlaformConfig Peer Description element
 void setHome(File home)
          Set the current directory for configuration and cache persistent store

(default is $CWD/.jxta)

Simple example : //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);

 void setHttpEnabled(boolean enabled)
          Toggles HTTP transport state
 void setHttpIncoming(boolean incoming)
          Toggles the HTTP transport server (incoming) mode
 void setHttpInterfaceAddress(String address)
          Sets the HTTP interface Address to bind the HTTP transport to

e.g. "192.168.1.1"

 void setHttpOutgoing(boolean outgoing)
          Toggles the HTTP transport client (outgoing) mode
 void setHttpPort(int port)
          Sets the HTTP listening port (default 9901)
 void setHttpPublicAddress(String address, boolean exclusive)
          Sets the HTTP JXTA Public Address e.g. "192.168.1.1:9700"
 void setInfrastructureDesc(XMLElement description)
          Sets the infrastructure PeerGroup description meta-data
 void setInfrastructureDescriptionStr(String description)
          Sets the infrastructure PeerGroup description meta-data
 void setInfrastructureID(ID id)
          Sets the ID which will be used for new net peer group instances.
 void setInfrastructureID(String idStr)
          Sets the ID which will be used for new net peer group instances.
 void setInfrastructureName(String name)
          Sets the infrastructure PeerGroup name meta-data
 void setKeyStoreLocation(URI keyStoreLocation)
          Sets freestanding keystore location
 void setMode(int mode)
          Sets the current node configuration mode.
 void setMulticastAddress(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 IP group multicast packet size
 void setName(String name)
          Sets the node name
 void setPassword(String password)
          Sets the password used to sign the private key of the root certificate
 void setPeerID(PeerID peerid)
          Sets the PeerID (by default, a new PeerID is generated).
 void setPeerId(String peerIdStr)
          Sets the PeerID for this Configuration
 void setPrincipal(String principal)
          Sets the Principal for the peer root certificate
 void setPrivateKey(PrivateKey subjectPkey)
          Sets the Subject private key
 void setRdvACLURI(URI aclURI)
          Sets Rendezvous Access Control URI

e.g. http://rdv.jxtahosts.net/cgi-bin/rendezvousACL.cgi?

 void setRelayACLURI(URI aclURI)
          Sets Relay Access Control URI

e.g. http://rdv.jxtahosts.net/cgi-bin/relayACL.cgi?

 void setRelayMaxClients(int relayMaxClients)
          Sets the RelayService maximum number of simultaneous relay clients
 void setRelaySeedingURIs(Set<String> seedURIs)
          Sets the relaySeeds represented as Strings

A seeding URI (when read) is expected to provide a list of physical endpoint address to relay peers

 void setRelaySeedURIs(List<String> seeds)
          Sets the List relaySeeds represented as Strings

A RelayService seed is defined as a physical endpoint address

e.g. http://192.168.1.1:9700, or tcp://192.168.1.1:9701

 void setRendezvousMaxClients(int rdvMaxClients)
          Sets the RendezVousService maximum number of simultaneous rendezvous clients
 void setRendezvousSeedingURIs(List<String> seedingURIs)
          Sets the List of RendezVousService seeding URIs represented as Strings.
 void setRendezvousSeeds(Set<String> seeds)
          Sets the List of RendezVousService seeds represented as Strings

A RendezvousService seed is defined as a physical endpoint address

e.g. http://192.168.1.1:9700, or tcp://192.168.1.1:9701

 void setRendezvousSeedURIs(List<String> seedingURIs)
          Deprecated. The name of this method is inconsistent with it's function! It sets the seeding URIs and not the seed URIs. Use #setRendezvousSeedingURIs() instead.
 void setStoreHome(URI newHome)
          Sets the location which will serve as the parent for all stored items used by JXTA.
 void setTcpEnabled(boolean enabled)
          Toggles TCP transport state
 void setTcpEndPort(int end)
          Returns the highest port on which the TCP Transport will listen if configured to do so.
 void setTcpIncoming(boolean incoming)
          Toggles TCP transport server (incoming) mode (default is on)
 void setTcpInterfaceAddress(String address)
          Sets the TCP transport interface address

e.g. "192.168.1.1"

 void setTcpOutgoing(boolean outgoing)
          Toggles TCP transport client (outgoing) mode (default is true)
 void setTcpPort(int port)
          Sets the TCP transport listening port (default 9701)
 void setTcpPublicAddress(String address, boolean exclusive)
          Sets the node public address

e.g. "192.168.1.1:9701"

This address is the physical address defined in a node's AccessPointAdvertisement.

 void setTcpStartPort(int start)
          Sets the lowest port on which the TCP Transport will listen if configured to do so.
 void setUseMulticast(boolean multicastOn)
          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
 void setUseOnlyRendezvousSeeds(boolean useOnlyRendezvouSeeds)
          Determines whether to restrict RendezvousService leases to those defined in the seed list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RELAY_OFF

public static final int RELAY_OFF
Relay off Mode

See Also:
Constant Field Values

RELAY_CLIENT

public static final int RELAY_CLIENT
Relay client Mode

See Also:
Constant Field Values

RELAY_SERVER

public static final int RELAY_SERVER
Relay Server Mode

See Also:
Constant Field Values

PROXY_SERVER

public static final int PROXY_SERVER
Proxy Server Mode

See Also:
Constant Field Values

TCP_CLIENT

public static final int TCP_CLIENT
TCP transport client Mode

See Also:
Constant Field Values

TCP_SERVER

public static final int TCP_SERVER
TCP transport Server Mode

See Also:
Constant Field Values

HTTP_CLIENT

public static final int HTTP_CLIENT
HTTP transport client Mode

See Also:
Constant Field Values

HTTP_SERVER

public static final int HTTP_SERVER
HTTP transport server Mode

See Also:
Constant Field Values

IP_MULTICAST

public static final int IP_MULTICAST
IP multicast transport Mode

See Also:
Constant Field Values

RDV_SERVER

public static final int RDV_SERVER
RendezVousService Mode

See Also:
Constant Field Values

RDV_CLIENT

public static final int RDV_CLIENT
RendezVousService Client

See Also:
Constant Field Values

RDV_AD_HOC

public static final int RDV_AD_HOC
RendezVousService Ad-Hoc mode

See Also:
Constant Field Values

ADHOC_NODE

public static final int ADHOC_NODE
Default AD-HOC configuration

See Also:
Constant Field Values

EDGE_NODE

public static final int EDGE_NODE
Default Edge configuration

See Also:
Constant Field Values

RDV_NODE

public static final int RDV_NODE
Default Rendezvous configuration

See Also:
Constant Field Values

RELAY_NODE

public static final int RELAY_NODE
Default Relay configuration

See Also:
Constant Field Values

PROXY_NODE

public static final int PROXY_NODE
Default Proxy configuration

See Also:
Constant Field Values

RDV_RELAY_PROXY_NODE

public static final int RDV_RELAY_PROXY_NODE
Default Rendezvous/Relay/Proxy configuration

See Also:
Constant Field Values

mode

protected transient int mode
Default mode


description

protected transient String description
Default PlatformConfig Peer Description


name

protected transient String name
Default peer name


password

protected transient String password
Password value used to generate root Certificate and to protect the Certificate's PrivateKey.


peerid

protected transient PeerID peerid
Default PeerID


principal

protected transient String principal
Principal value used to generate root certificate


cert

protected transient X509Certificate[] cert
Public Certificate chain


subjectPkey

protected transient PrivateKey subjectPkey
Subject private key


keyStoreLocation

protected transient URI keyStoreLocation
Freestanding keystore location


proxyConfig

protected transient XMLElement proxyConfig
Proxy Service Document


pseConf

protected transient PSEConfigAdv pseConf
Personal Security Environment Config Advertisement

See Also:
net.jxta.impl.membership.pse.PSEConfig

rdvConfig

protected transient RdvConfigAdv rdvConfig
Rendezvous Config Advertisement


rdvSeedingURI

protected URI rdvSeedingURI
Default Rendezvous Seeding URI


relayConfig

protected transient RelayConfigAdv relayConfig
Relay Config Advertisement


relaySeedingURI

protected transient URI relaySeedingURI
Default Relay Seeding URI


tcpConfig

protected transient TCPAdv tcpConfig
TCP Config Advertisement


tcpEnabled

protected transient boolean tcpEnabled
Default TCP transport state


httpConfig

protected transient HTTPAdv httpConfig
HTTP Config Advertisement


httpEnabled

protected transient boolean httpEnabled
Default HTTP transport state


infraPeerGroupConfig

protected transient PeerGroupConfigAdv infraPeerGroupConfig
Infrastructure Peer Group Configuration

Constructor Detail

NetworkConfigurator

public NetworkConfigurator()
Creates the default NetworkConfigurator. The configuration is stored with a default configuration mode of EDGE_NODE


NetworkConfigurator

public NetworkConfigurator(int mode,
                           URI storeHome)
Creates a NetworkConfigurator with the default configuration of the specified mode.

Valid modes include ADHOC_NODE, EDGE_NODE, RDV_NODE PROXY_NODE, RELAY_NODE, RDV_RELAY_PROXY_NODE, or any combination of specific configuration.

e.g. RDV_NODE | HTTP_CLIENT

Parameters:
mode - the new configuration mode
storeHome - the URI to persistent store
See Also:
setMode(int)
Method Detail

newAdHocConfiguration

public static NetworkConfigurator newAdHocConfiguration(URI storeHome)
Creates NetworkConfigurator instance with default AD-HOC configuration

Parameters:
storeHome - the URI to persistent store
Returns:
NetworkConfigurator instance with default AD-HOC configuration

newEdgeConfiguration

public static NetworkConfigurator newEdgeConfiguration(URI storeHome)
Creates NetworkConfigurator instance with default Edge configuration

Parameters:
storeHome - the URI to persistent store
Returns:
NetworkConfigurator instance with default AD-HOC configuration

newRdvConfiguration

public static NetworkConfigurator newRdvConfiguration(URI storeHome)
Creates NetworkConfigurator instance with default Rendezvous configuration

Parameters:
storeHome - the URI to persistent store
Returns:
NetworkConfigurator instance with default Rendezvous configuration

newRelayConfiguration

public static NetworkConfigurator newRelayConfiguration(URI storeHome)
Creates NetworkConfigurator instance with default Relay configuration

Parameters:
storeHome - the URI to persistent store
Returns:
NetworkConfigurator instance with default Relay configuration

newRdvRelayConfiguration

public static NetworkConfigurator newRdvRelayConfiguration(URI storeHome)
Creates NetworkConfigurator instance with default Rendezvous configuration

Parameters:
storeHome - the URI to persistent store
Returns:
NetworkConfigurator instance with default Rendezvous configuration

newProxyConfiguration

public static NetworkConfigurator newProxyConfiguration(URI storeHome)
Creates NetworkConfigurator instance with default Proxy configuration

Parameters:
storeHome - the URI to persistent store
Returns:
NetworkConfigurator instance with defaultProxy configuration

newRdvRelayProxyConfiguration

public static NetworkConfigurator newRdvRelayProxyConfiguration(URI storeHome)
Creates NetworkConfigurator instance with default Rendezvous, Relay, Proxy configuration

Parameters:
storeHome - the URI to persistent store
Returns:
NetworkConfigurator instance with default Rendezvous, Relay, Proxy configuration

setDescription

public void setDescription(String description)
Sets PlaformConfig Peer Description element

Parameters:
description - the peer description

setHome

public void setHome(File home)
Set the current directory for configuration and cache persistent store

(default is $CWD/.jxta)

Simple example :
  
   //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);
   
 

Parameters:
home - the new home value
See Also:
getHome()

getHome

public File getHome()
Returns the current directory for configuration and cache persistent store. This is the same location as returned by getStoreHome() which is more general than this method.

Returns:
Returns the current home directory
See Also:
setHome(java.io.File)

getStoreHome

public URI getStoreHome()
Returns the location which will serve as the parent for all stored items used by JXTA.

Returns:
The location which will serve as the parent for all stored items used by JXTA.
See Also:
PeerGroup.getStoreHome()

setStoreHome

public void setStoreHome(URI newHome)
Sets the location which will serve as the parent for all stored items used by JXTA.

See Also:
PeerGroup.getStoreHome()

setHttpEnabled

public void setHttpEnabled(boolean enabled)
Toggles HTTP transport state

Parameters:
enabled - if true, enables HTTP transport

setHttpIncoming

public void setHttpIncoming(boolean incoming)
Toggles the HTTP transport server (incoming) mode

Parameters:
incoming - toggles HTTP transport server mode

setHttpOutgoing

public void setHttpOutgoing(boolean outgoing)
Toggles the HTTP transport client (outgoing) mode

Parameters:
outgoing - toggles HTTP transport client mode

setHttpPort

public void setHttpPort(int port)
Sets the HTTP listening port (default 9901)

Parameters:
port - the new HTTP port value

setHttpInterfaceAddress

public void setHttpInterfaceAddress(String address)
Sets the HTTP interface Address to bind the HTTP transport to

e.g. "192.168.1.1"

Parameters:
address - the new address value

setHttpPublicAddress

public void setHttpPublicAddress(String address,
                                 boolean exclusive)
Sets the HTTP JXTA Public Address e.g. "192.168.1.1:9700"

Parameters:
address - the HTTP transport public address
exclusive - determines whether an address is advertised exclusively

setInfrastructureID

public void setInfrastructureID(ID id)
Sets the ID which will be used for new net peer group instances.

By Setting an alternate infrastructure PeerGroup ID (aka NetPeerGroup), it prevents heterogeneous infrastructure PeerGroups from intersecting.

This is highly recommended practice for application deployment

Parameters:
id - the new infrastructure PeerGroupID as a string
See Also:
PeerGroupFactory.setNetPGID(net.jxta.peergroup.PeerGroupID)

setInfrastructureID

public void setInfrastructureID(String idStr)
Sets the ID which will be used for new net peer group instances.

By Setting an alternate infrastructure PeerGroup ID (aka NetPeerGroup), it prevents heterogeneous infrastructure PeerGroups from intersecting.

This is highly recommended practice for application deployment

Parameters:
idStr - the new infrastructure PeerGroupID as a string
See Also:
PeerGroupFactory.setNetPGID(net.jxta.peergroup.PeerGroupID)

getInfrastructureIDStr

public String getInfrastructureIDStr()
Gets the ID which will be used for new net peer group instances.

Returns:
the infrastructure PeerGroupID as a string

setInfrastructureName

public void setInfrastructureName(String name)
Sets the infrastructure PeerGroup name meta-data

Parameters:
name - the Infrastructure PeerGroup name
See Also:
PeerGroupFactory.setNetPGName(java.lang.String)

getInfrastructureName

public String getInfrastructureName()
Gets the infrastructure PeerGroup name meta-data

Returns:
the Infrastructure PeerGroup name

setInfrastructureDescriptionStr

public void setInfrastructureDescriptionStr(String description)
Sets the infrastructure PeerGroup description meta-data

Parameters:
description - the infrastructure PeerGroup description
See Also:
PeerGroupFactory.setNetPGDesc(java.lang.String)

getInfrastructureDescriptionStr

public String getInfrastructureDescriptionStr()
Returns the infrastructure PeerGroup description meta-data

Returns:
the infrastructure PeerGroup description meta-data

setInfrastructureDesc

public void setInfrastructureDesc(XMLElement description)
Sets the infrastructure PeerGroup description meta-data

Parameters:
description - the infrastructure PeerGroup description
See Also:
PeerGroupFactory.setNetPGDesc(java.lang.String)

setMode

public void setMode(int mode)
Sets the current node configuration 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

Parameters:
mode - the new configuration mode
See Also:
getMode()

getMode

public int getMode()
Returns the current configuration mode

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.

Returns:
mode the current mode value
See Also:
setMode(int)

setMulticastSize

public void setMulticastSize(int size)
Sets the IP group multicast packet size

Parameters:
size - the new multicast packet

getMulticastSize

public int getMulticastSize()
Gets the IP group multicast packet size

Returns:
the multicast packet

setMulticastAddress

public void setMulticastAddress(String mcastAddress)
Sets the IP group multicast address (default 224.0.1.85)

Parameters:
mcastAddress - the new multicast group address
See Also:
setMulticastPort(int)

setMulticastPort

public void setMulticastPort(int port)
Sets the IP group multicast port (default 1234)

Parameters:
port - the new IP group multicast port
See Also:
setMulticastAddress(java.lang.String)

setName

public void setName(String name)
Sets the node name

Parameters:
name - node name

getName

public String getName()
Gets the node name

Returns:
node name

setPrincipal

public void setPrincipal(String principal)
Sets the Principal for the peer root certificate

Parameters:
principal - the new principal value
See Also:
setPassword(java.lang.String), getPrincipal(), setPrincipal(java.lang.String)

getPrincipal

public String getPrincipal()
Gets the Principal for the peer root certificate

Returns:
principal if a principal is set, null otherwise
See Also:
setPassword(java.lang.String), getPrincipal(), setPrincipal(java.lang.String)

setCertificate

public void setCertificate(X509Certificate cert)
Sets the public Certificate for this configuration.

Parameters:
cert - the new cert value

getCertificate

public X509Certificate getCertificate()
Returns the public Certificate for this configuration.

Returns:
X509Certificate

setCertificateChain

public void setCertificateChain(X509Certificate[] certificateChain)
Sets the public Certificate chain for this configuration.

Parameters:
certificateChain - the new Certificate chain value

getCertificateChain

public X509Certificate[] getCertificateChain()
Gets the public Certificate chain for this configuration.

Returns:
X509Certificate chain

setPrivateKey

public void setPrivateKey(PrivateKey subjectPkey)
Sets the Subject private key

Parameters:
subjectPkey - the subject private key

getPrivateKey

public PrivateKey getPrivateKey()
Gets the Subject private key

Returns:
the subject private key

setKeyStoreLocation

public void setKeyStoreLocation(URI keyStoreLocation)
Sets freestanding keystore location

Parameters:
keyStoreLocation - the absolute location of the freestanding keystore

getKeyStoreLocation

public URI getKeyStoreLocation()
Gets the freestanding keystore location

Returns:
the location of the freestanding keystore

setPassword

public void setPassword(String password)
Sets the password used to sign the private key of the root certificate

Parameters:
password - the new password value
See Also:
setPassword(java.lang.String), getPrincipal(), setPrincipal(java.lang.String)

getPassword

public String getPassword()
Gets the password used to sign the private key of the root certificate

Returns:
password if a password is set, null otherwise
See Also:
setPassword(java.lang.String), getPrincipal(), setPrincipal(java.lang.String)

setPeerID

public void setPeerID(PeerID peerid)
Sets the PeerID (by default, a new PeerID is generated).

Note: Persist the PeerID generated, or use load() to avoid overridding a node's PeerID between restarts.

Parameters:
peerid - the new net.jxta.peer.PeerID

getPeerID

public PeerID getPeerID()
Gets the PeerID

Returns:
peerid the net.jxta.peer.PeerID value

addRdvSeedingURI

public void addRdvSeedingURI(URI seedURI)
Sets Rendezvous Seeding URI

e.g. http://rdv.jxtahosts.net/cgi-bin/rendezvous.cgi?3

Parameters:
seedURI - Rendezvous service seeding URI

setRdvACLURI

public void setRdvACLURI(URI aclURI)
Sets Rendezvous Access Control URI

e.g. http://rdv.jxtahosts.net/cgi-bin/rendezvousACL.cgi?3

Parameters:
aclURI - Rendezvous Access Control URI

getRdvACLURI

public URI getRdvACLURI()
Gets Rendezvous Access Control URI if set

e.g. http://rdv.jxtahosts.net/cgi-bin/rendezvousACL.cgi?3

Returns:
aclURI Rendezvous Access Control URI

setRelayACLURI

public void setRelayACLURI(URI aclURI)
Sets Relay Access Control URI

e.g. http://rdv.jxtahosts.net/cgi-bin/relayACL.cgi?3

Parameters:
aclURI - Relay Access Control URI

getRelayACLURI

public URI getRelayACLURI()
Gets Relay Access Control URI if set

e.g. http://rdv.jxtahosts.net/cgi-bin/relayACL.cgi?3

Returns:
aclURI Relay Access Control URI

setRelayMaxClients

public void setRelayMaxClients(int relayMaxClients)
Sets the RelayService maximum number of simultaneous relay clients

Parameters:
relayMaxClients - the new relayMaxClients value

addRelaySeedingURI

public void addRelaySeedingURI(URI seedURI)
Sets the RelayService Seeding URI

e.g. http://rdv.jxtahosts.net/cgi-bin/relays.cgi?3

A seeding URI (when read) is expected to provide a list of physical endpoint addresse(s) to relay peers

Parameters:
seedURI - RelayService seeding URI

setRendezvousMaxClients

public void setRendezvousMaxClients(int rdvMaxClients)
Sets the RendezVousService maximum number of simultaneous rendezvous clients

Parameters:
rdvMaxClients - the new rendezvousMaxClients value

setTcpEnabled

public void setTcpEnabled(boolean enabled)
Toggles TCP transport state

Parameters:
enabled - if true, enables TCP transport

setTcpPort

public void setTcpPort(int port)
Sets the TCP transport listening port (default 9701)

Parameters:
port - the new tcpPort value

setTcpStartPort

public void setTcpStartPort(int start)
Sets the lowest port on which the TCP Transport will listen if configured to do so. 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.

Parameters:
start - the lowest port on which to listen.

setTcpEndPort

public void setTcpEndPort(int end)
Returns the highest port on which the TCP Transport will listen if configured to do so. 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 greater than the value used for start port.

Parameters:
end - the new TCP end port

setTcpIncoming

public void setTcpIncoming(boolean incoming)
Toggles TCP transport server (incoming) mode (default is on)

Parameters:
incoming - the new TCP server mode

setTcpOutgoing

public void setTcpOutgoing(boolean outgoing)
Toggles TCP transport client (outgoing) mode (default is true)

Parameters:
outgoing - the new tcpOutgoing value

setTcpInterfaceAddress

public void setTcpInterfaceAddress(String address)
Sets the TCP transport interface address

e.g. "192.168.1.1"

Parameters:
address - the TCP transport interface address

setTcpPublicAddress

public void setTcpPublicAddress(String address,
                                boolean exclusive)
Sets the node public address

e.g. "192.168.1.1:9701"

This address is the physical address defined in a node's AccessPointAdvertisement. This often required for NAT'd/FW nodes

Parameters:
address - the TCP transport public address
exclusive - public address advertised exclusively

setUseMulticast

public void setUseMulticast(boolean multicastOn)
Toggles whether to use IP group multicast (default is true)

Parameters:
multicastOn - the new useMulticast value

setUseOnlyRelaySeeds

public void setUseOnlyRelaySeeds(boolean useOnlyRelaySeeds)
Determines whether to restrict RelayService leases to those defined in the seed list

Parameters:
useOnlyRelaySeeds - restrict RelayService lease to seed list

setUseOnlyRendezvousSeeds

public void setUseOnlyRendezvousSeeds(boolean useOnlyRendezvouSeeds)
Determines whether to restrict RendezvousService leases to those defined in the seed list

Parameters:
useOnlyRendezvouSeeds - restrict RendezvousService lease to seed list

addSeedRelay

public void addSeedRelay(URI seedURI)
Adds RelayService peer seed address

A RelayService seed is defined as a physical endpoint address

e.g. http://192.168.1.1:9700, or tcp://192.168.1.1:9701

Parameters:
seedURI - the relay seed URI

addSeedRendezvous

public void addSeedRendezvous(URI seedURI)
Adds Rendezvous peer seed, physical endpoint address

A RendezVousService seed is defined as a physical endpoint address

e.g. http://192.168.1.1:9700, or tcp://192.168.1.1:9701

Parameters:
seedURI - the rendezvous seed URI

exists

public boolean exists()
Returns true if a PlatformConfig file exist under store home

Returns:
true if a PlatformConfig file exist under store home

setPeerId

public void setPeerId(String peerIdStr)
Sets the PeerID for this Configuration

Parameters:
peerIdStr - the new PeerID as a string

addRdvSeedingURI

public void addRdvSeedingURI(String seedURIStr)
Sets the new RendezvousService seeding URI as a string.

A seeding URI (when read) is expected to provide a list of physical endpoint address to rendezvous peers

Parameters:
seedURIStr - the new rendezvous seed URI as a string

addRelaySeedingURI

public void addRelaySeedingURI(String seedURIStr)
Sets the new RelayService seeding URI as a string.

A seeding URI (when read) is expected to provide a list of physical endpoint address to relay peers

Parameters:
seedURIStr - the new RelayService seed URI as a string

setRelaySeedURIs

public void setRelaySeedURIs(List<String> seeds)
Sets the List relaySeeds represented as Strings

A RelayService seed is defined as a physical endpoint address

e.g. http://192.168.1.1:9700, or tcp://192.168.1.1:9701

Parameters:
seeds - the Set RelayService seed URIs as a string

setRelaySeedingURIs

public void setRelaySeedingURIs(Set<String> seedURIs)
Sets the relaySeeds represented as Strings

A seeding URI (when read) is expected to provide a list of physical endpoint address to relay peers

Parameters:
seedURIs - the List relaySeeds represented as Strings

clearRelaySeeds

public void clearRelaySeeds()
Clears the List of RelayService seeds


clearRelaySeedingURIs

public void clearRelaySeedingURIs()
Clears the List of RelayService seeding URIs


setRendezvousSeeds

public void setRendezvousSeeds(Set<String> seeds)
Sets the List of RendezVousService seeds represented as Strings

A RendezvousService seed is defined as a physical endpoint address

e.g. http://192.168.1.1:9700, or tcp://192.168.1.1:9701

Parameters:
seeds - the Set of rendezvousSeeds represented as Strings

setRendezvousSeedURIs

@Deprecated
public void setRendezvousSeedURIs(List<String> seedingURIs)
Deprecated. The name of this method is inconsistent with it's function! It sets the seeding URIs and not the seed URIs. Use #setRendezvousSeedingURIs() instead.

Sets the List of RendezVousService seeding URIs represented as Strings. A seeding URI (when read) is expected to provide a list of physical endpoint address to rendezvous peers.

Parameters:
seedURIs - the List rendezvousSeeds represented as Strings

setRendezvousSeedingURIs

public void setRendezvousSeedingURIs(List<String> seedingURIs)
Sets the List of RendezVousService seeding URIs represented as Strings. A seeding URI (when read) is expected to provide a list of physical endpoint address to rendezvous peers.

Parameters:
seedURIs - the List rendezvousSeeds represented as Strings.

clearRendezvousSeeds

public void clearRendezvousSeeds()
Clears the list of RendezVousService seeds


clearRendezvousSeedURIs

@Deprecated
public void clearRendezvousSeedURIs()
Deprecated. The name of this method is inconsistent with it's function! It clears the seeding URIs and not the seed URIs. Use clearRendezvousSeedingURIs() instead.

Clears the list of RendezVousService seeding URIs


clearRendezvousSeedingURIs

public void clearRendezvousSeedingURIs()
Clears the list of RendezVousService seeding URIs


load

public ConfigParams load()
                  throws IOException,
                         CertificateException
Load a configuration from the specified store home uri

e.g. file:/export/dist/EdgeConfig.xml, e.g. http://configserver.net/configservice?Edge

Returns:
The loaded configuration.
Throws:
IOException - if an i/o error occurs
CertificateException - if the MembershipService is invalid

load

public ConfigParams load(URI uri)
                  throws IOException,
                         CertificateException
Loads a configuration from a specified uri

e.g. file:/export/dist/EdgeConfig.xml, e.g. http://configserver.net/configservice?Edge

Parameters:
uri - the URI to PlatformConfig
Returns:
The loaded configuration.
Throws:
IOException - if an i/o error occurs
CertificateException - if the MemebershipService is invalid

save

public void save()
          throws IOException
Persists a PlatformConfig advertisement under getStoreHome()+"/PlaformConfig"

Home may be overridden by a call to setHome()

Throws:
IOException - If there is a failure saving the PlatformConfig.
See Also:
load()

getParmDoc

protected XMLDocument getParmDoc(boolean enabled,
                                 Advertisement adv)
Returns a XMLDocument representation of an Advertisement

Parameters:
enabled - whether the param doc is enabled, adds a "isOff" element if disabled
adv - the Advertisement to retrieve the param doc from
Returns:
the parmDoc value

createHttpAdv

protected HTTPAdv createHttpAdv()
Creates an HTTP transport advertisement

Returns:
an HTTP transport advertisement

createPSEAdv

protected PSEConfigAdv createPSEAdv(String principal,
                                    String password)
Creates Personal Security Environment Config Advertisement

The configuration advertisement can include an optional seed certificate chain and encrypted private key. If this seed information is present the PSE Membership Service will require an initial authentication to unlock the encrypted private key before creating the PSE keystore. The newly created PSE keystore will be "seeded" with the certificate chain and the private key.

Parameters:
principal - principal
password - the password used to sign the private key of the root certificate
Returns:
PSEConfigAdv an PSE config advertisement
See Also:
net.jxta.impl.protocol.PSEConfigAdv

createPSEAdv

protected PSEConfigAdv createPSEAdv(X509Certificate cert)
Creates Personal Security Environment Config Advertisement

The configuration advertisement can include an optional seed certificate chain and encrypted private key. If this seed information is present the PSE Membership Service will require an initial authentication to unlock the encrypted private key before creating the PSE keystore. The newly created PSE keystore will be "seeded" with the certificate chain and the private key.

Parameters:
cert - X509Certificate
Returns:
PSEConfigAdv an PSE config advertisement
See Also:
net.jxta.impl.protocol.PSEConfigAdv

createPSEAdv

protected PSEConfigAdv createPSEAdv(X509Certificate[] certificateChain)
Creates Personal Security Environment Config Advertisement

The configuration advertisement can include an optional seed certificate chain and encrypted private key. If this seed information is present the PSE Membership Service will require an initial authentication to unlock the encrypted private key before creating the PSE keystore. The newly created PSE keystore will be "seeded" with the certificate chain and the private key.

Parameters:
certificateChain - X509Certificate[]
Returns:
PSEConfigAdv an PSE config advertisement
See Also:
net.jxta.impl.protocol.PSEConfigAdv

createProxyAdv

protected XMLDocument createProxyAdv()
Creates a ProxyService configuration advertisement

Returns:
ProxyService configuration advertisement

createRdvConfigAdv

protected RdvConfigAdv createRdvConfigAdv()
Creates a RendezVousService configuration advertisement with default values (EDGE)

Returns:
a RdvConfigAdv

createRelayConfigAdv

protected RelayConfigAdv createRelayConfigAdv()
Creates a RelayService configuration advertisement with default values (EDGE)

Returns:
a RelayConfigAdv

createTcpAdv

protected TCPAdv createTcpAdv()
Creates an TCP transport advertisement with the platform default values. multicast on, 224.0.1.85:1234, with a max packet size of 16K

Returns:
a TCP transport advertisement

createInfraConfigAdv

protected PeerGroupConfigAdv createInfraConfigAdv()

getPlatformConfig

public ConfigParams getPlatformConfig()
Returns a PlatformConfig which represents a platform configuration.

Fine tuning is achieved through accessing each configured advertisement and achieved through accessing each configured advertisement and modifying each object directly.

Returns:
the PeerPlatformConfig Advertisement

JXSE