| Line | Hits | Source |
|---|---|---|
| 1 | /******************************************************************************* | |
| 2 | *InternetCafe is a software solution that helps the management of Cybercafes | |
| 3 | * according with the ITALIAN DECREE LAW ON ANTI-TERROR MEASURES, 27 JULY 2005. | |
| 4 | * Copyright (C) 2006 Guido Angelo Ingenito | |
| 5 | ||
| 6 | * This program is free software; you can redistribute it and/or | |
| 7 | * modify it under the terms of the GNU General Public License | |
| 8 | * as published by the Free Software Foundation; either version 2 | |
| 9 | * of the License, or (at your option) any later version. | |
| 10 | ||
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 19 | *******************************************************************************/ | |
| 20 | package base.jdbs; | |
| 21 | ||
| 22 | import java.awt.BorderLayout; | |
| 23 | import java.io.File; | |
| 24 | ||
| 25 | import org.apache.log4j.Logger; | |
| 26 | import org.apache.log4j.xml.DOMConfigurator; | |
| 27 | ||
| 28 | import ui.dialog.UserDialog; | |
| 29 | import ui.util.GeneralUtil; | |
| 30 | import base.InternetCafe; | |
| 31 | import base.jdbs.ui.JDBSMainFrame; | |
| 32 | import base.jdbs.ui.JDBSMenuBar; | |
| 33 | import base.jdbs.ui.dialog.RepositorySetupDialog; | |
| 34 | import base.user.User; | |
| 35 | import base.user.UserFactory; | |
| 36 | ||
| 37 | 0 | public class JDBS { |
| 38 | ||
| 39 | 0 | private static final transient Logger logger = Logger.getLogger(JDBS.class |
| 40 | 0 | .getName()); |
| 41 | ||
| 42 | 0 | /** |
| 43 | * @param args | |
| 44 | */ | |
| 45 | public static void main(String[] args) { | |
| 46 | ||
| 47 | 0 | initJDBS(); |
| 48 | ||
| 49 | 0 | JDBSMainFrame mainFrame = new JDBSMainFrame(); |
| 50 | 0 | mainFrame.setSize(1024, 768); |
| 51 | 0 | mainFrame.setJMenuBar(new JDBSMenuBar()); |
| 52 | 0 | mainFrame.add(InternetCafe.getStatusBar(), BorderLayout.SOUTH); |
| 53 | 0 | GeneralUtil.centerComponent(mainFrame); |
| 54 | 0 | mainFrame.setVisible(true); |
| 55 | 0 | // NetworkManager.getInstance(); |
| 56 | 0 | } |
| 57 | ||
| 58 | 0 | protected static void initJDBS() { |
| 59 | // This call enables the log4j logs for JDBS. | |
| 60 | 0 | DOMConfigurator.configure("log4jConfiguration.xml"); |
| 61 | try { | |
| 62 | 0 | // First of all we must load the JDBS configurations. |
| 63 | 0 | File configurationFile = new File( |
| 64 | JDBSConstant.JDBS_CONFIGURATION_FILE); | |
| 65 | 0 | |
| 66 | 0 | if (configurationFile.exists()) { // Read It! |
| 67 | 0 | logger.info("Configuration file : " + configurationFile |
| 68 | 0 | + " found. Loading configurations from it..."); |
| 69 | 0 | ConfigurationManager.loadConfiguration(); |
| 70 | 0 | } else { |
| 71 | 0 | logger.info("Setting up the JDBS's user..."); |
| 72 | 0 | User user = UserFactory.newUser(); |
| 73 | 0 | UserDialog dialog = new UserDialog(user); |
| 74 | 0 | dialog.setModal(true); |
| 75 | 0 | dialog.setTitle("New User"); |
| 76 | 0 | dialog.setVisible(true); |
| 77 | 0 | ConfigurationManager.getInstance().setUser(dialog.getUser()); |
| 78 | 0 | logger.info(dialog.getUser()); |
| 79 | 0 | |
| 80 | 0 | logger.info("Setting up the JDBS's repository..."); |
| 81 | 0 | RepositorySetupDialog repositorySetupDialog = new RepositorySetupDialog(); |
| 82 | 0 | repositorySetupDialog.setModal(true); |
| 83 | 0 | GeneralUtil.centerComponent(repositorySetupDialog); |
| 84 | 0 | repositorySetupDialog.setVisible(true); |
| 85 | ||
| 86 | 0 | ConfigurationManager.saveConfiguration(); |
| 87 | 0 | } |
| 88 | 0 | } catch (Exception e) { |
| 89 | 0 | logger.error(e.getMessage()); |
| 90 | 0 | e.printStackTrace(); |
| 91 | 0 | } |
| 92 | 0 | |
| 93 | 0 | if (ConfigurationManager.getInstance().getRepository().getLocation() |
| 94 | 0 | .exists()) { |
| 95 | 0 | logger.info("Indexing the JDBS's repository..."); |
| 96 | 0 | ConfigurationManager.getInstance().getRepository() |
| 97 | 0 | .indexRepository(); |
| 98 | 0 | } |
| 99 | 0 | } |
| 100 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |