com.wm.app.tn.doc
Class FFDocType

java.lang.Object
  extended by com.wm.app.tn.util.TNFixedData
      extended by com.wm.app.tn.doc.BizDocType
          extended by com.wm.app.tn.doc.FFDocType
All Implemented Interfaces:
com.wm.data.IData, com.wm.util.coder.IDataCodable, java.io.Serializable, java.lang.Cloneable

public class FFDocType
extends BizDocType

This class maintains information about flat file document types. When TN is being configured, instances of this class are created and saved. Each one represents a type of flat file document. At runtime, when a document is sent in to TN, the instances of this class are used to determine which types of flat file documents match the incoming data. This is TN's document recognition process. If one instance of FFDocType is found to match the incoming data, that instance is used to create a BizDocEnvelope (a "bizdoc"). The recognition criteria for flat files consists entirely of pipeline matching values.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.wm.app.tn.util.TNFixedData
com.wm.app.tn.util.TNFixedData.TreeCursor
 
Constructor Summary
FFDocType()
          Used by TN to revive instances from persistent storage.
 
Method Summary
 java.lang.String attributesListToString()
           
 void compare(BizDocType oldType, BizDocType newType, java.util.Vector<ActivityLogEntry> logs)
           
 BizDocType copy()
          Creates a shallow copy of an FFDocType.
static com.wm.data.IData create()
          Needed for the IDataCodable implementation.
 BizDocEnvelope createEnvelope(com.wm.data.IData in)
          Creates a BizDocEnvelope for a flat file document and initializes it from the pipeline in.
 com.wm.data.IData createPipeline(BizDocEnvelope bizdoc)
          Factory method for creating a pipeline from the given BizDoc.
 byte[] getContentBytes(BizDocEnvelope bizdoc)
          Returns content of a bizdoc.
 java.lang.String getContentEncoding(BizDocEnvelope bizdoc)
          Returns the content encoding of a flat file bizdoc.
 java.lang.String getContentType(BizDocEnvelope bizdoc)
          Returns the content-type of a flat file bizdoc.
 java.lang.Object getDeliveryContent(BizDocEnvelope bizdoc)
          Gets delivery content for the given envelope.
 java.lang.String getDisplayName()
          Used by the TN Console.
static byte[] getDocumentContent(com.wm.data.IData in, BizDocEnvelope env)
          Get the content bytes from input pipeline.
 java.lang.String getEditorName()
          Used by the TN Console.
 java.lang.String getFtpFileExtension(BizDocEnvelope bizdoc)
          Gets the file extension for FTP transport.
 com.wm.data.IData getIData()
          Returns the class as a IData object.
 java.lang.String getParsingSchema()
           
 BizDocAttributeTransform getSystemAttribute(java.lang.String id)
          Returns the requested system attribute, within its attribute transformer.
 java.util.Enumeration<java.lang.String> getSystemAttributeIds()
          This method overrides implementation in BizDocType and Enumerates List of System attribut IDs.
 com.wm.data.IData getValidationInputs()
          Returns the user-supplied settings that control flat file parsing behavior.
 boolean isType(com.wm.data.IData in)
          Abstract method for determining if the IData contains data representing a lower level document type (eg, XML, EDI, etc).
 java.lang.String pipelineDataToString()
           
 boolean recognize(com.wm.data.IData in)
          Recognizes the pipeline in as a specific instance of an FFDocType.
 void removeAllAttributes()
          Removes all system and user attributes.
static com.wm.data.IData s_createPipeline(BizDocEnvelope bizdoc)
          Creates a pipeline from a BizDocEnvelope.
static boolean s_isType(com.wm.data.IData in)
          Determines if the pipeline in contains a flat file document.
 void setContentBytes(BizDocEnvelope env, byte[] data)
          Sets content of a bizdoc.
 void setContentType(com.wm.data.IData in)
           
 void setIData(com.wm.data.IData idata)
          Sets the attributes of the class based on a IData object.
 void setParsingSchema(java.lang.String s)
          Sets the name of the NSRecord used to turn docs of this type into records.
 void setSystemAttribute(BizDocAttributeTransform bdat)
          Sets a system attribute and its attribute transformer.
 void setValidationInputs(com.wm.data.IData in)
          Sets the user-supplied settings that control flat file parsing behavior.
 java.lang.String toString()
          Default toString implementation returns class name followed by contents.
 
Methods inherited from class com.wm.app.tn.doc.BizDocType
addBAMAttribute, addPipelineMatch, createActivityLog, determineSenderFromSession, getAttribute, getAttributeIds, getAttributeTransform, getBAMAction, getBAMDocTypeDependency, getBAMDocTypeMapping, getBAMEventMap, getBAMEventMapName, getBAMMonitoringAttributes, getDescription, getFormattedContentPart, getId, getLastModifiedTime, getName, getPipelineMatchIData, getPreRoutingFlags, getSigningService, getSubDocTypeID, getType, getValidationService, getVerificationService, getVersion, isAttributeListEventOption, isAttributeRequired, isDeleted, isFormattedContentPart, isHidden, isMonitored, isRoutable, monitor, newEnvelope, pipelineMatch, removeAttribute, removeBAMAttribute, removePipelineMatch, setAttribute, setAttribute, setAttributeRequirement, setAttributeTransform, setAttributeTransform, setAttributeTransform, setBAMAction, setBAMDocTypeDependency, setBAMDocTypeMapping, setBAMEventMap, setBAMEventMapName, setBAMEventOptionForAttrList, setBAMMonitoringAttributes, setDeleted, setDescription, setDetermineSenderFromSession, setHidden, setId, setLastModifiedTime, setName, setPipelineMatchIData, setPreRoutingFlags, setReceiveSvc, setRouting, setSigningService, setSubDocTypeID, setType, setValidationService, setVerificationService, setVersion
 
Methods inherited from class com.wm.app.tn.util.TNFixedData
clone, dataSize, get, get, getCursor, getHashCursor, getIndexCursor, getKey, getSharedCursor, getTreeCursor, indexOf, merge, set, set
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FFDocType

public FFDocType()
Used by TN to revive instances from persistent storage.

Method Detail

s_isType

public static boolean s_isType(com.wm.data.IData in)
Determines if the pipeline in contains a flat file document. Simply looks for for a key of "ffdata" in the pipeline, with an InputStream for a value.

Parameters:
in - a pipeline
Returns:
true if pipeline contains a flat file document

isType

public boolean isType(com.wm.data.IData in)
Description copied from class: BizDocType
Abstract method for determining if the IData contains data representing a lower level document type (eg, XML, EDI, etc). This is really meant to be a class (static) method but you cant override a static. Each subclass must provide it owns way of determing this. For example, if an XML document then "in" will have a "node" keyword.

Specified by:
isType in class BizDocType
Parameters:
in - IData object containing keyword and data for particular document type
Returns:
true if "in" contains a document of this class type

recognize

public boolean recognize(com.wm.data.IData in)
Recognizes the pipeline in as a specific instance of an FFDocType. Recognition for FFDocType consists entirely of pipeline matching. The pipeline matching criteria are compared to the elements within the TN_parms IData at the root of the pipeline, as described in the Building Your Network document. If no pipline matching criteria is specified for a doctype, this method will return false.

Specified by:
recognize in class BizDocType
Parameters:
in - a pipeline
Returns:
true if in matches the specified criteria, otherwise false.
See Also:
BizDocType.addPipelineMatch(java.lang.String,java.lang.String), BizDocType.removePipelineMatch(java.lang.String)

createEnvelope

public BizDocEnvelope createEnvelope(com.wm.data.IData in)
                              throws BizDocTypeException
Creates a BizDocEnvelope for a flat file document and initializes it from the pipeline in.

Specified by:
createEnvelope in class BizDocType
Parameters:
in - input IData containing the document
Returns:
a new BizDocEnvelope
Throws:
BizDocTypeException

getDocumentContent

public static byte[] getDocumentContent(com.wm.data.IData in,
                                        BizDocEnvelope env)
                                 throws BizDocTypeException
Get the content bytes from input pipeline.

Throws:
BizDocTypeException

s_createPipeline

public static com.wm.data.IData s_createPipeline(BizDocEnvelope bizdoc)
                                          throws BizDocTypeException
Creates a pipeline from a BizDocEnvelope.

Parameters:
bizdoc - a BizDocEnvelope
Returns:
A pipeline that, if sent to wm.tn:receive, would produce another BizDocEnvelope, just like bizdoc.
Throws:
BizDocTypeException

createPipeline

public com.wm.data.IData createPipeline(BizDocEnvelope bizdoc)
                                 throws BizDocTypeException
Description copied from class: BizDocType
Factory method for creating a pipeline from the given BizDoc. Subclasses must redefine this to do type-specific initialization.

Specified by:
createPipeline in class BizDocType
Parameters:
bizdoc - input BizDocEnvelope
Returns:
the IData representation of the given envelope
Throws:
BizDocTypeException

copy

public BizDocType copy()
Creates a shallow copy of an FFDocType. A new FFDocType is created and the members of this are copied into it.

Specified by:
copy in class BizDocType
Returns:
a new BizDoctype

getContentBytes

public byte[] getContentBytes(BizDocEnvelope bizdoc)
Returns content of a bizdoc. The content of a flat file bizdoc is stored in the "ffdata" content part. Note that you should not use this method for large documents. Copying the entire content into memory as a byte[] may result in an OutofMemoryError. Instead, use the getDeliveryContent method.

Specified by:
getContentBytes in class BizDocType
Parameters:
bizdoc - the document whose contents are to be returned
Returns:
The bizdoc content as a byte[], or null if there is no "ffdata" content part.
See Also:
getDeliveryContent(com.wm.app.tn.doc.BizDocEnvelope)

setContentBytes

public void setContentBytes(BizDocEnvelope env,
                            byte[] data)
Sets content of a bizdoc. The content of a flat file bizdoc is stored in the "ffdata" content part. This method adds the ffdata part to env and populates it with data.

Specified by:
setContentBytes in class BizDocType
Parameters:
bizdoc - BizDoc to set the contents
data - the content

getDeliveryContent

public java.lang.Object getDeliveryContent(BizDocEnvelope bizdoc)
                                    throws java.io.IOException
Gets delivery content for the given envelope.

Overrides:
getDeliveryContent in class BizDocType
Parameters:
bizdoc - BizDocEnvelope to get the delivery content from
Returns:
the content of BizDocEnvelope as a java Object. For small documents, the return value will be a byte[]. For large documents, the return value will be an InputStream.
Throws:
java.io.IOException

setSystemAttribute

public void setSystemAttribute(BizDocAttributeTransform bdat)
                        throws BizDocTypeException
Sets a system attribute and its attribute transformer.

Parameters:
bdat - The transformer that contains the BizDocAttribute and the attribute transformation details.
Throws:
BizDocTypeException

getSystemAttribute

public BizDocAttributeTransform getSystemAttribute(java.lang.String id)
Returns the requested system attribute, within its attribute transformer.

Parameters:
id - Identifier of the atttribute to return.
Returns:
a BizDocAttributeTransform

removeAllAttributes

public void removeAllAttributes()
Removes all system and user attributes.

Overrides:
removeAllAttributes in class BizDocType

getFtpFileExtension

public java.lang.String getFtpFileExtension(BizDocEnvelope bizdoc)
Gets the file extension for FTP transport.

Overrides:
getFtpFileExtension in class BizDocType
Parameters:
bizdoc - BizDocEnvelope to get the ftp file extension
Returns:
the file extention

getDisplayName

public java.lang.String getDisplayName()
Used by the TN Console.

Overrides:
getDisplayName in class BizDocType
Returns:
a name that will be displayed on the Console for the class

getEditorName

public java.lang.String getEditorName()
Used by the TN Console.

Overrides:
getEditorName in class BizDocType
Returns:
fully qualified class name of the doctype editor

getContentType

public java.lang.String getContentType(BizDocEnvelope bizdoc)
Returns the content-type of a flat file bizdoc.

Specified by:
getContentType in class BizDocType
Parameters:
bizdoc - BizDocEnvelope whose content type is to be returned
Returns:
The content-type in the format type; encoding. If the bizdoc does not contain an "ffdata" BizDocContentPart, null is returned.

getContentEncoding

public java.lang.String getContentEncoding(BizDocEnvelope bizdoc)
Returns the content encoding of a flat file bizdoc.

Parameters:
bizdoc - BizDocEnvelope whose content encoding is to be returned
Returns:
The content encoding. If the bizdoc does not contain an "ffdata" BizDocContentPart, null is returned.

getSystemAttributeIds

public java.util.Enumeration<java.lang.String> getSystemAttributeIds()
This method overrides implementation in BizDocType and Enumerates List of System attribut IDs.

Overrides:
getSystemAttributeIds in class BizDocType
Returns:
a list of system attributes associated with docs of this type

getParsingSchema

public java.lang.String getParsingSchema()
Returns:
the name of the NSRecord used to turn docs of this type into records

setParsingSchema

public void setParsingSchema(java.lang.String s)
Sets the name of the NSRecord used to turn docs of this type into records.

Parameters:
s - the name of the NSRecord used to turn docs of this type into records

getValidationInputs

public com.wm.data.IData getValidationInputs()
Returns the user-supplied settings that control flat file parsing behavior. These settings are described in the Building Your Network document.

Returns:
the parsing settings in an IData

setValidationInputs

public void setValidationInputs(com.wm.data.IData in)
Sets the user-supplied settings that control flat file parsing behavior. These settings are described in the Building Your Network document.


attributesListToString

public java.lang.String attributesListToString()
Returns:
a String representation of the attributes list

pipelineDataToString

public java.lang.String pipelineDataToString()
Returns:
a String representation of the pipeline data

toString

public java.lang.String toString()
Description copied from class: com.wm.app.tn.util.TNFixedData
Default toString implementation returns class name followed by contents.

Overrides:
toString in class com.wm.app.tn.util.TNFixedData
Returns:
a String representation of the flatfile document type

compare

public void compare(BizDocType oldType,
                    BizDocType newType,
                    java.util.Vector<ActivityLogEntry> logs)
Specified by:
compare in class BizDocType
Parameters:
logs - the new logs will be added.
priorDocType - the previous value before update operation takes place.
newDocType - the new value against which previous value will be compared.

getIData

public com.wm.data.IData getIData()
Returns the class as a IData object.

Specified by:
getIData in interface com.wm.util.coder.IDataCodable
Overrides:
getIData in class BizDocType
Returns:
the class as a IData object.

setIData

public void setIData(com.wm.data.IData idata)
Sets the attributes of the class based on a IData object.

Specified by:
setIData in interface com.wm.util.coder.IDataCodable
Overrides:
setIData in class BizDocType
Parameters:
idata - IData object containing values for class attributes

create

public static com.wm.data.IData create()
Needed for the IDataCodable implementation.


setContentType

public void setContentType(com.wm.data.IData in)