Follow the links below to browse sample Javadoc for MJ classes and tools, including the MJ Runtime Library.

 

Package: com.arsi.mj  next contents

Utility classes and classes in common use across MJ components.

Classes and Interfaces
FreemarkerBootstrap Simple factory for accessing singleton instance of Freemarker Configuration.
GenericEnumUserType Commonly used custom Hibernate type that handles conversion between java.lang.Enum and an underlying database representation of an enumeration constant.
IGenericEnum Marker interface for enumerations compatible with GenericEnumUserType.
MJConstants
MJExecuteException Exception that occurs during execution of a converted Mapper-to-Java (MJ) application, and not during the translation and conversion phase.
MJTranslateException Exception that occurs during translation of Mapper report data, RUN commands, or other Mapper artifacts to Java code or J2EE constructs.
MJUtil Utility methods useful to various components of MJ.
NameValuePair Paired name and value.
VariableScope Enumerates scope of Mapper (and MJ) variables.

Class: FreemarkerBootstrap   next package

Simple factory for accessing singleton instance of Freemarker Configuration.
Treat this factory class as "thread-safe", but the thread-safety of the shared Configuration instance doled out by the factory is dependent on the Freemarker library.
public class com.arsi.mj.FreemarkerBootstrap
  extends java.lang.Object
Methods
Get pre-configured, shared Freemarker configuration.
Returns:
Freemarker configuration object.
public final freemarker.template.Configuration getConfiguration()
Get singleton instance of factory.
Returns:
singleton instance of factory.
public static com.arsi.mj.FreemarkerBootstrap getInstance()

Class: GenericEnumUserType   previous next package

Commonly used custom Hibernate type that handles conversion between java.lang.Enum and an underlying database representation of an enumeration constant.

Interface: IGenericEnum   previous next package

Marker interface for enumerations compatible with GenericEnumUserType. All enumerations used by persistent classes generated by MJ should implement this interface.
public interface com.arsi.mj.IGenericEnum
Methods
Get canonical name of the enumeration constant, which is the associated string value.
Returns:
canonical name, i.e., associated string value (e.g., if Java enum constant is AVERAGE, canonical name might be "AVG").
public java.lang.String asName()

Class: MJConstants   previous next package

public class com.arsi.mj.MJConstants
  extends java.lang.Object
Fields
Resource path to Hibernate configuration file.
public static final java.lang.String HIBERNATE_CFG_FILE = "hibernate.cfg.xml"
Constructors
public MJConstants()

Exception: MJExecuteException   previous next package

Exception that occurs during execution of a converted Mapper-to-Java (MJ) application, and not during the translation and conversion phase.

public class com.arsi.mj.MJExecuteException
  extends java.lang.RuntimeException
Constructors
public MJExecuteException()
public MJExecuteException(java.lang.String aMessage)
public MJExecuteException(java.lang.String aMessage, java.lang.Object someMessageArgs)
public MJExecuteException(java.lang.String aMessage, java.lang.Throwable anException)
public MJExecuteException(java.lang.String aMessage, java.lang.Throwable anException, java.lang.Object someMessageArgs)
public MJExecuteException(java.lang.Throwable anException)

Exception: MJTranslateException   previous next package

Exception that occurs during translation of Mapper report data, RUN commands, or other Mapper artifacts to Java code or J2EE constructs. Since some translation may occur during execution of a converted application, this exception may be throw at run-time in addition to the conversion phase.

public class com.arsi.mj.MJTranslateException
  extends java.lang.RuntimeException
Constructors
public MJTranslateException()
public MJTranslateException(java.lang.String aMessage)
public MJTranslateException(java.lang.String aMessage, java.lang.Object someMessageArgs)
public MJTranslateException(java.lang.String aMessage, java.lang.Throwable anException)
public MJTranslateException(java.lang.String aMessage, java.lang.Throwable anException, java.lang.Object someMessageArgs)
public MJTranslateException(java.lang.Throwable anException)

Class: MJUtil   previous next package

Utility methods useful to various components of MJ.
Treat this class as "thread-safe", since as a utility class it has no (and should not have) state after initialization.
public class com.arsi.mj.MJUtil
  extends java.lang.Object
Inner Class TemplateParam
Nested class that holds a template parameter name and indent.
public static class com.arsi.mj.MJUtil.TemplateParam
  extends java.lang.Object
Number of characters the parameter is indented from the left.
public final int indent

Line number in the template file where the parameter is found.
public final int lineNum

Name of the template parameter.
public final java.lang.String paramName

Ctor for initializing an instance of this class.
Parameters:
aParam - template parameter name.
anIndent - indentation of template parameter.
aLine - line number of template parameter.
public MJUtil.TemplateParam(java.lang.String aParam, int anIndent, int aLine)
public boolean equals(java.lang.Object anObject)
public int hashCode()
Fields
The newline character sequence for this platform.
public static final java.lang.String newline
Regular expression for identifying the portion of a string bounded by leading spaces.
  • the bounded content is unmatched; use replaceAll() to remove the leading spaces

public static final java.util.regex.Pattern TRUNCATE_LEADING_SPACES
Regular expression for identifying the portion of a string bounded by leading and/or trailing spaces.
  • the bounded content is unmatched; use replaceAll() to remove the leading/trailing spaces

public static final java.util.regex.Pattern TRUNCATE_SPACES
Regular expression for identifying the portion of a string bounded by trailing spaces.
  • the bounded content is unmatched; use replaceAll() to remove the trailing spaces

public static final java.util.regex.Pattern TRUNCATE_TRAILING_SPACES
Constructors
public MJUtil()
Methods
Parse string assumed to contain delimited, possibly quoted values into tokens. Note that spaces surrounding a delimiter character is trimmed, so tokens that include spaces should be quoted.
Parameters:
anInput - string assumed to contain delimited, possibly quoted values.
aDelimiterCharset - one or more delimiter characters.
Returns:
list of delimited tokens.
public static java.util.List asDelimitedList(java.lang.String anInput, java.lang.String aDelimiterCharset)
Creates a resource as a Java source file on the file system.
Parameters:
aRootDir - root of directory hierarchy where resource file is to be created.
aFullResourceName - name that includes package name and simple name (e.g., class name) parts, per Java conventions (e.g., "com.arsi.test.MyClass").
aContent - content of resource to save to file.
Throws:
MJTranslateException - if an I/O or other error occurs.
Returns:
file object that represents newly created resource on file system.
public static java.io.File createJavaSourceCodeResource(java.io.File aRootDir, java.lang.String aFullResourceName, java.lang.String aContent)
    throws com.arsi.mj.MJTranslateException
Creates resource as a file on the file system, where the naming of the resource may require a package name.
Parameters:
aRootDir - root of directory hierarchy where resource file is to be created.
aPackageName - package name of resource per Java conventions (e.g., "com.arsi.test.MyClass"), which is treated as a hierarchy of sub-directories under aRootDir.
aResourceName - simple resource name which is treated as simple file name; if no suffix is included, ".java" is added, treating resource a Java source file.
aContent - content of resource to save to file.
Throws:
MJTranslateException - if an I/O or other error occurs.
Returns:
file object that represents newly created resource on file system.
public static java.io.File createResource(java.io.File aRootDir, java.lang.String aPackageName, java.lang.String aResourceName, java.lang.String aContent)
    throws com.arsi.mj.MJTranslateException
Escape special character in string with a backslash.
Parameters:
anInputString - an input string that may contain occurrences of the specified character to be escaped.
aChar - the specified character to escape.
Returns:
a copy of the input string where occurrences of the specified character have been prefixed by backslash escape character.
public static java.lang.String escapeChar(java.lang.String anInputString, char aChar)
Get first non-blank token in string before delimiting whitespace.
Parameters:
aString - a string that may contain tokens delimited by whitespace.
Returns:
the first non-blank token delimited by whitespace or end-of-string, or NULL if none.
public static java.lang.String firstTokenBeforeWhitespace(java.lang.String aString)
Find the first pragma that has the specified pragma name in a list of pragmas.
Parameters:
<T> - a pragma subclass.
aPragmaName - name of a valid pragma.
somePragmas - list of pragmas to search for the pragma name.
aClass - pragma class to cast result to.
Returns:
first pragma that matches pragma name, or NULL if none.
public static com.arsi.mj.maprpt.parser.pragma.Pragma matchFirstPragma(java.lang.String aPragmaName, java.util.List somePragmas, java.lang.Class aClass)
Read input into a string.
Parameters:
aStream - input stream to read.
Throws:
IOException - if an I/O occurs reading the input.
Returns:
a string containing the text read from the input.
public static java.lang.String readAsString(java.io.InputStream aStream)
    throws java.io.IOException
Bind values associated with template parameters into template.
Parameters:
anInputString - an input string containing a code template.
someParamValues - name-value pairs where name is the template parameter (assumed to be delimited by $, e.g., "$person$") and value is String to substitute for parameter.
Returns:
string where specified template parameters have been substituted.
public static java.lang.String templateBind(java.lang.String anInputString, java.util.List someParamValues)
Bind values associated with template parameters into template.
Parameters:
anInputString - an input string containing a (partial) code template.
aParam - template parameter (assumed to be delimited by $, e.g., "$person$").
aValue - value is String to substitute for parameter.
Returns:
string where specified template parameters have been substituted.
public static java.lang.String templateBind(java.lang.String anInputString, java.lang.String aParam, java.lang.String aValue)
Indent each line except the first one in the input string.
Parameters:
anInputString - the string containing one or more lines to be indented.
anIndent - the number of spaces to indent.
Returns:
the indented string.
public static java.lang.String templateIndent(java.lang.String anInputString, int anIndent)
Extract parameters identified by "$parameter$" notation in template, and determine how much the parameter was indented. For example, in "\n $substitute$\n", "substitute" is indented five spaces (only whitespace exists between newline and parameter).
Parameters:
anInputString - an input string containing a code template.
aTemplateId - the ID of the template for error reporting.
Throws:
MJTranslateException - if an error occurs while extracting parameters from the template.
Returns:
list of TemplateParam that contains the parameters in the template.
public static java.util.List templateParameters(java.lang.String anInputString, java.lang.String aTemplateId)
    throws com.arsi.mj.MJTranslateException
Trim indent from the beginning of each line in a string.
Parameters:
anInputString - the input string containing lines to be "un-indented".
anIndent - the number of spaces to remove from the beginning of each line.
Returns:
the string with indent removed from lines.
public static java.lang.String templateUnindentLines(java.lang.String anInputString, int anIndent)
Removes leading spaces from a content string.
Parameters:
aString - the content to clean up
Returns:
the input content without leading spaces
public static java.lang.String truncateLeadingSpaces(java.lang.String aString)
Removes leading and trailing spaces from a content string. Internal spaces are unaffected.
Parameters:
aString - the content to clean up
Returns:
the input content without leading/trailing spaces
public static java.lang.String truncateSpaces(java.lang.String aString)
Removes trailing spaces from a content string.
Parameters:
aString - the content to clean up
Returns:
the input content without trailing spaces
public static java.lang.String truncateTrailingSpaces(java.lang.String aString)
Format full "report-drawer-cabinet" Mapper report identifier suitable for display to user, e.g., if cabinet=408, drawer='a' and reportNumber=12, returns "12A408".
Parameters:
aCabinetNumber - number of cabinet of Mapper report.
aDrawerLetter - letter of drawer of Mapper report.
aReportNumber - number of Mapper report.
Returns:
the report identifier.
public static java.lang.String userRID(int aCabinetNumber, char aDrawerLetter, int aReportNumber)

Class: NameValuePair   previous next package

Paired name and value. Treat this class as "thread-safe" since instances are immutable upon creation.

public class com.arsi.mj.NameValuePair
  extends java.lang.Object
Constructors
Public ctor for initializing an instance of this class.
Parameters:
aName - column name.
aValue - value as a raw String, or converted to an appropriate Java wrapper class (e.g., Integer, Date).
public NameValuePair(java.lang.String aName, java.lang.Object aValue)
Methods
Get name whose value is to be set.
public final java.lang.String getName()
Get value as a possibly coerced String.
public final java.lang.String getStringValue()
Get value as either as a raw String, or appropriate Java wrapper.
public final java.lang.Object getValue()

Class: VariableScope   previous package

Enumerates scope of Mapper (and MJ) variables.
public final class com.arsi.mj.VariableScope
  extends java.lang.Enum
Fields
Identifies a variable available to all scripts; these variables remain defined until the user session ends or the variable is cleared.
public static final com.arsi.mj.VariableScope ENVIRONMENT
Identifies a variable available to more than one script; these variables remain defined until the defining process ends or the variable is cleared.
public static final com.arsi.mj.VariableScope GLOBAL
Identifies a variable scoped to the current run.
public static final com.arsi.mj.VariableScope LOCAL
Identifies a variable available only within the scope of a Mapper command formula; these variables remain defined until the formula evaluation is completed.
public static final com.arsi.mj.VariableScope TEMP
Methods
public static com.arsi.mj.VariableScope valueOf(java.lang.String name)
public static com.arsi.mj.VariableScope values()