Class JDFDoc

java.lang.Object
org.cip4.jdflib.core.XMLDoc
org.cip4.jdflib.core.JDFDoc
All Implemented Interfaces:
Cloneable, IStreamWriter

public class JDFDoc extends XMLDoc
  • Constructor Details

    • JDFDoc

      public JDFDoc()
      constructor
    • JDFDoc

      public JDFDoc(Document document)
      constructor from a document note that the constructor will create a copy of the document in case it is not a typesafe DocumentJDFImpl
      Parameters:
      document -
    • JDFDoc

      public JDFDoc(XMLDoc document)
      constructor note that the constructor will create a copy of the document in case it is not a typesafe DocumentJDFImpl
      Parameters:
      document -
    • JDFDoc

      public JDFDoc(DocumentJDFImpl document)
      constructor
      Parameters:
      document -
    • JDFDoc

      public JDFDoc(String strDocType)
      constructor - create the kind of JDF you need
      Parameters:
      strDocType - - ElementName.JDF, ElementName.JMF, "Config" ...
    • JDFDoc

      public JDFDoc(String strDocType, JDFElement.EnumVersion version)
      constructor - create the kind of JDF you need
      Parameters:
      strDocType - - ElementName.JDF, ElementName.JMF, "Config" ...
      version -
  • Method Details

    • reparse

      protected void reparse(Document document)
    • createRoot

      protected JDFDoc createRoot(Document document)
      Overrides:
      createRoot in class XMLDoc
    • getImpl

      protected DocumentXMLImpl getImpl()
      Overrides:
      getImpl in class XMLDoc
    • getJDFRoot

      public JDFNode getJDFRoot()
      GetJDFRoot - get the jdf root
      Returns:
      JDFNode - the root of the JDF file
    • setMemberDoc

      protected void setMemberDoc(DocumentXMLImpl myDoc)
      Overrides:
      setMemberDoc in class XMLDoc
    • getJMFRoot

      public JDFJMF getJMFRoot()
      GetJMFRoot - get the jmf root
      Returns:
      JDFJMF - the root of the JMF file
    • clone

      public JDFDoc clone()
      clone
      Overrides:
      clone in class XMLDoc
      Returns:
      JDFDoc the cloned JDFDoc
    • toString

      public String toString()
      toString
      Overrides:
      toString in class XMLDoc
      Returns:
      String
    • createJDF

      @Deprecated public static JDFDoc createJDF(String jdfPath)
      Deprecated.
      simply use constructor
      CreateJDF
      Parameters:
      jdfPath -
      Returns:
      JDFDoc
    • getJDFNodeByID

      @Deprecated public JDFNode getJDFNodeByID(String id)
      Deprecated.
      use getRoot().getTarget(id, AttributeName.ID) and cast.
      returns a JDFNode by its id attribute
      Parameters:
      id - the ID parameter of the JDF node
      Returns:
      JDFNode - the corresponding JDF Node, null if no such node exists
    • collectGarbageResources

      @Deprecated public int collectGarbageResources(VString nodeNames)
      Deprecated.
      use JDFNode.eraseUnlinkedResources
      removes all dangling resources and cleans up the rrefs attributes
      Parameters:
      nodeNames - the list of nodenames to remove, remove all if nodenames is empty
      Returns:
      the number of collected resources
    • getContentType

      public String getContentType()
      gets the content type
      Returns:
      the content type, Text/XML if neither jdf nor jmf
    • parseStream

      public static JDFDoc parseStream(InputStream is)
      parse a JDF input stream
      Parameters:
      is -
      Returns:
      the parsed JDFDoc
    • parseFile

      public static JDFDoc parseFile(File file)
      parse a JDF file
      Parameters:
      file -
      Returns:
      the parsed JDFDoc
    • parseString

      public static JDFDoc parseString(String string)
      parse a JDF string
      Parameters:
      file -
      Returns:
      the parsed JDFDoc
    • parseFile

      public static JDFDoc parseFile(String fileName)
      parse a JDF file
      Parameters:
      fileName -
      Returns:
      the parsed JDFDoc
    • parseURL

      public static JDFDoc parseURL(String url, javax.mail.BodyPart bp)
      parse a given url
      Parameters:
      url - the url to search
      bp - the bodypart that the CID url is located in
      Returns:
      the parsed JDFDoc
    • setRoot

      public KElement setRoot(String strDocType, String namespaceURI)
      initialize a new root of strDocType in the document called by constructor XMLDoc(String strDocType)
      Overrides:
      setRoot in class XMLDoc
      Parameters:
      strDocType - qualified tag name of the doc root to create if still empty
      namespaceURI - namespace URI of the doc root
      Returns:
      KElement - the root element
    • registerCustomClass

      public static void registerCustomClass(String strElement, String packagepath)
      register new custom class in the factory
      Parameters:
      strElement - fully qualified name
      packagepath - package path
    • write2URL

      public JDFDoc write2URL(String strURL)
      This method sends the contents of this JDFDoc to the URL strURL and receives the response in the returned JDFDoc. the content type is automagically set to either text/xml for undefined xml or to application/vnd.cip4-jdf+xml or application/vnd.cip4-jmf+xml
      Parameters:
      strURL - the URL to write to
      Returns:
      docResponse the response received from URL. A Null document if no response was received, or an exception occurred
    • write2URL

      public JDFDoc write2URL(String strURL, HTTPDetails details)
      This method sends the contents of this JDFDoc to the URL strURL and receives the response in the returned JDFDoc. the content type is automagically set to either text/xml for undefined xml or to application/vnd.cip4-jdf+xml or application/vnd.cip4-jmf+xml
      Parameters:
      strURL - the URL to write to
      Returns:
      docResponse the response received from URL. A Null document if no response was received, or an exception occurred
    • getXMLParser

      protected XMLParser getXMLParser()
      get the correct parser for this type of document
      Overrides:
      getXMLParser in class XMLDoc
      Returns:
    • pushParser

      protected void pushParser(XMLParser xmlParser)
      Overrides:
      pushParser in class XMLDoc
      Parameters:
      xmlParser -
    • write2HTTPURL

      public HttpURLConnection write2HTTPURL(URL strURL, HTTPDetails det)
      Parameters:
      strURL -
      det -
      Returns:
    • write2HttpURL

      public UrlPart write2HttpURL(URL strURL, HTTPDetails det)
      Parameters:
      strURL -
      det -
      Returns:
    • getContentType

      public static String getContentType(KElement e)
      gets the contentType for a given root element
      Parameters:
      e -
      Returns:
    • createElement

      public Element createElement(String elementName)
      Description copied from class: XMLDoc
      createElement create a JDFElement that floats in nirvana. This must be appended to a node with appendChild (created in namespace JDFCoreConstants.NONAMESPACE (DOM Level 2)).
      Another way would be to use KElement.appendElement(String elementName, String nameSpaceURI)
      Overrides:
      createElement in class XMLDoc
      Parameters:
      elementName - name of the element that is created
      Returns:
      Element - unconnected element that is created
    • getXMLDocUserData

      protected XMLDocUserData getXMLDocUserData()
      Method getXMLDocUserData - get the associated XMLDocUserData
      Returns:
      XMLDocUserData of this object
    • hasXMLDocUserData

      protected boolean hasXMLDocUserData()
      does the owner document of this have an associated XMLDocUserData
      Returns:
      true if XMLDocUserData of this exists
    • getCreateXMLDocUserData

      public XMLDocUserData getCreateXMLDocUserData()
      get/create the associated XMLDocUserData - it is always there!
      Returns:
      the XMLDocUserData of this
    • getDirtyIDs

      public VString getDirtyIDs()
      get a vector of all IDs of elements that are dirty
      Returns:
      VString - the vector of element IDs
    • clearDirtyIDs

      public void clearDirtyIDs()
      clear the vector of all IDs of elements that are dirty
    • isDirty

      public boolean isDirty(String strID)
      is the node with ID dirty?
      Parameters:
      strID - id the id to be checked
      Returns:
      boolean - true if the node with ID=id is dirty
    • setInitOnCreate

      public void setInitOnCreate(boolean bInitOnCreate)
      if true (the default) initialize element when they are created, else don't call init() when an element is initially created
      Parameters:
      bInitOnCreate -
    • getInitOnCreate

      public boolean getInitOnCreate()
      if true (the default) initialize element when they are created, else don't call init() when an element is initially created
      Returns:
      bInitOnCreate
    • getMemberDocument

      public DocumentJDFImpl getMemberDocument()
      getMemberDocument
      Overrides:
      getMemberDocument in class XMLDoc
      Returns:
      the MemberDocument
    • setXPathValues

      public void setXPathValues(JDFAttributeMap valueMap)
      Description copied from class: XMLDoc
      set the xpath values of thei to the values in the node
      Overrides:
      setXPathValues in class XMLDoc
      Parameters:
      valueMap - the map of values, if this is still null, MUST be fully qualified
      See Also: