|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ProfileSelection
Interface which is used to extent the selection of a Profile within a ProfileSet for generating a Model. Users that wish to specify a custom profile selection mechanism can specify a handler name in a Profile Set using the Profile Set Manager. When a handler is specified the Model regeneration process will dynamically load the ProfileSelection class specified and then call its init(..) method with any optional properties and then the selectProfile(..) method. The resulting Profile returned from the selectProfile(..) method will be used as the selected Profile for generating the model.
An XML definition file is used to describe the named profile selection handlers. In the handler definition file you must specify the name of the class that implements this interface. The handler files are stored in the J2EERoot\WEB-INF\config\selection_handlers directory.
Here is an example of a handler file:
<Handler name="File Segment Handler"> <Description>Handler that maps users to a segment using mapping data from a simple xml file.</Description> <Selection class="com.bowstreet.webapp.examples.profileselection.FileSegmentSelectionHandler"> <Properties> <Property name="file">factory/profile_segment_data/segments.xml</Property> </Properties> </Selection> <SegmentList class="com.bowstreet.profiles.FileSegmentSelectionHandler" /> </Handler>This file describes the following:
Handler name - This is the name of the handler, which will be used as the display name in the Profile Set Manager to allow the the user to select a handler for their profile set.
Description - A short description that specifies the functionality of the handler.
Selection class - The class that implements the ProfileSelection interface. This must include the full package name.
Properties - These are optional name/value pair properties that will be passed as a Map to the init(..) method of your ProfileSelection implementation class.
SegmentList class - The class that implements the SegmentList interface. This must include the full package name. This is an optional value that is used by a customizer UI to get the list of segments for this handler.
SegmentList
,
Profile
,
ProfileSet
Method Summary | |
---|---|
void |
init(java.util.Map properties)
Initialization method that is used to pass handler properties to implementers of the ProfileSelection interface. |
java.lang.String |
selectProfile(javax.servlet.http.HttpServletRequest request,
ProfileSet profileSet,
java.lang.String modelName,
java.lang.String explicitProfile,
ModelInstanceCreator modelInstanceCreator)
Gets the selected Profile from the specified ProfileSet to be used to generate a Model into a WebApp. |
Method Detail |
---|
void init(java.util.Map properties)
properties
- A Map of name value pairs specified in the handler definition file. The Map key and values are both of type java.lang.String.java.lang.String selectProfile(javax.servlet.http.HttpServletRequest request, ProfileSet profileSet, java.lang.String modelName, java.lang.String explicitProfile, ModelInstanceCreator modelInstanceCreator)
request
- The HttpServletRequest for the current request. This can be used to get additional information about the requestor. Implementers of this method should test this for null, for cases where generation is done outside the context of the server.profileSet
- The ProfileSet, for the profile being selected. Note - The ProfileSet is not populated with all of the Profiles and should not be used to search for matching segments.
The ProfileSet will typically contain only the structural information and the default Profile.modelName
- The name of the Model that is being generated. This will be the full path of the model relative to the "J2EERoot\WEB-INF\models" directory (e.g. "factory/core/Welcome")explicitProfile
- The name of an explicitly selected profile, or null if there was not one specified (e.g. "Gold").modelInstanceCreator
- This can be use to instantiate a WebApp Model, which can then be invoked. Implementers of this method should test this for null, for cases where generation is done outside the context of the server.
ProfileSet
,
ModelInstanceCreator
,
HttpServletRequest
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |