Controlling the Adapter Behavior Using a Properties File

In this section:

To hide or show specific classes, methods, or folders, and enable or disable the cache function, create a property in XML format called iway.xml. This properties file must be copied to the path that is specified in the Assemblies’ Directory field during the creation of the target.

However, if you want to use default system settings, then you are not required to create the iway.xml properties file. By default, the cache is disabled and all assemblies or folder and public subclasses, methods can be displayed.

The caching behavior of iWay .NET Technology Adapter is configured by iWay Service Manager (iSM) in cooperation with the adapter during iSM initialization. When the caching settings are changed in the iway.xml properties file configuration files are changed, iSM must be restarted to read the updated properties file.

Note: A separate iway.xml properties file can be created for each adapter target. As a result, specific cache behaviors can be applied to different Assemblies.

To review a sample iway.xml properties file, see Sample Properties File.


Top of page

x
Understanding the Format of the Properties File

The following image illustrates the settings and format of the iway.xml properties file.

where:

[BOOLEAN]

Is a boolean value (true or false).

[AF_PATH]

Is the full path of an assembly or folder.

[METHOD_SIGNATURE]

Is the signature of a method, which is the combination of the name of the method along with the number and types of the parameters (and their order).

[CLASS_NAME]

Is a full class name which is equal to:

[namespacename] +'.'+[classname]

In this case [namespacename] is the name of a namespace and [classname] is the name of a class.

The following is a list of rules and guidelines for the creation and usage of the iway.xml properties file:

  1. You can set the cache attribute value to true to enable caching or false to disable caching. The default cache value is the value of the cache attribute of the root element iwaydotnetadapter. This is used for all assemblies under the path that is specified in the Assemblies’ Directory field during the creation of the target. The only exception is that subassemblies have their own cache values. If a subassembly has a cache value, then the iWay .NET Technology Adapter will base the cache value to enable or disable cache for the assembly. Otherwise, the iWay .NET Technology Adapter will use the default cache value setting.
  2. To hide or show a folder, assembly, class, method (for example, item), you can set the value of the display attribute value of the corresponding item to true or false. By default, all assemblies, folders, public subclasses, and methods can be displayed. Therefore, if you do not want to hide an item and its sub-items, do not list this item in the iway.xml properties file.
  3. If a method is inherited from the System.Object, then the value of the display attribute of the method can overwrite the value of the Hide System.Object methods property for the method. Therefore, you can show or hide inherited System.Object methods under a particular class based on their own status.
  4. If you enable cache for an assembly, then the constructors of the classes of the assembly will be displayed in iWay Explorer.

Top of page

x
Usage Considerations and Examples

For demonstration purposes, this example has a subfolder called bin located in the C:\Example directory. In addition, there is no iway.xml file saved in the \bin subfolder, as shown in the following image.

The following compiled image shows the contents of the \Release, \Properties, and \Test Folder subdirectories.

This example will use the following directory path as the Assemblies’ Directory:

C:\Example\bin

This is the path that must be specified in the Assemblies’ Directory field during the creation of the adapter target using iWay Explorer.

The following image shows the New Target dialog box that opens when you create a target for the iWay .NET Technology Adapter.

Specify Example as the name of this new adapter target and click Next.

The Configuration pane of the New Target dialog box opens, as shown in the following image.

Specify values for the new adapter target as listed in the following table.

Parameter

Value

Assemblies’ Directory

C:\Example\bin

Search Recursively

true

Look for

All Native Assemblies

Assembly List

Infer Complex Schemas

true

Hide System.Object methods

false

Click Finish.

The new adapter target node called Example is added under the Adapters node of iWay Explorer, as shown in the following image.

In the above compiled image, the Example adapter target contains the following Assemblies:

The Complex.dll Assembly supports one public class called Complex.ComplexNumber. The Complex.ComplexNumber class has fourteen methods. Since the value of the Hide System.Object methods parameter was set to false during the adapter target creation process, the inherited System.Object methods are also displayed.

The Math.dll Assembly supports the following public classes:

The Math.Math class contains 21 methods (including the Equals, GetHashCode, GetType, and ToString methods).



x
Display Assemblies, Hiding Classes and Methods, and Disabling Cache

Using the iway.xml properties file, this example demonstrates how to:

The following image shows a configured iway.xml properties file that will implement the conditions listed.

Create an iway.xml properties file based on the above example and save the file to the C:\Example\bin directory, as shown in the following image.

Restart iWay Service Manager (iSM), reconnect to the Example adapter target node, and then expand this node, as shown in the following image.

Notice that only three Assemblies (Math.dll, DeepConstructorObject.dll, and Complex.dll) are displayed. All other folder nodes and Assemblies. In addition, the Math.Base, Math.BaseParent, Math.DerivedBase, Math.TextStyle, and Math.structObj classes are also hidden.

Expand the Complex.dll and Math.dll Assemblies, as shown in the following image.

The left side of the image shows the hierarchy that is displayed in iWay Explorer when no iway.xml properties file is included in the C:\Example\bin directory. The right side of the image shows the hierarchy that is displayed in iWay Explorer when the configured iway.xml properties file is included in the C:\Example\bin directory.

Notice that the returnnull and ResetComplexNumber methods of the Complex.ComplexNumber public class are hidden. Since the Math.dll Assembly has its cache value set to true (enabling cache), all public constructors of the Math class are now displayed.

Edit the Example adapter target in iWay Explorer and set the value of the Hide System.Object methods parameter to true, as shown in the following image.

Modify the existing iway.xml properties file, as shown in the following image.

Restart iSM, reconnect to the Example adapter target node, and then expand the node for the Complex.dll Assembly, as shown in the following image.

The left side of the image shows the hierarchy that is displayed in iWay Explorer when no modifications are made to the existing iway.xml properties file. The right side of the image shows the hierarchy that is displayed in iWay Explorer when the modified iway.xml properties file is used.

Setting the value of the Hide System.Object methods parameter to true results in the three inherited System.Object methods (Equals, GetHashCode, and GetType) under the Complex.ComplexNumber public class to be hidden. Only the inherited System.Object ToString is displayed, since the value of the display attribute of the ToString method forces the system to have it displayed.


Top of page

x
Sample Properties File

For reference purposes, the following is a sample iway.xml properties file that can be customized as required.

<iwaydotnetadapter cache="true">
  <nodes>
     <node isassembly="true" path="C:/Program Files (x86)/iway7/etc/samples/dotnet/bin/Math.dll" display="true" cache="false">
       <class name="Math.Math"  display="true">
          <method name="ToString()" display="false"/>
          <method name="Equals(System.Object)" display="true"/>
       </class>
       <class name="Math.Base" display="false">
       </class>
     </node>
     <node isassembly="true" path="C:/Program Files (x86)/iway7/etc/samples/dotnet/bin/Complex.dll" display="true" cache="false">
       <class name="Complex.ComplexNumber" display="true">
          <method name="ToString()" display="false"/>
          <method name="Equals(System.Object)" display="false"/>
       </class>
     </node>
     <node isassembly="true" path="C:/Program Files (x86)/iway7/etc/samples/dotnet/bin/SubComplex.dll" display="true" cache="false">
       <class name="SubComplex.SubComplexData" display="true">
          <method name="ToString()" display="false"/>
          <method name="Equals(System.Object)" display="false"/>
       </class>
     </node>
  </nodes>
</iwaydotnetadapter>

iWay Software