Alachisoft.NCache.Common.Monitoring.EventViewerEvent 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.Monitoring;
//import Alachisoft.NCache.Common.*;
import Alachisoft.NCache.Common.Enum.EventType;
import com.alachisoft.ncache.runtime.util.NCDateTime;
import com.alachisoft.ncache.serialization.core.io.InternalCompactSerializable;
import com.alachisoft.ncache.serialization.standard.io.CompactReader;
import com.alachisoft.ncache.serialization.standard.io.CompactWriter;
import java.io.IOException;
//import com.alachisoft.ncache.serialization.core.io.ICompactSerializable;
//import com.alachisoft.ncache.serialization.core.io.NCacheObjectInput;
//import com.alachisoft.ncache.serialization.core.io.NCacheObjectOutput;
//import java.io.Serializable;
/**
* Contains the information about events in event viewer.
*/
// Cloneable,
public class EventViewerEvent implements InternalCompactSerializable {
public static EventType _type = EventType.INFORMATION;
private long _instanceId;
private NCDateTime _timeGenerated;
private String _source;
private String _message;
private String _node;
// /**
// Default constructor.
// */
public EventViewerEvent() {
}
//
// /**
// Initializes a new instance of EventViewerEvent.
//
// @param source Sourece of the event.
// @param eventId Event id
// @param eventDescription Event details
// @param time Time of the occurance of event.
// @param node Node at which event occured
// @param type Type of the event
// */
// public EventViewerEvent(EventLogEntry logEntry) {
// _source = logEntry.Source;
// _instanceId = logEntry.InstanceId;
// _timeGenerated = logEntry.TimeGenerated;
// _type = logEntry.EntryType;
// _message = logEntry.Message;
// }
//
/**
* Gets the Id of the event.
*/
public final long getInstanceID() {
return _instanceId;
}
/**
* Gets the source of the event.
*/
public final String getSource() {
return _source;
}
/**
* Sets the source of the event.
*
* @param source
* @return _source
*/
public final String setSource(String source) {
return _source = source;
}
/**
* Gets the time of the event.
*/
public final NCDateTime getTimeGenerated() {
return _timeGenerated;
}
/**
* Gets the detail of the event.
*/
public final String getMessage() {
return _message;
}
/**
*
*/
public final void setMessage(String message) {
_message = message;
}
/**
* Gets the type of the event.
*/
// public final EventLogEntryType getEventType() {
// return _type;
// }
public final String getMachine() {
return _node;
}
public final void setMachine(String value) {
_node = value;
}
public final void setGeneratedTime(NCDateTime dateTime) {
_timeGenerated = dateTime;
}
public final void setInstanceId(long id) {
_instanceId = id;
}
public final EventType getEventType() {
return _type;
}
public final void setEventType(EventType type) {
_type = type;
}
//
//
////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
// ///#region ICloneable Members
//
// public final Object clone() {
// EventViewerEvent eventViewerEntry = new EventViewerEvent();
// eventViewerEntry._instanceId = this.getInstanceID();
// eventViewerEntry._message = this.getMessage();
//// eventViewerEntry._type = this.getEventType();
// eventViewerEntry._source = this.getSource();
// eventViewerEntry._timeGenerated = this.getTimeGenerated();
// eventViewerEntry._node = this.getMachine();
// return eventViewerEntry;
// }
//
////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
// ///#endregion
@Override
public void Deserialize(CompactReader reader) throws IOException, ClassNotFoundException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void Serialize(CompactWriter writer) throws IOException {
writer.Write(_instanceId);
writer.Write(_timeGenerated.getTicks());
writer.WriteObject(_source);
writer.WriteObject(_message);
writer.WriteObject(_node);
if (_type == EventType.ERROR)
writer.Write(1);
else if (_type == EventType.WARNING)
writer.Write(2);
else if (_type == EventType.INFORMATION)
writer.Write(4);
// else if ( _type == EventLogEntryType.SuccessAudit)
// writer.Write(8);
// else if ( _type == EventLogEntryType.FailureAudit)
// writer.Write(16);
}
}