Skip to content

Commit

Permalink
Code convention fixes, log dispatcher doc
Browse files Browse the repository at this point in the history
  • Loading branch information
autumoswitzerland committed Jul 7, 2024
1 parent 0259230 commit 80d303f
Show file tree
Hide file tree
Showing 48 changed files with 82 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class AbstractBeetRootServlet extends HttpServlet {

private static final long serialVersionUID = 1L;

protected final static Logger LOG = LoggerFactory.getLogger(AbstractBeetRootServlet.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(AbstractBeetRootServlet.class.getName());

private BeetRootService beetRootService = null;
private Map<String, BeetRootHTTPSession> sessions = new ConcurrentHashMap<String, BeetRootHTTPSession>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
public class BeetRootClientHandler extends ClientHandler {

protected final static Logger LOG = LoggerFactory.getLogger(BeetRootClientHandler.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(BeetRootClientHandler.class.getName());

private final BeetRootWebServer nanoHttpd;
private final InputStream nanoInputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
*/
public class BeetRootConfigurationManager {

protected final static Logger LOG = LoggerFactory.getLogger(BeetRootConfigurationManager.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(BeetRootConfigurationManager.class.getName());

private static BeetRootConfigurationManager manager = null;
private static String rootPath = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
*/
public class BeetRootDatabaseManager {

protected final static Logger LOG = LoggerFactory.getLogger(BeetRootDatabaseManager.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(BeetRootDatabaseManager.class.getName());

public static final String POOL_NAME_PEFIX = "-DB-Pool";

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/BeetRootHTTPSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
*/
public class BeetRootHTTPSession extends HTTPSession {

protected final static Logger LOG = LoggerFactory.getLogger(BeetRootHTTPSession.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(BeetRootHTTPSession.class.getName());

static {

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/BeetRootWebServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
*/
public class BeetRootWebServer extends RouterNanoHTTPD implements BeetRootService {

protected final static Logger LOG = LoggerFactory.getLogger(BeetRootWebServer.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(BeetRootWebServer.class.getName());

private Class<?> defaultHandlerClass = TasksIndexHandler.class;
private String defaultHandlerEntity = "tasks";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/LanguageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
public class LanguageManager {

protected final static Logger LOG = LoggerFactory.getLogger(LanguageManager.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(LanguageManager.class.getName());

public static final String DEFAULT_LANG = "en";

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public abstract class Model implements Entity {

private static final long serialVersionUID = 1L;

protected final static Logger LOG = LoggerFactory.getLogger(Model.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(Model.class.getName());

/**
* Unassigned id; a model has been created
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/SessionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*/
public class SessionManager {

protected final static Logger LOG = LoggerFactory.getLogger(SessionManager.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(SessionManager.class.getName());


private static SessionManager instance = null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/cache/FileCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
public class FileCache {

protected final static Logger LOG = LoggerFactory.getLogger(FileCache.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(FileCache.class.getName());

// file buffer size
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
public class FileCacheManager {

protected final static Logger LOG = LoggerFactory.getLogger(FileCacheManager.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(FileCacheManager.class.getName());

// file buffer size
static {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/call/TwilioCaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class TwilioCaller implements Caller {

protected final static Logger LOG = LoggerFactory.getLogger(TwilioCaller.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(TwilioCaller.class.getName());

private String accountSid = null;
private String authToken = null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/crud/EventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
public class EventHandler {

protected final static Logger LOG = LoggerFactory.getLogger(EventHandler.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(EventHandler.class.getName());

private static EventHandler handler;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/handler/BaseHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
*/
public abstract class BaseHandler extends DefaultHandler implements Handler {

private final static Logger LOG = LoggerFactory.getLogger(BaseHandler.class.getName());
private static final Logger LOG = LoggerFactory.getLogger(BaseHandler.class.getName());

// Precision HTML input types
protected static List<String> PRECISION_INPUT_TYPES = Arrays.asList(new String[] {"email", "password", "search", "tel", "text", "url"});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
*/
public abstract class DefaultAddHandler extends BaseHandler {

private final static Logger LOG = LoggerFactory.getLogger(DefaultAddHandler.class.getName());
private static final Logger LOG = LoggerFactory.getLogger(DefaultAddHandler.class.getName());

private Map<String, Class<?>> refs = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
*/
public class DefaultIndexHandler extends BaseHandler {

protected final static Logger LOG = LoggerFactory.getLogger(DefaultIndexHandler.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(DefaultIndexHandler.class.getName());

private Map<String, Class<?>> refs = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
public class DefaultRESTIndexHandler extends BaseHandler {

protected final static Logger LOG = LoggerFactory.getLogger(DefaultRESTIndexHandler.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(DefaultRESTIndexHandler.class.getName());

private int maxRecPerPage = 20;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class ExampleDownloadHandler extends BaseHandler {

protected final static Logger LOG = LoggerFactory.getLogger(ExampleDownloadHandler.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(ExampleDownloadHandler.class.getName());

public ExampleDownloadHandler(String entity) {
super(entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
public class ExampleUploadHandler extends BaseHandler {

protected final static Logger LOG = LoggerFactory.getLogger(ExampleUploadHandler.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(ExampleUploadHandler.class.getName());

public ExampleUploadHandler(String entity) {
super(entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*/
public class LogHandler extends BaseHandler {

private final static Logger LOG = LoggerFactory.getLogger(LogHandler.class);
private static final Logger LOG = LoggerFactory.getLogger(LogHandler.class);

/** Default log size . */
public static int DEFAULT_LOG_SIZE = LogEventAppender.DEFAULT_LOG_SIZE;
Expand All @@ -61,7 +61,7 @@ public class LogHandler extends BaseHandler {
public static final int MINIMUM_REFRESH_TIME = 15;

/** Log pattern. Note: 'im' not recognized in pattern. */
private final static String LOG_PATTERN = "%highlight{%-5p}{TRACE=white} %style{%d{yyyyMMdd-HH:mm:ss.SSS}}{bright_black} %style{[%-26.26t]}{magenta} %style{%-35.35c{1.1.1.*}}{cyan} %style{:}{bright_black} %.-1000m%ex%n";
private static final String LOG_PATTERN = "%highlight{%-5p}{TRACE=white} %style{%d{yyyyMMdd-HH:mm:ss.SSS}}{bright_black} %style{[%-26.26t]}{magenta} %style{%-35.35c{1.1.1.*}}{cyan} %style{:}{bright_black} %.-1000m%ex%n";

private static Pattern PATTERN_REFRESH = Pattern.compile("\\{\\$logRefreshTime\\}");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*/
public class ChangeHandler extends BaseHandler {

protected final static Logger LOG = LoggerFactory.getLogger(ChangeHandler.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(ChangeHandler.class.getName());

private String entity = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*/
public class ResetHandler extends BaseHandler {

protected final static Logger LOG = LoggerFactory.getLogger(ResetHandler.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(ResetHandler.class.getName());

private String entity = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
public class UsersViewHandler extends DefaultViewHandler {

private final static Logger LOG = LoggerFactory.getLogger(UsersViewHandler.class.getName());
private static final Logger LOG = LoggerFactory.getLogger(UsersViewHandler.class.getName());

protected String userName = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
*/
public abstract class AbstractMailer implements Mailer {

private final static Logger LOG = LoggerFactory.getLogger(AbstractMailer.class.getName());
private static final Logger LOG = LoggerFactory.getLogger(AbstractMailer.class.getName());

protected String mailformats[] = null;
protected boolean auth = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*/
public class JakartaMailer extends AbstractMailer {

private final static Logger LOG = LoggerFactory.getLogger(JakartaMailer.class.getName());
private static final Logger LOG = LoggerFactory.getLogger(JakartaMailer.class.getName());

@Override
public void mail(String to[], String subject, Map<String, String> variables, String templateName, BeetRootHTTPSession session) throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/mailing/JavaxMailer.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
*/
public class JavaxMailer extends AbstractMailer {

private final static Logger LOG = LoggerFactory.getLogger(JavaxMailer.class.getName());
private static final Logger LOG = LoggerFactory.getLogger(JavaxMailer.class.getName());

@Override
public void mail(String[] to, String subject, Map<String, String> variables, String templateName, BeetRootHTTPSession session) throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/mime/MimeTypeFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
public class MimeTypeFile implements MimeTypeRegistry {

protected final static Logger LOG = LoggerFactory.getLogger(MimeTypeFile.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(MimeTypeFile.class.getName());

private Hashtable<String, MimeTypeEntry> mimeTypeMap = new Hashtable<String, MimeTypeEntry>();

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/plant/Plant.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
*/
public class Plant {

protected final static Logger LOG = LoggerFactory.getLogger(Plant.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(Plant.class.getName());

public static final String RELEASE = Constants.APP_VERSION;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class BeetRootDefaultRouter implements Router {
/**
* Log.
*/
protected final static Logger LOG = LoggerFactory.getLogger(BeetRootDefaultRouter.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(BeetRootDefaultRouter.class.getName());

/**
* Get not implemented handler class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/
public class SecureApplicationHolder {

protected final static Logger LOG = LoggerFactory.getLogger(SecureApplicationHolder.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(SecureApplicationHolder.class.getName());

private static SecureApplicationHolder holder = null;
private static final SecApp SEC_APP= new SecApp();
Expand Down
23 changes: 10 additions & 13 deletions src/main/java/ch/autumo/beetroot/server/BaseServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
*/
public abstract class BaseServer {

protected final static Logger LOG = LoggerFactory.getLogger(BaseServer.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(BaseServer.class.getName());

private static String rootPath = null;

Expand Down Expand Up @@ -1110,18 +1110,15 @@ public void run() {
LOG.error("Admin server connection listener failed! We recommend to restart the server!", e);

} finally {

if (!BaseServer.this.serverStop) {
if (serverSocket != null && serverSocket.isClosed()) {
try {
serverSocket = BaseServer.this.serverSocketFactory.create(this.listenerPort);
if (serverTimeout > 0)
serverSocket.setSoTimeout(serverTimeout);
} catch (IOException e) {
// That's wild, I know
}
}
}
if (!BaseServer.this.serverStop && serverSocket != null && serverSocket.isClosed()) {
try {
serverSocket = BaseServer.this.serverSocketFactory.create(this.listenerPort);
if (serverTimeout > 0)
serverSocket.setSoTimeout(serverTimeout);
} catch (IOException e) {
// That's wild, I know
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
public class BeetRootServer extends BaseServer {

protected final static Logger LOG = LoggerFactory.getLogger(BeetRootServer.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(BeetRootServer.class.getName());

/**
* Create an beetRoot server.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/autumo/beetroot/server/FileServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
*/
public class FileServer {

protected final static Logger LOG = LoggerFactory.getLogger(FileServer.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(FileServer.class.getName());

/** the base server */
private BaseServer baseServer = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
*/
public class ClientFileTransfer extends FileTransfer {

protected final static Logger LOG = LoggerFactory.getLogger(ClientFileTransfer.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(ClientFileTransfer.class.getName());

private static SocketFactory socketFactory = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,24 @@
*/
public class Communicator {

protected final static Logger LOG = LoggerFactory.getLogger(Communicator.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(Communicator.class.getName());

/** Max. message size: 512 kBytes */
public final static int MAX_MSG_SIZE = 512 * 1024;
public static final int MAX_MSG_SIZE = 512 * 1024;

/** Connection timeout in seconds */
public final static int TIMEOUT = 5;
public static final int TIMEOUT = 5;

/** Stop command */
public final static String CMD_STOP = "STOP";
public static final String CMD_STOP = "STOP";
/** Health command */
public final static String CMD_HEALTH = "HEALTH";
public static final String CMD_HEALTH = "HEALTH";
/** File delete */
public final static String CMD_FILE_DELETE = "FILE_DELETE";
public static final String CMD_FILE_DELETE = "FILE_DELETE";
/** File request for download */
public final static String CMD_FILE_REQUEST = "FILE_REQUEST";
public static final String CMD_FILE_REQUEST = "FILE_REQUEST";
/** File receive request for upload */
public final static String CMD_FILE_RECEIVE_REQUEST = "FILE_RECEIVE_REQUEST";
public static final String CMD_FILE_RECEIVE_REQUEST = "FILE_RECEIVE_REQUEST";

/**
* User agents used for tunneled server commands.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
*/
public class FileTransfer {

protected final static Logger LOG = LoggerFactory.getLogger(FileTransfer.class.getName());
protected static final Logger LOG = LoggerFactory.getLogger(FileTransfer.class.getName());

/** file server default port */
public static int DEFAULT_FILE_SERVER_PORT = 9777;
/** file receiver default port */
public static int DEFAULT_FILE_RECEIVER_PORT = 9779;

/** File get */
public final static String CMD_FILE_GET = "FILE_GET";
public static final String CMD_FILE_GET = "FILE_GET";

/** default buffer length in Kb for sending bits of a file */
public static int DEFAULT_BUFFER_LEN = 32;
Expand Down
Loading

0 comments on commit 80d303f

Please sign in to comment.