|
Project JXTA | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--net.jxta.util.ClassFactory
|
+--net.jxta.document.AdvertisementFactory
A Factory class for Advertisements. This class abstracts the the implementations used to represent and create advertisements.
Advertisements are core objects that are used to advertise a Peer, a PeerGroup, a Service, or a PipeServiceImpl. The Advertisement class provides a platform independent representation of core objects that can be exchanged between different implementations (Java, C). The AdvertisementFactory extends the ClassFactory to register the various types of adverstisements into a static hastable. The factory is called with the Advertisement type requested to create the corresponding advertisement type. The initial set of Advertisement instances is loaded from the java property "net.jxta.impl.config.AdvertisementInstanceTypes" It would be nice to have "newAdvertisement" methods for "Document" and "TextDocument", but this is not feasible because "TextElement" got there first.
Advertisement,
Document,
MimeMediaType,
PeerGroup,
PeerAdvertisement,
PeerGroupAdvertisement,
PipeAdvertisement| Inner Class Summary | |
static interface |
AdvertisementFactory.Instantiator
Interface for instantiators of StructuredDocuments |
| Method Summary | |
protected java.util.Hashtable |
getAssocTable()
Used by ClassFactory methods to get the mapping of Mime Types to constructors. |
java.lang.Class |
getClassForKey()
Used by ClassFactory methods to ensure that all keys used with the mapping are of the correct type. |
java.lang.Class |
getClassOfInstantiators()
Used by ClassFactory methods to ensure that all of the instance classes which register with this factory have the correct base class |
static Advertisement |
newAdvertisement(MimeMediaType mimetype,
java.io.InputStream stream)
Constructs an instance of Advertisement matching the type
specified by the advertisementType parameter. |
static Advertisement |
newAdvertisement(MimeMediaType mimetype,
java.io.Reader source)
Constructs an instance of Advertisement matching the type
specified by the advertisementType parameter. |
static Advertisement |
newAdvertisement(java.lang.String advertisementType)
Constructs an instance of Advertisement matching the type
specified by the advertisementType parameter. |
static Advertisement |
newAdvertisement(TextElement root)
Constructs an instance of Advertisement matching the type
specified by the root parameter. |
static boolean |
registerAdvertisementInstance(java.lang.String rootType,
AdvertisementFactory.Instantiator instantiator)
Register an instantiator for and advertisement type to allow instances of that type to be created. |
protected boolean |
registerAssoc(java.lang.String className)
Register a class with the factory from its class name. |
| Methods inherited from class net.jxta.util.ClassFactory |
getAvailableKeys, getInstantiator, registerAssoc, registerFromResources, registerFromString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
protected java.util.Hashtable getAssocTable()
getAssocTable in class ClassFactorypublic java.lang.Class getClassOfInstantiators()
getClassOfInstantiators in class ClassFactorypublic java.lang.Class getClassForKey()
getClassForKey in class ClassFactoryprotected boolean registerAssoc(java.lang.String className)
registerAssoc in class ClassFactoryclassName - The class name which will be regiestered.
public static boolean registerAdvertisementInstance(java.lang.String rootType,
AdvertisementFactory.Instantiator instantiator)
rootType - the identifying value for this advertisement instance
typeinstantiator - the instantiator to use in constructing objects
of this rootType.public static Advertisement newAdvertisement(java.lang.String advertisementType)
Advertisement matching the type
specified by the advertisementType parameter.advertisementType - Specifies the type of advertisement to create.Advertisement or null if it
could not be created.
public static Advertisement newAdvertisement(MimeMediaType mimetype,
java.io.InputStream stream)
throws java.io.IOException
Advertisement matching the type
specified by the advertisementType parameter.mimetype - Specifies the mime media type of the stream being read.stream - imput stream used to read data to construct the advertisementAdvertisementjava.io.IOException - error reading message from input streamjava.util.NoSuchElementException - if there is no matching advertisement type
for the type of document read in.
public static Advertisement newAdvertisement(MimeMediaType mimetype,
java.io.Reader source)
throws java.io.IOException
Advertisement matching the type
specified by the advertisementType parameter.mimetype - Specifies the mime media type of the stream being read.source - used to read data to construct the advertisementAdvertisementjava.io.IOException - error reading message from input streamjava.util.NoSuchElementException - if there is no matching advertisement type
for the type of document read in.java.lang.UnsupportedOperationException - if the specified mime type is not
associated with a text oriented document type.public static Advertisement newAdvertisement(TextElement root)
Advertisement matching the type
specified by the root parameter.root - Specifies a portion of a StructuredDocument which will be
converted into an Advertisement.Advertisement or null if it
could not be created.java.util.NoSuchElementException - if there is no matching advertisement type
for the type of document read in.
|
Project JXTA | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||