arc:import

Version 24.2.9039


arc:import


Use the arc:import keyword to select the correct version of a library when more than one is available. You can also use it to bind the specified version to a namespace prefix.

You can use arc:import to import a library from the Global Assembly Cache (GAC) or from outside the classpath.

Connector Versioning

arc:import allows you to load multiple versions and then explicitly choose which version to use.

  • For the .NET edition, you can put connector and formatter assemblies into the GAC and use arc:import to load the version you want in your scripts.

  • For the Cross-Platform edition, you can put connector and formatter JAR files outside of the normal classpath (for example, in a subdirectory of your WEB-INF/lib folder), thus providing a way to keep multiple concurrent versions of the same JAR. Then you can use arc:import to select which JAR file to load.

Name Simplification

The arc:import keyword can also help simplify the name of an operation or formatter. For example, while custom formatters require the complete class name, you can use arc:import to prefix the complete class name to a shorter name.

Parameters

  • lib: The name of the library to import. In the .NET edition, this specifies the assembly name (preferably a fully qualified one). In the Cross-Platform edition, this specifies the path to the JAR file.
  • ns: The namespace that the operation or formatter name binds to. When specified, the namespace is given priority during the lookup. If not specified, the normal rules for finding the implementation class are used.
  • prefix: The prefix to use to avoid name collisions when using operations or formatters that have the same name but are implemented in different libraries, different namespaces, or both. When you use this parameter, the ns parameter is also required.

Control Attributes

None

Examples

Load version 2.0 of a library:

<arc:import lib="myops, Version=2.0.0.0" ns="MyCompany.MyOps" prefix="my2"/>
<arc:call op="my2.Operation" ...>

Apply a custom count formatter defined in CustomFormatters.jar:

<arc:import lib="CustomFormatters.jar" ns="com.mycompany.Formatters" prefix="cust"/>
<arc:set attr="size" value="[elem.number | cust.count]"/>