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

Page of 79
C
HAPTER 
10:
 
S
AY 
I
S
MART 
P
LUGINS
 
 
C
ISCO 
CVP V
OICE
XML 3.1
 
 
  
Programmer 
Guide 
 
Utility Methods 
These utility methods are provided to aid the Say It Smart plugin developer. Their use is 
optional. 
void validateArguments(Object data, String inputFormat,  
 
String outputFormat, String fileset) 
This method validates each argument and throws a 
SayItSmartException
 if there is an error 
with one of them. The exception is thrown if 
data
 is 
null
, or 
inputFormat
outputFormat
, or 
fileset
 does not correspond to the ones defined in the 
getDisplayInformation()
 method. 
Additionally, an exception is thrown if 
outputFormat
 does not depend on 
inputFormat
 or 
fileset
 does not depend on the 
outputFormat
. The error message lists all the appropriate 
options available. 
All CVP VoiceXML Say It Smart plugins call this method in the first line of their execution 
methods. 
String createError(String header, String[] options, String footer) 
This utility method is a shortcut for creating an error message when some value does not match 
one of an array of different possible values. The error conveys that and lists all the values the 
data can be.  Many CVP VoiceXML Say It Smart plugins provide an array of 
String
containing formats that they will accept input data to arrive in and this method is used when the 
input data does not arrive in a supported format. The output string starts with “SayItSmart Error 
– PLUGIN” where PLUGIN is the name of the plugin type as returned by the 
getDsplayInformation()
 method. The header then appears, followed by a comma-delimited 
list of correct values (with the last option following an “and”) followed by the footer. 
This is best explained with an example. A Say It Smart plugin named "Foo" has the input 
formats "a", "b", "c", and "d". If the input format passed was "e", this method can be called to 
create the error message. Calling the message like so: 
createError("Only the input formats supported are: ", new String[] {"a", "b", 
"c", "d"}, " Please use a supported format."). 
will produce the following error message: 
SayItSmart Error - Foo: Only the input formats supported are: "a", "b", "c", 
and "d". Please use a supported format. 
 
String[] getFilesetContents(String fileset) 
This utility method returns an array of 
String
s containing the filenames required for the fileset 
passed as input. This method can be used to determine what audio files need to be recorded to 
fully support a fileset for a Say It Smart plugin. At this point, this method exists only for 
 
 
Copyright 2001 - 2005 Audium Corporation.  All Rights Reserved. 10/05
 
69