Class JDFDoc

  • All Implemented Interfaces:
    java.lang.Cloneable, IStreamWriter

    public class JDFDoc
    extends XMLDoc
    • Constructor Detail

      • JDFDoc

        public JDFDoc()
        constructor
      • JDFDoc

        public JDFDoc​(org.w3c.dom.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​(java.lang.String strDocType)
        constructor - create the kind of JDF you need
        Parameters:
        strDocType - - ElementName.JDF, ElementName.JMF, "Config" ...
      • JDFDoc

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

      • reparse

        protected void reparse​(org.w3c.dom.Document document)
      • createRoot

        protected JDFDoc createRoot​(org.w3c.dom.Document document)
        Overrides:
        createRoot in class XMLDoc
      • getJDFRoot

        public JDFNode getJDFRoot()
        GetJDFRoot - get the jdf root
        Returns:
        JDFNode - the root of the JDF file
      • 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 java.lang.String toString()
        toString
        Overrides:
        toString in class XMLDoc
        Returns:
        String
      • createJDF

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

        @Deprecated
        public JDFNode getJDFNodeByID​(java.lang.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 java.lang.String getContentType()
        gets the content type
        Returns:
        the content type, Text/XML if neither jdf nor jmf
      • parseStream

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

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

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

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

        public static JDFDoc parseURL​(java.lang.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​(java.lang.String strDocType,
                                java.lang.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​(java.lang.String strElement,
                                               java.lang.String packagepath)
        register new custom class in the factory
        Parameters:
        strElement - fully qualified name
        packagepath - package path
      • write2URL

        public JDFDoc write2URL​(java.lang.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​(java.lang.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 java.net.HttpURLConnection write2HTTPURL​(java.net.URL strURL,
                                                        HTTPDetails det)
        Parameters:
        strURL -
        det -
        Returns:
      • write2HttpURL

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

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

        public org.w3c.dom.Element createElement​(java.lang.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​(java.lang.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