org.cip4.jdflib.core
Class JDFDoc

java.lang.Object
  extended by org.cip4.jdflib.core.XMLDoc
      extended by org.cip4.jdflib.core.JDFDoc

public class JDFDoc
extends XMLDoc


Field Summary
 
Fields inherited from class org.cip4.jdflib.core.XMLDoc
log, m_doc, sm_strENCODING
 
Constructor Summary
JDFDoc()
          constructor
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
JDFDoc(DocumentJDFImpl document)
          constructor
JDFDoc(String strDocType)
          constructor - create the kind of JDF you need
JDFDoc(XMLDoc document)
          constructor note that the constructor will create a copy of the document in case it is not a typesafe DocumentJDFImpl
 
Method Summary
 void clearDirtyIDs()
          clear the vector of all IDs of elements that are dirty
 JDFDoc clone()
          clone
 int collectGarbageResources(VString nodeNames)
          Deprecated. use JDFNode.eraseUnlinkedResources
 Element createElement(String elementName)
          createElement create a JDFElement that floats in nirvana.
static JDFDoc createJDF(String jdfPath)
          Deprecated. simply use constructor
protected  JDFDoc createRoot(Document document)
           
 String getContentType()
          gets the content type
static String getContentType(KElement e)
          gets the contentType for a given root element
 XMLDocUserData getCreateXMLDocUserData()
          get/create the associated XMLDocUserData - it is always there!
 VString getDirtyIDs()
          get a vector of all IDs of elements that are dirty
protected  DocumentXMLImpl getImpl()
           
 boolean getInitOnCreate()
          if true (the default) initialize element when they are created, else don't call init() when an element is initially created
 JDFNode getJDFNodeByID(String id)
          Deprecated. use getRoot().getTarget(id, AttributeName.ID) and cast.
 JDFNode getJDFRoot()
          GetJDFRoot - get the jdf root
 JDFJMF getJMFRoot()
          GetJMFRoot - get the jmf root
 DocumentJDFImpl getMemberDocument()
          getMemberDocument
 XMLDoc getValidationResult()
           
protected  XMLDocUserData getXMLDocUserData()
          Method getXMLDocUserData - get the associated XMLDocUserData
protected  XMLParser getXMLParser()
          get the correct parser for this type of document
protected  boolean hasXMLDocUserData()
          does the owner document of this have an associated XMLDocUserData
 boolean isDirty(String strID)
          is the node with ID dirty?
static JDFDoc parseFile(String fileName)
          parse a JDF file
static JDFDoc parseStream(InputStream is)
          parse a JDF input stream
static JDFDoc parseURL(String url, javax.mail.BodyPart bp)
          parse a given url
static void registerCustomClass(String strElement, String packagepath)
          register new custom class in the factory
protected  void reparse(Document document)
           
 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
protected  void setMemberDoc(DocumentXMLImpl myDoc)
           
 KElement setRoot(String strDocType, String namespaceURI)
          initialize a new root of strDocType in the document called by constructor XMLDoc(String strDocType)
 String toString()
          toString
 UrlPart write2HttpURL(URL strURL, UrlUtil.HTTPDetails det)
           
 HttpURLConnection write2HTTPURL(URL strURL, UrlUtil.HTTPDetails det)
           
 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
 
Methods inherited from class org.cip4.jdflib.core.XMLDoc
appendChild, cloneNode, copyMeta, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createDocumentType, createElementDefinition, createElementNS, createEntity, createEntityReference, createEvent, createNodeIterator, createNodeIterator, createNotation, createProcessingInstruction, createRange, createTextNode, createTreeWalker, createTreeWalker, equals, flush, getAttributes, getBodyPart, getChildNodes, getDocMemoryUsed, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getErrorChecking, getFirstChild, getIdentifier, getIdentifiers, getImplementation, getLastChild, getLocalName, getMultiPart, getNextSibling, getNodeName, getNodeType, getNodeValue, getOriginalFileName, getParentNode, getPrefix, getPreviousSibling, getRoot, getSchemaLocation, getSchemaLocationFile, getZipReader, hasAttributes, hasChildNodes, hashCode, importNode, insertBefore, isNull, isSupported, normalize, parseFile, putIdentifier, removeChild, removeIdentifier, replaceChild, setBodyPart, setErrorChecking, setNodeValue, setNSMap, setOriginalFileName, setPrefix, setSchemaLocation, setValidationResult, setXSLTURL, setZipReader, toXML, write2File, write2File, write2File, write2HttpURL, write2HTTPURL, write2Stream, write2Stream, write2StreamStatic, write2StreamStatic, write2String, write2URL
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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" ...
Method Detail

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(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

getXMLParser

protected XMLParser getXMLParser()
get the correct parser for this type of document

Overrides:
getXMLParser in class XMLDoc
Returns:

write2HTTPURL

public HttpURLConnection write2HTTPURL(URL strURL,
                                       UrlUtil.HTTPDetails det)
Parameters:
strURL -
det -
Returns:

write2HttpURL

public UrlPart write2HttpURL(URL strURL,
                             UrlUtil.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

getValidationResult

public XMLDoc getValidationResult()
Returns:
Returns the m_OriginalFileName.

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


Copyright © 2013. All Rights Reserved.