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 describes one of any number of published implementations for a given specification.

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 PeerGroup 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
 ModuleImplAdvertisement 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 opaque compatibility statement for this advertisement.
protected  StructuredDocument getCompatPriv()
          Privileged version of getCompat() that does not clone the elements.
 StructuredDocument getDesc()
          returns the description
 StructuredDocument getDescPriv()
          Privileged version of getDesc() 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 reference for the executable code described by this advertisement.
 void setCompat(Element compat)
          Sets the module impl. compatibility statement.
 void setDesc(Element desc)
          sets the description
 void setDescription(String description)
          sets the description
 void setModuleSpecID(ModuleSpecID msid)
          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, handleAttribute, 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 ModuleImplAdvertisement clone()
Clone this ModuleImplAdvertisement

Overrides:
clone in class Advertisement

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 msid)
Sets the id of the spec that is implemented

Parameters:
msid - The id of the spec

getDescription

public String getDescription()
returns the description

Returns:
String the description

setDescription

public void setDescription(String description)
sets the description

Parameters:
description - the description

getDesc

public StructuredDocument getDesc()
returns the description

Returns:
the description

getDescPriv

public StructuredDocument getDescPriv()
Privileged version of getDesc() that does not clone the elements.

Returns:
the description

setDesc

public void setDesc(Element desc)
sets the description

Parameters:
desc - the description

getCompat

public StructuredDocument getCompat()
Returns the opaque compatibility statement for this advertisement. Each JXTA implementation has the ability to recognize and evaluate it's own compatibility statements (even though it may not be able to evaluate the compatibility statements of other implementations).

Returns:
The compatibility statement as a StructuredDocument of unspecified content.

getCompatPriv

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

Returns:
The compatibility 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.

The appropriate interpretation of the code value is dependant upon the compatibility statement. Any compatible consumer of this advertisement will be able to correctly interpret code value. The standard group implementations of the JXSE reference implementation expect it to be a reference to a jar file.

Returns:
A reference to the executable code described by this advertisement.

setCode

public void setCode(String code)
Sets the reference for the executable code described by this advertisement.

Parameters:
code - A reference to the executable code described by this advertisement.

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.

The appropriate interpretation of the URI value is dependant upon the compatibility statement. Any compatible consumer of this advertisement will be able to correctly interpret the URI value. The standard group implementations of the JXSE reference implementation expect it to be a reference to a jar file.

Returns:
Location URI for the code described by this advertisement.

setUri

public void setUri(String uri)
Sets the uri

Parameters:
uri - Location URI for the code described by this advertisement.

getProvider

public String getProvider()
returns the provider

Returns:
String the provider

setProvider

public void setProvider(String provider)
sets the provider

Parameters:
provider - the provider

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:
A standalone structured document of unspecified content.

getParamPriv

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

Returns:
A standalone structured document of unspecified content.

setParam

public void setParam(Element param)
Sets the module param

Parameters:
param - Element of an unspecified content.

JXSE