forked from loafle/openapi-generator-original
Use LOGGER instead of LOG
Use spaces instead of tabs
This commit is contained in:
@@ -12,11 +12,11 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ConfigParser {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ConfigParser.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigParser.class);
|
||||
|
||||
public static Config read(String location) {
|
||||
|
||||
LOG.debug("reading config from " + location);
|
||||
LOGGER.debug("reading config from " + location);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@@ -32,11 +32,11 @@ public class ConfigParser {
|
||||
if (optionNode.getValue().isValueNode()) {
|
||||
config.setOption(optionNode.getKey(), optionNode.getValue().asText());
|
||||
} else {
|
||||
LOG.warn("omitting non-value node " + optionNode.getKey());
|
||||
LOGGER.warn("omitting non-value node " + optionNode.getKey());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage());
|
||||
LOGGER.error(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public abstract class AbstractGenerator {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractGenerator.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractGenerator.class);
|
||||
|
||||
@SuppressWarnings("static-method")
|
||||
public File writeToFile(String filename, String contents) throws IOException {
|
||||
LOG.debug("writing file " + filename);
|
||||
LOGGER.debug("writing file " + filename);
|
||||
File output = new File(filename);
|
||||
|
||||
if (output.getParent() != null && !new File(output.getParent()).exists()) {
|
||||
@@ -45,7 +45,7 @@ public abstract class AbstractGenerator {
|
||||
Scanner s = new Scanner(reader).useDelimiter("\\A");
|
||||
return s.hasNext() ? s.next() : "";
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage());
|
||||
LOGGER.error(e.getMessage());
|
||||
}
|
||||
throw new RuntimeException("can't load template " + name);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public abstract class AbstractGenerator {
|
||||
}
|
||||
return new InputStreamReader(is);
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage());
|
||||
LOGGER.error(e.getMessage());
|
||||
}
|
||||
throw new RuntimeException("can't load template " + name);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import io.swagger.parser.SwaggerParser;
|
||||
@Deprecated
|
||||
public class Codegen extends DefaultGenerator {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Codegen.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Codegen.class);
|
||||
|
||||
static Map<String, CodegenConfig> configs = new HashMap<String, CodegenConfig>();
|
||||
static String configString;
|
||||
@@ -117,7 +117,7 @@ public class Codegen extends DefaultGenerator {
|
||||
.swagger(swagger);
|
||||
new Codegen().opts(clientOptInput).generate();
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,9 +142,9 @@ public class Codegen extends DefaultGenerator {
|
||||
} else {
|
||||
// see if it's a class
|
||||
try {
|
||||
LOG.debug("loading class " + name);
|
||||
LOGGER.debug("loading class " + name);
|
||||
Class<?> customClass = Class.forName(name);
|
||||
LOG.debug("loaded");
|
||||
LOGGER.debug("loaded");
|
||||
return (CodegenConfig) customClass.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("can't load class " + name);
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.ServiceLoader;
|
||||
@Deprecated
|
||||
public class MetaGenerator extends AbstractGenerator {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MetaGenerator.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MetaGenerator.class);
|
||||
|
||||
static Map<String, CodegenConfig> configs = new HashMap<String, CodegenConfig>();
|
||||
static String configString;
|
||||
@@ -105,7 +105,7 @@ public class MetaGenerator extends AbstractGenerator {
|
||||
usage(options);
|
||||
return;
|
||||
}
|
||||
LOG.info("writing to folder " + outputFolder);
|
||||
LOGGER.info("writing to folder " + outputFolder);
|
||||
File outputFolderLocation = new File(outputFolder);
|
||||
if (!outputFolderLocation.exists()) {
|
||||
outputFolderLocation.mkdirs();
|
||||
@@ -169,11 +169,11 @@ public class MetaGenerator extends AbstractGenerator {
|
||||
} else {
|
||||
String template = readTemplate(templateDir + File.separator + support.templateFile);
|
||||
FileUtils.writeStringToFile(new File(outputFilename), template);
|
||||
LOG.info("copying file to " + outputFilename);
|
||||
LOGGER.info("copying file to " + outputFilename);
|
||||
files.add(new File(outputFilename));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
|
||||
public class AuthParser {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AuthParser.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AuthParser.class);
|
||||
|
||||
public static List<AuthorizationValue> parse(String urlEncodedAuthStr) {
|
||||
List<AuthorizationValue> auths = new ArrayList<AuthorizationValue>();
|
||||
@@ -45,7 +45,7 @@ public class AuthParser {
|
||||
.append(URLEncoder.encode(v.getValue(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
// continue
|
||||
LOG.error(e.getMessage(), e);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return b.toString();
|
||||
|
||||
@@ -36,7 +36,7 @@ import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
*/
|
||||
public class CodegenConfigurator {
|
||||
|
||||
public static final Logger LOG = LoggerFactory.getLogger(CodegenConfigurator.class);
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(CodegenConfigurator.class);
|
||||
|
||||
private String lang;
|
||||
private String inputSpec;
|
||||
@@ -349,7 +349,7 @@ public class CodegenConfigurator {
|
||||
if (!verbose) {
|
||||
return;
|
||||
}
|
||||
LOG.info("\nVERBOSE MODE: ON. Additional debug options are injected" +
|
||||
LOGGER.info("\nVERBOSE MODE: ON. Additional debug options are injected" +
|
||||
"\n - [debugSwagger] prints the swagger specification as interpreted by the codegen" +
|
||||
"\n - [debugModels] prints models passed to the template engine" +
|
||||
"\n - [debugOperations] prints operations passed to the template engine" +
|
||||
@@ -392,7 +392,7 @@ public class CodegenConfigurator {
|
||||
try {
|
||||
return Json.mapper().readValue(new File(configFile), CodegenConfigurator.class);
|
||||
} catch (IOException e) {
|
||||
LOG.error("Unable to deserialize config file: " + configFile, e);
|
||||
LOGGER.error("Unable to deserialize config file: " + configFile, e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(FlaskConnexionCodegen.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FlaskConnexionCodegen.class);
|
||||
|
||||
public static final String CONTROLLER_PACKAGE = "controllerPackage";
|
||||
public static final String DEFAULT_CONTROLLER = "defaultController";
|
||||
@@ -297,7 +297,7 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
|
||||
try {
|
||||
objs.put("swagger-yaml", Yaml.mapper().writeValueAsString(swagger));
|
||||
} catch (JsonProcessingException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
for (Map<String, Object> operations : getOperations(objs)) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
public class JavaInflectorServerCodegen extends JavaClientCodegen implements CodegenConfig {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(JavaInflectorServerCodegen.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JavaInflectorServerCodegen.class);
|
||||
|
||||
protected String title = "Swagger Inflector";
|
||||
|
||||
@@ -170,7 +170,7 @@ public class JavaInflectorServerCodegen extends JavaClientCodegen implements Cod
|
||||
try {
|
||||
objs.put("swagger-yaml", Yaml.mapper().writeValueAsString(swagger));
|
||||
} catch (JsonProcessingException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return super.postProcessSupportingFileData(objs);
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(NodeJSServerCodegen.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(NodeJSServerCodegen.class);
|
||||
|
||||
protected String apiVersion = "1.0.0";
|
||||
protected int serverPort = 8080;
|
||||
@@ -290,7 +290,7 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig
|
||||
});
|
||||
objs.put("swagger-yaml", Yaml.mapper().registerModule(module).writeValueAsString(swagger));
|
||||
} catch (JsonProcessingException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
for (Map<String, Object> operations : getOperations(objs)) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SinatraServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SinatraServerCodegen.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SinatraServerCodegen.class);
|
||||
|
||||
protected String gemName;
|
||||
protected String moduleName;
|
||||
@@ -237,7 +237,7 @@ public class SinatraServerCodegen extends DefaultCodegen implements CodegenConfi
|
||||
try {
|
||||
objs.put("swagger-yaml", Yaml.mapper().writeValueAsString(swagger));
|
||||
} catch (JsonProcessingException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return super.postProcessSupportingFileData(objs);
|
||||
|
||||
@@ -15,7 +15,7 @@ import io.swagger.util.Json;
|
||||
|
||||
public class SwaggerGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SwaggerGenerator.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SwaggerGenerator.class);
|
||||
|
||||
public SwaggerGenerator() {
|
||||
super();
|
||||
@@ -47,9 +47,9 @@ public class SwaggerGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
try {
|
||||
String outputFile = outputFolder + File.separator + "swagger.json";
|
||||
FileUtils.writeStringToFile(new File(outputFile), swaggerString);
|
||||
LOG.debug("wrote file to " + outputFile);
|
||||
LOGGER.debug("wrote file to " + outputFile);
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import io.swagger.util.Yaml;
|
||||
|
||||
public class SwaggerYamlGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SwaggerYamlGenerator.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SwaggerYamlGenerator.class);
|
||||
|
||||
public SwaggerYamlGenerator() {
|
||||
super();
|
||||
@@ -46,9 +46,9 @@ public class SwaggerYamlGenerator extends DefaultCodegen implements CodegenConfi
|
||||
String swaggerString = Yaml.mapper().writeValueAsString(swagger);
|
||||
String outputFile = outputFolder + File.separator + "swagger.yaml";
|
||||
FileUtils.writeStringToFile(new File(outputFile), swaggerString);
|
||||
LOG.debug("wrote file to " + outputFile);
|
||||
LOGGER.debug("wrote file to " + outputFile);
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user