| .. | .. |
|---|
| 13 | 13 | import net.curisit.securis.utils.LicUtils; |
|---|
| 14 | 14 | |
|---|
| 15 | 15 | import org.apache.commons.io.IOUtils; |
|---|
| 16 | | -import org.slf4j.Logger; |
|---|
| 17 | | -import org.slf4j.LoggerFactory; |
|---|
| 16 | +import org.apache.logging.log4j.LogManager; |
|---|
| 17 | +import org.apache.logging.log4j.Logger; |
|---|
| 18 | 18 | |
|---|
| 19 | 19 | public class ReqGenerator { |
|---|
| 20 | 20 | |
|---|
| 21 | | - @SuppressWarnings("unused") |
|---|
| 22 | | - private static final Logger log = LoggerFactory.getLogger(ReqGenerator.class); |
|---|
| 21 | + private static final Logger log = LogManager.getLogger(ReqGenerator.class); |
|---|
| 23 | 22 | |
|---|
| 24 | 23 | private static ReqGenerator singleton = new ReqGenerator(); |
|---|
| 25 | 24 | |
|---|
| .. | .. |
|---|
| 50 | 49 | return req; |
|---|
| 51 | 50 | } |
|---|
| 52 | 51 | |
|---|
| 52 | + public RequestBean loadRequest(File requestFile) throws SeCurisException { |
|---|
| 53 | + try { |
|---|
| 54 | + String json = new String(Files.readAllBytes(Paths.get(requestFile.toURI())), "utf-8"); |
|---|
| 55 | + RequestBean req = JsonUtils.json2object(json, RequestBean.class); |
|---|
| 56 | + return req; |
|---|
| 57 | + } catch (IOException e) { |
|---|
| 58 | + log.error("Request file {} was not found or is not accesible"); |
|---|
| 59 | + throw new SeCurisException("ERROR accesing request file: " + requestFile.getAbsolutePath(), e); |
|---|
| 60 | + } |
|---|
| 61 | + } |
|---|
| 62 | + |
|---|
| 53 | 63 | /** |
|---|
| 54 | 64 | * Generate a request file using a {@link RequestBean} |
|---|
| 55 | 65 | * |
|---|