|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.peergroup.PeerGroupInterface
class PeerGroupInterface
PeerGroupInterface provides a pure interface object that permits interaction with the actual PeerGroup implementation without giving access to the real object.
This class defines immutable objects. It has no control over the wrapped peer group object's life cycle. It serves to make weak PeerGroup interface object.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.jxta.peergroup.PeerGroup |
---|
PeerGroup.GlobalRegistry |
Field Summary | |
---|---|
protected PeerGroup |
groupImpl
The peer group instance which backs this interface object. |
Fields inherited from interface net.jxta.platform.Module |
---|
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_DISABLED, START_OK |
Constructor Summary | |
---|---|
PeerGroupInterface(PeerGroup theRealThing)
Constructs an interface object that front-ends a given GenericPeerGroup. |
Method Summary | |
---|---|
boolean |
compatible(Element compat)
Return true if the provided compatibility statement is compatible with this group. |
boolean |
equals(Object target)
|
AccessService |
getAccessService()
Return the Access Service for this Peer Group. |
ModuleImplAdvertisement |
getAllPurposePeerGroupImplAdvertisement()
Get an all purpose peerGroup ModuleImplAdvertisement that is compatible with this group. |
ConfigParams |
getConfigAdvertisement()
Returns the config advertisement for this peer in this group (if any). |
DiscoveryService |
getDiscoveryService()
Return the Discovery Service for this Peer Group. |
EndpointService |
getEndpointService()
Return the Endpoint Service for this Peer Group. |
ThreadGroup |
getHomeThreadGroup()
Returns the Thread Group in which threads for this peer group will live. |
Advertisement |
getImplAdvertisement()
Returns the advertisement for this service. |
Service |
getInterface()
Service objects are not manipulated directly to protect usage of the service. |
JxtaLoader |
getLoader()
Returns the class loader for this group. |
MembershipService |
getMembershipService()
Return the Membership Service for this Peer Group. |
PeerGroup |
getParentGroup()
Returns the parent group of this group. |
PeerAdvertisement |
getPeerAdvertisement()
Return the PeerAdvertisement of the local Peer within this Peer Group. |
PeerGroupAdvertisement |
getPeerGroupAdvertisement()
Return the PeerGroupAdvertisement for this group. |
PeerGroupID |
getPeerGroupID()
Return the Peer Group ID of this Peer Group. |
String |
getPeerGroupName()
Return the Name of this group. |
PeerID |
getPeerID()
Return the Peer ID by which this Peer is known within this Peer Group. |
PeerInfoService |
getPeerInfoService()
Return the PeerInfo Service for this Peer Group. |
String |
getPeerName()
Return the name of the local peer within this group. |
PipeService |
getPipeService()
Return the Pipe Service for this Peer Group. |
RendezVousService |
getRendezVousService()
Return the Rendezvous Service for this Peer Group. |
ResolverService |
getResolverService()
Return the Resolver Service for this Peer Group. |
Iterator |
getRoleMap(ID name)
Returns the map of the assigned IDs currently associated with the given ModuleClassID by this PeerGroup object. |
URI |
getStoreHome()
Returns the location of the parent of all items that this peer group is using for persistently storing its preferences, cache, persistent store, properties, etc. |
PeerGroup |
getWeakInterface()
Returns a weak interface object that represents this group. |
void |
init(PeerGroup pg,
ID assignedID,
Advertisement impl)
Initialize the module, passing it its peer group and advertisement. |
boolean |
isRendezvous()
Returns the whether the group member is a Rendezvous peer for the group. |
Module |
loadModule(ID assignedID,
Advertisement impl)
Load a Module from a ModuleImplAdv. |
Module |
loadModule(ID assignedID,
ModuleSpecID specID,
int where)
Load a module from a ModuleSpecID Advertisement is sought, compatibility is checked on all candidates and load is attempted. |
Service |
lookupService(ID name)
Lookup for a service by name. |
Service |
lookupService(ID name,
int roleIndex)
Lookup for a service by class ID and index in a map. |
PeerGroup |
newGroup(Advertisement pgAdv)
Instantiate a peer group from the provided advertisement. |
PeerGroup |
newGroup(PeerGroupID gid)
Instantiate a group from its Peer Group ID only. |
PeerGroup |
newGroup(PeerGroupID gid,
Advertisement impl,
String name,
String description)
Instantiates a peer group from its elementary pieces and publishes the corresponding PeerGroupAdvertisement. |
void |
publishGroup(String name,
String description)
Publish this group's Peer Group Advertisement. |
int |
startApp(String[] arg)
Complete any remaining initialization of the module. |
void |
stopApp()
Stop a module. |
String |
toString()
An implementation suitable for debugging. |
void |
unref()
Explicitly notifies a group interface that it will no-longer be used (similar to dispose). |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected PeerGroup groupImpl
Constructor Detail |
---|
PeerGroupInterface(PeerGroup theRealThing)
theRealThing
- the real PeerGroupMethod Detail |
---|
public boolean equals(Object target)
equals
in class Object
public String toString()
toString
in class Object
public void init(PeerGroup pg, ID assignedID, Advertisement impl)
init
in interface Module
pg
- The PeerGroup from which this Module can obtain services.
If this module is a Service, this is also the PeerGroup of which this
module is a service.assignedID
- Identity of Module within group.
modules can use it as a the root of their namespace to create
names that are unique within the group but predictable by the
same module on another peer. This is normally the ModuleClassID
which is also the name under which the module is known by other
modules. For a group it is the PeerGroupID itself.
The parameters of a service, in the Peer configuration, are indexed
by the assignedID of that service, and a Service must publish its
run-time parameters in the Peer Advertisement under its assigned ID.impl
- The implementation advertisement for this
Module. It is permissible to pass null if no implementation
advertisement is available. This may happen if the
implementation was selected by explicit class name rather than
by following an implementation advertisement. Modules are not
required to support that style of loading, but if they do, then
their documentation should mention it.public int startApp(String[] arg)
startApp()
is completed. That is
also the opportunity to supply arbitrary arguments (mostly to
applications).
If this module is a PeerGroup
service, it may be invoked
several times depending on its return value.
This is here for class hierarchy reasons. It is normaly ignored. By
definition, the interface object protects the real object's start/stop
methods from being called.
startApp
in interface Module
arg
- An array of Strings forming the parameters for this
Module.
Module.START_OK
, Module.START_AGAIN_PROGRESS
,
Module.START_AGAIN_STALLED
, which indicates partial or complete
success, or any other value (negative values are
recommended for future compatibility), which indicates failure.public void stopApp()
init()
completes and should not assume that startApp()
has been
called or completed.
The Module cannot be forced to comply, but in the future
we might be able to deny it access to anything after some timeout.
This is here for class hierarchy reasons. It is normaly ignored. By
definition, the interface object protects the real object's start/stop
methods from being called.
stopApp
in interface Module
public Service getInterface()
getInterface
in interface Service
public PeerGroup getWeakInterface()
getWeakInterface
in interface PeerGroup
public void unref()
unref
in interface PeerGroup
public Advertisement getImplAdvertisement()
getImplAdvertisement
in interface Service
ModuleImplAdvertisement
.public ThreadGroup getHomeThreadGroup()
getHomeThreadGroup
in interface PeerGroup
public URI getStoreHome()
null
if the peergroup has no defined
location for storing persistent data.
getStoreHome
in interface PeerGroup
public JxtaLoader getLoader()
getLoader
in interface PeerGroup
public boolean isRendezvous()
isRendezvous
in interface PeerGroup
public PeerGroupAdvertisement getPeerGroupAdvertisement()
getPeerGroupAdvertisement
in interface PeerGroup
public PeerAdvertisement getPeerAdvertisement()
getPeerAdvertisement
in interface PeerGroup
public Service lookupService(ID name) throws ServiceNotFoundException
lookupService
in interface PeerGroup
name
- the service identifier.
ServiceNotFoundException
- could not find the service requestedpublic Service lookupService(ID name, int roleIndex) throws ServiceNotFoundException
lookupService
in interface PeerGroup
name
- the service identifierroleIndex
- the index in the list of assigned IDs that match
that identifier.
ServiceNotFoundException
- Could not find the service requested.public Iterator getRoleMap(ID name)
getRoleMap
in interface PeerGroup
name
- The ModuleClassID for which the map is desired.
public boolean compatible(Element compat)
compatible
in interface PeerGroup
compat
- compatibility element
public Module loadModule(ID assignedID, Advertisement impl) throws ProtocolNotSupportedException, PeerGroupException
loadModule
in interface PeerGroup
assignedID
- Id to be assigned to that module (usually its ClassID).impl
- An implementation advertisement for that module.
ProtocolNotSupportedException
- The implementation described by the
advertisement is incompatible with this peer. The module cannot be loaded.
PeerGroupException
- The module could not be loaded or initializedpublic Module loadModule(ID assignedID, ModuleSpecID specID, int where)
loadModule
in interface PeerGroup
assignedID
- Id to be assigned to that module (usually its ClassID).specID
- The specID of this module.where
- May be one of: Here
, FromParent
, or
Both
, meaning that the implementation advertisement will be
searched in this group, its parent or both. As a general guideline, the
implementation advertisements of a group should be searched in its
prospective parent (that is Here
), the implementation
advertisements of a group standard service should be searched in the same
group than where this group's advertisement was found (that is,
FromParent
), while applications may be sought more freely
(Both
).
public void publishGroup(String name, String description) throws IOException
publishGroup
in interface PeerGroup
name
- The name of this group.description
- The description of this group.
IOException
- The publication could not be accomplished
because of a network or storage failure.public PeerGroup newGroup(Advertisement pgAdv) throws PeerGroupException
newGroup
in interface PeerGroup
pgAdv
- The advertisement for the group to be instantiated.
PeerGroupException
- For problems instantiating the peer group.public PeerGroup newGroup(PeerGroupID gid, Advertisement impl, String name, String description) throws PeerGroupException
newGrp = thisGroup.loadModule(gid, impl); newGrp.publishGroup(name, description);or, but only if the implementation advertisement has been published:
newPGAdv = AdvertisementFactory.newAdvertisement( PeerGroupAdvertisement.getAdvertisementType()); newPGAdv.setPeerGroupID(gid); newPGAdv.setModuleSpecID(impl.getModuleSpecID()); newPGAdv.setName(name); newPGAdv.setDescription(description); newGrp = thisGroup.newGroup(newPGAdv);
newGroup
in interface PeerGroup
gid
- The ID of that group. If null
then a new group ID
will be chosen.impl
- The advertisement of the implementation to be used.name
- The name of the group.description
- A description of this group.
PeerGroupException
- Thrown if the group could not be instantiated.public PeerGroup newGroup(PeerGroupID gid) throws PeerGroupException
PeerGroup.loadModule(ID,Advertisement)
or even:
grp = new GroupSubClass();
grp.init(parentGroup, gid, impladv);
then, REMEMBER TO PUBLISH THE GROUP IF IT IS ALL NEW.
newGroup
in interface PeerGroup
gid
- the groupID.
PeerGroupException
- Thrown if the group could not be instantiated.public RendezVousService getRendezVousService()
getRendezVousService
in interface PeerGroup
null
if there is no Rendezvous Service in this Peer Group.public EndpointService getEndpointService()
getEndpointService
in interface PeerGroup
public ResolverService getResolverService()
getResolverService
in interface PeerGroup
public DiscoveryService getDiscoveryService()
getDiscoveryService
in interface PeerGroup
null
if there is no PeerInfo Service in this Peer Group.public PeerInfoService getPeerInfoService()
getPeerInfoService
in interface PeerGroup
null
if there is no PeerInfo Service in this Peer Group.public MembershipService getMembershipService()
getMembershipService
in interface PeerGroup
public PipeService getPipeService()
getPipeService
in interface PeerGroup
null
if
there is no Pipe Service in this Peer Group.public AccessService getAccessService()
getAccessService
in interface PeerGroup
public PeerGroupID getPeerGroupID()
getPeerGroupID
in interface PeerGroup
public PeerID getPeerID()
getPeerID
in interface PeerGroup
public String getPeerGroupName()
getPeerGroupName
in interface PeerGroup
null
if no name was
specified.public String getPeerName()
getPeerName
in interface PeerGroup
null
if no name was
specified.public ConfigParams getConfigAdvertisement()
getConfigAdvertisement
in interface PeerGroup
null
if none is available.public ModuleImplAdvertisement getAllPurposePeerGroupImplAdvertisement() throws Exception
getAllPurposePeerGroupImplAdvertisement
in interface PeerGroup
Exception
- if an error occurs while creating the implementation advertisementpublic PeerGroup getParentGroup()
net.jxta.peergroup.PeerGroup
getParentGroup
in interface PeerGroup
null
if a parent group
if not available.
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |