serves primarily as a JXTA property sheet and
implements very little attribute association logic beyond that of what
is required to perform integrity validation and address expansion. To
the latter, All addresses are of the form URI. Addresses that do not
specify a scheme will default accordingly. Further, RendezVous
and Relay
addresses that do not specify a host wil be replaced
with the corresponding boostrap results. If a scheme is specified only
bootstrap results with matching schemes will be maintained. All other
addresses that do not specify a host will, in turn, be replaced with the
local host. All fields have backing defaults enabling one to seed a
configuration with a partial yet valid resource file.
Configurator will parse an existing PlatformConfig
if
one exists in the specified JXTA home
directory. If
this is not the case, a Configuration
file will be
parsed it one such file exists. Lastly, if neither of the above are
resolvable the Default profile
will be used to seed the newly created instance.
Resulting PlatformConfig
instances can then be retrieved or
persisted upon passing the integrity validation checks.
- Version:
- $Id: Configurator.java,v 1.184 2004/11/30 22:42:10 gonzo Exp $
- Author:
- james todd [gonzo at jxta dot org]
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Configurator
public Configurator()
- Deprecated. It's recommended to use the four params constructor
- Constructor for the Configurator object.
Configurator
public Configurator(String name,
String password)
- Constructor for the Configurator object.
- Parameters:
name
- peer namepassword
- peer password
Configurator
public Configurator(String name,
String principal,
String password)
- Deprecated. It's recommended to use the four param constructor
- Constructor for the Configurator object.
- Parameters:
name
- peer nameprincipal
- peer principalpassword
- peer password
Configurator
public Configurator(String name,
String description,
String principal,
String password)
- Constructor for the Configurator object.
If a Platform configuration file
is found
residing in the JXTA home
directory it is used to
seed this instance. If this fails and a Env#PROFILEProfile
is
found residing in the JXTA home
directory, it is,
in turn, used to seed this instance. In the event neither of these
configuration files are found the defaults
are
configured accordingly.
- Parameters:
name
- peer namedescription
- peer descriptionprincipal
- peer principalpassword
- peer password- See Also:
PlatformConfig
Configurator
public Configurator(Profile profile)
- Constructor for the Configurator object.
If the provided Profile
is null the default profile
will be used in it's place.
- Parameters:
profile
- profile
Configurator
public Configurator(PlatformConfig config)
- Constructor for the Configurator object.
If the provided PlatformConfig
is null a default
PlatformConfig will be used in it's place.
- Parameters:
config
- configuration- See Also:
PlatformConfig
getHome
public static File getHome()
- Gets base JXTA home.
- Returns:
- The home value
setHome
public static void setHome(File home)
- Sets the home attribute of the Configurator class
- Parameters:
home
- The new home value
setConfigurator
public static void setConfigurator(Class configurator)
toAllAddresses
public static URI toAllAddresses(URI base)
- Method to transpose
URI
into one that represents all local
interfaces.
- Parameters:
base
- The provided address
- Returns:
- Description of the Return Value
- See Also:
Env.ALL_ADDRESSES
load
public ConfigParams load()
throws ConfiguratorException
-
- Specified by:
load
in interface Configurator
- Throws:
ConfiguratorException
load
public PlatformConfig load(File loadFile)
throws ConfiguratorException
- Persist the associated{ @link net.jxta.impl.protocol.PlatformConfig} to
the specified
location
.
- Specified by:
load
in interface PlatformConfigurator
- Parameters:
loadFile
- The file to which the configuration will be saved.
- Returns:
true
if the configuration was successfully saved
otherwise false
. If the parameters are not persisted then
false/code> is returned.
- Throws:
ConfiguratorException
getJXTAHome
public URI getJXTAHome()
- Specified by:
getJXTAHome
in interface PlatformConfigurator
getDescriptor
public String getDescriptor()
- Gets the descriptor.
- Returns:
- The descriptor value
setDescriptor
public void setDescriptor(String descriptor)
- Sets the descriptor
- Parameters:
descriptor
- The new descriptor value
getName
public String getName()
- Gets the
Peer
name.
- Returns:
- The peer name
setName
public void setName(String name)
- Sets the
Peer
name.
- Parameters:
name
- the peer name
getDescription
public String getDescription()
- Gets the
Peer
description.
- Returns:
- The peer description
setDescription
public void setDescription(String description)
- Sets the
Peer
description.
- Parameters:
description
- the peer description
getTrace
public Trace getTrace()
- Gets the
Trace
.
- Returns:
- The Trace
setTrace
public void setTrace(Trace trace)
- Sets the
Trace
level.
- Parameters:
trace
- the Trace
getPeerId
public PeerID getPeerId()
- Gets the
PeerID
.
- Returns:
- The PeerID
setPeerId
public void setPeerId(PeerID peerId)
- Sets the
PeerID
.
Unspecified PeerIDs will be generated by the Platform
.
- Parameters:
peerId
- The PeerID
isRendezVous
public boolean isRendezVous()
- Gets the
RendezVous
enabler.
- Returns:
- The RendezVous enabler
setRendezVous
public void setRendezVous(boolean isEnabled)
- Sets the
RendezVous
enabler.
- Parameters:
isEnabled
- The RendezVous enabler
getRendezVous
public List getRendezVous()
- Gets the
RendezVous
addresses.
- Returns:
- The RendezVous addresses
setRendezVous
public void setRendezVous(URI rendezVous)
throws ConfiguratorException
- Sets the
RendezVous
addresses.
RendezVous addresses with unspecified host information will be, upon
PlatformConfig
generation, be replaced with the associated
bootstrap results. Further, if the scheme is provided.then only matching
boostrap results will be retained.
- Parameters:
rendezVous
- The RendezVous address
- Throws:
ConfiguratorException
- Description of the Exception
ConfiguratorException
setRendezVous
public void setRendezVous(List seed)
throws ConfiguratorException
- Sets the
RendezVous
addresses.
RendezVous addresses with unspecified host information will be, upon
PlatformConfig
generation, be replaced with the associated
bootstrap results. Further, if the scheme is provided.then only matching
boostrap results will be retained.
- Throws:
ConfiguratorException
- Description of the Exception
ConfiguratorException
addRendezVous
public void addRendezVous(URI seed)
throws ConfiguratorException
- Adds a
RendezVous
address.
RendezVous addresses with unspecified host information will be, upon
PlatformConfig
generation, be replaced with the associated
bootstrap results. Further, if the scheme is provided.then only matching
boostrap results will be retained.
- Throws:
ConfiguratorException
- Description of the Exception
ConfiguratorException
addRendezVous
public void addRendezVous(List seed)
throws ConfiguratorException
- Adds
RendezVous
addresses.
RendezVous addresses with unspecified host information will be, upon
PlatformConfig
generation, be replaced with the associated
bootstrap results. Further, if the scheme is provided.then only matching
boostrap results will be retained.
- Throws:
ConfiguratorException
- Description of the Exception
ConfiguratorException
removeRendezVous
public URI removeRendezVous(URI rendezVous)
- Remove the
RendezVous
address.
- Parameters:
rendezVous
- The RendezVous address
- Returns:
- Description of the Return Value
clearRendezVous
public void clearRendezVous()
- Remove all
RendezVous
addresses.
isRendezVousAutoStart
public boolean isRendezVousAutoStart()
- Get
RendezVousService
AutoStart status.
- Returns:
- The rendezVousAutoStart value
setRendezVousAutoStart
public void setRendezVousAutoStart(boolean isAutoStart)
- Deprecated. controlled via setting autostart interval.
- Set
RendezVousService
AutoStart status enabling the
resulting Peer
to become a RendezVous
if the
ascribed RendezVous are not accessible.
- Parameters:
isAutoStart
- The new rendezVousAutoStart value
getRendezVousAutoStart
public long getRendezVousAutoStart()
- Gets the
RendezVous
AutoStart delay in milliseconds.
- Returns:
- autoStart
setRendezVousAutoStart
public void setRendezVousAutoStart(long autoStart)
- Sets the
RendezVous
AutoStart delay measured in
milliseconds.
- Parameters:
autoStart
- autoStart delay in milliseconds
isRelay
public boolean isRelay()
- Gets the
Relay
enabler.
- Returns:
- The Relay enabler.
setRelay
public void setRelay(boolean isEnabled)
- Sets the
Relay
enabler.
- Parameters:
isEnabled
- The Relay enabler.
getRelays
public List getRelays()
- Gets the
Relay
addresses.
- Returns:
- The relays value
setRelay
public void setRelay(URI relay)
throws ConfiguratorException
- Sets the
Relay
address.
Relays addresses with unspecified host information will be, upon
PlatformConfig
generation, be replaced with the
associated bootstrap results. Further if the scheme is provided.then
only matching boostrap results will be retained.
- Parameters:
relay
- The Relay address
- Throws:
ConfiguratorException
- Description of the Exception
ConfiguratorException
setRelays
public void setRelays(List relays)
throws ConfiguratorException
- Sets the
Relay
addresses.
Relays addresses with unspecified host information will be, upon
PlatformConfig
generation, be replaced with the
associated bootstrap results. Further, if the scheme is provided
then only matching boostrap results will be retained.
- Parameters:
relays
- The Relay addresses
- Throws:
ConfiguratorException
- Description of the Exception
ConfiguratorException
addRelay
public void addRelay(URI relay)
throws ConfiguratorException
- Adds a
Relay
address.
Relays addresses with unspecified host information will be, upon
PlatformConfig
generation, be replaced with the
associated bootstrap results. Further if the scheme is provided
then only matching boostrap results will be retained.
- Parameters:
relay
- The Relay address.
- Throws:
ConfiguratorException
- Description of the Exception
ConfiguratorException
addRelays
public void addRelays(List relays)
throws ConfiguratorException
- Adds
Relay
addresses.
Relays addresses with unspecified host information will be, upon
PlatformConfig
generation, be replaced with the
associated bootstrap results. Further if the scheme is provided
then only matching boostrap results will be retained.
- Parameters:
relays
- The Relay addresses
- Throws:
ConfiguratorException
- Description of the Exception
ConfiguratorException
removeRelay
public URI removeRelay(URI relay)
- Remove the
Relay
address.
- Parameters:
relay
- The Relay address
- Returns:
- Description of the Return Value
clearRelays
public void clearRelays()
- Remove all
Relay
addresses.
isRelayIncoming
public boolean isRelayIncoming()
- Gets the
Relay
incoming enabler.
- Returns:
- The Relay enabler
setRelayIncoming
public void setRelayIncoming(boolean isEnabled)
- Sets the
Relay
enabler enabling inbound connections.
- Parameters:
isEnabled
- The Relay enabler
getRelayIncomingMaximum
public int getRelayIncomingMaximum()
- Gets the
Relay
incoming maximum.
- Returns:
- The Relay incoming maximum
setRelayIncomingMaximum
public void setRelayIncomingMaximum(int maximumIncoming)
- Sets the
Relay
incoming maximum.
- Parameters:
maximumIncoming
- The Relay incoming maximum
getRelayIncomingLease
public long getRelayIncomingLease()
- Gets the
Relay
incoming lease measured in milliseconds.
- Returns:
- The Relay incoming lease
setRelayIncomingLease
public void setRelayIncomingLease(long incomingLease)
- Sets the
Relay
incoming lease measured in milliseconds.
- Parameters:
incomingLease
- The Relay incoming lease
isRelayOutgoing
public boolean isRelayOutgoing()
- Gets the
Relay
outgoing enabler.
- Returns:
- The Relay outgoing enabler
setRelayOutgoing
public void setRelayOutgoing(boolean isEnabled)
- Sets the
Relay
outgoing enabler enabling outbound
connnections.
- Parameters:
isEnabled
- The Relay outgoing enabler
getRelayOutgoingMaximum
public int getRelayOutgoingMaximum()
- Gets the
Relay
outgoing maximum.
- Returns:
- The Relay outgoing maximum
setRelayOutgoingMaximum
public void setRelayOutgoingMaximum(int maximumOutgoing)
- Sets the
Relay
outgoing maximum.
- Parameters:
maximumOutgoing
- The Relay outgoing maximum
getRelayOutgoingLease
public long getRelayOutgoingLease()
- Gets the
Relay
outgoing lease measured in milliseconds.
- Returns:
- The Relay outgoing lease
setRelayOutgoingLease
public void setRelayOutgoingLease(long outgoingLease)
- Sets the
Relay
outgoing lease measured in milliseconds.
- Parameters:
outgoingLease
- The Relay outgoing lease
getRelayQueueSize
public int getRelayQueueSize()
- Gets the
Relay
queue size measured in messages.
- Returns:
- The Relay queue size
setRelayQueueSize
public void setRelayQueueSize(int queueSize)
- Sets the
Relay
queue size measured in messages.
- Parameters:
queueSize
- The Relay queue size
getTransports
public List getTransports()
- Gets the transports attribute of the Configurator object
- Returns:
- The transports value
setTransport
public void setTransport(Transport transport)
- Sets the transport attribute of the Configurator object
- Parameters:
transport
- The new transport value
setTransports
public void setTransports(List transports)
- Sets the transports attribute of the Configurator object
- Parameters:
transports
- The new transports value
addTransport
public void addTransport(Transport transport)
- Adds a feature to the Transport attribute of the Configurator object
- Parameters:
transport
- The feature to be added to the Transport attribute
addTransports
public void addTransports(List transports)
- Adds a feature to the Transports attribute of the Configurator object
- Parameters:
transports
- The feature to be added to the Transports attribute
removeTransport
public Transport removeTransport(Transport transport)
- Description of the Method
- Parameters:
transport
- Description of the Parameter
- Returns:
- Description of the Return Value
clearTransports
public void clearTransports()
- Description of the Method
getPrincipal
public String getPrincipal()
- Gets the principal.
- Returns:
- The principal
isSecurity
public boolean isSecurity()
- Gets the security enabler.
- Returns:
- security enabler
setSecurity
public void setSecurity(boolean isEnabled)
- Sets the security enabler.
- Parameters:
isEnabled
- The new security value
setSecurity
public void setSecurity(String principal,
String password)
- Sets the principal and associated password.
- Parameters:
principal
- The principalpassword
- The password
getRootCertificateAddress
public URI getRootCertificateAddress()
- Gets the Root Certificate address.
- Returns:
- The root certificate address
setRootCertificateAddress
public void setRootCertificateAddress(URI rootCertificateAddress)
- Sets the Root Certificate address.
- Parameters:
rootCertificateAddress
- the root certificate address
getRootCertificate
public Certificate getRootCertificate()
- Gets the root certificate.
- Returns:
- The root certificate
getRootCertificateBase64
public String getRootCertificateBase64()
- Gets the root certificate Base64 encoded.
- Returns:
- The root certificate
setRootCertificate
public void setRootCertificate(Certificate rootCertificate)
- Sets the root certificate
- Parameters:
rootCertificate
- root certificate
setRootCertificateBase64
public void setRootCertificateBase64(String rootCertificate)
- Sets the root certificate
- Parameters:
rootCertificate
- Base64 encoded root certificate
getPeerProxyAddress
public URI getPeerProxyAddress()
- Gets the proxy used for configuration.
- Returns:
- The cofigurator proxy address value
setPeerProxyAddress
public void setPeerProxyAddress(URI peerProxyAddress)
throws ConfiguratorException
- Sets the proxy used for configuration. If the address scheme is not
specified the appropriate value will be assigned.
- Parameters:
peerProxyAddress
- The new peerProxyAddress value
- Throws:
ConfiguratorException
- if the address scheme is not "http" or
the port is invalid
ConfiguratorException
getEndpointOutgoingQueueSize
public int getEndpointOutgoingQueueSize()
- Gets the Endpoint queue size measured in messages
- Returns:
- The endpointOutgoingQueueSize value
setEndpointOutgoingQueueSize
public void setEndpointOutgoingQueueSize(int size)
- Sets the Endpoint queue size measured in messages
- Parameters:
size
- The endpoint queue size
isProxy
public boolean isProxy()
- Gets the proxy service enabler.
- Returns:
- The proxy service enabler
setProxy
public void setProxy(boolean isEnabled)
- Sets the proxy service enabler.
- Parameters:
isEnabled
- The proxy service enabler
getRendezVousBootstrapAddress
public URI getRendezVousBootstrapAddress()
- Gets the
RendezVous
bootstrap address.
- Returns:
- The rendezVousBootstrap value
setRendezVousBootstrapAddress
public void setRendezVousBootstrapAddress(URI rendezVousBootstrapAddress)
throws ConfiguratorException
- Sets the
RendezVous
bootstrap address that will be used to
resolve all addresses that do not specify a host.
- Parameters:
rendezVousBootstrapAddress
- The new rendezVousBootstrapAddress
value
- Throws:
ConfiguratorException
- Description of the Exception
ConfiguratorException
isRendezVousDiscovery
public boolean isRendezVousDiscovery()
- Gets the
RendezVous
discovery enabler.
- Returns:
- The rendezVousDiscovery value
setRendezVousDiscovery
public void setRendezVousDiscovery(boolean discover)
- Sets the
RendezVous
discovery enabler.
getRelaysBootstrapAddress
public URI getRelaysBootstrapAddress()
- Gets the
Relay
bootstrap address.
- Returns:
- The relaysBootstrap value
setRelaysBootstrapAddress
public void setRelaysBootstrapAddress(URI relaysBootstrapAddress)
throws ConfiguratorException
- Sets the
Relay
bootstrap address that will be used to
resolve all addresses that do not specify a host.
- Parameters:
relaysBootstrapAddress
- The new relaysBootstrapAddress value
- Throws:
ConfiguratorException
- Description of the Exception
ConfiguratorException
isRelaysDiscovery
public boolean isRelaysDiscovery()
- Gets the
Relay
discovery enabler.
- Returns:
- The relayDiscovery value
setRelayDiscovery
public void setRelayDiscovery(boolean isEnabled)
- Sets the
Relay
discovery enabler.
- Parameters:
isEnabled
- The new relayDiscovery value
getRelaysDiscovery
public boolean getRelaysDiscovery()
- Gets the
Relay
discovery enabler.
- Returns:
- The relaysDiscovery value
setRelaysDiscovery
public void setRelaysDiscovery(boolean isEnabled)
- Sets the
Relays
discovery enabler.
- Parameters:
isEnabled
- The new relaysDiscovery value
getReflectionBootstrapAddress
public URI getReflectionBootstrapAddress()
- Deprecated. moved to
RelayOptimizer
property
- Gets the
Reflection
bootstrap address.
- Returns:
- The reflectionBootstrap value
setReflectionBootstrapAddress
public void setReflectionBootstrapAddress(URI reflectionBootstrapAddress)
throws ConfiguratorException
- Deprecated. moved to
RelayOptimizer
property
- Sets the
Reflection
bootstrap address that is used during
the optimization process.
- Parameters:
reflectionBootstrapAddress
- The new reflectionBootstrapAddress value
- Throws:
ConfiguratorException
- Description of the Exception
ConfiguratorException
getPlatformConfig
public PlatformConfig getPlatformConfig()
throws ConfiguratorException
- Gets the
PlatformConfig
that is comprised of the
constituent properties. Contingencies include the following integrity
validation checks:
- specified Peer name
- valid principal and password
- at least one transport is enabled
- transport host and port is specified
- valid multicast port and size
- for Relays at least one transport is specified
- valid Http proxy, if requiired
- Specified by:
getPlatformConfig
in interface PlatformConfigurator
- Returns:
- The PlatformConfig
- Throws:
ConfiguratorException
- if invalid configuration
ConfiguratorException
getConfigParams
public ConfigParams getConfigParams()
throws ConfiguratorException
- Specified by:
getConfigParams
in interface Configurator
- Throws:
ConfiguratorException
setPlatformConfig
public void setPlatformConfig(PlatformConfig pc)
- Sets the platformConfig attribute of the Configurator object
- Specified by:
setPlatformConfig
in interface PlatformConfigurator
- Parameters:
pc
- The new platformConfig value
setConfigParams
public void setConfigParams(ConfigParams pc)
- Sets the platformConfig attribute of the Configurator object
- Specified by:
setConfigParams
in interface Configurator
- Parameters:
pc
- The new platformConfig value
fetchBootstrapAddresses
public List fetchBootstrapAddresses(URI u)
throws IOException
- Retrieve the specified bootstrap file.
- Parameters:
u
- bootstrap address
- Returns:
- bootstrap iterator
- Throws:
IOException
- Description of the Exception
getOptimizers
public Iterator getOptimizers()
addOptimizer
public void addOptimizer(Optimizer optimizer)
addOptimizers
public void addOptimizers(List optimizers)
removeOptimizer
public Class removeOptimizer(Optimizer optimizer)
clearOptimizers
public void clearOptimizers()
setReconfigure
public void setReconfigure(boolean reconfigure)
- Sets the reconfigure attribute of the Configurator object
- Specified by:
setReconfigure
in interface PlatformConfigurator
- Parameters:
reconfigure
- The new reconfigure value
isReconfigure
public boolean isReconfigure()
- gets the reconfigure attribute of the Configurator object
- Specified by:
isReconfigure
in interface PlatformConfigurator
- Returns:
- Returns
true
if a forced reconfiguration
will occur the next time PlatformConfigurator.getPlatformConfig()
is called.
save
public boolean save()
throws ConfiguratorException
- Perisist the resultant
PlatformConfig
.
The PlatformConfig will be saved in the Platform configuration file
under the JXTA home
directory
.
- Specified by:
save
in interface Configurator
- Returns:
- success indicator
- Throws:
ConfiguratorException
- if invalid configuration
ConfiguratorException
save
public boolean save(File platformConfig)
throws ConfiguratorException
- Persist the resultant
PlatformConfig
in the specified file.
- Specified by:
save
in interface PlatformConfigurator
- Parameters:
platformConfig
- destination file
- Returns:
- success indicator
- Throws:
ConfiguratorException
- if invalid configuration
ConfiguratorException
writeExternal
public void writeExternal(ObjectOutput out)
- Specified by:
writeExternal
in interface Externalizable
readExternal
public void readExternal(ObjectInput in)
- Specified by:
readExternal
in interface Externalizable
getPassword
protected String getPassword()
- Gets the password.
- Returns:
- The password
getLocalHost
protected String getLocalHost()
- Gets the localHost attribute of the Configurator object
- Returns:
- The localHost value
transportsContainsScheme
protected boolean transportsContainsScheme(String scheme)
- Description of the Method
- Parameters:
scheme
- Description of the Parameter
- Returns:
- Description of the Return Value