Roberto Sánchez
2014-09-18 a4b1e4c32927208e92ca9895fa780e18051d3932
src/main/java/net/curisit/securis/License.java
....@@ -42,7 +42,7 @@
4242 */
4343 public class License {
4444
45
- private static final Logger log = LogManager.getLogger(License.class);
45
+ private static final Logger LOG = LogManager.getLogger(License.class);
4646
4747 /**
4848 * Aplication entry point when it used as CLI
....@@ -51,9 +51,8 @@
5151 * @throws URISyntaxException
5252 */
5353 public static void main(String[] args) throws URISyntaxException {
54
- // Configuration conf = XMLConfigurationFactory.getInstance().getConfiguration("config", License.class.getResource("/log4j.xml").toURI());
5554
56
- log.debug("SeCuris client tool init ");
55
+ LOG.debug("SeCuris client tool init ");
5756
5857 checkConfigFile();
5958 CommandLine cmd = getCommandLine(args);
....@@ -65,7 +64,7 @@
6564 filename = "./license.req";
6665 File file = new File(filename);
6766 LicenseManager.getInstance().createRequestFile(file);
68
- log.info("Request file {} generated OK", file.getAbsolutePath());
67
+ LOG.info("Request file {} generated OK", file.getAbsolutePath());
6968 System.exit(0);
7069 }
7170
....@@ -76,10 +75,10 @@
7675 File file = new File(filename);
7776 try {
7877 LicenseManager.getInstance().validateLicense(file);
79
- log.info("License file {} is valid", file.getAbsolutePath());
78
+ LOG.info("License file {} is valid", file.getAbsolutePath());
8079 } 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());
8382 }
8483
8584 System.exit(0);
....@@ -89,30 +88,30 @@
8988 String reqFilename = cmd.getOptionValue("rfile");
9089 checkMandatoryParameter(reqFilename, "rfile");
9190
92
- log.warn("This command is not yet implemented");
91
+ LOG.warn("This command is not yet implemented");
9392 System.exit(0);
9493 }
9594
9695 if (cmd.hasOption('t')) {
97
- log.warn("This command is not yet implemented");
96
+ LOG.warn("This command is not yet implemented");
9897 System.exit(0);
9998 }
10099
101100 if (cmd.hasOption('r')) {
102101 String licFilename = cmd.getOptionValue("renew");
103102 checkMandatoryParameter(licFilename, "renew");
104
- log.warn("This command is not yet implemented");
103
+ LOG.warn("This command is not yet implemented");
105104 System.exit(0);
106105 }
107106
108107 } catch (SeCurisException e) {
109
- log.error("The command generated an error: {}", e.toString());
108
+ LOG.error("The command generated an error: {}", e.toString());
110109 }
111110 }
112111
113112 private static void checkMandatoryParameter(String value, String param) {
114113 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);
116115 System.exit(-5);
117116 }
118117 }
....@@ -123,12 +122,12 @@
123122 private static void checkConfigFile() {
124123 String appCode = Params.get(Params.KEYS.APPLICATION_CODE);
125124 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);
127126 System.exit(-3);
128127 }
129128 String customerCode = Params.get(Params.KEYS.CUSTOMER_CODE);
130129 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);
132131 System.exit(-4);
133132 }
134133 }