Portlet Factory, Version 6.1.2


 

Example: Profile Selection Interface

A typical profile selection interface looks as follows.

public interface ProfileSelection
 /**
* Gets the selected Profile from the specified Profile Set to be used to generate a Model into a WebApp.
* Implementers of this interface must return a valid Profile name for the Profile Set.
*
* @param 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.
* @param profile Set The Profile Set, which contains the Profile to be selected.
*@param 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")
* @param explicitProfile The name of an explicitly selected profile, or null if there was not one specified (e.g. "Gold").
* @param 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.
*
* @return The name of the selected profile. If an explicitProfile is specified then the implementer of this method should validate the explicit profile
* for the user making the request and return the name of the explicit profile if valid. If unable to determine the correct profile name for a user then  return the default profile name ("Default"). 
*
* @see com.bowstreet.profiles.ProfileSet
* @see com.bowstreet.webapp.ModelInstanceCreator
* @see javax.servlet.http.HttpServletRequest
*/ String selectProfile(HttpServletRequest request, ProfileSet profileSet, String modelName, String explicitProfile, ModelInstanceCreator modelInstanceCreator);

/**
* Initialization method that is used to pass handler properties to implementers of the ProfileSelection interface.
* Implementers of this interface should use this method to do any required Initialization before the selectProfile(..) method is called.
*
* @param 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.
*/ void init(Map properties);
}

Parent topic: Using the ProfileSelection interface


Library | Support |