org.mitre.cybox.objects.UnixProcess Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stix Show documentation
Show all versions of stix Show documentation
The Java bindings for STIX v.1.2.0.2
/**
* Copyright (c) 2015, The MITRE Corporation. All rights reserved.
* See LICENSE for complete terms.
*/
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.06.23 at 10:59:44 AM EDT
//
package org.mitre.cybox.objects;
import java.io.StringReader;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
import org.mitre.cybox.common_2.CustomPropertiesType;
import org.mitre.cybox.common_2.DateTimeObjectPropertyType;
import org.mitre.cybox.common_2.DurationObjectPropertyType;
import org.mitre.cybox.common_2.EnvironmentVariableListType;
import org.mitre.cybox.common_2.ExtractedFeaturesType;
import org.mitre.cybox.common_2.NonNegativeIntegerObjectPropertyType;
import org.mitre.cybox.common_2.StringObjectPropertyType;
import org.mitre.cybox.common_2.UnsignedIntegerObjectPropertyType;
import org.mitre.stix.DocumentUtilities;
import org.mitre.stix.STIXSchema;
import org.mitre.stix.ValidationEventHandler;
/**
* The UnixProcessObjectType type is intended to characterize Unix processes.
*
* Java class for UnixProcessObjectType complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType name="UnixProcessObjectType">
* <complexContent>
* <extension base="{http://cybox.mitre.org/objects#ProcessObject-2}ProcessObjectType">
* <sequence>
* <element name="Open_File_Descriptor_List" type="{http://cybox.mitre.org/objects#UnixProcessObject-2}FileDescriptorListType" minOccurs="0"/>
* <element name="Priority" type="{http://cybox.mitre.org/common-2}NonNegativeIntegerObjectPropertyType" minOccurs="0"/>
* <element name="RUID" type="{http://cybox.mitre.org/common-2}NonNegativeIntegerObjectPropertyType" minOccurs="0"/>
* <element name="Session_ID" type="{http://cybox.mitre.org/common-2}NonNegativeIntegerObjectPropertyType" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UnixProcessObjectType", namespace = "http://cybox.mitre.org/objects#UnixProcessObject-2", propOrder = {
"openFileDescriptorList", "priority", "ruid", "sessionID" })
@XmlRootElement(name = "Unix_Process", namespace = "http://cybox.mitre.org/objects#UnixProcessObject-2")
public class UnixProcess extends ProcessObjectType implements Equals, HashCode,
ToString {
@XmlElement(name = "Open_File_Descriptor_List")
protected FileDescriptorListType openFileDescriptorList;
@XmlElement(name = "Priority")
protected NonNegativeIntegerObjectPropertyType priority;
@XmlElement(name = "RUID")
protected NonNegativeIntegerObjectPropertyType ruid;
@XmlElement(name = "Session_ID")
protected NonNegativeIntegerObjectPropertyType sessionID;
/**
* Default no-arg constructor
*
*/
public UnixProcess() {
super();
}
/**
* Fully-initialising value constructor
*
*/
public UnixProcess(final CustomPropertiesType customProperties,
final QName objectReference,
final UnsignedIntegerObjectPropertyType pid,
final StringObjectPropertyType name,
final DateTimeObjectPropertyType creationTime,
final UnsignedIntegerObjectPropertyType parentPID,
final ChildPIDListType childPIDList, final ImageInfoType imageInfo,
final ArgumentListType argumentList,
final EnvironmentVariableListType environmentVariableList,
final DurationObjectPropertyType kernelTime,
final PortListType portList,
final NetworkConnectionListType networkConnectionList,
final DateTimeObjectPropertyType startTime,
final ProcessStatusType status,
final StringObjectPropertyType username,
final DurationObjectPropertyType userTime,
final ExtractedFeaturesType extractedFeatures,
final Boolean isHidden,
final FileDescriptorListType openFileDescriptorList,
final NonNegativeIntegerObjectPropertyType priority,
final NonNegativeIntegerObjectPropertyType ruid,
final NonNegativeIntegerObjectPropertyType sessionID) {
super(customProperties, objectReference, pid, name, creationTime,
parentPID, childPIDList, imageInfo, argumentList,
environmentVariableList, kernelTime, portList,
networkConnectionList, startTime, status, username, userTime,
extractedFeatures, isHidden);
this.openFileDescriptorList = openFileDescriptorList;
this.priority = priority;
this.ruid = ruid;
this.sessionID = sessionID;
}
/**
* Gets the value of the openFileDescriptorList property.
*
* @return
* possible object is
* {@link FileDescriptorListType }
*
*/
public FileDescriptorListType getOpenFileDescriptorList() {
return openFileDescriptorList;
}
/**
* Sets the value of the openFileDescriptorList property.
*
* @param value
* allowed object is
* {@link FileDescriptorListType }
*
*/
public void setOpenFileDescriptorList(FileDescriptorListType value) {
this.openFileDescriptorList = value;
}
/**
* Gets the value of the priority property.
*
* @return
* possible object is
* {@link NonNegativeIntegerObjectPropertyType }
*
*/
public NonNegativeIntegerObjectPropertyType getPriority() {
return priority;
}
/**
* Sets the value of the priority property.
*
* @param value
* allowed object is
* {@link NonNegativeIntegerObjectPropertyType }
*
*/
public void setPriority(NonNegativeIntegerObjectPropertyType value) {
this.priority = value;
}
/**
* Gets the value of the ruid property.
*
* @return
* possible object is
* {@link NonNegativeIntegerObjectPropertyType }
*
*/
public NonNegativeIntegerObjectPropertyType getRUID() {
return ruid;
}
/**
* Sets the value of the ruid property.
*
* @param value
* allowed object is
* {@link NonNegativeIntegerObjectPropertyType }
*
*/
public void setRUID(NonNegativeIntegerObjectPropertyType value) {
this.ruid = value;
}
/**
* Gets the value of the sessionID property.
*
* @return
* possible object is
* {@link NonNegativeIntegerObjectPropertyType }
*
*/
public NonNegativeIntegerObjectPropertyType getSessionID() {
return sessionID;
}
/**
* Sets the value of the sessionID property.
*
* @param value
* allowed object is
* {@link NonNegativeIntegerObjectPropertyType }
*
*/
public void setSessionID(NonNegativeIntegerObjectPropertyType value) {
this.sessionID = value;
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator,
Object object, EqualsStrategy strategy) {
if (!(object instanceof UnixProcess)) {
return false;
}
if (this == object) {
return true;
}
if (!super.equals(thisLocator, thatLocator, object, strategy)) {
return false;
}
final UnixProcess that = ((UnixProcess) object);
{
FileDescriptorListType lhsOpenFileDescriptorList;
lhsOpenFileDescriptorList = this.getOpenFileDescriptorList();
FileDescriptorListType rhsOpenFileDescriptorList;
rhsOpenFileDescriptorList = that.getOpenFileDescriptorList();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"openFileDescriptorList", lhsOpenFileDescriptorList),
LocatorUtils
.property(thatLocator, "openFileDescriptorList",
rhsOpenFileDescriptorList),
lhsOpenFileDescriptorList, rhsOpenFileDescriptorList)) {
return false;
}
}
{
NonNegativeIntegerObjectPropertyType lhsPriority;
lhsPriority = this.getPriority();
NonNegativeIntegerObjectPropertyType rhsPriority;
rhsPriority = that.getPriority();
if (!strategy
.equals(LocatorUtils.property(thisLocator, "priority",
lhsPriority), LocatorUtils.property(thatLocator,
"priority", rhsPriority), lhsPriority, rhsPriority)) {
return false;
}
}
{
NonNegativeIntegerObjectPropertyType lhsRUID;
lhsRUID = this.getRUID();
NonNegativeIntegerObjectPropertyType rhsRUID;
rhsRUID = that.getRUID();
if (!strategy.equals(
LocatorUtils.property(thisLocator, "ruid", lhsRUID),
LocatorUtils.property(thatLocator, "ruid", rhsRUID),
lhsRUID, rhsRUID)) {
return false;
}
}
{
NonNegativeIntegerObjectPropertyType lhsSessionID;
lhsSessionID = this.getSessionID();
NonNegativeIntegerObjectPropertyType rhsSessionID;
rhsSessionID = that.getSessionID();
if (!strategy.equals(LocatorUtils.property(thisLocator,
"sessionID", lhsSessionID), LocatorUtils.property(
thatLocator, "sessionID", rhsSessionID), lhsSessionID,
rhsSessionID)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE;
return equals(null, null, object, strategy);
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = super.hashCode(locator, strategy);
{
FileDescriptorListType theOpenFileDescriptorList;
theOpenFileDescriptorList = this.getOpenFileDescriptorList();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator,
"openFileDescriptorList", theOpenFileDescriptorList),
currentHashCode, theOpenFileDescriptorList);
}
{
NonNegativeIntegerObjectPropertyType thePriority;
thePriority = this.getPriority();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "priority", thePriority),
currentHashCode, thePriority);
}
{
NonNegativeIntegerObjectPropertyType theRUID;
theRUID = this.getRUID();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "ruid", theRUID),
currentHashCode, theRUID);
}
{
NonNegativeIntegerObjectPropertyType theSessionID;
theSessionID = this.getSessionID();
currentHashCode = strategy.hashCode(
LocatorUtils.property(locator, "sessionID", theSessionID),
currentHashCode, theSessionID);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public UnixProcess withOpenFileDescriptorList(FileDescriptorListType value) {
setOpenFileDescriptorList(value);
return this;
}
public UnixProcess withPriority(NonNegativeIntegerObjectPropertyType value) {
setPriority(value);
return this;
}
public UnixProcess withRUID(NonNegativeIntegerObjectPropertyType value) {
setRUID(value);
return this;
}
public UnixProcess withSessionID(NonNegativeIntegerObjectPropertyType value) {
setSessionID(value);
return this;
}
@Override
public UnixProcess withPID(UnsignedIntegerObjectPropertyType value) {
setPID(value);
return this;
}
@Override
public UnixProcess withName(StringObjectPropertyType value) {
setName(value);
return this;
}
@Override
public UnixProcess withCreationTime(DateTimeObjectPropertyType value) {
setCreationTime(value);
return this;
}
@Override
public UnixProcess withParentPID(UnsignedIntegerObjectPropertyType value) {
setParentPID(value);
return this;
}
@Override
public UnixProcess withChildPIDList(ChildPIDListType value) {
setChildPIDList(value);
return this;
}
@Override
public UnixProcess withImageInfo(ImageInfoType value) {
setImageInfo(value);
return this;
}
@Override
public UnixProcess withArgumentList(ArgumentListType value) {
setArgumentList(value);
return this;
}
@Override
public UnixProcess withEnvironmentVariableList(
EnvironmentVariableListType value) {
setEnvironmentVariableList(value);
return this;
}
@Override
public UnixProcess withKernelTime(DurationObjectPropertyType value) {
setKernelTime(value);
return this;
}
@Override
public UnixProcess withPortList(PortListType value) {
setPortList(value);
return this;
}
@Override
public UnixProcess withNetworkConnectionList(NetworkConnectionListType value) {
setNetworkConnectionList(value);
return this;
}
@Override
public UnixProcess withStartTime(DateTimeObjectPropertyType value) {
setStartTime(value);
return this;
}
@Override
public UnixProcess withStatus(ProcessStatusType value) {
setStatus(value);
return this;
}
@Override
public UnixProcess withUsername(StringObjectPropertyType value) {
setUsername(value);
return this;
}
@Override
public UnixProcess withUserTime(DurationObjectPropertyType value) {
setUserTime(value);
return this;
}
@Override
public UnixProcess withExtractedFeatures(ExtractedFeaturesType value) {
setExtractedFeatures(value);
return this;
}
@Override
public UnixProcess withIsHidden(Boolean value) {
setIsHidden(value);
return this;
}
@Override
public UnixProcess withCustomProperties(CustomPropertiesType value) {
setCustomProperties(value);
return this;
}
@Override
public UnixProcess withObjectReference(QName value) {
setObjectReference(value);
return this;
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer,
ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator,
StringBuilder buffer, ToStringStrategy strategy) {
super.appendFields(locator, buffer, strategy);
{
FileDescriptorListType theOpenFileDescriptorList;
theOpenFileDescriptorList = this.getOpenFileDescriptorList();
strategy.appendField(locator, this, "openFileDescriptorList",
buffer, theOpenFileDescriptorList);
}
{
NonNegativeIntegerObjectPropertyType thePriority;
thePriority = this.getPriority();
strategy.appendField(locator, this, "priority", buffer, thePriority);
}
{
NonNegativeIntegerObjectPropertyType theRUID;
theRUID = this.getRUID();
strategy.appendField(locator, this, "ruid", buffer, theRUID);
}
{
NonNegativeIntegerObjectPropertyType theSessionID;
theSessionID = this.getSessionID();
strategy.appendField(locator, this, "sessionID", buffer,
theSessionID);
}
return buffer;
}
/**
* Returns A Document representation of this instance that is not formatted.
*
* @return The Document representation for this instance.
*/
public org.w3c.dom.Document toDocument() {
return toDocument(false);
}
/**
* Returns A Document representation for this instance.
*
* @param prettyPrint
* True for pretty print, otherwise false
*
* @return The Document representation for this instance.
*/
public org.w3c.dom.Document toDocument(boolean prettyPrint) {
return DocumentUtilities.toDocument(toJAXBElement(), prettyPrint);
}
/**
* Returns JAXBElement for this instance.
*
* @return The JAXBElement for this instance.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public JAXBElement> toJAXBElement() {
QName qualifiedName = STIXSchema.getQualifiedName(this);
return new JAXBElement(qualifiedName, UnixProcess.class, this);
}
/**
* Returns String representation of this instance that is not formatted.
*
* @return The String containing the XML mark-up.
*/
public String toXMLString() {
return toXMLString(false);
}
/**
* Returns XML String for JAXB Document Object Model object.
*
* @param prettyPrint
* True for pretty print, otherwise false
*
* @return The String containing the XML mark-up.
*/
public String toXMLString(boolean prettyPrint) {
return DocumentUtilities.toXMLString(toDocument(), prettyPrint);
}
/**
* Creates UnixProcess instance for XML String
*
* @param text
* XML String for the document
* @return The UnixProcess instance for the passed XML String
*/
public static UnixProcess fromXMLString(String text) {
JAXBContext jaxbContext;
try {
jaxbContext = JAXBContext.newInstance(UnixProcess.class
.getPackage().getName());
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
unmarshaller.setSchema(STIXSchema.getInstance().getSchema());
unmarshaller.setEventHandler(new ValidationEventHandler());
StreamSource streamSource = new StreamSource(new StringReader(text));
return (UnixProcess) unmarshaller.unmarshal(streamSource);
} catch (JAXBException e) {
throw new RuntimeException(e);
}
}
/**
* Validates the XML representation of this UnixProcess instance
* Returning true indicating a successful validation, false if not.
*
* @return boolean
*/
public boolean validate() {
return STIXSchema.getInstance().validate(toXMLString());
}
}