Alachisoft.NCache.Common.BridgeUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nc-common Show documentation
Show all versions of nc-common Show documentation
Internal package of Alachisoft.
package Alachisoft.NCache.Common;
//public class Logs
//{
// private TextWriter _writer;
// private long _logCleanInterval;
// private DateTime _lastCleanTime;
// private bool _logsEnabled;
// private bool _errorLogsEnabled;
// private object _sync_mutex = new object();
// public Logs() { }
// ///
// /// Gets/Sets the flag whether logs are enabled or not.
// ///
// public bool LogsEnabled
// {
// get { return _logsEnabled; }
// set { lock (_sync_mutex) { _logsEnabled = value; } }
// }
// ///
// /// Gets/Sets the flag whether Error logs are enabled or not.
// ///
// public bool IsErrorLogEnabled
// {
// get { return _errorLogsEnabled; }
// set { lock (_sync_mutex) { _errorLogsEnabled = value; } }
// }
// ///
// /// Gets/sets the logs clean interval. Interval is to be specified
// /// in terms of minute.
// ///
// public long LogCleanInterval
// {
// get { return _logCleanInterval; }
// set { if (value > 0) _logCleanInterval = value; }
// }
// public bool IsWriterNull
// {
// get
// {
// if (_writer == null) return true;
// else return false;
// }
// }
// ///
// /// Creates logs in installation folder
// ///
// ///
// ///
// public void Initialize(string fileName, string directory)
// {
// Initialize(fileName, null, directory);
// }
// public void Initialize(string fileName,string filepath,string directory)
// {
// lock (_sync_mutex)
// {
// string filename = fileName + "." +
// Environment.MachineName.ToLower() + "." +
// DateTime.Now.ToString("dd-MM-yy HH-mm-ss") + @".logs.txt";
// RegistryKey ncache = null;
// if (filepath == null)
// ncache = Registry.LocalMachine.OpenSubKey(@"Software\Alachisoft\NCache");
// try
// {
// if (ncache != null)
// {
// filepath = (string)ncache.GetValue("InstallDir");
// if (filepath != null) filepath += @"\ServicePropValues.LOGS_FOLDER";
// }
// if (filepath == null || filepath.Length == 0) throw new Exception("Missing log path");
// filepath = Path.Combine(filepath, directory);
// if (!Directory.Exists(filepath)) Directory.CreateDirectory(filepath);
// filepath = Path.Combine(filepath, filename);
// _writer = TextWriter.Synchronized(new StreamWriter(filepath, false));
// _lastCleanTime = DateTime.Now;
// _errorLogsEnabled = true;
// }
// catch (Exception ex)
// {
// throw new Exception(ex.Message, ex.InnerException);
// }
// }
// }
// public void WriteLogEntry(string module, string logText)
// {
// if (_writer != null)
// {
// int space2 = 40;
// string line = null;
// line = System.DateTime.Now.ToString("HH:mm:ss:ffff") + ": " + module.PadRight(space2, ' ') + logText;
// //string line = DateTime.Now.ToString() + " " + logText;
// lock (_sync_mutex)
// {
// _writer.WriteLine(line);
// _writer.Flush();
// }
// }
// }
// public void Close()
// {
// lock (_sync_mutex)
// {
// if (_writer != null)
// {
// lock (_writer)
// {
// _writer.Close();
// _writer = null;
// _logsEnabled = false;
// _errorLogsEnabled = false;
// }
// }
// }
// }
//}
//#endif
public class BridgeUtil {
public enum BridgeCacheStatus {
active,
passive;
public static BridgeCacheStatus forValue(int value) {
return values()[value];
}
public int getValue() {
return this.ordinal();
}
}
//C# TO JAVA CONVERTER WARNING: Java does not allow user-defined value types. The behavior of this class will differ from the original:
//ORIGINAL LINE: public struct BridgeTopologies
public final static class BridgeTopologies {
public static final String ActiveActive = "active-active";
public static final String ActivePassive = "active-passive";
public static final String HubeSpoke = "hub-spoke";
public static final String Centralized = "star";
}
}