|
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
This class is a class factory for Advertisements. The class enables to hide the implementation used to represent and create advertisements.
Advertisements are core objects that are used to advertise a Peer, a PeerGroup, a Service, or a PipeService. 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.
Advertisement
,
Document
,
MimeMediaType
,
PeerGroup
,
PeerAdvertisement
,
PeerGroupAdvertisement
,
PipeAdvertisement
Constructor Summary | |
AdvertisementFactory()
|
Method Summary | |
protected java.util.Hashtable |
getAssocTable()
Used by ClassFactory methods to get the mapping of Mime Types to constructors. |
protected java.lang.Class |
getBaseClassForFactory()
Used by ClassFactory methods to ensure that all of the instance classes which register with this factory have the correct base class |
protected java.lang.Class |
getClassForKey()
Used by ClassFactory methods to ensure that all keys used with the mapping are of the correct type. |
protected java.lang.Class[][] |
getRequiredConstructors()
Used by ClassFactory methods to determine the required set of constructors needed by the instance classes generated by this factory. |
protected java.lang.Object[][] |
getRequiredStaticMethods()
Used by ClassFactory methods to determine the required set of static methods needed by classes registering with this factory. |
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(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 advertisementType parameter. |
static boolean |
registerAdvertisementInstance(java.lang.String rootType,
java.lang.Class instanceClass)
Register an array of constructor for an ID type to enable IDs of that type to be constructed. |
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 |
callStaticMethod, newInstance, registerAssoc, registerFromResources, registerFromString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AdvertisementFactory()
Method Detail |
protected java.util.Hashtable getAssocTable()
getAssocTable
in class ClassFactory
protected java.lang.Class getBaseClassForFactory()
getBaseClassForFactory
in class ClassFactory
protected java.lang.Class getClassForKey()
getClassForKey
in class ClassFactory
protected java.lang.Class[][] getRequiredConstructors()
getRequiredConstructors
in class ClassFactory
protected java.lang.Object[][] getRequiredStaticMethods()
getRequiredStaticMethods
in class ClassFactory
protected boolean registerAssoc(java.lang.String className)
registerAssoc
in class ClassFactory
className
- The class name which will be regiestered.public static boolean registerAdvertisementInstance(java.lang.String rootType, java.lang.Class instanceClass) throws java.lang.NoSuchMethodException, java.lang.SecurityException
rootType
- the identifying value for this advertisement instance typeinstanceClass
- the constructors to use in constructing objects
of this rootTypeIns type.java.lang.NoSuchMethodException
- invalid registrationjava.lang.SecurityException
- security errorpublic static Advertisement newAdvertisement(java.lang.String advertisementType) throws java.lang.reflect.InvocationTargetException
Advertisement
matching the type
specified by the advertisementType
parameter.advertisementType
- Specifies the mime media type to be associated with the
StructuredDocument
to be created.Advertisement
or null if it
could not be created.java.lang.reflect.InvocationTargetException
- error invoking target constructorpublic static Advertisement newAdvertisement(MimeMediaType mimetype, java.io.InputStream stream) throws java.lang.reflect.InvocationTargetException
Advertisement
matching the type
specified by the advertisementType
parameter.mimetype
- Specifies the mime media type to be associated with the
StructuredDocument
to be created.stream
- imput stream used to read data to construct the advertisementAdvertisement
or null if it
could not be created.java.lang.reflect.InvocationTargetException
- error invoking target constructorpublic static Advertisement newAdvertisement(TextElement root) throws java.lang.reflect.InvocationTargetException
Advertisement
matching the type
specified by the advertisementType
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.lang.reflect.InvocationTargetException
- error invoking target constructor
|
Project JXTA | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |