All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mitre.cybox.objects.ArchiveFile Maven / Gradle / Ivy

There is a newer version: 1.2.0.2
Show newest version
/**
 * 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.07.01 at 03:30:29 PM EDT 
//

package org.mitre.cybox.objects;

import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
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.ByteRunsType;
import org.mitre.cybox.common_2.CipherType;
import org.mitre.cybox.common_2.CustomPropertiesType;
import org.mitre.cybox.common_2.DateTimeObjectPropertyType;
import org.mitre.cybox.common_2.DigitalSignaturesType;
import org.mitre.cybox.common_2.DoubleObjectPropertyType;
import org.mitre.cybox.common_2.ExtractedFeaturesType;
import org.mitre.cybox.common_2.HashListType;
import org.mitre.cybox.common_2.HexBinaryObjectPropertyType;
import org.mitre.cybox.common_2.IntegerObjectPropertyType;
import org.mitre.cybox.common_2.StringObjectPropertyType;
import org.mitre.cybox.common_2.UnsignedLongObjectPropertyType;
import org.mitre.stix.DocumentUtilities;
import org.mitre.stix.STIXSchema;
import org.mitre.stix.ValidationEventHandler;
import org.xml.sax.SAXException;

/**
 * The ArchiveFileObjectType type is intended to characterize archive files.
 * 
 * 

Java class for ArchiveFileObjectType complex type. * *

The following schema fragment specifies the expected content contained within this class. * *

 * <complexType name="ArchiveFileObjectType">
 *   <complexContent>
 *     <extension base="{http://cybox.mitre.org/objects#FileObject-2}FileObjectType">
 *       <sequence>
 *         <element name="Archive_Format" type="{http://cybox.mitre.org/objects#ArchiveFileObject-1}ArchiveFileFormatType" minOccurs="0"/>
 *         <element name="Version" type="{http://cybox.mitre.org/common-2}StringObjectPropertyType" minOccurs="0"/>
 *         <element name="File_Count" type="{http://cybox.mitre.org/common-2}IntegerObjectPropertyType" minOccurs="0"/>
 *         <element name="Comment" type="{http://cybox.mitre.org/common-2}StringObjectPropertyType" minOccurs="0"/>
 *         <element name="Archived_File" type="{http://cybox.mitre.org/objects#FileObject-2}FileObjectType" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 * 
* * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ArchiveFileObjectType", namespace = "http://cybox.mitre.org/objects#ArchiveFileObject-1", propOrder = { "archiveFormat", "version", "fileCount", "comment", "archivedFiles" }) @XmlRootElement(name = "Archive_File", namespace = "http://cybox.mitre.org/objects#ArchiveFileObject-1") public class ArchiveFile extends FileObjectType implements Equals, HashCode, ToString { @XmlElement(name = "Archive_Format") protected ArchiveFileFormatType archiveFormat; @XmlElement(name = "Version") protected StringObjectPropertyType version; @XmlElement(name = "File_Count") protected IntegerObjectPropertyType fileCount; @XmlElement(name = "Comment") protected StringObjectPropertyType comment; @XmlElement(name = "Archived_File") protected List archivedFiles; /** * Default no-arg constructor * */ public ArchiveFile() { super(); } /** * Fully-initialising value constructor * */ public ArchiveFile(final CustomPropertiesType customProperties, final QName objectReference, final StringObjectPropertyType fileName, final FilePathType filePath, final StringObjectPropertyType devicePath, final StringObjectPropertyType fullPath, final StringObjectPropertyType fileExtension, final UnsignedLongObjectPropertyType sizeInBytes, final HexBinaryObjectPropertyType magicNumber, final StringObjectPropertyType fileFormat, final HashListType hashes, final DigitalSignaturesType digitalSignatures, final DateTimeObjectPropertyType modifiedTime, final DateTimeObjectPropertyType accessedTime, final DateTimeObjectPropertyType createdTime, final FileAttributeType fileAttributesList, final FilePermissionsType permissions, final StringObjectPropertyType userOwner, final PackerListType packerList, final DoubleObjectPropertyType peakEntropy, final SymLinksListType symLinks, final ByteRunsType byteRuns, final ExtractedFeaturesType extractedFeatures, final CipherType encryptionAlgorithm, final StringObjectPropertyType decryptionKey, final StringObjectPropertyType compressionMethod, final StringObjectPropertyType compressionVersion, final StringObjectPropertyType compressionComment, final Boolean isPacked, final Boolean isMasqueraded, final ArchiveFileFormatType archiveFormat, final StringObjectPropertyType version, final IntegerObjectPropertyType fileCount, final StringObjectPropertyType comment, final List archivedFiles) { super(customProperties, objectReference, fileName, filePath, devicePath, fullPath, fileExtension, sizeInBytes, magicNumber, fileFormat, hashes, digitalSignatures, modifiedTime, accessedTime, createdTime, fileAttributesList, permissions, userOwner, packerList, peakEntropy, symLinks, byteRuns, extractedFeatures, encryptionAlgorithm, decryptionKey, compressionMethod, compressionVersion, compressionComment, isPacked, isMasqueraded); this.archiveFormat = archiveFormat; this.version = version; this.fileCount = fileCount; this.comment = comment; this.archivedFiles = archivedFiles; } /** * Gets the value of the archiveFormat property. * * @return * possible object is * {@link ArchiveFileFormatType } * */ public ArchiveFileFormatType getArchiveFormat() { return archiveFormat; } /** * Sets the value of the archiveFormat property. * * @param value * allowed object is * {@link ArchiveFileFormatType } * */ public void setArchiveFormat(ArchiveFileFormatType value) { this.archiveFormat = value; } /** * Gets the value of the version property. * * @return * possible object is * {@link StringObjectPropertyType } * */ public StringObjectPropertyType getVersion() { return version; } /** * Sets the value of the version property. * * @param value * allowed object is * {@link StringObjectPropertyType } * */ public void setVersion(StringObjectPropertyType value) { this.version = value; } /** * Gets the value of the fileCount property. * * @return * possible object is * {@link IntegerObjectPropertyType } * */ public IntegerObjectPropertyType getFileCount() { return fileCount; } /** * Sets the value of the fileCount property. * * @param value * allowed object is * {@link IntegerObjectPropertyType } * */ public void setFileCount(IntegerObjectPropertyType value) { this.fileCount = value; } /** * Gets the value of the comment property. * * @return * possible object is * {@link StringObjectPropertyType } * */ public StringObjectPropertyType getComment() { return comment; } /** * Sets the value of the comment property. * * @param value * allowed object is * {@link StringObjectPropertyType } * */ public void setComment(StringObjectPropertyType value) { this.comment = value; } /** * Gets the value of the archivedFiles property. * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the archivedFiles property. * *

* For example, to add a new item, do as follows: *

	 *    getArchivedFiles().add(newItem);
	 * 
* * *

* Objects of the following type(s) are allowed in the list * {@link FileObjectType } * * */ public List getArchivedFiles() { if (archivedFiles == null) { archivedFiles = new ArrayList(); } return this.archivedFiles; } public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof ArchiveFile)) { return false; } if (this == object) { return true; } if (!super.equals(thisLocator, thatLocator, object, strategy)) { return false; } final ArchiveFile that = ((ArchiveFile) object); { ArchiveFileFormatType lhsArchiveFormat; lhsArchiveFormat = this.getArchiveFormat(); ArchiveFileFormatType rhsArchiveFormat; rhsArchiveFormat = that.getArchiveFormat(); if (!strategy.equals(LocatorUtils.property(thisLocator, "archiveFormat", lhsArchiveFormat), LocatorUtils.property( thatLocator, "archiveFormat", rhsArchiveFormat), lhsArchiveFormat, rhsArchiveFormat)) { return false; } } { StringObjectPropertyType lhsVersion; lhsVersion = this.getVersion(); StringObjectPropertyType rhsVersion; rhsVersion = that.getVersion(); if (!strategy.equals( LocatorUtils.property(thisLocator, "version", lhsVersion), LocatorUtils.property(thatLocator, "version", rhsVersion), lhsVersion, rhsVersion)) { return false; } } { IntegerObjectPropertyType lhsFileCount; lhsFileCount = this.getFileCount(); IntegerObjectPropertyType rhsFileCount; rhsFileCount = that.getFileCount(); if (!strategy.equals(LocatorUtils.property(thisLocator, "fileCount", lhsFileCount), LocatorUtils.property( thatLocator, "fileCount", rhsFileCount), lhsFileCount, rhsFileCount)) { return false; } } { StringObjectPropertyType lhsComment; lhsComment = this.getComment(); StringObjectPropertyType rhsComment; rhsComment = that.getComment(); if (!strategy.equals( LocatorUtils.property(thisLocator, "comment", lhsComment), LocatorUtils.property(thatLocator, "comment", rhsComment), lhsComment, rhsComment)) { return false; } } { List lhsArchivedFiles; lhsArchivedFiles = (((this.archivedFiles != null) && (!this.archivedFiles .isEmpty())) ? this.getArchivedFiles() : null); List rhsArchivedFiles; rhsArchivedFiles = (((that.archivedFiles != null) && (!that.archivedFiles .isEmpty())) ? that.getArchivedFiles() : null); if (!strategy.equals(LocatorUtils.property(thisLocator, "archivedFiles", lhsArchivedFiles), LocatorUtils.property( thatLocator, "archivedFiles", rhsArchivedFiles), lhsArchivedFiles, rhsArchivedFiles)) { 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); { ArchiveFileFormatType theArchiveFormat; theArchiveFormat = this.getArchiveFormat(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "archiveFormat", theArchiveFormat), currentHashCode, theArchiveFormat); } { StringObjectPropertyType theVersion; theVersion = this.getVersion(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "version", theVersion), currentHashCode, theVersion); } { IntegerObjectPropertyType theFileCount; theFileCount = this.getFileCount(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "fileCount", theFileCount), currentHashCode, theFileCount); } { StringObjectPropertyType theComment; theComment = this.getComment(); currentHashCode = strategy.hashCode( LocatorUtils.property(locator, "comment", theComment), currentHashCode, theComment); } { List theArchivedFiles; theArchivedFiles = (((this.archivedFiles != null) && (!this.archivedFiles .isEmpty())) ? this.getArchivedFiles() : null); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "archivedFiles", theArchivedFiles), currentHashCode, theArchivedFiles); } return currentHashCode; } public int hashCode() { final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE; return this.hashCode(null, strategy); } public ArchiveFile withArchiveFormat(ArchiveFileFormatType value) { setArchiveFormat(value); return this; } public ArchiveFile withVersion(StringObjectPropertyType value) { setVersion(value); return this; } public ArchiveFile withFileCount(IntegerObjectPropertyType value) { setFileCount(value); return this; } public ArchiveFile withComment(StringObjectPropertyType value) { setComment(value); return this; } public ArchiveFile withArchivedFiles(FileObjectType... values) { if (values != null) { for (FileObjectType value : values) { getArchivedFiles().add(value); } } return this; } public ArchiveFile withArchivedFiles(Collection values) { if (values != null) { getArchivedFiles().addAll(values); } return this; } @Override public ArchiveFile withFileName(StringObjectPropertyType value) { setFileName(value); return this; } @Override public ArchiveFile withFilePath(FilePathType value) { setFilePath(value); return this; } @Override public ArchiveFile withDevicePath(StringObjectPropertyType value) { setDevicePath(value); return this; } @Override public ArchiveFile withFullPath(StringObjectPropertyType value) { setFullPath(value); return this; } @Override public ArchiveFile withFileExtension(StringObjectPropertyType value) { setFileExtension(value); return this; } @Override public ArchiveFile withSizeInBytes(UnsignedLongObjectPropertyType value) { setSizeInBytes(value); return this; } @Override public ArchiveFile withMagicNumber(HexBinaryObjectPropertyType value) { setMagicNumber(value); return this; } @Override public ArchiveFile withFileFormat(StringObjectPropertyType value) { setFileFormat(value); return this; } @Override public ArchiveFile withHashes(HashListType value) { setHashes(value); return this; } @Override public ArchiveFile withDigitalSignatures(DigitalSignaturesType value) { setDigitalSignatures(value); return this; } @Override public ArchiveFile withModifiedTime(DateTimeObjectPropertyType value) { setModifiedTime(value); return this; } @Override public ArchiveFile withAccessedTime(DateTimeObjectPropertyType value) { setAccessedTime(value); return this; } @Override public ArchiveFile withCreatedTime(DateTimeObjectPropertyType value) { setCreatedTime(value); return this; } @Override public ArchiveFile withFileAttributesList(FileAttributeType value) { setFileAttributesList(value); return this; } @Override public ArchiveFile withPermissions(FilePermissionsType value) { setPermissions(value); return this; } @Override public ArchiveFile withUserOwner(StringObjectPropertyType value) { setUserOwner(value); return this; } @Override public ArchiveFile withPackerList(PackerListType value) { setPackerList(value); return this; } @Override public ArchiveFile withPeakEntropy(DoubleObjectPropertyType value) { setPeakEntropy(value); return this; } @Override public ArchiveFile withSymLinks(SymLinksListType value) { setSymLinks(value); return this; } @Override public ArchiveFile withByteRuns(ByteRunsType value) { setByteRuns(value); return this; } @Override public ArchiveFile withExtractedFeatures(ExtractedFeaturesType value) { setExtractedFeatures(value); return this; } @Override public ArchiveFile withEncryptionAlgorithm(CipherType value) { setEncryptionAlgorithm(value); return this; } @Override public ArchiveFile withDecryptionKey(StringObjectPropertyType value) { setDecryptionKey(value); return this; } @Override public ArchiveFile withCompressionMethod(StringObjectPropertyType value) { setCompressionMethod(value); return this; } @Override public ArchiveFile withCompressionVersion(StringObjectPropertyType value) { setCompressionVersion(value); return this; } @Override public ArchiveFile withCompressionComment(StringObjectPropertyType value) { setCompressionComment(value); return this; } @Override public ArchiveFile withIsPacked(Boolean value) { setIsPacked(value); return this; } @Override public ArchiveFile withIsMasqueraded(Boolean value) { setIsMasqueraded(value); return this; } @Override public ArchiveFile withCustomProperties(CustomPropertiesType value) { setCustomProperties(value); return this; } @Override public ArchiveFile 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); { ArchiveFileFormatType theArchiveFormat; theArchiveFormat = this.getArchiveFormat(); strategy.appendField(locator, this, "archiveFormat", buffer, theArchiveFormat); } { StringObjectPropertyType theVersion; theVersion = this.getVersion(); strategy.appendField(locator, this, "version", buffer, theVersion); } { IntegerObjectPropertyType theFileCount; theFileCount = this.getFileCount(); strategy.appendField(locator, this, "fileCount", buffer, theFileCount); } { StringObjectPropertyType theComment; theComment = this.getComment(); strategy.appendField(locator, this, "comment", buffer, theComment); } { List theArchivedFiles; theArchivedFiles = (((this.archivedFiles != null) && (!this.archivedFiles .isEmpty())) ? this.getArchivedFiles() : null); strategy.appendField(locator, this, "archivedFiles", buffer, theArchivedFiles); } 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, ArchiveFile.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 ArchiveFile instance for XML String * * @param text * XML String for the document * @return The ArchiveFile instance for the passed XML String */ public static ArchiveFile fromXMLString(String text) { JAXBContext jaxbContext; try { jaxbContext = JAXBContext.newInstance(ArchiveFile.class .getPackage().getName()); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setSchema(STIXSchema.getInstance().getSchema()); unmarshaller.setEventHandler(new ValidationEventHandler()); StreamSource streamSource = new StreamSource(new StringReader(text)); return (ArchiveFile) unmarshaller.unmarshal(streamSource); } catch (JAXBException e) { throw new RuntimeException(e); } } /** * Validates the XML representation of this ArchiveFile instance * Returning true indicating a successful validation, false if not. * * @return boolean True If it validates against the schema * @throws SAXException * If the a validation ErrorHandler has not been set, and * validation throws a SAXException */ public boolean validate() throws SAXException { return STIXSchema.getInstance().validate(toXMLString()); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy