<commit_before>/*
 * Copyright (c) 2006 Digital Bazaar, Inc.  All rights reserved.
 */
package com.db.net.soap;

import com.db.logging.Logger;
import com.db.logging.LoggerManager;
import com.db.xml.AbstractXmlSerializer;
import com.db.xml.XmlElement;

/**
 * A SoapFault is a class that represents a SOAP (Simple Object Access Protocol)
 * Fault message. A SOAP fault is "raised" when some error occurs during
 * communication over SOAP.
 * 
 * FUTURE CODE: This soap fault implementation may be incomplete/incorrect
 * with respect to fault code and fault detail.
 * 
 * @author <NAME>
 */
public class SoapFault extends AbstractXmlSerializer
{
   /**
    * The fault code for this soap fault, if any. A fault code can be any
    * of the following:
    * 
    * VersionMismatch.*
    * MustUnderstand.*
    * Client.*
    * Server.*
    */
   protected String mFaultCode;
   
   /**
    * The fault string for this soap fault, if any. This is a human
    * readable string that provides a short explanation for the fault.
    */
   protected String mFaultString;
   
   /**
    * The fault actor for this soap fault, if any. The fault actor specifies
    * who caused the fault to happen within the soap message path. The fault
    * actor is a URI identifying the source of the fault.
    */
   protected String mFaultActor;
   
   /**
    * The fault detail for this soap fault, if any. This is an XmlElement
    * defining, in some specific way, a detailed error message. Parsing
    * this element is left up to the user of an instance of SoapFault.
    */
   protected XmlElement mFaultDetail;
   
   /**
    * A soap fault: when a version mismatch occurs.
    */
   protected final static String FAULT_VERSION_MISMATCH = "VersionMismatch";
   
   /**
    * A soap fault: when something must be understood but is not.
    */
   protected final static String FAULT_MUST_UNDERSTAND = "MustUnderstand";
   
   /**
    * A soap fault: when a soap client faults.
    */
   protected final static String FAULT_CLIENT = "Client";
   
   /**
    * A soap fault: when a soap server faults.
    */
   protected final static String FAULT_SERVER = "Server";
   
   /**
    * Creates a new SoapFault.
    */
   public SoapFault()
   {
      // set defaults
      setFaultCode("VersionMismatch");
      setFaultString("");
      setFaultActor("");
   }
   
   /**
    * Returns the root tag name for this serializer.
    * 
    * @return the root tag name for this serializer.
    */
   @Override
   public String getRootTag()   
   {
      // according to soap envelope schema
      return "Fault";
   }
   
   /**
    * Creates an XmlElement from this object.
    *
    * @param parent the parent XmlElement for the XmlElement being created
    *               (can be null). 
    * <commit_msg>Made soap fault settings public (as necessary).<commit_after>/*
 * Copyright (c) 2006 Digital Bazaar, Inc.  All rights reserved.
 */
package com.db.net.soap;

import com.db.logging.Logger;
import com.db.logging.LoggerManager;
import com.db.xml.AbstractXmlSerializer;
import com.db.xml.XmlElement;

/**
 * A SoapFault is a class that represents a SOAP (Simple Object Access Protocol)
 * Fault message. A SOAP fault is "raised" when some error occurs during
 * communication over SOAP.
 * 
 * FUTURE CODE: This soap fault implementation may be incomplete/incorrect
 * with respect to fault code and fault detail.
 * 
 * @author <NAME>
 */
public class SoapFault extends AbstractXmlSerializer
{
   /**
    * The fault code for this soap fault, if any. A fault code can be any
    * of the following:
    * 
    * VersionMismatch.*
    * MustUnderstand.*
    * Client.*
    * Server.*
    */
   protected String mFaultCode;
   
   /**
    * The fault string for this soap fault, if any. This is a human
    * readable string that provides a short explanation for the fault.
    */
   protected String mFaultString;
   
   /**
    * The fault actor for this soap fault, if any. The fault actor specifies
    * who caused the fault to happen within the soap message path. The fault
    * actor is a URI identifying the source of the fault.
    */
   protected String mFaultActor;
   
   /**
    * The fault detail for this soap fault, if any. This is an XmlElement
    * defining, in some specific way, a detailed error message. Parsing
    * this element is left up to the user of an instance of SoapFault.
    */
   protected XmlElement mFaultDetail;
   
   /**
    * A soap fault: when a version mismatch occurs.
    */
   public final static String FAULT_VERSION_MISMATCH = "VersionMismatch";
   
   /**
    * A soap fault: when something must be understood but is not.
    */
   public final static String FAULT_MUST_UNDERSTAND = "MustUnderstand";
   
   /**
    * A soap fault: when a soap client faults.
    */
   public final static String FAULT_CLIENT = "Client";
   
   /**
    * A soap fault: when a soap server faults.
    */
   public final static String FAULT_SERVER = "Server";
   
   /**
    * Creates a new SoapFault.
    */
   public SoapFault()
   {
      // set defaults
      setFaultCode("VersionMismatch");
      setFaultString("");
      setFaultActor("");
   }
   
   /**
    * Returns the root tag name for this serializer.
    * 
    * @return the root tag name for this serializer.
    */
   @Override
   public String getRootTag()   
   {
      // according to soap envelope schema
      return "Fault";
   }
   
   /**
    * Creates an XmlElement from this object.
    *
    * @param parent the parent XmlElement for the XmlElement being created
    *               (can be null). 
    * 
{'fraction_non_alphanumeric': 0.08336308461263835, 'fraction_numerical': 0.0014280614066404856, 'mean_word_length': 2.4714993804213137, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2391050', 'n_tokens_mistral': 1637, 'n_tokens_neox': 1593, 'n_words': 640}