p2ps.imp.peer.config
Class ConfigImp

java.lang.Object
  extended byp2ps.imp.peer.config.ConfigImp
All Implemented Interfaces:
Config

public class ConfigImp
extends java.lang.Object
implements Config

The configuration for a p2ps peer

Version:
$Revision: 295 $
Author:
Ian Wang

Nested Class Summary
 
Nested classes inherited from class p2ps.peer.Config
Config.RendezvousRequirement
 
Field Summary
 
Fields inherited from interface p2ps.peer.Config
RENDEZVOUS_ALWAYS, RENDEZVOUS_IF_REQUIRED, RENDEZVOUS_NEVER
 
Constructor Summary
protected ConfigImp()
          Constructs an empty ConfigImp
  ConfigImp(Config config)
          Constructs a ConfigImp from the specfied config
 
Method Summary
 void addAdvertInstantiatorConfig(InstantiatorConfig config)
          Add an advert instantiator config
 void addLocalRendezvousURI(java.net.URI endpoint)
          Add a local rendezvous endpoint
 void addRemoteRendezvousURI(java.net.URI endpoint)
          Add a remote rendezvous endpoint
 void addResolverConfigs(ResolverConfig resconfig)
          Adds a resolver configuration to configuration
 void clearAdvertisementInstantiatorConfigs()
          Add an endpoint address instantiator config
 void clearLocalRendezvousEndpoints()
          Removes all remote rendezvous endpoints
 void clearRemoteRendezvousEndpoints()
          Removes all remote rendezvous endpoints
 void clearResolverConfigs()
          Removes all the resolver configs
 InstantiatorConfig[] getAdvertInstantiatorConfigs()
           
 java.lang.String getClientSecurityLevel()
           
 java.lang.String getDiscoveryServiceClass()
           
 java.lang.String getGroupServiceClass()
           
 Identity getIdentity()
           
 java.lang.String getIDFactoryClass()
           
 java.lang.String getKeyAlias()
           
 java.lang.String getKeyStore()
           
 java.net.URI[] getLocalRendezvousEndpoints()
           
 int getMaxPort()
           
 int getMinPort()
           
 java.lang.String getNetworkInterfaceClass()
           
 java.lang.String getPeerFactoryClass()
           
 java.lang.String getPipeServiceClass()
           
 java.net.URI[] getRemoteRendezvousEndpoints()
           
 Config.RendezvousRequirement getRendezvousRequirement()
           
 java.lang.String getRendezvousServiceClass()
           
 ResolverConfig getResolverConfig(java.lang.String classname)
           
 ResolverConfig[] getResolverConfigs()
           
 java.lang.String getServerSecurityLevel()
           
 boolean isKeyStoreTemporary()
           
 boolean isPortRangeInputOnly()
           
 void setClientSecurityLevel(java.lang.String securitylevel)
          Sets the client security level
 void setDiscoveryServiceClass(java.lang.String discclass)
           
 void setGroupServiceClass(java.lang.String groupclass)
           
 void setIdentity(Identity identity)
          Sets the identity for this peer (ignored if keystore is specified)
 void setIDFactoryClass(java.lang.String idclass)
           
 void setKeyAlias(java.lang.String keyalias)
          Sets the alias of the certificate key for this peer
 void setKeyStore(java.lang.String keystore)
          Sets the keystore location
 void setKeyStoreTemporary(boolean state)
          Sets whether the key store is temporary for the lifetime of the peer
 void setNetworkInterfaceClass(java.lang.String netclass)
           
 void setPeerFactoryClass(java.lang.String peerclass)
           
 void setPipeServiceClass(java.lang.String pipeclass)
           
 void setPortRange(int minport, int maxport)
          Sets the mininum available port
 void setPortRangeInputOnly(boolean state)
          Sets whether the port range applies for input sockets only
 void setRendezvousRequirement(Config.RendezvousRequirement rendezvous)
          Sets whether a peer is RENDEZVOUS_ALWAYS, RENDEZVOUS_IF_REQUIRED or RENDEZVOUS_NEVER
 void setRendezvousServiceClass(java.lang.String rendezclass)
           
 void setServerSecurityLevel(java.lang.String securitylevel)
          Sets the server security level
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigImp

protected ConfigImp()
Constructs an empty ConfigImp


ConfigImp

public ConfigImp(Config config)
Constructs a ConfigImp from the specfied config

Method Detail

getKeyStore

public java.lang.String getKeyStore()
Specified by:
getKeyStore in interface Config
Returns:
the keystore location (or null if not applicable)

setKeyStore

public void setKeyStore(java.lang.String keystore)
Sets the keystore location


getKeyAlias

public java.lang.String getKeyAlias()
Specified by:
getKeyAlias in interface Config
Returns:
the alias of the certificate key for this peer (or null if not applicable)

setKeyAlias

public void setKeyAlias(java.lang.String keyalias)
Sets the alias of the certificate key for this peer


isKeyStoreTemporary

public boolean isKeyStoreTemporary()
Specified by:
isKeyStoreTemporary in interface Config
Returns:
true if the key store is temporary for the lifetime of the peer

setKeyStoreTemporary

public void setKeyStoreTemporary(boolean state)
Sets whether the key store is temporary for the lifetime of the peer


getIdentity

public Identity getIdentity()
Specified by:
getIdentity in interface Config
Returns:
the identity for this peer (ignored if keystore is specified)

setIdentity

public void setIdentity(Identity identity)
Sets the identity for this peer (ignored if keystore is specified)


getClientSecurityLevel

public java.lang.String getClientSecurityLevel()
Specified by:
getClientSecurityLevel in interface Config
Returns:
the client security level

setClientSecurityLevel

public void setClientSecurityLevel(java.lang.String securitylevel)
Sets the client security level


getServerSecurityLevel

public java.lang.String getServerSecurityLevel()
Specified by:
getServerSecurityLevel in interface Config
Returns:
the server security level

setServerSecurityLevel

public void setServerSecurityLevel(java.lang.String securitylevel)
Sets the server security level


getDiscoveryServiceClass

public java.lang.String getDiscoveryServiceClass()
Specified by:
getDiscoveryServiceClass in interface Config
Returns:
the class of the discovery service

setDiscoveryServiceClass

public void setDiscoveryServiceClass(java.lang.String discclass)

getPipeServiceClass

public java.lang.String getPipeServiceClass()
Specified by:
getPipeServiceClass in interface Config
Returns:
the class of the pipe service

setPipeServiceClass

public void setPipeServiceClass(java.lang.String pipeclass)

getRendezvousServiceClass

public java.lang.String getRendezvousServiceClass()
Specified by:
getRendezvousServiceClass in interface Config
Returns:
the class of the rendezvous service

setRendezvousServiceClass

public void setRendezvousServiceClass(java.lang.String rendezclass)

getGroupServiceClass

public java.lang.String getGroupServiceClass()
Specified by:
getGroupServiceClass in interface Config
Returns:
the class of the group service

setGroupServiceClass

public void setGroupServiceClass(java.lang.String groupclass)

getPeerFactoryClass

public java.lang.String getPeerFactoryClass()
Specified by:
getPeerFactoryClass in interface Config
Returns:
the class of the peer factory

setPeerFactoryClass

public void setPeerFactoryClass(java.lang.String peerclass)

getIDFactoryClass

public java.lang.String getIDFactoryClass()
Specified by:
getIDFactoryClass in interface Config
Returns:
the class of the id factory

setIDFactoryClass

public void setIDFactoryClass(java.lang.String idclass)

getNetworkInterfaceClass

public java.lang.String getNetworkInterfaceClass()
Specified by:
getNetworkInterfaceClass in interface Config
Returns:
the class of the network interface factory

setNetworkInterfaceClass

public void setNetworkInterfaceClass(java.lang.String netclass)

getAdvertInstantiatorConfigs

public InstantiatorConfig[] getAdvertInstantiatorConfigs()
Specified by:
getAdvertInstantiatorConfigs in interface Config
Returns:
an array of the advert instantiator configs

addAdvertInstantiatorConfig

public void addAdvertInstantiatorConfig(InstantiatorConfig config)
Add an advert instantiator config


clearAdvertisementInstantiatorConfigs

public void clearAdvertisementInstantiatorConfigs()
Add an endpoint address instantiator config


getRendezvousRequirement

public Config.RendezvousRequirement getRendezvousRequirement()
Specified by:
getRendezvousRequirement in interface Config
Returns:
true if the peer is a rendezvous peer

setRendezvousRequirement

public void setRendezvousRequirement(Config.RendezvousRequirement rendezvous)
Sets whether a peer is RENDEZVOUS_ALWAYS, RENDEZVOUS_IF_REQUIRED or RENDEZVOUS_NEVER


getLocalRendezvousEndpoints

public java.net.URI[] getLocalRendezvousEndpoints()
Specified by:
getLocalRendezvousEndpoints in interface Config
Returns:
an array of the local rendezvous endpoints

addLocalRendezvousURI

public void addLocalRendezvousURI(java.net.URI endpoint)
Add a local rendezvous endpoint


clearLocalRendezvousEndpoints

public void clearLocalRendezvousEndpoints()
Removes all remote rendezvous endpoints


getRemoteRendezvousEndpoints

public java.net.URI[] getRemoteRendezvousEndpoints()
Specified by:
getRemoteRendezvousEndpoints in interface Config
Returns:
an array of the remote rendezvous endpoints that the rendezvous service should connect to.

addRemoteRendezvousURI

public void addRemoteRendezvousURI(java.net.URI endpoint)
Add a remote rendezvous endpoint


clearRemoteRendezvousEndpoints

public void clearRemoteRendezvousEndpoints()
Removes all remote rendezvous endpoints


getResolverConfigs

public ResolverConfig[] getResolverConfigs()
Specified by:
getResolverConfigs in interface Config
Returns:
an array of resolver configurations

getResolverConfig

public ResolverConfig getResolverConfig(java.lang.String classname)
Specified by:
getResolverConfig in interface Config
Returns:
the resolver config for the specified resolver class name

addResolverConfigs

public void addResolverConfigs(ResolverConfig resconfig)
Adds a resolver configuration to configuration


clearResolverConfigs

public void clearResolverConfigs()
Removes all the resolver configs


getMinPort

public int getMinPort()
Specified by:
getMinPort in interface Config
Returns:
the minimum available port number

getMaxPort

public int getMaxPort()
Specified by:
getMaxPort in interface Config
Returns:
the maximum available port number

setPortRange

public void setPortRange(int minport,
                         int maxport)
Sets the mininum available port


isPortRangeInputOnly

public boolean isPortRangeInputOnly()
Specified by:
isPortRangeInputOnly in interface Config
Returns:
true if the port range applies for input sockets only

setPortRangeInputOnly

public void setPortRangeInputOnly(boolean state)
Sets whether the port range applies for input sockets only