| .. | .. |
|---|
| 42 | 42 | */ |
|---|
| 43 | 43 | public class License { |
|---|
| 44 | 44 | |
|---|
| 45 | | - private static final Logger log = LogManager.getLogger(License.class); |
|---|
| 45 | + private static final Logger LOG = LogManager.getLogger(License.class); |
|---|
| 46 | 46 | |
|---|
| 47 | 47 | /** |
|---|
| 48 | 48 | * Aplication entry point when it used as CLI |
|---|
| .. | .. |
|---|
| 51 | 51 | * @throws URISyntaxException |
|---|
| 52 | 52 | */ |
|---|
| 53 | 53 | public static void main(String[] args) throws URISyntaxException { |
|---|
| 54 | | - // Configuration conf = XMLConfigurationFactory.getInstance().getConfiguration("config", License.class.getResource("/log4j.xml").toURI()); |
|---|
| 55 | 54 | |
|---|
| 56 | | - log.debug("SeCuris client tool init "); |
|---|
| 55 | + LOG.debug("SeCuris client tool init "); |
|---|
| 57 | 56 | |
|---|
| 58 | 57 | checkConfigFile(); |
|---|
| 59 | 58 | CommandLine cmd = getCommandLine(args); |
|---|
| .. | .. |
|---|
| 65 | 64 | filename = "./license.req"; |
|---|
| 66 | 65 | File file = new File(filename); |
|---|
| 67 | 66 | LicenseManager.getInstance().createRequestFile(file); |
|---|
| 68 | | - log.info("Request file {} generated OK", file.getAbsolutePath()); |
|---|
| 67 | + LOG.info("Request file {} generated OK", file.getAbsolutePath()); |
|---|
| 69 | 68 | System.exit(0); |
|---|
| 70 | 69 | } |
|---|
| 71 | 70 | |
|---|
| .. | .. |
|---|
| 76 | 75 | File file = new File(filename); |
|---|
| 77 | 76 | try { |
|---|
| 78 | 77 | LicenseManager.getInstance().validateLicense(file); |
|---|
| 79 | | - log.info("License file {} is valid", file.getAbsolutePath()); |
|---|
| 78 | + LOG.info("License file {} is valid", file.getAbsolutePath()); |
|---|
| 80 | 79 | } catch (SeCurisException e) { |
|---|
| 81 | | - log.info("License file {} is NOT valid", file.getAbsolutePath()); |
|---|
| 82 | | - log.info("Reason: {}", e.toString()); |
|---|
| 80 | + LOG.info("License file {} is NOT valid", file.getAbsolutePath()); |
|---|
| 81 | + LOG.info("Reason: {}", e.toString()); |
|---|
| 83 | 82 | } |
|---|
| 84 | 83 | |
|---|
| 85 | 84 | System.exit(0); |
|---|
| .. | .. |
|---|
| 89 | 88 | String reqFilename = cmd.getOptionValue("rfile"); |
|---|
| 90 | 89 | checkMandatoryParameter(reqFilename, "rfile"); |
|---|
| 91 | 90 | |
|---|
| 92 | | - log.warn("This command is not yet implemented"); |
|---|
| 91 | + LOG.warn("This command is not yet implemented"); |
|---|
| 93 | 92 | System.exit(0); |
|---|
| 94 | 93 | } |
|---|
| 95 | 94 | |
|---|
| 96 | 95 | if (cmd.hasOption('t')) { |
|---|
| 97 | | - log.warn("This command is not yet implemented"); |
|---|
| 96 | + LOG.warn("This command is not yet implemented"); |
|---|
| 98 | 97 | System.exit(0); |
|---|
| 99 | 98 | } |
|---|
| 100 | 99 | |
|---|
| 101 | 100 | if (cmd.hasOption('r')) { |
|---|
| 102 | 101 | String licFilename = cmd.getOptionValue("renew"); |
|---|
| 103 | 102 | checkMandatoryParameter(licFilename, "renew"); |
|---|
| 104 | | - log.warn("This command is not yet implemented"); |
|---|
| 103 | + LOG.warn("This command is not yet implemented"); |
|---|
| 105 | 104 | System.exit(0); |
|---|
| 106 | 105 | } |
|---|
| 107 | 106 | |
|---|
| 108 | 107 | } catch (SeCurisException e) { |
|---|
| 109 | | - log.error("The command generated an error: {}", e.toString()); |
|---|
| 108 | + LOG.error("The command generated an error: {}", e.toString()); |
|---|
| 110 | 109 | } |
|---|
| 111 | 110 | } |
|---|
| 112 | 111 | |
|---|
| 113 | 112 | private static void checkMandatoryParameter(String value, String param) { |
|---|
| 114 | 113 | if (value == null) { |
|---|
| 115 | | - log.error("Parameter {} is mandatory. Use --help to get information about parameters", param); |
|---|
| 114 | + LOG.error("Parameter {} is mandatory. Use --help to get information about parameters", param); |
|---|
| 116 | 115 | System.exit(-5); |
|---|
| 117 | 116 | } |
|---|
| 118 | 117 | } |
|---|
| .. | .. |
|---|
| 123 | 122 | private static void checkConfigFile() { |
|---|
| 124 | 123 | String appCode = Params.get(Params.KEYS.APPLICATION_CODE); |
|---|
| 125 | 124 | if (appCode == null) { |
|---|
| 126 | | - log.error("Manadatory parameter {} is not set in config file", Params.KEYS.APPLICATION_CODE); |
|---|
| 125 | + LOG.error("Manadatory parameter {} is not set in config file", Params.KEYS.APPLICATION_CODE); |
|---|
| 127 | 126 | System.exit(-3); |
|---|
| 128 | 127 | } |
|---|
| 129 | 128 | String customerCode = Params.get(Params.KEYS.CUSTOMER_CODE); |
|---|
| 130 | 129 | if (customerCode == null) { |
|---|
| 131 | | - log.error("Manadatory parameter {} is not set in config file", Params.KEYS.CUSTOMER_CODE); |
|---|
| 130 | + LOG.error("Manadatory parameter {} is not set in config file", Params.KEYS.CUSTOMER_CODE); |
|---|
| 132 | 131 | System.exit(-4); |
|---|
| 133 | 132 | } |
|---|
| 134 | 133 | } |
|---|