JXTA

net.jxta.impl.util
Class URISeedingManager

java.lang.Object
  extended by net.jxta.impl.util.ACLSeedingManager
      extended by net.jxta.impl.util.RdvAdvSeedingManager
          extended by net.jxta.impl.util.URISeedingManager
All Implemented Interfaces:
SeedingManager
Direct Known Subclasses:
RelayReferralSeedingManager

public class URISeedingManager
extends RdvAdvSeedingManager

A seeding manager that supports both explicit seed peers and loading of seeds from seeding resources.


Field Summary
 
Fields inherited from class net.jxta.impl.util.RdvAdvSeedingManager
discoveredRoutes, group, MIN_REFRESH_INTERVAL, nextRemoteDiscovery, serviceName
 
Fields inherited from class net.jxta.impl.util.ACLSeedingManager
acl
 
Constructor Summary
URISeedingManager(URI aclLocation, boolean allowOnlySeeds, PeerGroup group, String serviceName)
          Get an instance of URISeedingManager.
 
Method Summary
 void addSeed(RouteAdvertisement seed)
          Adds the specified URI to the list of permanent seeds.
 void addSeed(URI seed)
          Adds the specified URI to the list of permanent seeds.
 void addSeedingURI(URI seeding)
          Adds the specified URI to the list of seeding URIs.
 RouteAdvertisement[] getActiveSeedRoutes()
          Returns the route advertisements of the active seed peers.
 URI[] getActiveSeedURIs()
          Returns the URI of the endpoint addresses of the active seed peers.
 boolean isAcceptablePeer(PeerAdvertisement peeradv)
          Returns true if the provided peer advertisement is an acceptable peer as determined by the seeding manager.
 boolean isAcceptablePeer(RouteAdvertisement radv)
          Returns true if the provided route advertisement is an acceptable peer as determined by the seeding manager.
(package private) static RouteAdvertisement[] loadSeeds(URI seedingURI)
          Load a list of seed peer RouteAdvertisements from the specified URI.
 void stop()
          Stop this seeding manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URISeedingManager

public URISeedingManager(URI aclLocation,
                         boolean allowOnlySeeds,
                         PeerGroup group,
                         String serviceName)
Get an instance of URISeedingManager.

Parameters:
aclLocation - The location of the ACL file or null if no ACL file should be used.
allowOnlySeeds - If true then the only peers which are part of the seed peer set will be
Method Detail

stop

public void stop()
Stop this seeding manager.

Specified by:
stop in interface SeedingManager
Overrides:
stop in class RdvAdvSeedingManager

addSeed

public void addSeed(URI seed)
Adds the specified URI to the list of permanent seeds. Even if allowOnlySeeds is in effect, this seed may now be used, as if it was part of the initial configuration.

Parameters:
seed - The URI of the seed peer.

addSeed

public void addSeed(RouteAdvertisement seed)
Adds the specified URI to the list of permanent seeds. Even if allowOnlySeeds is in effect, this seed may now be used, as if it was part of the initial configuration.

Parameters:
seed - The RouteAdvertisement of the seed peer.

addSeedingURI

public void addSeedingURI(URI seeding)
Adds the specified URI to the list of seeding URIs.

Parameters:
seeding - The URI of the seeding list.

getActiveSeedURIs

public URI[] getActiveSeedURIs()
Returns the URI of the endpoint addresses of the active seed peers. The URIs are returned in the order which the consumer should attempt to contact the seed peers.

Using the endpoint address URIs is less optimal than using the route advertisements as there is no association between the potentially multiple message transport addresses referring to a single peer.

Specified by:
getActiveSeedURIs in interface SeedingManager
Overrides:
getActiveSeedURIs in class RdvAdvSeedingManager
Returns:
The URIs of the active seed peers in the order in which the seed peers should be contacted.

getActiveSeedRoutes

public RouteAdvertisement[] getActiveSeedRoutes()
Returns the route advertisements of the active seed peers. The route advertisements are returned in the order which the consumer should attempt to contact the seed peers. In some cases the returned route advertisements may omit the destination PeerID if it is not known.

Specified by:
getActiveSeedRoutes in interface SeedingManager
Overrides:
getActiveSeedRoutes in class RdvAdvSeedingManager
Returns:
The route advertisements of the active seed peers in the order in which the seed peers should be contacted.

isAcceptablePeer

public boolean isAcceptablePeer(PeerAdvertisement peeradv)
Returns true if the provided peer advertisement is an acceptable peer as determined by the seeding manager.

Performs it's determination based solely on the list of peers in the access list.

Specified by:
isAcceptablePeer in interface SeedingManager
Overrides:
isAcceptablePeer in class ACLSeedingManager
Parameters:
peeradv - The PeerAdvertisement of the peer being tested.

isAcceptablePeer

public boolean isAcceptablePeer(RouteAdvertisement radv)
Returns true if the provided route advertisement is an acceptable peer as determined by the seeding manager.

Performs it's determination based solely on the list of peers in the access list.

Specified by:
isAcceptablePeer in interface SeedingManager
Overrides:
isAcceptablePeer in class ACLSeedingManager
Parameters:
radv - The RouteAdvertisement of the peer being tested.

loadSeeds

static RouteAdvertisement[] loadSeeds(URI seedingURI)
                               throws IOException
Load a list of seed peer RouteAdvertisements from the specified URI.

Two formats are supported:

TEXT
A simple UTF-8 or US ASCII text file containing one seed endpoint address per line. These entries are converted into very simple RouteAdvertisements.
XML
A simple XML file containing a sequence of seed RouteAdvertisements. The seed advertisements may be ordered or unordered.

Parameters:
seedingURI - The intended source of the RouteAdvertisements.
Returns:
The loaded RouteAdvertisements.
Throws:
IOException - Thrown for errors encountered loading the seed RouteAdvertisements.

JXSE