com.interfaceware.chameleon
Class Engine

java.lang.Object
  extended by com.interfaceware.chameleon.Engine
Direct Known Subclasses:
DynamicEngine

public abstract class Engine
extends java.lang.Object

This class handles Chameleon Engine objects.


Constructor Summary
Engine()
          Construct an Engine object.
 
Method Summary
 int ackMessageIndex()
          Get the index of the message selected by the user to be the ACKnowledgment message.
 void addLog(Log ALog)
          Add the specified log listener to receive log events from the Engine.
 int buildNumber()
          Get the build number of Chameleon.
 Config config()
          Get the Config object that allows one to set and get delimiter characters.
 java.lang.String configName(int ConfigIndex)
          Get the name of the configuration with the specified index.
 int countOfConfig()
          Get the number of configurations in the VMD file.
 int countOfMessage()
          Get the number of messages that are defined in the currently loaded VMD file.
 int countOfMessageIdentifier(int MessageIndex)
          Get the count of identifiers for a given message.
 void createEmptyMessageTable(Table ATable, int MessageIndex)
          Create an empty message table with the specified message index.
 int currentConfigIndex()
          Get the index of the current configuration.
protected  void errorEvent(java.lang.Exception Error, java.lang.String Description)
          Convert an error to a string and append the description.
protected  void finalize()
          Finalizer that invokes the release method.
 java.lang.String generate(Table ATable, int MessageIndex)
          Get a message in string format by generating it from the table structure ATable and the message at MessageIndex.
 java.lang.String generateAckFromMessage(java.lang.String Message)
          Generate an ACKnowledgment message in an optimized manner.
 void generateSchema(java.lang.String Filename)
          Generate a XML schema.
 int ignoreMessageIndex()
          Get the index of the message selected by the user to be the default message.
 int inConfigIndex()
          Get the index of the incoming configuration used for graphical transformation.
 void load(java.lang.String MappingFile)
          Load the visual message definition (VMD) file MappingFile.
 Log log()
          Get the log interface.
 int majorVersion()
          Get the major version number of Chameleon.
 java.lang.String makeMessagePrintable(java.lang.String Message)
          Get a message string in a printable format by appending a newline character '\n' after every carriage return character '\r'.
 java.lang.String messageIdentity(int MessageIndex, int IdentityIndex)
          Get the regular expression used to match a field in a message's identity list.
 java.lang.String messageName(int MessageIndex)
          Get the name of the message at index MessageIndex.
 int minorVersion()
          Get the minor version number of Chameleon.
 int outConfigIndex()
          Get the index of the outgoing configuration used for graphical transformation.
protected  int parse(java.lang.String Flatwire, Table ResultTable)
          Call the native C DLL method to parse the specified flatwire string into a Table.
 void parseMessage(java.lang.String Flatwire, Transport ATransport)
          Parse flatwire messages into a table if stubcode is being used.
 void println(java.lang.String Line)
          Print the string Line to the log output.
 void release()
          Release the Engine object handle.
 void setCurrentConfigIndex(int NewIndex)
          Set the index of the current configuration.
 void setPythonKeyValuePair(java.lang.String Key, java.lang.String Value)
          Set a key value pair in the Python global namespace.
 void setRejectBadSegmentGrammar(boolean Value)
          Set the option to enforce strict segment grammar in a parsed message.
 java.lang.String transformMessage(java.lang.String InMessage, int InConfigIndex, int OutConfigIndex)
          Convert a message from one format to another.
 java.lang.String translateMessageToXml(java.lang.String Flatwire)
          Translate a HL7 message into XML.
 java.lang.String translateXmlToMessage(java.lang.String Xml)
          Translate XML encoded HL7 into a HL7 message.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Engine

public Engine()
       throws ChameleonException
Construct an Engine object.

Throws:
ChameleonException
Method Detail

release

public void release()
             throws ChameleonException
Release the Engine object handle.

Throws:
ChameleonException

finalize

protected void finalize()
                 throws ChameleonException
Finalizer that invokes the release method.

Overrides:
finalize in class java.lang.Object
Throws:
ChameleonException

load

public void load(java.lang.String MappingFile)
          throws ChameleonException
Load the visual message definition (VMD) file MappingFile. This must be done before the Engine can be used. Applications should load the VMD file as part of initialization since loading may take a few seconds. Loading the VMD file every time a message is encountered will result in very slow performance.

Throws:
ChameleonException

parseMessage

public void parseMessage(java.lang.String Flatwire,
                         Transport ATransport)
                  throws ChameleonException
Parse flatwire messages into a table if stubcode is being used. It must be overridden by descendant classes. It can also be overridden for logging purposes, or any other application where the user would need to access the flatwire format of the message before parsing it. Because the Transport interface is no longer being used (see Transport for more information), a null object can be passed in for the Transport argument.

Throws:
ChameleonException

translateMessageToXml

public java.lang.String translateMessageToXml(java.lang.String Flatwire)
                                       throws ChameleonException
Translate a HL7 message into XML. The format of the XML output conforms to the DTDs of the format specified in the XML tab of the Options window in the Chameleon GUI for your VMD. For example code, see the XML example in the New Project wizard.

Throws:
ChameleonException
See Also:
http://www.interfaceware.com/manual/xml.html

translateXmlToMessage

public java.lang.String translateXmlToMessage(java.lang.String Xml)
                                       throws ChameleonException
Translate XML encoded HL7 into a HL7 message. The format of the XML message should conform to the DTDs of the format specified in the XML tab of the Options window in the Chameleon GUI for your VMD. For example code, see the XML example in the New Project wizard.

Throws:
ChameleonException
See Also:
http://www.interfaceware.com/manual/xml.html

parse

protected int parse(java.lang.String Flatwire,
                    Table ResultTable)
             throws ChameleonException
Call the native C DLL method to parse the specified flatwire string into a Table. Returns the message index.

Throws:
ChameleonException

setRejectBadSegmentGrammar

public void setRejectBadSegmentGrammar(boolean Value)
                                throws ChameleonException
Set the option to enforce strict segment grammar in a parsed message. The default value is false. When this flag is set the parser will check for the presence of compulsory fields in each segment and enforce other rules such as maximum field length. This option can also be set in the Misc tab of the Options window in the Chameleon GUI.

Throws:
ChameleonException

makeMessagePrintable

public java.lang.String makeMessagePrintable(java.lang.String Message)
                                      throws ChameleonException
Get a message string in a printable format by appending a newline character '\n' after every carriage return character '\r'.

Throws:
ChameleonException

countOfMessage

public int countOfMessage()
                   throws ChameleonException
Get the number of messages that are defined in the currently loaded VMD file. Usage of this method with messageName offers an easy way to iterate through the messages.

Throws:
ChameleonException

countOfMessageIdentifier

public int countOfMessageIdentifier(int MessageIndex)
                             throws ChameleonException
Get the count of identifiers for a given message. Usage of this method with messageIdentity offers an easy way to iterate through each message to get the regular expression used for matching for each message.

Throws:
ChameleonException

messageIdentity

public java.lang.String messageIdentity(int MessageIndex,
                                        int IdentityIndex)
                                 throws ChameleonException
Get the regular expression used to match a field in a message's identity list. Usage of this method with countOfMessageIdentifier offers an easy way to iterate through each message to get the regular expressions used for matching.

Throws:
ChameleonException

messageName

public java.lang.String messageName(int MessageIndex)
                             throws ChameleonException
Get the name of the message at index MessageIndex. Usage of this method with countOfMessage offers an easy was to iterate through the messages.

Throws:
ChameleonException

config

public Config config()
              throws ChameleonException
Get the Config object that allows one to set and get delimiter characters.

Throws:
ChameleonException

generate

public java.lang.String generate(Table ATable,
                                 int MessageIndex)
                          throws ChameleonException
Get a message in string format by generating it from the table structure ATable and the message at MessageIndex.

Throws:
ChameleonException

createEmptyMessageTable

public void createEmptyMessageTable(Table ATable,
                                    int MessageIndex)
                             throws ChameleonException
Create an empty message table with the specified message index.

Throws:
ChameleonException

log

public Log log()
Get the log interface.

See Also:
addLog(Log)

addLog

public void addLog(Log ALog)
Add the specified log listener to receive log events from the Engine. This method is used by the Engine for logging output. Use of the python log() command in the VMD file will be output through this interface.

See Also:
log()

println

public void println(java.lang.String Line)
Print the string Line to the log output.


transformMessage

public java.lang.String transformMessage(java.lang.String InMessage,
                                         int InConfigIndex,
                                         int OutConfigIndex)
                                  throws ChameleonException
Convert a message from one format to another. This method invokes Chameleon's translation logic to take a message of the InConfigIndex flavor and translate it to the OutConfigIndex flavor. The method returns the transformed data.

Throws:
ChameleonException
See Also:
http://www.interfaceware.com/manual/transform_message.html

countOfConfig

public int countOfConfig()
                  throws ChameleonException
Get the number of configurations in the VMD file. This is useful for iterating through the named configurations.

Throws:
ChameleonException

currentConfigIndex

public int currentConfigIndex()
                       throws ChameleonException
Get the index of the current configuration.

Throws:
ChameleonException
See Also:
setCurrentConfigIndex(int)

setCurrentConfigIndex

public void setCurrentConfigIndex(int NewIndex)
                           throws ChameleonException
Set the index of the current configuration.

Throws:
ChameleonException
See Also:
currentConfigIndex()

inConfigIndex

public int inConfigIndex()
                  throws ChameleonException
Get the index of the incoming configuration used for graphical transformation. The index is that of the input configuration last set by the user in the Transformation window in the VMD file. This is not used for scripted transformation.

Throws:
ChameleonException

outConfigIndex

public int outConfigIndex()
                   throws ChameleonException
Get the index of the outgoing configuration used for graphical transformation. The index is that of the output configuration last set by the user in the Transformation window in the VMD file. This is not used for scripted transformation.

Throws:
ChameleonException

configName

public java.lang.String configName(int ConfigIndex)
                            throws ChameleonException
Get the name of the configuration with the specified index.

Throws:
ChameleonException

errorEvent

protected void errorEvent(java.lang.Exception Error,
                          java.lang.String Description)
Convert an error to a string and append the description. The resulting string is printed to the log output.


majorVersion

public int majorVersion()
                 throws ChameleonException
Get the major version number of Chameleon.

Throws:
ChameleonException

minorVersion

public int minorVersion()
                 throws ChameleonException
Get the minor version number of Chameleon.

Throws:
ChameleonException

buildNumber

public int buildNumber()
                throws ChameleonException
Get the build number of Chameleon.

Throws:
ChameleonException

ackMessageIndex

public int ackMessageIndex()
                    throws ChameleonException
Get the index of the message selected by the user to be the ACKnowledgment message. This message is set in the Special Messages tab of the Options window in Chameleon.

Throws:
ChameleonException
See Also:
http://www.interfaceware.com/manual/autoack.html

ignoreMessageIndex

public int ignoreMessageIndex()
                       throws ChameleonException
Get the index of the message selected by the user to be the default message. This message is used to identify messages which do not match the precise identification criteria for other messages in the given VMD file. This message is set in the Special Messages tab of the Options window in Chameleon.

Throws:
ChameleonException
See Also:
http://www.interfaceware.com/manual/default_message.html

generateSchema

public void generateSchema(java.lang.String Filename)
                    throws ChameleonException
Generate a XML schema. This schema is that used to translate to and from XML.

Throws:
ChameleonException

generateAckFromMessage

public java.lang.String generateAckFromMessage(java.lang.String Message)
                                        throws ChameleonException
Generate an ACKnowledgment message in an optimized manner. This function will strip off just the MSH segment of an HL7 message. It parses this segment, stores parameters in Python variables, then generates an ACK message. The technique used is described as Auto Acknowledgment in the manual. The function will have unpredictable effects if the message definition file is not set up correctly.

Throws:
ChameleonException
See Also:
http://www.interfaceware.com/manual/autoack.html

setPythonKeyValuePair

public void setPythonKeyValuePair(java.lang.String Key,
                                  java.lang.String Value)
                           throws ChameleonException
Set a key value pair in the Python global namespace. Certain reserved words will result in exceptions, i.e., "environment" as a key. Calling this method will result in the variable Key in Python being assigned the value Value.

Throws:
ChameleonException