Cisco Customer Response Applications Editor Step Reference Guide (3.1)
Java Step Descriptions

Table of Contents

Java Step Descriptions
Create Java Object
Create Remote Java Object
Execute Java Method
Set/Get Java Property

Java Step Descriptions


The steps in the JAVA palette of the Cisco Customer Response Applications (CRA) Editor provide script designers with a way to create Java objects and use Java classes.

The JAVA palette contains the following steps:

Figure 15-1 shows the steps in the JAVA palette as they appear in the Palette pane of the Cisco CRA Editor.


Figure 15-1   JAVA Palette Steps


Create Java Object

Use the Create Java Object step to instantiate a variable or an object of a specified Java class. You can create object instances for any variables or Java classes that you defined in the Variable pane of the CRA Editor or that are included in the definitions of the steps in your palette.

The Variable pane of the CRA Editor supports 20 built-in data types:

  • Integer (java.lang.Integer)—Whole numbers.
  • String (java.lang.String)—Set of unicode characters.
  • Boolean (java.lang.Boolean)—True or False.
  • Float (java.lang.Float)—Decimal numbers.
  • Prompt (com.cisco.prompt.Playable)—Prompt object created with prompt expressions or returned using prompt steps.
  • Character (java.lang.Character)—Characters, such as the letters in the alphabet.
  • Contact (com.cisco.contact.Contact)—Represents a call, e-mail, or HTTP request.
  • Session (com.cisco.session.Session)—Information that can be used to track contacts as they move through the system.
  • User (com.cisco.user.User)—Information useful for user authentication.
  • Grammar (com.cisco.grammar.Recognizable)—Words or Dual Tone Multi-Frequency (DTMF) digits that can be recognized by the CRA script.
  • Document (com.cisco.doc.Document)—Any type of document, such as a file, a URL, or a recording.
  • Currency (com.cisco.util.Currency)—Monetary format.
  • Date (java.util.Date)—Date information.
  • Language (java.util.Locale)—Language information.
  • Time (java.sql.Time)—Time information.
  • BigDecimal (java.math.BigDecimal)—Large decimal number.
  • BigInteger (java.math.BigInteger)—Large integer.
  • Double (java.lang.Double)—Expanded Float variable.
  • Long (java.lang.Long)—Expanded Integer variable.
  • Java Type—To build more advanced applications, you can write other Java variable types that are not represented by a built-in type. Use the Variable pane to declare a variable using the Java classes in your computer CLASSPATH.

Note    You can use only Java types defined since Java Development Kit (JDK) 1.1.8 or compatible with JDK 1.1.8.

The Create Java Object customizer window contains two tabs:

The following sections describe these tabs.

Class Assignment Tab

Use the Class Assignment tab of the Create Java Object customizer window to assign a class to the object.

Figure 15-2 shows the Class Assignment tab of the Create Java Object customizer window.


Figure 15-2   Create Java Object Customizer Window—Class Assignment Tab


Table 15-1 describes the properties of the Class Assignment tab of the Create Java Object customizer window.

Table 15-1   Create Java Object Properties—Class Assignment Tab

Property Description

Variable Name

Variable that represents a specific Java class.

Variable Type

A list of Java classes that corresponds to the variable you select.

To use the Class Assignment tab of the Create Java Object customizer window to assign a class to the object, perform the following procedure:

Procedure

Step 1   If necessary, click the Class Assignment tab.

The Class Assignment tab of the Create Java Object customizer window appears.

Step 2   From the Variable Name drop-down menu, choose the variable to represent the specific Java class.

The corresponding Java class appears next to the Variable Type label.

Step 3   Click Apply.

You are now ready to configure the Class Information tab of the Create Java Object customizer window.





Class Information Tab

Use the Class Information tab of the Create Java Object customizer window to choose the constructor for your chosen Java class.

A constructor is a function that allows you to instantiate an instance of this class.


Note   You can access only constructors that have been defined since JDK 1.1.8 or are compatible with JDK 1.1.8.

If any of the parameters to be passed to a constructor is of type InputStream or Reader, the Create Java Object step allows you to select a Document object and automatically convert the document to an InputStream or Reader object.

If the type created is an instance of InputStream or Reader, the Create Java Object step allows you to assign the result to a Document variable by converting the result into the appropriate format. However, the resulting document will only be accessible once by a single output step (unless cached in memory using the Cache Document step).

Figure 15-3 shows the Class Information tab of the Create Java Object customizer window.


Figure 15-3   Create Java Object Customizer Window—Class Information Tab


Table 15-2 describes the properties of the Class Information tab of the Create Java Object customizer window.

Table 15-2   Create Java Object Properties—Class Information Tab

Property Description

Constructor

Drop-down menu from which you choose the applicable constructor.

Argument/Type/Value

A list of the arguments, types, and values for the chosen constructor.

To use the Class Information tab of the Create Java Object customizer window to choose the constructor for your chosen Java class, perform the following procedure:

Procedure

Step 1   If necessary, click the Class Information tab.

The Class Information tab of the Create Java Object customizer window appears.

Step 2   From the Constructor drop-down menu, choose the constructor for the specific Java class.

The Argument and Type appear automatically under their respective columns in the Argument list box.

Step 3   To assign the value to or to modify the value of an argument, double-click the entry in the Argument list box.

The Enter Variable dialog box appears. (See Figure 15-4 .)


Figure 15-4   Enter Variable Dialog Box


Step 4   In the Enter Variable or Expression field, enter a value directly or take one of the following actions:

  • From the Enter Variable or Expression drop-down menu, choose the variable that stores the value for the specified argument.
  • Click the Expression Editor (...) button and enter an expression that specifies the value for the selected argument.

Step 5   Click OK.

The Enter Variable dialog box closes, and the value appears in the Value column of the Arguments list box of the Class Information tab of the Create Java Object customizer window.

Step 6   Click OK.

The Create Java Object customizer window closes, and the variable name and value appear next to the Create Java Object step icon in the Design pane of the CRA Editor.





Create Remote Java Object

Use the Create Remote Java Object step to create a Java object representing an object hosted on a remote computer.

You can then use the Execute Java Method step on the returned object to invoke methods on this remote object.

Figure 15-5 shows the customizer window for the Create Remote Java Object step.


Figure 15-5   Create Remote Java Object Customizer Window


Table 15-3 describes the properties of the Create Remote Java Object customizer window.

Table 15-3   Create Remote Java Object Properties

Property Description

Variable Name

Variable that represents the remote Java object.

Type

Type of variable (automatically fills in when you choose a variable in the Variable Name drop-down menu.)

Host Name

DNS1 or WINS2 host name of the remote host or the IP address.

Port Number

TCP port number of the RMI3 registry on the remote host that you will use to connect to it.

The default port number for RMI is 1099.

Service Name

Service name under which the remote object was registered in the RMI registry.

1DNS = Domain Name Service

2WINS = Windows Internet Naming Service

3RMI = Remote Method Invocation

To use the Create Remote Java Object customizer window to create a Java object representing an object hosted on a remote computer, perform the following procedure:

Procedure

Step 1   From the Variable Name drop-down menu, choose the variable to represent the remote Java object.

The corresponding Java class appears next to the Variable Type label.

Step 2   In the Host Name field, enter a value directly or take one of the following actions:

  • From the Host Name drop-down menu, choose the variable that stores the host name value.
  • Click the Expression Editor (...) button and enter an expression that specifies the host name value.

Step 3   In the Port Number field, enter a value directly or take one of the following actions:

  • From the Port Number drop-down menu, choose the variable that stores the port number value.
  • Click the Expression Editor (...) button and enter an expression that specifies the port number value.

Step 4   In the Service Name field, enter a value directly or take one of the following actions:

  • From the Service Name drop-down menu, choose the variable that stores the service name value.
  • Click the Expression Editor (...) button and enter an expression that specifies the service name value.

Step 5   Click OK.

The Create Remote Java Object customizer window closes, and the selected variable names appear next to the Create Remote Java Object step icon in the Design pane of the CRA Editor.





Execute Java Method

Use the Execute Java Method step to execute a specified static or non-static method of a Java class for a defined variable.


Note   You can use only methods defined since JDK 1.1.8 or compatible with JDK 1.1.8.

The Execute Java Method customizer window contains two tabs:

The following sections describe these tabs.

Explore Tab

Use the Explore tab of the Execute Java Method customizer window to select a variable for which you want to execute a specific Java method.

Figure 15-6 shows the Explore tab of the Execute Java Method customizer window.


Figure 15-6   Execute Java Method Customizer Window—Explore Tab


Table 15-4 describes the properties of the Explore tab of the Execute Java Method customizer window.

Table 15-4   Execute Java Method Properties—Explore Tab

Property Description

Select Variable

Variable on which you want to invoke a method

Variable Name

Name of selected variable

Variable Type

Type of selected variable

Browse the Class

Members defined for the class assigned to this variable

To use the Explore tab of the Execute Java Method customizer window to specify the variable for which you want to execute a specific Java method, perform the following procedure:

Procedure

Step 1   If necessary, click the Explore tab.

The Explore tab of the Execute Java Method customizer window appears.

Step 2   From the Select Variable drop-down menu, choose the variable to represent the specific Java class.

The Variable Name and Variable Type fields are automatically filled, and the members for the class assigned to this variable appear in the Browse the Class text field along with a plus (+) sign.

Step 3   To view the different members, click the plus sign (+) in this box.

You are now ready to configure the Explore Class Information tab of the Execute Java Method customizer window.





Explore Class Information Tab

Use the Explore Class Information tab of the Execute Java Method customizer window to choose a method to execute from the class selected in the Explore tab.

If any of the parameters to be passed to a constructor is of type InputStream or Reader, the Execute Java Method step allows you to select a Document object and automatically convert the document to an InputStream or Reader object.

If the return type is an instance of InputStream or Reader, the Execute Java Method step allows you to assign the result to a Document variable by converting the result into the appropriate format.

Figure 15-7 shows the Explore Class Information tab of the Execute Java Method customizer window.


Figure 15-7   Execute Java Method Customizer Window—Explore Class Information Tab


Table 15-5 describes the properties of the Explore Class Information tab of the Execute Java Method customizer window.

Table 15-5   Execute Java Method Properties—Explore Class Information Tab

Property Description

Object

Variable on which you want to invoke a method

Method

Name of the method to call.

Argument/Type/Value

List of input arguments, types, and values to the method.

Method Return Type

Data type returned by the selected method.

Assign to Variable

Variable that stores the value returned by the method.

To use the Explore Class Information tab of the Execute Java Method customizer window to choose a method to execute on the variable you selected in the Explore tab, perform the following procedure:

Procedure

Step 1   If necessary, click the Explore Class Information tab.

The Explore Class Information tab of the Execute Java Method customizer window appears, and the variable you selected in the Select Variable field of the Explore tab appears in the Object field.

Step 2   From the Method drop-down menu, choose the name of the method to call.

The list contains the methods available for the specified variable in Create Java Object steps. You cannot call methods that require unsupported data types, such as short and array.

The Argument and Type appear automatically under their respective columns in the Argument list box, and the method return type appears next to the Method Return Type name.

Step 3   To assign the value to or to modify the value of an argument, double-click the entry in the Argument list box.

The Enter Variable dialog box appears. (See Figure 15-4 .)

Step 4   In the Enter Variable or Expression field, enter a value directly or take one of the following actions:

  • From the Enter Variable or Expression drop-down menu, choose the variable that stores the value for the specified argument.
  • Click the Expression Editor (...) button and enter an expression that specifies the value for the selected argument.

Step 5   Click OK.

The Enter Variable dialog box closes, and the value appears in the Value column of the Arguments list box in the Explore Class Information tab of the Execute Java Method customizer window.

Step 6   Click OK.

The Execute Java Method customizer window closes, and the variable name and value appear next to the Execute Java Method step icon in the Design pane of the CRA Editor.





Set/Get Java Property

Use the Set/Get Java Property step to obtain and/or modify the value of a property defined in a variable.


Note   You can access or modify only properties defined since JDK 1.1.8 or compatible with JDK 1.1.8.

If an attribute of a class of type InputStream or Reader is set, the Set/Get Java Property step accepts a parameter of type Document and automatically convert it to either an InputStream or a Reader.

If the attribute retrieved is an instance of InputStream or Reader, the Set/Get Java Property step allows you to assign the result to a Document variable by converting the result into the appropriate format. However, the resulting document will only be accessible once by a single output step (unless cached in memory using the Cache Document step).

The Set/Get Java Property customizer window contains two tabs:

The following sections describe these tabs.

Source Tab

Use the Source tab the Set/Get Java Property customizer window to select a source variable or field with the value you want to obtain.

Figure 15-8 shows the Source tab of the Set/Get Java Property customizer window.


Figure 15-8   Set/Get Java Property Customizer Window—Source Tab


Table 15-6 describes the properties of the Source tab of the Set/Get Java Property customizer window.

Table 15-6   Set/Get Java Property Properties—Source Tab

Property Description

Variable Name

Variable for which you want to obtain and/or modify the value of a Java property

Variable Field

Name of the selected variable

Type

Type of selected variable

Browse the Class

Members defined for the class assigned to this variable

To use the Source tab of the Set/Get Java Property customizer window to obtain and/or modify the value of a property defined in a variable, perform the following procedure:

Procedure

Step 1   If necessary, click the Source tab.

The Source tab of the Set/Get Java Property customizer window appears.

Step 2   From the Variable Name drop-down menu, choose the variable for which you want to obtain and/or modify the value of a Java property.

The variable name and type are automatically displayed, and the members for the class assigned to this variable appear in the Browse the Class text field along with a plus (+) sign.

Step 3   To view the different members of the class in the Browse the Class display box, click the plus sign (+) in this box.

You are now ready to configure the Destination tab of the Set/Get Java Property customizer window.





Destination Tab

Use the Destination tab of the Set/Get Java Property customizer window to select the variable or a field to receive the value of the source variable.

Figure 15-9 shows the Destination tab of the Set/Get Java Property customizer window.


Figure 15-9   Set/Get Java Property Customizer Window—Destination Tab


Table 15-7 describes the properties of the Destination tab of the Set/Get Java Property customizer window.

Table 15-7   Set/Get Java Property Properties—Destination Tab

Property Description

Variable Name

Variable that stores the value of the specified Java property

Variable Field

Name of the selected variable

Type

Type of selected variable

Browse the Class

Members defined for the class assigned to this variable

To use the Destination tab of the Set/Get Java Property customizer window to select the variable or a field to receive the value of the source variable, perform the following procedure:

Procedure

Step 1   If necessary, click the Destination tab.

The Destination tab of the Set/Get Java Property customizer window appears.

Step 2   From the Variable Name drop-down menu, choose the variable that stores the value of the specified Java property.

The variable name and type are automatically displayed, and the members for the class assigned to this variable appear in the Browse the Class text field along with a plus (+) sign.

Step 3   To view the different members of the class in the Browse the Class display box, click the plus sign (+) in this box.

Step 4   Click OK.

The Set/Get Java Property customizer window closes, and the selected variables appear next to the Set/Get Java Object step icon in the Design pane of the CRA Editor.