Cisco Cisco Unified Customer Voice Portal 11.0(1) Developer's Guide

Page of 98
C
HAPTER 
2:
 
C
ISCO 
U
NIFIED 
CVP
 
API
 
I
NTRODUCTION
V
OICE
XML
 
P
ROGRAMMING 
G
UIDE 
 
 
 
FOR 
C
ISCO 
U
NIFIED 
C
USTOMER 
V
OICE 
P
ORTAL 
R
ELEASE 
4.0(1) 
 
 
 
 
6
 
As a result, it is the developer’s responsibility that the contents of the common folder in 
VoiceXML Studio also appear in the VoiceXML Server common folder. 
Note that when the VoiceXML Server initializes, it first loads the classes in 
common
 and then 
loads each application’s classes. Due to the way Java classloaders work, if a Java class appears in 
both the 
common
 folder and an application’s 
java
 folder, the one in 
common
 will take precedence 
and the one in the application’s 
java
 folder will not be loaded. Also note that due to the order in 
which these classes are loaded, the developer cannot place a class in 
common
 that refers to a class 
that only appears in an application’s 
java
 folder since the classes in 
common
 are loaded first. 
Keep in mind that some application servers have advanced options to change this precedence to 
“parent-last”, meaning that the application-level classloaders take precedence. By default, all 
application servers should be configured to be “parent-first”. 
Subdirectories of the Java Folder 
The 
java
 folder of a VoiceXML Studio project and a VoiceXML Server application folder 
contain two subdirectories named 
application
 and 
util
. Each folder encapsulates Java classes 
used for different purposes, their distinctions applying primarily to how the application works 
within Unified CVP VoiceXML Server. 
The 
application
 folder should contain all Java code for components that are used by the 
application. Note that in Unified CVP VoiceXML Studio, any custom configurable elements that 
are utilized only by the application would be placed in this folder and will appear in Unified 
CVP VoiceXML Studio’s element pane under the folder named “Local Elements”. The call flow 
editor for that application must be closed and reopened in order for newly copied local elements 
to appear in the element pane. 
The second subdirectory of the 
java
 folder is the 
util
 folder. This is used for Java libraries that 
provide the application with utilities unaffiliated with Cisco Unified CVP (such as math libraries, 
XML parsing libraries, etc.).  
There are several notes that must be made concerning which folder to use: 
    Any class that refers to Unified CVP-specific API classes cannot be deployed in the 
util
 
folder. If the class is application-specific, it must be placed in the 
application
 folder of that 
application. If the class is to be shared across all applications, it must be placed in the 
common
 
folder of the VoiceXML Server. 
    The classes in the 
util
 folder will not be reloaded when the application is updated using the 
updateApp
 administration script. If this behavior is not desired or the utility libraries are 
frequently updated, place these files in the 
application
 folder. See the VoiceXML Server 
User Guide for Cisco Unified Customer Voice Portal, Chapter 3 in the section describing the 
update capabilities for more information. 
    Utility classes that do not refer to Unified CVP classes at all (such as third-party libraries) 
can be placed anywhere within the 
CLASSPATH
 of the application server. For example, on the