Skip to main content

About Business Hosts and Adapters

This topic discusses information that applies to all business hosts and adapters written in an external language.

Creating Runtime Variables

The PEX framework allows you to use the Management Portal to specify runtime values of variables in the remote class, giving you the ability to re-use a PEX component in different productions. A variable that is declared in the remote class appears in the Management Portal as a setting of the corresponding business host. For example, if a Python class of a business service declares Min = int(0), then the production’s business service has a Min setting. At runtime, the variable is set to the value of the setting in the Management Portal.

If your remote class declares variables that you do not want to appear in the Management Portal, you can add metadata to hide the variable.

Variable Metadata

You can add metadata to your remote class that affects the Management Portal setting that is created for a variable. The syntax of this metadata depends on your external language: Java uses an annotation, .NET uses an attribute, and Python uses a special method named variableName_info. For example, the following code specifies that a setting MyVariable is required and adds a description that appears as a tool tip for the setting:

@FieldMetadata(IsRequired=true,Description="Name of the company")
public String MyVariable;
[FieldMetadata(IsRequired=true,Description="Name of the company")]
public string MyVariable;
MyVariable = int(0)

@classmethod
def MyVariable_info(self) -> \
 {
    'Description': "Maximum value",
    'IsRequired': True
  }:
  pass

Using this syntax, the following elements can be added to metadata to control the behavior of a Management Portal setting:

Metadata Element Description
Description A description of the setting that appears as a tool tip in the Management Portal.
Category Groups the setting under a category heading. For example, if Category="Basic" is added to a Java class, then the setting is grouped under the Basic section of settings.
DataType Overrides the variable data type, associating the setting with a new data type, for example, Ens.DataType.ConfigName.
IsRequired If true, a value must be provided for the setting. Defaults to false.
ExcludeFromSettings If true, it prevents a variable from appearing in the Management Portal as a setting. Defaults to false.

PEX Component Metadata

Just as you can add metadata to individual variables in a remote class, you can add metadata that applies to the entire PEX component. This metadata is used to provide information about the component in the Management Portal, where it appears on the Production EXtensions page and the Production Configuration page under Informational Settings.

Metadata Element Description
Description A description of the PEX component.
Info URL A URL associated with the PEX component, for example, a web page providing detailed information about the component.

The syntax to include this class metadata depends on your external language. Java uses an annotation and .NET uses an attribute. Python uses a docstring and a special variable. The following code adds these metadata elements to the remote class of a PEX component:

@ClassMetadata(Description="Custom Java Business Service",InfoURL="http://www.mycompany.com")
public class MyBusinessService extends com.intersystems.enslib.pex.BusinessService {
[ClassMetadata(Description ="Custom .NET Business Service", InfoURL="www.mycompany.com")]
public class MyBusinessService : InterSystems.EnsLib.PEX.BusinessService
class MyBusinessService(iris.pex.BusinessService):
  """ Custom Business Service in Python """

  INFO_URL = "http://www.mycompany.com"

FeedbackOpens in a new tab