org.mitre.stix.common_1.ObjectFactory Maven / Gradle / Ivy
Show all versions of stix Show documentation
/**
* 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.stix.common_1;
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.XmlRegistry;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
import org.mitre.stix.DocumentUtilities;
import org.mitre.stix.STIXSchema;
import org.mitre.stix.ValidationEventHandler;
import org.xml.sax.SAXException;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the org.mitre.stix.common_1 package.
* An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.mitre.stix.common_1
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link RelatedIndicatorType }
*
*/
public RelatedIndicatorType createRelatedIndicatorType() {
return new RelatedIndicatorType();
}
/**
* Create an instance of {@link ExploitTargetsType }
*
*/
public ExploitTargetsType createExploitTargetsType() {
return new ExploitTargetsType();
}
/**
* Create an instance of {@link KillChainType }
*
*/
public KillChainType createKillChainType() {
return new KillChainType();
}
/**
* Create an instance of {@link RelatedIdentityType }
*
*/
public RelatedIdentityType createRelatedIdentityType() {
return new RelatedIdentityType();
}
/**
* Create an instance of {@link RelatedIdentitiesType }
*
*/
public RelatedIdentitiesType createRelatedIdentitiesType() {
return new RelatedIdentitiesType();
}
/**
* Create an instance of {@link NamesType }
*
*/
public NamesType createNamesType() {
return new NamesType();
}
/**
* Create an instance of {@link RelatedIncidentType }
*
*/
public RelatedIncidentType createRelatedIncidentType() {
return new RelatedIncidentType();
}
/**
* Create an instance of {@link IndicatorBaseType }
*
*/
public IndicatorBaseType createIndicatorBaseType() {
return new IndicatorBaseType();
}
/**
* Create an instance of {@link ThreatActorBaseType }
*
*/
public ThreatActorBaseType createThreatActorBaseType() {
return new ThreatActorBaseType();
}
/**
* Create an instance of {@link ReferencesType }
*
*/
public ReferencesType createReferencesType() {
return new ReferencesType();
}
/**
* Create an instance of {@link ConfidenceType }
*
*/
public ConfidenceType createConfidenceType() {
return new ConfidenceType();
}
/**
* Create an instance of {@link RelatedCampaignReferenceType }
*
*/
public RelatedCampaignReferenceType createRelatedCampaignReferenceType() {
return new RelatedCampaignReferenceType();
}
/**
* Create an instance of {@link RelatedCampaignType }
*
*/
public RelatedCampaignType createRelatedCampaignType() {
return new RelatedCampaignType();
}
/**
* Create an instance of {@link KillChainsType }
*
*/
public KillChainsType createKillChainsType() {
return new KillChainsType();
}
/**
* Create an instance of {@link CampaignBaseType }
*
*/
public CampaignBaseType createCampaignBaseType() {
return new CampaignBaseType();
}
/**
* Create an instance of {@link RelatedObservableType }
*
*/
public RelatedObservableType createRelatedObservableType() {
return new RelatedObservableType();
}
/**
* Create an instance of {@link TTPBaseType }
*
*/
public TTPBaseType createTTPBaseType() {
return new TTPBaseType();
}
/**
* Create an instance of {@link CampaignReferenceType }
*
*/
public CampaignReferenceType createCampaignReferenceType() {
return new CampaignReferenceType();
}
/**
* Create an instance of {@link RelatedExploitTargetType }
*
*/
public RelatedExploitTargetType createRelatedExploitTargetType() {
return new RelatedExploitTargetType();
}
/**
* Create an instance of {@link IdentityType }
*
*/
public IdentityType createIdentityType() {
return new IdentityType();
}
/**
* Create an instance of {@link EncodedCDATAType }
*
*/
public EncodedCDATAType createEncodedCDATAType() {
return new EncodedCDATAType();
}
/**
* Create an instance of {@link ContributingSourcesType }
*
*/
public ContributingSourcesType createContributingSourcesType() {
return new ContributingSourcesType();
}
/**
* Create an instance of {@link InformationSourceType }
*
*/
public InformationSourceType createInformationSourceType() {
return new InformationSourceType();
}
/**
* Create an instance of {@link DateTimeWithPrecisionType }
*
*/
public DateTimeWithPrecisionType createDateTimeWithPrecisionType() {
return new DateTimeWithPrecisionType();
}
/**
* Create an instance of {@link KillChainPhaseReferenceType }
*
*/
public KillChainPhaseReferenceType createKillChainPhaseReferenceType() {
return new KillChainPhaseReferenceType();
}
/**
* Create an instance of {@link IncidentBaseType }
*
*/
public IncidentBaseType createIncidentBaseType() {
return new IncidentBaseType();
}
/**
* Create an instance of {@link ProfilesType }
*
*/
public ProfilesType createProfilesType() {
return new ProfilesType();
}
/**
* Create an instance of {@link RelatedPackageRefsType }
*
*/
public RelatedPackageRefsType createRelatedPackageRefsType() {
return new RelatedPackageRefsType();
}
/**
* Create an instance of {@link ControlledVocabularyStringType }
*
*/
public ControlledVocabularyStringType createControlledVocabularyStringType() {
return new ControlledVocabularyStringType();
}
/**
* Create an instance of {@link KillChainPhaseType }
*
*/
public KillChainPhaseType createKillChainPhaseType() {
return new KillChainPhaseType();
}
/**
* Create an instance of {@link StructuredTextType }
*
*/
public StructuredTextType createStructuredTextType() {
return new StructuredTextType();
}
/**
* Create an instance of {@link ConfidenceAssertionChainType }
*
*/
public ConfidenceAssertionChainType createConfidenceAssertionChainType() {
return new ConfidenceAssertionChainType();
}
/**
* Create an instance of {@link StatementType }
*
*/
public StatementType createStatementType() {
return new StatementType();
}
/**
* Create an instance of {@link KillChainPhasesReferenceType }
*
*/
public KillChainPhasesReferenceType createKillChainPhasesReferenceType() {
return new KillChainPhasesReferenceType();
}
/**
* Create an instance of {@link ToolInformationType }
*
*/
public ToolInformationType createToolInformationType() {
return new ToolInformationType();
}
/**
* Create an instance of {@link RelatedTTPType }
*
*/
public RelatedTTPType createRelatedTTPType() {
return new RelatedTTPType();
}
/**
* Create an instance of {@link RelatedPackageRefType }
*
*/
public RelatedPackageRefType createRelatedPackageRefType() {
return new RelatedPackageRefType();
}
/**
* Create an instance of {@link RelatedThreatActorType }
*
*/
public RelatedThreatActorType createRelatedThreatActorType() {
return new RelatedThreatActorType();
}
/**
* Create an instance of {@link ExploitTargetBaseType }
*
*/
public ExploitTargetBaseType createExploitTargetBaseType() {
return new ExploitTargetBaseType();
}
/**
* Create an instance of {@link RelatedCourseOfActionType }
*
*/
public RelatedCourseOfActionType createRelatedCourseOfActionType() {
return new RelatedCourseOfActionType();
}
/**
* Create an instance of {@link CourseOfActionBaseType }
*
*/
public CourseOfActionBaseType createCourseOfActionBaseType() {
return new CourseOfActionBaseType();
}
/**
* 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, ObjectFactory.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 ObjectFactory instance for XML String
*
* @param text
* XML String for the document
* @return The ObjectFactory instance for the passed XML String
*/
public static ObjectFactory fromXMLString(String text) {
JAXBContext jaxbContext;
try {
jaxbContext = JAXBContext.newInstance(ObjectFactory.class
.getPackage().getName());
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
unmarshaller.setSchema(STIXSchema.getInstance().getSchema());
unmarshaller.setEventHandler(new ValidationEventHandler());
StreamSource streamSource = new StreamSource(new StringReader(text));
return (ObjectFactory) unmarshaller.unmarshal(streamSource);
} catch (JAXBException e) {
throw new RuntimeException(e);
}
}
/**
* Validates the XML representation of this ObjectFactory 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());
}
}