org.hd.d.pg2k.webSvr.ads
Interface AdBeanInterface

All Known Implementing Classes:
AdBriteBean, EShirtAdBean, GoogleAdSenseUnitBean, TribalFusionBean

public interface AdBeanInterface

This is the interface of all AdBean advertising beans. Beans to support advertising in the body of a page are put in the classpath and loaded by name, and must implement this interface.

An AdBean can produce several sorts of output, the usual one being some well-behaved HTML to insert into a page as a banner or elsewhere.

AdBean entities should be completely thread-safe and should probably not carry significant state from call to call.

AdBean items can signal their affinity to certain Gallery topic areas or keywords or even exhibit prefixes and may be used preferentially around such exhibits.

When asked to produce output, this is passed a random-number source to help generate its output. A bean should assume that the source is a shared resource (eg that is should not be locked for long periods) and that it may be expensive to use and so using it sparingly is a good thing.

Many of the routines take an immutable Context argument, which details which Gallery section and/or exhibit is featured near the ad insert, if appropriate, and what is the preferred user locale.

This interface and its subcomponents must not depend on any PG2K types/classes, because it must be possible to take this file/class on its own and compile against it.


Nested Class Summary
static class AdBeanInterface.Context
          Details context in which advertisement is to be shown.
 
Method Summary
 boolean canMakeHTMLBodyInsert(AdBeanInterface.Context ctxt)
          Can make an HTML body-text insert in the given context.
 java.lang.String getHTMLBodyInsert(AdBeanInterface.Context ctxt, java.util.Random source)
          Make HTML body text in the given context, or null if none can be made.
 AdBeanInterface setParams(java.lang.String rawParams)
          Can be used to set general parameters for the bean, or can be null.
 

Method Detail

setParams

AdBeanInterface setParams(java.lang.String rawParams)
Can be used to set general parameters for the bean, or can be null. It is up to the bean how or if to interpret this value at all.

Returns:
instance so as to allow pure expression constructions of form (new ...Bean()).setParams().getHTMLBodyInsert(xxx, rnd)

canMakeHTMLBodyInsert

boolean canMakeHTMLBodyInsert(AdBeanInterface.Context ctxt)
Can make an HTML body-text insert in the given context.


getHTMLBodyInsert

java.lang.String getHTMLBodyInsert(AdBeanInterface.Context ctxt,
                                   java.util.Random source)
Make HTML body text in the given context, or null if none can be made. This takes a random-number source and the user's locale and generates a segment of HTML to insert into a page.

Returns the empty string if not possible.


DHD Multimedia Gallery V1.53.0

Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.