Project JXTA

net.jxta.protocol
Class ModuleImplAdvertisement

java.lang.Object
  extended by net.jxta.document.Advertisement
      extended by net.jxta.document.ExtendableAdvertisement
          extended by net.jxta.protocol.ModuleImplAdvertisement
All Implemented Interfaces:
Cloneable

public abstract class ModuleImplAdvertisement
extends ExtendableAdvertisement
implements Cloneable

A ModuleImplAdvertisement represents one of any number of published implementations of a given specification.

It is meant to be published via JXTA discovery.

Module specifications are referenced by their ModuleSpecID. Given a ModuleSpecID, a ModuleImplAdvertisement may be searched by means of JXTA Discovery, filtered according to the compatibility statement it contains, and if compatible, loaded and initialized. The loadModule method of a PeerGroup implementation performs this task automatically, given a ModuleSpecID.

One significant example of Modules referenced and loaded in that manner are the services and protocols that constitute a StdPeerGroup in the java reference implementation.

See Also:
ID, ModuleSpecID, Advertisement, StructuredDocument, Element, ModuleSpecAdvertisement, PeerGroup

Constructor Summary
ModuleImplAdvertisement()
           
 
Method Summary
 Object clone()
          Clone this ModuleImplAdvertisement
static String getAdvertisementType()
          Returns the identifying type of this Advertisement.
 String getBaseAdvType()
          Returns the base type of this advertisement hierarchy.
 String getCode()
          returns the code; a reference to or representation of the executable code advertised by this advertisement.
 StructuredDocument getCompat()
          returns the module impl. compatibility statement.
protected  StructuredDocument getCompatPriv()
          Privileged version of getCompat() that does not clone the elements.
 String getDescription()
          returns the description
 ID getID()
          Returns the unique ID of that advertisement for indexing purposes.
 ModuleSpecID getModuleSpecID()
          Returns the id of the spec that this implements.
 StructuredDocument getParam()
          returns the param element.
protected  StructuredDocument getParamPriv()
          Privileged version of getParam() that does not clone the elements.
 String getProvider()
          returns the provider
 String getUri()
          returns the uri; that is a reference to or representation of a package from which the executable code referenced by the getCode method may be loaded.
 void setCode(String code)
          sets the code
 void setCompat(Element compat)
          sets the module impl. compatibility statement.
 void setDescription(String description)
          sets the description
 void setModuleSpecID(ModuleSpecID sid)
          Sets the id of the spec that is implemented
 void setParam(Element param)
          sets the module param
 void setProvider(String provider)
          sets the provider
 void setUri(String uri)
          sets the uri
 
Methods inherited from class net.jxta.document.ExtendableAdvertisement
getDocument, handleElement
 
Methods inherited from class net.jxta.document.Advertisement
getAdvType, getIndexFields, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModuleImplAdvertisement

public ModuleImplAdvertisement()
Method Detail

getAdvertisementType

public static String getAdvertisementType()
Returns the identifying type of this Advertisement.

Returns:
String the type of advertisement

getBaseAdvType

public final String getBaseAdvType()
Returns the base type of this advertisement hierarchy. Typically, only the most basic advertisement of a type will implement this method and declare it as final.

Specified by:
getBaseAdvType in class ExtendableAdvertisement
Returns:
String the base type of advertisements in this hierarchy.

clone

public Object clone()
Clone this ModuleImplAdvertisement

Overrides:
clone in class Advertisement
Returns:
Object an object of class ModuleImplAdvertisement that is a deep-enough copy of this one.

getID

public ID getID()
Returns the unique ID of that advertisement for indexing purposes. In that case we do not have any particular one to offer. Let the indexer hash the document.

Specified by:
getID in class Advertisement
Returns:
ID the unique id

getModuleSpecID

public ModuleSpecID getModuleSpecID()
Returns the id of the spec that this implements.

Returns:
ID the spec id

setModuleSpecID

public void setModuleSpecID(ModuleSpecID sid)
Sets the id of the spec that is implemented

Parameters:
sid - The id of the spec

getCompat

public StructuredDocument getCompat()
returns the module impl. compatibility statement.

Returns:
StructuredDocument the statement as a StructuredDocument of unspecified content.

getCompatPriv

protected StructuredDocument getCompatPriv()
Privileged version of getCompat() that does not clone the elements.

Returns:
StructuredDocument the statement as a StructuredDocument of unspecified content.

setCompat

public void setCompat(Element compat)
sets the module impl. compatibility statement.

Parameters:
compat - Element of an unspecified content.

getCode

public String getCode()
returns the code; a reference to or representation of the executable code advertised by this advertisement. What the code really is depends on the compatibility statement. Any compatible user of this impl. adv. knows what it means. The standard group implementations of the java reference implementation expect it to be a fully qualified java class name.

Returns:
String the code

setCode

public void setCode(String code)
sets the code

Parameters:
code - reference to the code

getUri

public String getUri()
returns the uri; that is a reference to or representation of a package from which the executable code referenced by the getCode method may be loaded. What the uri really is depends on the compatibility statement. Any compatible user of this impl. adv. knows what it means. The standard group implementations of the java reference implementation expect it to be a reference to a jar file.

Returns:
String uri

setUri

public void setUri(String uri)
sets the uri

Parameters:
uri - string uri

getProvider

public String getProvider()
returns the provider

Returns:
String the provider

setProvider

public void setProvider(String provider)
sets the provider

Parameters:
provider - the provider

getDescription

public String getDescription()
returns the description

Returns:
String the description

setDescription

public void setDescription(String description)
sets the description

Parameters:
description - the description

getParam

public StructuredDocument getParam()
returns the param element. The interpretation of the param element is entirely up to the code that this advertises. One valid use of it is to enable the code to be configured so that multiple specs or multiple implementations of one spec may use the same code.

Returns:
StructuredDocument A standalone structured document of unspecified content.

getParamPriv

protected StructuredDocument getParamPriv()
Privileged version of getParam() that does not clone the elements.

Returns:
StructuredDocument A standalone structured document of unspecified content.

setParam

public void setParam(Element param)
sets the module param

Parameters:
param - Element of an unspecified content.

JXTA J2SE