01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/samples/tags/sakai_2-4-1/sample-tool-jsf/src/java/org/sakaiproject/sample/tool/JsfSampleTool.java $
03: * $Id: JsfSampleTool.java 17061 2006-10-11 19:27:43Z ggolden@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.sample.tool;
21:
22: import org.apache.commons.logging.Log;
23: import org.apache.commons.logging.LogFactory;
24: import org.sakaiproject.jsf.util.JsfTool;
25: import org.sakaiproject.tool.api.Session;
26: import org.sakaiproject.tool.cover.SessionManager;
27:
28: /**
29: * <p>
30: * Example of extending the standard JsfTool for a particular application; in this case, the sample JSF tool.
31: * </p>
32: */
33: public class JsfSampleTool extends JsfTool {
34: /** Our log (commons). */
35: private static Log M_log = LogFactory.getLog(JsfSampleTool.class);
36:
37: /**
38: * Compute a target (i.e. the servlet path info, not including folder root or jsf extension) for the case of the actual path being empty.
39: *
40: * @return The servlet info path target computed for the case of empty actual path.
41: */
42: protected String computeDefaultTarget() {
43: Session session = SessionManager.getCurrentSession();
44: if (session.getUserId() == null) {
45: return "list";
46: }
47:
48: return "main";
49: }
50: }
|