Importing Custom Java and .NET Libraries

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Functions >

Importing Custom Java and .NET Libraries

Compiled Java class files as well as .NET DLL assemblies (including .NET 4.0 assemblies) can be imported into MapForce. If the imported libraries contain functions that use basic data types as parameters and return simple types, such functions appear in the Libraries window, and can be used in mappings as any other function available in MapForce. The mapping output of imported Java and .NET functions can be previewed in the Output pane and the functions are available in generated code.

 

Notes:

 

To import custom Java or .NET functions, you need compiled Java classes (.class) or the .NET.dll assembly files. Importing Java .jar files or .dll files that are not a .NET assembly is not supported.
Compiled Java class (.class) files are supported when the mapping language is set to Java. Java Runtime Environment 7 or later must be installed on your computer. Only specific types and members are supported (see Java function support).
.NET assembly files are supported when the mapping language is set to C#. The .NET assemblies may be written in .NET languages other than C# (for example, C++.NET or VB.NET), provided they use only the basic data types from the System Assembly as parameters and return types (see also .NET Function Support).
Setting the mapping language to C++ is not supported if the mapping uses imported Java .class or .NET DLL assemblies.
Importing functions from native C++ DLLs is limited and requires a special approach. For more information, see Referencing Java, C# and C++ Libraries Manually.
Setting the mapping language to XSLT is not supported if the mapping uses imported Java .class or .NET DLL assemblies (a custom XSLT function that acts as an adapter would have to be written).
All functions called from a MapForce mapping should be “idempotent” (this means that they should return the same value each time the function is called with the same input parameters). The exact order and the number of times a function is called by MapForce is undefined.
In case of Java, the imported class files and their packages do not need to be added to the CLASSPATH variable, since the Built-in execution engine, as well as generated Java code, will automatically add imported packages to the Java engine’s classpath or to Ant, respectively. However, any dependencies of the imported class files and packages will not be handled automatically. Therefore, if imported Java class files or packages depend on other class files, be sure to add the parent directories of all dependent packages to the CLASSPATH environment variable.

 

Java function support

Top-level classes, static member classes and non-static member classes are supported:

 

new <classname>(<arg1>, <arg2>, ...)
<object>.new <member-class>(<arg1>, <arg2>, ...)

 

Member functions and static functions are supported:

 

<function>(<arg1>, <arg2>, ...)
<object>.<method>(<arg1>, ...)

 

Supported connections between XML Schema and Java types:

 

Schema type

Java type

xs:string

String

xs:byte

byte

xs:short

short

xs:int

int

xs:long

long

xs:boolean

boolean

xs:float

float

xs:double

double

xs:decimal

java.math.BigDecimal

xs:integer

java.math.BigInteger

 

Connections in both directions are possible. Other Java types (including array types) are not supported. Methods using such parameters or return values, will be ignored.

 

Object types are supported by calling their constructor, or as a return value of a method. They can be mapped to other Java methods. Manipulating the object using MapForce means is not possible.

 

.NET function support

Top-level classes and member classes are supported:

 

new <classname>(<arg1>, <arg2>, ...)

 

Member functions and static functions are supported:

 

<function>(<arg1>, <arg2>, ...)
<object>.<method>(<arg1>, ...)

 

Supported connections between XML Schema and .NET/C# types:

 

Schema type

.NET type

C# type

xs:string

System.String

string

xs:byte

System.SByte

sbyte

xs:short

System.Int16

short

xs:int

System.Int32

int

xs:long

System.Int64

long

xs:unsignedByte

System.Byte

byte

xs:unsignedShort

System.UInt16

ushort

xs:unsignedInt

System.UInt32

uint

xs:unsignedLong

System.UInt64

ulong

xs:boolean

System.Boolean

bool

xs:float

System.Single

float

xs:double

System.Double

double

xs:decimal

System.Decimal

decimal

 

Connections in both directions are possible. Other .NET/C# types (including array types) are not supported. Methods using such parameters or return values will be ignored.

 

Object types are supported by calling their constructor, or as a return value of a method. They can be mapped to other .NET methods. Manipulating the object using MapForce means is not possible.


© 2019 Altova GmbH