001: /*
002: * Created on Aug 25, 2004
003: *
004: * To change the template for this generated file go to
005: * Window>Preferences>Java>Code Generation>Code and Comments
006: */
007: package org.jasig.portal.channels.jsp;
008:
009: import java.util.Map;
010:
011: import javax.servlet.http.HttpSession;
012:
013: import org.jasig.portal.ChannelRuntimeData;
014: import org.jasig.portal.ChannelStaticData;
015: import org.jasig.portal.ICacheable;
016: import org.jasig.portal.PortalEvent;
017: import org.jasig.portal.properties.PropertiesManager;
018:
019: /**
020: * Implementors of this interface can be used in the Jsp Channel Type to
021: * a create a channel whose content is served up from JSPs in a model II
022: * controller architecture. The controller can act on each incoming request
023: * via the processRuntimeData method and alter its internal model accordingly.
024: * There is one controller intance per channel per user so it can safely use
025: * instance variables. Any business objects that need to be passed to one of
026: * its JSPs via the request object should be placed in the Map returned from
027: * that method.
028: *
029: * @author Mark Boyd
030: */
031: public interface IController extends ICacheable {
032: public static String JSP_DEPLOY_PATH = PropertiesManager
033: .getProperty(Deployer.JSP_DEPLOY_DIR_PROP,
034: "/WEB-INF/classes");
035:
036: /**
037: * Allows the plugged-in controller for the jsp channel to have access to
038: * publish-time parameters and other information about the user. Included
039: * in the set are parameters whose keys end in ".jsp". Additionally, there
040: * will be one parameter whose key is "controllerClass". The are used by
041: * the jsp channel itself. For more information see the indicated method.
042: * Beyond these two restrictions on keys any other parameters can be
043: * specified during publishing that are needed by the controller to perform
044: * its work. In addition to the static data the HttpSession is also passed
045: * in and can be used to set both session and application scope values to
046: * be used in its JSPs.
047: *
048: * @see org.jasig.portal.channels.jsp.IController#getJspToRender()
049: */
050: public void setStaticData(ChannelStaticData csd);
051:
052: /** Allows the plugged-in controller for the jsp channel to know about
053: * channel events.
054: *
055: * @see org.jasig.portal.IChannel#receiveEvent(org.jasig.portal.PortalEvent)
056: */
057: public void receiveEvent(PortalEvent ev);
058:
059: /**
060: * Allows the plugged-in controller for the jsp channel to have access to
061: * request-time parameters passed back to the channel instance and to take
062: * action internally. Any objects that should be passed to the jsp to be
063: * delegated to should be placed in the returned Map object and they will
064: * be added to the request.setAttribute() method using the same keys and
065: * values. If no objects are to be passed to the jsp via the request object
066: * then this method can return null. If a Map is returned two parameters
067: * will be passed added in to be passed to the
068: * jsp by the containing Jsp Channel type and will override values having
069: * the same key already located within the Map passed back from the
070: * controller. These are "baseActionUrl" and "baseMediaUrl".
071: */
072: public Map processRuntimeData(ChannelRuntimeData drd, HttpSession s);
073:
074: /**
075: * Returns a Map of jsp pages that are exposed by the controller. This
076: * map is a name/value pair, where the name is the actual jsp channel name
077: * and the value is the request path.
078: *
079: * Process flow of the channel framework dictates that the map should be
080: * available to the controlling channel during the setStaticData method
081: * call.
082: *
083: * An example of the values that would be typically be placed in the map by
084: * the controller is:
085: *
086: * <pre>
087: * jspmap.put("show.UserInfo.jsp","jsps/user.jsp");
088: * </pre>
089: *
090: **/
091: public Map getJspMap();
092:
093: /**
094: * Returns the id of the jsp that should be delegated to for this request.
095: *
096: * The
097: * set of ids that can be returned and the jsps that each id maps to is defined
098: * in the getJspMap method. Their value
099: * indicates the location of the specific jsp page to be used. The location
100: * returned follows the pattern used by
101: * java.lang.Class.getResource(). If the value begins with a "/" it is left
102: * unchanged; otherwise, the package name of the
103: * controller class is prepended to the value after converting "." to "/". In
104: * either case the location is expected to be relative to the
105: * "WEB-INF/classes" directory for the webapp and the JSP is then delegated
106: * to using a request dispatcher. If the controller, its JSPs, and any
107: * other resource are is deployed as a CAR the Channel class extracts
108: * and class files and JSPs into WEB-INF/classes in package relative
109: * locations so that the web server can compile the JSPs and so that the
110: * JSPs can access the classes. All other resources remain within the CAR
111: * and are accesses appropriately by the Channel. *
112: *
113: * An example of the values that would be typically be placed in the map by
114: * the controller is:
115: *
116: * <pre>
117: * map.put("show.UserInfo.jsp","jsps/user.jsp");
118: * </pre>
119: *
120: * For the above example if the controller were in the com.sct.myChannel
121: * package and this method returned "show.UserInfo.jsp" then the fully
122: * qualified path specified to acquire the dispatcher would be:
123: *
124: * "/WEB-INF/classes/com/sct/myChannel/jsp/user.jsp"
125: *
126: * This method should never return a value of null. If the last content
127: * generated by the channel should be used the ICacheable implementations
128: * should indicate such behavior and prevent this method from being
129: * called. This method will only be called when new rendering is required
130: * as dictated by reponses to the ICacheable implementation methods.
131: */
132: public String getJspToRender();
133: }
|