| 1 | This servlet is the entry point for the database connection, user login, and user interfaces. It is a generated class that should not be present in the subversion repository. An example of this class: |
| 2 | |
| 3 | {{{ |
| 4 | /* |
| 5 | * Created by: org.molgenis.generators.server.MolgenisServletGen |
| 6 | * Date: October 4, 2010 |
| 7 | */ |
| 8 | |
| 9 | package app.servlet; |
| 10 | |
| 11 | import java.io.File; |
| 12 | |
| 13 | import javax.naming.NamingException; |
| 14 | import javax.servlet.http.HttpServletRequest; |
| 15 | import javax.sql.DataSource; |
| 16 | |
| 17 | import org.molgenis.framework.security.Login; |
| 18 | |
| 19 | import org.molgenis.framework.db.Database; |
| 20 | import org.molgenis.framework.db.DatabaseException; |
| 21 | import org.molgenis.framework.ui.UserInterface; |
| 22 | import org.molgenis.framework.server.AbstractMolgenisServlet; |
| 23 | |
| 24 | import org.molgenis.util.EmailService; |
| 25 | import org.molgenis.util.SimpleEmailService; |
| 26 | |
| 27 | import org.molgenis.framework.db.jdbc.JndiDataSourceWrapper; |
| 28 | |
| 29 | public class MolgenisServlet extends AbstractMolgenisServlet |
| 30 | { |
| 31 | |
| 32 | private static final long serialVersionUID = 3141439968743510237L; |
| 33 | |
| 34 | public Database getDatabase() throws DatabaseException, NamingException |
| 35 | { |
| 36 | DataSource dataSource = (DataSource) getServletContext().getAttribute("DataSource"); |
| 37 | return new app.JDBCDatabase(dataSource, new File("xgap")); |
| 38 | } |
| 39 | |
| 40 | public Login createLogin(Database db, HttpServletRequest request) |
| 41 | { |
| 42 | return new org.molgenis.framework.security.SimpleLogin(); |
| 43 | } |
| 44 | |
| 45 | public UserInterface createUserInterface(Login userLogin) |
| 46 | { |
| 47 | UserInterface app = new UserInterface(userLogin); |
| 48 | app.setLabel("XGAP 1.4 distro prototype"); |
| 49 | app.setVersion("3.3.3"); |
| 50 | |
| 51 | EmailService service = new SimpleEmailService(); |
| 52 | service.setSmtpProtocol("smtp"); |
| 53 | service.setSmtpHostname("localhost"); |
| 54 | service.setSmtpPort(25); |
| 55 | service.setSmtpUser(""); |
| 56 | service.setSmtpPassword(""); |
| 57 | app.setEmailService(service); |
| 58 | |
| 59 | new app.ui.Molgenis_headerPlugin(app); |
| 60 | new app.ui.MainMenu(app); |
| 61 | return app; |
| 62 | } |
| 63 | |
| 64 | public static String getMolgenisVariantID() |
| 65 | { |
| 66 | return "xgap_1_4_distro"; |
| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | public Object getSoapImpl() throws DatabaseException, NamingException |
| 71 | { |
| 72 | return new app.servlet.SoapApi((Database) getDatabase()); |
| 73 | } |
| 74 | } |
| 75 | }}} |