001: /*
002: * Copyright (c) 1999-2001 Lutris Technologies, Inc. All Rights
003: * Reserved.
004: *
005: * This source code file is distributed by Lutris Technologies, Inc. for
006: * use only by licensed users of product(s) that include this source
007: * file. Use of this source file or the software that uses it is covered
008: * by the terms and conditions of the Lutris Enhydra Development License
009: * Agreement included with this product.
010: *
011: * This Software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
012: * ANY KIND, either express or implied. See the License for the specific terms
013: * governing rights and limitations under the License.
014: *
015: * Contributor(s):
016: *
017: * $Id: MessengerMain.java,v 1.1 2006-09-11 12:29:26 sinisa Exp $
018: */
019:
020: package com.lutris.airsent.presentation.messenger;
021:
022: import com.lutris.appserver.server.httpPresentation.*;
023: import com.lutris.appserver.server.session.*;
024: import com.lutris.util.*; //import com.lutris.xml.xmlc.*;
025: import org.enhydra.xml.xmlc.XMLCUtil;
026: import org.enhydra.xml.xmlc.XMLObject;
027: import org.w3c.dom.*;
028: import java.util.Date;
029: import com.lutris.airsent.presentation.AirSentConstants;
030: import com.lutris.airsent.presentation.DeviceBasePO;
031: import com.lutris.airsent.presentation.DeviceUtils;
032: import com.lutris.airsent.presentation.AirSentPresentationException;
033: import java.lang.reflect.Method;
034:
035: /**
036: * MessengerMain.java is the Main Directory page for the Messenger portion
037: * of the AirSent app.
038: *
039: * @author
040: * @version
041: */
042: public class MessengerMain extends DeviceBasePO {
043:
044: /**
045: * Constants
046: */
047: private static final int AUTH_LEVEL = AirSentConstants.UNAUTH_USER;
048:
049: /**
050: * Superclass method override.
051: * returns the authorization level necessary to access this po.
052: *
053: * @return int required authorization level
054: */
055: public int getRequiredAuthLevel() {
056: return AUTH_LEVEL;
057: }
058:
059: /**
060: * Default event. Just show the page.
061: *
062: * @return XMLObject document
063: * @exception HttpPresentationException
064: */
065: public XMLObject handleDefault() throws HttpPresentationException {
066: return showPage(null);
067: }
068:
069: /**
070: * Displays the MessengerMain page.
071: *
072: * @param errorMsg, the error messages
073: * @return XMLObject document
074: * @exception HttpPresentationException
075: */
076: public XMLObject showPage(String errorMsg)
077: throws HttpPresentationException {
078: Class tempClass = null;
079: Object page = null;
080: Method setTextErrorText = null;
081:
082: try {
083: Class stringClass = Class.forName("java.lang.String");
084: tempClass = Class
085: .forName(DeviceUtils
086: .getPageName(myComms,
087: "com.lutris.airsent.presentation.messenger.MessengerMain"));
088: page = myComms.xmlcFactory.create(tempClass);
089: Class[] argTypeArr = { stringClass };
090: setTextErrorText = tempClass.getMethod("setTextErrorText",
091: argTypeArr);
092: } catch (Exception e) {
093: }
094:
095: // MessengerMainPage page =
096: // (MessengerMainPage) create("com.lutris.airsent.presentation.messenger.MessengerMain");
097:
098: try {
099: if (null != errorMsg
100: || null != (errorMsg = this .getSessionData()
101: .getAndClearUserMessage())) {
102: Object[] temp = { errorMsg };
103: setTextErrorText.invoke(page, temp);
104: //page.setTextErrorText(errorMsg);
105: } else {
106: Object[] temp = { "" };
107: setTextErrorText.invoke(page, temp);
108: //page.setTextErrorText("");
109: }
110: } catch (Exception e) {
111: throw new AirSentPresentationException(
112: "Exception showing main page: ", e);
113: }
114: DeviceUtils.setURLTimeStamp((XMLObject) page);
115: return ((XMLObject) page);
116: }
117:
118: }
|