|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.scenario.targeting.Slot
public class Slot
A Slot is a container for a set of displayable dynamic beans. A slot acts as a Targeter, i.e. a source of personalized displayable content. As such, it can be used by any of the Targeting family of droplets to render content within a page.
Slots serve as buffers between generators of displayable content and renderers of that content. A generator will access a slot and modify its contents, perhaps adding some content items from a repository. A renderer may later access the same slot via the Targeter interface, pulling content out of the slot and showing it. Many modes of use are possible: the generator and renderer may access the slot in quick succession during the same request thread, or the generator may run once to set up content at session start to be subsequently rendered over and over again.
Slots have both an active and a passive mode:
In the passive mode, which is the default, a slot simply waits for content generators to place items in it. No messages are posted.
In the active mode, an empty slot will post a synchronous local JMS message when its contents are requested; the purpose of the message is to notify any interested content generators that the slot would like some items. The message will convey significant data from the NameResolver context passed in by the renderer.
Slots can also be configured for the following retrieval modes:
Slots can be also configured to automatically order their contents in the following ways:
A slot guarantees that following any generator modification of its contents, ordering will be reapplied before a renderer can access those contents.
Slots do not permit duplicate items to be entered, even with different priorities. Adding an item that already exists does not duplicate it, but results in its priority being set to the maximum of all priorities that it has been added with.
Finally, slots can be configured with a maxRenderSize property; this determines the largest number of items that a call to any of the target() methods will ever return, effectively acting as a ceiling on the pMaxNumber parameter to those methods. A rotating slot whose maxRenderSize is 1 will always return items one-at-a-time, rotating through the set of items in the slot, even if a TargetingForEach droplet is used with no maximum item count parameter.
Nested Class Summary | |
---|---|
protected static class |
Slot.SlotEntry
SlotEntry class: holds priority alongside item. |
Field Summary | |
---|---|
static int |
ACTIVE_GENERATION
|
static java.lang.String |
CLASS_VERSION
|
protected static int |
DEFAULT_PRIORITY
|
static int |
DESTRUCTIVE_RETRIEVAL
|
static int |
PASSIVE_GENERATION
|
static int |
PRIORITY_RANDOM_ORDERING
|
static int |
PRIORITY_SEQUENTIAL_ORDERING
|
static int |
ROTATING_RETRIEVAL
|
static int |
STATIC_RETRIEVAL
|
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.targeting.Targeter |
---|
NO_MAX_NUMBER, NO_START_INDEX |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
Slot()
|
Method Summary | |
---|---|
void |
add(java.lang.Object pItem)
Add an item to this slot with a default priority. |
void |
add(java.lang.Object pItem,
int pPriority)
Add an item to this slot. |
void |
addAll(java.util.Collection pItems)
Add multiple items to this slot with a default priority. |
void |
addAll(java.util.Collection pItems,
int pPriority)
Add an item to this slot. |
void |
clear()
Clear all items from the slot. |
boolean |
getAllowDuplicates()
Returns flag controlling whether duplicates are allowed or not |
java.util.Collection |
getCurrentItems()
|
int |
getEntryCount()
Returns the number of entries currently in this slot |
int |
getGeneration()
Returns content generation mode |
int |
getMaxRenderSize()
Returns maximum render size. |
java.lang.String |
getMessageSourcePath()
Returns the path to the DSS Message Source |
int |
getOrdering()
Returns content ordering mode |
protected java.lang.Object[] |
getRange(int pStartIndex,
int pMaxNumber)
Return a list of objects to be rendered. |
int |
getRetrieval()
Returns content retrieval mode |
java.lang.Class |
getValueType()
Returns the type of values contained by the slot, null if the slot is allowed to contain values of any type. |
void |
remove(java.lang.Object pItem)
Remove an item from this slot. |
void |
removeAll(java.util.Collection pItems)
Remove a collection of items from this slot. |
void |
setAllowDuplicates(boolean pAllowDuplicates)
Sets flag controlling whether duplicates are allowed or not |
void |
setGeneration(int pGeneration)
Sets content generation mode |
void |
setMaxRenderSize(int pMaxRenderSize)
Sets maximum render size: the maximum number of items that will be returned at one time in a single rendering call through the Targeter interface. |
void |
setMessageSourcePath(java.lang.String pMessageSourcePath)
Sets the nucleus path to the DSS Message Source |
void |
setOrdering(int pOrdering)
Sets content ordering mode |
void |
setRetrieval(int pRetrieval)
Sets content retrieval mode |
void |
setValueType(java.lang.Class pValueType)
Sets the type of values contained by the slot. |
protected void |
sortItems()
Sort the collection of items according to our mode. |
java.lang.Object[] |
target(NameResolver pNameResolver)
Performs a targeting operation, returning an array of "target" objects. |
java.lang.Object[] |
target(NameResolver pNameResolver,
int pMaxNumber)
Performs a targeting operation, returning an array of "target" objects containing at most pMaxNumber elements. |
java.lang.Object[] |
target(NameResolver pNameResolver,
int pStartIndex,
int pMaxNumber)
Performs a targeting operation, returning an array of "target" objects, beginning at the starting index of the entire result set, and containing at most pMaxNumber elements. |
java.lang.String |
toString()
Render slot as a string, marking current item. |
protected void |
trimConsumedItems()
Trim off any inactive portion of the list. |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
public static final int ACTIVE_GENERATION
public static final int PASSIVE_GENERATION
public static final int STATIC_RETRIEVAL
public static final int ROTATING_RETRIEVAL
public static final int DESTRUCTIVE_RETRIEVAL
public static final int PRIORITY_SEQUENTIAL_ORDERING
public static final int PRIORITY_RANDOM_ORDERING
protected static final int DEFAULT_PRIORITY
Constructor Detail |
---|
public Slot()
Method Detail |
---|
public void setGeneration(int pGeneration)
public int getGeneration()
public void setRetrieval(int pRetrieval)
public int getRetrieval()
public void setOrdering(int pOrdering)
public int getOrdering()
public void setAllowDuplicates(boolean pAllowDuplicates)
public boolean getAllowDuplicates()
public void setMaxRenderSize(int pMaxRenderSize)
public int getMaxRenderSize()
public java.lang.Class getValueType()
public void setValueType(java.lang.Class pValueType)
public java.lang.String getMessageSourcePath()
public void setMessageSourcePath(java.lang.String pMessageSourcePath)
public void add(java.lang.Object pItem)
pItem
- the item to be added.public void add(java.lang.Object pItem, int pPriority)
pItem
- the item to be added.pPriority
- a relative priority used to order the items for renderingpublic void addAll(java.util.Collection pItems)
pItems
- the collection of items to be added.public void addAll(java.util.Collection pItems, int pPriority)
pItems
- the items to be added.pPriority
- a relative priority used to order the items for renderingpublic void remove(java.lang.Object pItem)
pItem
- the item to be removed.public void removeAll(java.util.Collection pItems)
pItems
- the items to be removed.public int getEntryCount()
public void clear()
public java.lang.Object[] target(NameResolver pNameResolver) throws atg.targeting.TargetingException
Returns null if no items are found matching the targeting criteria.
target
in interface Targeter
pNameResolver
- a NameResolver that can be used by the
operation. At a minimum this must be able to resolve global
Nucleus components.
atg.targeting.TargetingException
- if a problem was encountered
during the targeting operationpublic java.lang.Object[] target(NameResolver pNameResolver, int pMaxNumber) throws atg.targeting.TargetingException
Returns null if no items are found matching the targeting criteria.
target
in interface Targeter
pNameResolver
- a NameResolver that can be used by the
operation. At a minimum this must be able to resolve global
Nucleus components.pMaxNumber
- the maximum number of elements to return;
if -1, the entire result set will be retrieved
atg.targeting.TargetingException
- if a problem was encountered
during the targeting operationpublic java.lang.Object[] target(NameResolver pNameResolver, int pStartIndex, int pMaxNumber) throws atg.targeting.TargetingException
Returns null if no items are found matching the targeting criteria, or if the number of items found is smaller than the specified starting index.
target
in interface Targeter
pNameResolver
- a NameResolver that can be used by the
operation. At a minimum this must be able to resolve global
Nucleus components.pStartIndex
- the starting index; must be >= 0pMaxNumber
- the maximum number of elements to return;
if -1, the entire result set starting at index pStartIndex will
be retrieved
atg.targeting.TargetingException
- if a problem was encountered
during the targeting operationprotected java.lang.Object[] getRange(int pStartIndex, int pMaxNumber)
pStartIndex
- the starting index of the renderingpMaxNumber
- the maximum number of objects to render
protected void sortItems()
protected void trimConsumedItems()
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Collection getCurrentItems()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |