Alachisoft.NCache.Common.LoggingInfo Maven / Gradle / Ivy
package Alachisoft.NCache.Common;
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
import java.io.Serializable;
//#if VS2005
//#endif
/**
* Provide information about client or server logging.
*/
public final class LoggingInfo implements Serializable {
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if VS2005
private java.util.HashMap _logMap;
//#endif
/**
* Create a new logging information
*/
public LoggingInfo() {
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if VS2005
this._logMap = new java.util.HashMap(2);
this._logMap.put(LoggingType.Error, LogsStatus.Disable);
this._logMap.put(LoggingType.Detailed, LogsStatus.Disable);
//#endif
}
/**
* Set logging status
*
* @param type Type of logging to set status for
* @param status Status of logging
*/
public void SetStatus(LoggingType type, LogsStatus status) {
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if VS2005
//if (status != LogsStatus.Unchanged)
//{
this._logMap.put(type, status);
//}
//#endif
}
/**
* Get logging status for a specified type
*
* @param type Type of logging
* @return Logging status for that type
*/
public LogsStatus GetStatus(LoggingType type) {
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if VS2005
//return this._logMap.get(type);
//#else
return LogsStatus.Disable;
//#endif
}
/**
* Defines the subsystem
*/
public enum LoggingSubsystem {
/**
* Socket server
*/
Server,
/**
* Remote clients
*/
Client;
public static LoggingSubsystem forValue(int value) {
return values()[value];
}
public int getValue() {
return this.ordinal();
}
}
/**
* Defines status of client and server side logging
*/
public enum LogsStatus {
/**
* Disable logging
*/
Disable(0),
/**
* Enable logging
*/
Enable(1);
private static java.util.HashMap mappings;
/**
* Keep the current value
*/
//Unchanged
private int intValue;
private LogsStatus(int value) {
intValue = value;
LogsStatus.getMappings().put(value, this);
}
private static java.util.HashMap getMappings() {
if (mappings == null) {
synchronized (LogsStatus.class) {
if (mappings == null) {
mappings = new java.util.HashMap();
}
}
}
return mappings;
}
public static LogsStatus forValue(int value) {
return getMappings().get(value);
}
public int getValue() {
return intValue;
}
}
/**
* Type of logging
*/
public enum LoggingType {
/**
* Log only exception and unexpected behaviours
*/
Error(0x1),
/**
* Log all information related to important operations
*/
Detailed(0x2);
private static java.util.HashMap mappings;
private int intValue;
private LoggingType(int value) {
intValue = value;
LoggingType.getMappings().put(value, this);
}
private static java.util.HashMap getMappings() {
if (mappings == null) {
synchronized (LoggingType.class) {
if (mappings == null) {
mappings = new java.util.HashMap();
}
}
}
return mappings;
}
public static LoggingType forValue(int value) {
return getMappings().get(value);
}
public int getValue() {
return intValue;
}
}
}