KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > airsent > AirSent


1 /*
2  * Copyright (c) 1999-2001 Lutris Technologies, Inc. All Rights
3  * Reserved.
4  *
5  * This source code file is distributed by Lutris Technologies, Inc. for
6  * use only by licensed users of product(s) that include this source
7  * file. Use of this source file or the software that uses it is covered
8  * by the terms and conditions of the Lutris Enhydra Development License
9  * Agreement included with this product.
10  *
11  * This Software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
12  * ANY KIND, either express or implied. See the License for the specific terms
13  * governing rights and limitations under the License.
14  *
15  * Contributor(s):
16  *
17  * $Id: AirSent.java,v 1.1 2004/08/16 09:33:16 slobodan Exp $
18  */

19
20 package com.lutris.airsent;
21
22 import com.lutris.appserver.server.*;
23 import com.lutris.appserver.server.httpPresentation.*;
24 import com.lutris.appserver.server.session.*;
25 import com.lutris.util.*;
26 import com.lutris.airsent.spec.*;
27
28 /**
29  * The application object.
30  *
31  * Application-wide data would go here.
32  */

33 public class AirSent extends StandardApplication {
34     
35     protected boolean useServerPush = false;
36
37     /*
38      * A few methods you might want to add to.
39      * See StandardApplication for more details.
40      */

41
42     /**
43      * Start the application.
44      *
45      *
46      * @param appConfig
47      *
48      * @throws ApplicationException
49      *
50      * @see
51      */

52     public void startup(Config appConfig)
53         throws ApplicationException {
54
55     super.startup(appConfig);
56
57       try {
58         
59          
60       HomeManager homeManager = HomeManagerFactory.getHomeManager("com.lutris.airsent.business.HomeManagerImpl");
61          
62           homeManager.initialize(appConfig);
63           
64       
65           setAirSentConfig(appConfig);
66     
67     } catch (Exception JavaDoc ex) {
68             }
69     }
70
71     /**
72      * Gets the preprocessor.
73      *
74      *
75      * @param comms
76      *
77      * @return
78      *
79      * @throws Exception
80      *
81      * @see
82      */

83     public boolean requestPreprocessor(HttpPresentationComms comms)
84         throws Exception JavaDoc {
85
86     return super.requestPreprocessor(comms);
87     }
88
89     /**
90      * Gets the home Manager which controlls
91      * access to all business objects.
92      *
93      */

94     public HomeManager getHomeManager()
95         throws AirSentException {
96
97       HomeManager homeManager = HomeManagerFactory.getHomeManager("com.lutris.airsent.business.HomeManagerImpl");
98       return homeManager.getInst();
99
100     
101     }
102
103     /**
104      * This is an optional function, used only by the Multiserver's graphical
105      * administration. This bit of HTML appears in the status page for this
106      * application. You could add extra status info, for example
107      * a list of currently logged in users.
108      *
109      * @return HTML that is displayed in the status page of the Multiserver.
110      */

111     public String JavaDoc toHtml() {
112     return "This is <I>AirSent</I>";
113     }
114
115     /**
116      *Sets AirSent Configuration parameters
117      *
118      *
119      *
120      */

121     private void setAirSentConfig(Config config) throws AirSentException{
122     
123     try {
124         // Get the email config.
125
KeywordValueTable section = config.getSection("AirSentConfig");
126         useServerPush = Boolean.getBoolean(section.getString("ServerPush"));
127     
128         } catch (Exception JavaDoc ex) {
129         throw new AirSentException("Error configuring AirSent:", ex);
130     }
131     }
132
133
134     
135     /**
136      * Returns boolean based on if the app
137      * should use the server push technique
138      * for instant updates to screens.
139      *
140      * @param weather or not to use ServerPush.
141      */

142     public boolean useServerPush() {
143
144     return useServerPush;
145     }
146     
147 }
148
149
Popular Tags