Using call studio v11. I have a two part question. As part of my application I want to load from a file configuration information that will be used by the application.
Question #1: Is there an initialization phase for the applications that only runs once (ex: call a java class) This class will execute, and store application configuration information in "application" scope variables to be shared by all calls.
Question #2: Can someone explain the proper approach using studio to create application variables. I see how element, and session variables can be created, but I'm not able to understand how application scope variables are created using elements. Also, I have created a java class that I invoke from the action element. In that java class I create an application scope variable using :
When I debug the application inside studio and execute the action element I don't see in the debug window any application scope variables listed. Should I expect to see application scope variables in the debug pane that are created by a java class?
Application data is persistent, but there's no visibility of it within
Studio out of the box elements.
You have to use your own custom java components to get/set.
Look in the javadocs at the APIBase (which is inherited by ElementAPI) -
and look at its method named getApplicationAPI
That will then point you to theApplicationAPI - which contains the
getters and setters for both Application and Global data
On the CVP system, there's a *jconsole gui window*where you can
get/set Application Data (which is helpful when testing your custom java
to ensure it worked):
double click C:\Cisco\CVP\jre\bin\jconsole.exe
Login with ipaddress:9696 (no user or pwd)
It'll say that it "Failed to log in securely", press OK.
Go to the tab labeled MBeans
Expand: Cisco Unified CVP VXMLServer/ Voice Application/
Appname/Data/Operations - and you can then setApplicationData (name,
value) or getApplicationData (provide a name)
You can also create a java component that runs at Start of Application -
which means only when the app is loaded in memory (deployApp.bat,
updateApp.bat, reboot) - so it doesn't execute very frequently. The
whole idea is to create some Application data when the app is loaded
into memory, and have that data remain persistent in memory. If you have
to change the data, just run the updateApp.bat for that particular
The Start of Application class is the only component that is passed the
Anything else you write (Action, Decision, Start of Call, etc) must
access it like this elementAPI.getApplicationAPI()
Using a Start Application class as Janine mentions you can trigger the Studio App itself and do initialisation using the standard script or custom elements. The mobile agent CLI fixup app I gave you the link to does exactly that. Check out theThe need in that case is to load some config into static application data at application start/update. The reason for doing the initialisation in the script is to avoid having to hard code hostname/IP and access credentials in the Start Application class itself. Using the Studio application allows you to configure such things via element settings. So, bottom line is that you can have a Studio app that both does the normal run-time processing and also has a section to perform startup initialisation, simply using the Start Application class as the initialisation trigger.
Note that the scope of any static class variables you create is limited the single application that created them because a new class loader is created for each application loaded.
Janine & Paul
This Start Application Class is what will meet my needs for the application (Deploy, Update, Reboot). Paul, thank you again for the helpful sample code you provided. Appears to be the example I need.