| | |
| | | import art.servers.controller.ControllerStatus; |
| | | import art.servers.controller.ControllerTransactions; |
| | | import art.servers.controller.ControllerUserPermissions; |
| | | import art.servers.gui.ArticWindow; |
| | | import java.awt.GraphicsDevice; |
| | | import java.awt.GraphicsEnvironment; |
| | | import java.awt.Toolkit; |
| | | import java.awt.datatransfer.Clipboard; |
| | | import java.awt.datatransfer.StringSelection; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.net.InetAddress; |
| | | import java.security.cert.X509Certificate; |
| | | import java.util.Properties; |
| | |
| | | |
| | | public static void preinitialise(String[] args, Class configurationClass) throws Exception |
| | | { |
| | | |
| | | Shared.debug = existParameter(args, "-debug"); |
| | | Shared.reloadDevices = existParameter(args, "--reload"); |
| | | Shared.restoreDevices = existParameter(args, "--restore"); |
| | |
| | | |
| | | System.setProperties(properties); |
| | | } |
| | | |
| | | |
| | | |
| | | // License |
| | | |
| | | boolean license = true; |
| | | |
| | | // if (existParameter(args, "-code") == true) |
| | | // { |
| | | // license = getParameter(args, "-code").equals(Shared.getApplicationCode()); |
| | | // } |
| | | // |
| | | // |
| | | // if (existParameter(args, "--license") == true) |
| | | // { |
| | | // String password = getParameter(args, "--license"); |
| | | // |
| | | // if (password.equalsIgnoreCase("¡¡register!!") == true) |
| | | // { |
| | | // FileOutputStream fos = new FileOutputStream(new File(Shared.getApplicationName() + ".license")); |
| | | // fos.write(Licence.licenceGeneration(Licence.codeGeneration(Shared.getApplicationCode())).getBytes()); |
| | | // fos.close(); |
| | | // } |
| | | // } |
| | | // |
| | | // if (license == false) |
| | | // { |
| | | // if (Licence.hasLicence(Shared.getApplicationCode(), new File(Shared.getApplicationName() + ".license")) == false) |
| | | // { |
| | | // codeGeneration(); |
| | | // } |
| | | // } |
| | | if (existParameter(args, "-code") == true) |
| | | { |
| | | license = getParameter(args, "-code").equals(Shared.getApplicationCode()); |
| | | } |
| | | |
| | | |
| | | if (existParameter(args, "--license") == true) |
| | | { |
| | | String password = getParameter(args, "--license"); |
| | | |
| | | if ((password.equalsIgnoreCase("¡¡register!!") == true) || (password.equalsIgnoreCase("**register**") == true)) |
| | | { |
| | | FileOutputStream fos = new FileOutputStream(new File(Shared.getApplicationName() + ".license")); |
| | | fos.write(Licence.licenceGeneration(Licence.codeGeneration(Shared.getApplicationCode())).getBytes()); |
| | | fos.close(); |
| | | } |
| | | } |
| | | |
| | | if (license == false) |
| | | { |
| | | if (Licence.hasLicence(Shared.getApplicationCode(), new File(Shared.getApplicationName() + ".license")) == false) |
| | | { |
| | | codeGeneration(); |
| | | } |
| | | } |
| | | |
| | | |
| | | // User and password database desencryption |
| | | |
| | | |
| | | if (Shared.configuration.database != null) |
| | | { |
| | | for (PersistenceDatabaseParameters parameters : Shared.configuration.database) |
| | |
| | | parameters.password = Licence.decrypt(parameters.password); |
| | | } |
| | | } |
| | | |
| | | |
| | | // Application device, status |
| | | |
| | | Application application = new Application(Shared.configuration.application); |
| | |
| | | } |
| | | else |
| | | { |
| | | System.out.println(Shared.getMessage("Process %1 already opened").replace("%1", Shared.configuration.general.executableName)); |
| | | } |
| | | |
| | | System.exit(0); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // Controller database |
| | | |
| | |
| | | |
| | | Shared.controllerProcessInformation = new ControllerProcessInformation(); |
| | | |
| | | |
| | | |
| | | |
| | | // Controller transactions |
| | | |
| | |
| | | Shared.lcontroller.add(Shared.controllerTransactions); |
| | | } |
| | | |
| | | |
| | | // Controller NTP HTTP |
| | | |
| | | if (Shared.configuration.controllerNTPHTTP != null) |
| | |
| | | Shared.lcontroller.add(Shared.controllerNtpHttp); |
| | | } |
| | | |
| | | }public static void postinitialise(String[] args) throws Exception |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public static void postinitialise(String[] args) throws Exception |
| | | { |
| | | |
| | | // Graphical interface |
| | | |
| | | // if (existParameter(args, "-nogui") == false) |
| | | // { |
| | | // GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
| | | // int screenWidth = gd.getDisplayMode().getWidth(); |
| | | // int screenHeight = gd.getDisplayMode().getHeight(); |
| | | // Shared.window = new ArticWindow(); |
| | | // Shared.window.setLocation(Shared.configuration.general.windowX, Shared.configuration.general.windowY); |
| | | // Shared.window.setSize(Math.min(Shared.configuration.general.windowW, screenWidth), Math.min(Shared.configuration.general.windowH, screenHeight)); |
| | | // } |
| | | if (existParameter(args, "-nogui") == false) |
| | | { |
| | | GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
| | | int screenWidth = gd.getDisplayMode().getWidth(); |
| | | int screenHeight = gd.getDisplayMode().getHeight(); |
| | | Shared.window = new ArticWindow(); |
| | | Shared.window.setLocation(Shared.configuration.general.windowX, Shared.configuration.general.windowY); |
| | | Shared.window.setSize(Math.min(Shared.configuration.general.windowW, screenWidth), Math.min(Shared.configuration.general.windowH, screenHeight)); |
| | | } |
| | | |
| | | |
| | | // Controller listener aluvisa |
| | |
| | | |
| | | // Version |
| | | |
| | | System.out.println(Shared.getApplicationName() + ", version " + Shared.version()); |
| | | Shared.printVersion("art.library.adf", "adf.version.properties"); |
| | | Shared.printVersion("art.library.andigo", "andigo.version.properties"); |
| | | Shared.printVersion("art.library.flatgui", "flatgui.version.properties"); |
| | |
| | | clpbrd.setContents(stringSelection, null); |
| | | String message = Shared.getMessage("Copy below code and send to provider to activate product"); |
| | | message = message + "\n\n" + code + "\n\n"; |
| | | System.out.println(message); |
| | | FlatDialog.showDialog(null, Shared.getMessage("License code"), message, true, FlatDialog.DIALOG_INFORMATION); |
| | | } |
| | | catch (Exception e) |
| | |
| | | String message = Shared.getMessage("Error in licence generation"); |
| | | message = message + "\n"; |
| | | message = message + Shared.getMessage("Contact provider to solve the problem"); |
| | | System.out.println(message); |
| | | FlatDialog.showDialog(null, Shared.getMessage("Error"), message, true, FlatDialog.DIALOG_ERROR); |
| | | } |
| | | catch (Exception exception) |