Wiki

« Back to Messaging

Messaging Application-Java

About the Application#

This application uses the Messaging Plugin. The application cannot be created if you do not have this plugin correctly created, installed, and running.

Creating the Application Project#

1. Open a Command Prompt window.

2. Navigate to the directory you want to use as your workspace. To use the CUAE command-line tool to create a new application, type the cuae create command and the name of the application project.

c:>cd MessagingApp
c:\MessagingApp> cuae create MessagingApp}}}

The tool then prompts you for additional information.

Note: Once you are more familiar with the options, you can type the full command rather than answering the prompts by using the following syntax://

cuae create -l language -m namespace -t project type [options] projectname

3. First the tool prompts you to choose between building an application or a plugin. In this example, the correct choice is application:

Project Type? [application or plugin] application

4. Next the tool prompts you to specify the programming language. In this example, the correct choice is java:

Programming language? [java or csharp] java

5. The tool prompts you to choose the build format you prefer. In this example we are using ant.

Build format? [ant or maven2] ant

6. The tool asks you for the namespace for the application. A program might want to use a fully qualified namespace like com.company.messagingapp or something simple like messagingapp. The tool offers you a simple namespace based on the project name. Let's accept the tool's suggestion for now and use messagingapp:

Project namespace? [default: messagingapp] <Return>

7. Finally, the tool asks if you would like to specify a triggering event.

Note: The CUAE command-line tool requires that you select a triggering event, however, the MessagingApp application will not utilize the triggering event.

Select option 5:

 Available application triggering event:
0: Skip this step 1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall 2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated 3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished 4: cisco.uc.cuae.legacy.CallControl.IncomingCall 5: cisco.uc.cuae.legacy.Http.GotRequest 6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated 7: cisco.uc.cuae.legacy.Presence.Notify 8: cisco.uc.cuae.legacy.TimerFacility.TimerFire

Triggering event? [0-9] 5 }}}

The tool now has enough information to generate the project template.

   Generating:

  • application named "MessagingApp"
  • with namespace "messagingapp"
  • with language "java"
  • with trigger event "cisco.uc.cuae.legacy.Http.GotRequest"
  • in location C:\MessagingApp\

Created project "MessagingApp" in directory "C:\MessagingApp\MessagingApp\" }}}

Here is the whole sequence again with all of the steps together:

c:/workspace> cuae create MessagingApp
Project type? [application or plugin] application Programming language? [java or csharp] java Build format? [ant or maven2] ant Project namespace? [default: messagingapp] Available application triggering event: 0: Skip this step 1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall 2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated 3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished 4: cisco.uc.cuae.legacy.CallControl.IncomingCall 5: cisco.uc.cuae.legacy.Http.GotRequest 6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated 7: cisco.uc.cuae.legacy.Presence.Notify 8: cisco.uc.cuae.legacy.TimerFacility.TimerFire

Triggering event? [0-9] 5 Generating:

  • application named "MessagingApp"
  • with namespace "messagingapp"
  • with laguage "java"
  • with trigger event "cisco.uc.cuae.legacy.Http.GotRequest"
  • in location C:\MessagingApp\

Created project "MessagingApp" in directory "C:\MessagingApp\MessagingApp\" }}}

Declaring Services#

The first step in building an Etch-based application is identifying which Cisco Unified Application Environment hosted services the application requires and then editing the .etch file to declare the names of those services into the application.

Note: Once you identify the services you need, you can familiarize yourself with them by visiting the API reference for the version of the Unified Application Environment you are using.

The following snippet is the default content of the .etch file that the CUAE command-line tool generates. We use the mixin command to declare the appropriate services.

// CUAE Application Etch Service Definition
//
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module messagingapp

// The name of your service.
service MessagingApp
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.Http
    mixin cisco.uc.cuae.messaging


}

Because this application will use methods in the Messaging Plugin library to retrieve/play/send messages to the Unity Connection server, we need to mixin the Messaging etch file.

    mixin cisco.uc.cuae.messaging

The default etch file already has a mixin for HTTP because of the triggering event you selected when creating the application project.

   mixin cisco.uc.cuae.legacy.Http

The new MessagingAppClient.etch file should look like this:

// CUAE Application Etch Service Definition
This service defines your application and the CUAE services that you use in your application.

The service module namespace, this will be translated to the namespace of the generated source code. module messagingapp

The name of your service.service MessagingApp{ By default, you must always use the EtchBridge service. Do not remove this mixin, otherwise your application won't work.mixin cisco.uc.cuae.EtchBridge

You may add any additional service mixins that you require. For example, if you'd like to make and receive phone calls, add the following line: mixin cisco.uc.cuae.legacy.CallControl mixin cisco.uc.cuae.legacy.Http mixin cisco.uc.cuae.messaging } }}}

Building the Application#

After declaring the services you need, you must build the application to generate source files. 1. Open a Command Prompt and navigate to the application directory. 2. Run the ant command to generate source files.

C:\MessagingApp\MessagingApp\>ant

The following source file templates are then created in the directory src\messagingapp:

  • MainMessagingAppClient.java
  • ImplMessagingAppClient.java

Writing Application Code#

This section provides instructions and code samples for writing the application logic.

Import the Project into your IDE#

1. Open Eclipse (or another IDE of your preference).

2. Create a new Java project from an existing Ant buildfile by selecting File -> New -> Other -> Java Project from an existing Ant buildfile and selecting the build.xml file from the MessagingApp directory.

3. Click Next.

4. Browse to C:\MessagingApp\MessagingApp and select the build.xml file.

5. Click Open.

6. Select "javac" task found in target "build[default]".

MainMessagingAppClient (Registering the Application)#

This is the main class of this application. Here the application is registered with the Cisco Unified Application Environment. Once the registration is done, a command line tool is launched from this class.

Code sample for Main method#

public static void main(String[] args) throws Exception {
TODO Change to correct URIString uri = <Appserver Ip Address:port?<parameters>

MainMessagingAppClient client = new MainMessagingAppClient();

RemoteMessagingAppServer server = MessagingAppHelper.newServer(uri, null, client);

Connect to the serviceserver._startAndWaitUp(4000);

String regKey = server.registerApplication("MessagingApp", "Default", "Administrator", "metreos");

System.out.println("Messaging App registered with key :" + regKey);

sessionId = server.addCuaeSession(regKey);

client.launchCmdLineTool();

server.removeCuaeSession(sessionId);

server._stopAndWaitDown(4000);

} }}}

Registering the application#

Before any Etch-based API calls can actually be made, we must register the application with the Cisco Unified Application Server.

Following lines of code register the application with CUAE

String regKey = server.registerApplication("MessagingApp", "Default",
"username", "password");

System.out.println("Messaging App registered with key :" + regKey); }}}

Modify the String URI to match the IP address and port of the Cisco Unified Application Server.

URI settings vary slightly between 2.5(1) Beta 1 and more recent versions of 2.5(1), as follows:

2.5(1) and 2.5(1) Beta 2, Beta 3, Beta 4 & later releases#

// TODO Change to correct URI
String uri = "tls://appserver_ipaddress:9000?TlsConnection.authReqd=false&filter=KeepAlive &KeepAlive.Count=5&Packetizer.maxPktSize=102400&TcpTransport.reconnectDelay=4000";}}}

Note: In Beta 2, the Etch Bridge was updated to use Transport Layer Securityfor encryption by default. For your applications to work, you must specify TLS as the protocol in the URI and set the authReqd parameter to false. In the example above, the KeepAlive filter and Max Packet Size and Reconnect Delay parameters have also been set.

2.5(1) Beta 1#

// TODO Change to correct URI
String uri = "tcp://appserver_ipaddress:9000?&TcpConnection.reconnect_delay=4000";}}}

Note: In addition to setting the correct IP address and port for the Cisco Unfied Application Server, the Reconnect Delay parameter should be set on all connection URIs.

Output#

When this class is run, the following is displayed on the Console.

----------------------------
Sample Unity Connection App (JAVA) ---------------------------- Usage: sendMessage <FileName> <Destination User> <Source User> deleteMessage <MsgId> forwardMessage <MsgId> <Destination User> <Source User> logout findMessages <constraint> getMessageCount isLoggedIn login <Username> <Password> <UserType> playMessage <MsgId> quit getMessage <MsgId> Cmd: }}}

Login#

The first thing a user will do is login to the Unity Connection server. This is the login command:

Cmd: login <username> <password> EndUser

Code Snippet for Login#

               try {
mailbox = server.openMailbox(sessionId, uName, uName, passwd );

} catch (AuthenticationException e) { TODO Auto-generated catch blocke.printStackTrace();} catch (UnderlyingProtocolException e) { TODO Auto-generated catch block e.printStackTrace(); } catch (MessagingException e) { TODO Auto-generated catch blocke.printStackTrace();} catch (Exception e) {e.printStackTrace();} }}}

Messaging Plugin login API requires user to provide the sessionId, which is what we received when we added the cuae session. userName, password and userType is provided at command line. Valid values for UserType are SuperUser and EndUser.

Once the login is successful, the mailbox for the userName is opened.

Get Message#

----------------------------
Sample Unity Connection App (JAVA) ---------------------------- Usage: sendMessage <FileName> <Destination User> <Source User> deleteMessage <MsgId> forwardMessage <MsgId> <Destination User> <Source User> logout findMessages <constraint> getMessageCount isLoggedIn login <Username> <Password> <UserType> playMessage <MsgId> quit getMessages <MsgId> Cmd:getMessage 23 }}}

getMessage gets the message specified by the message Id from the corresponding Unity or UnityConnection server.

Code Snippet for GetMessage#

private void getMessage(Vector<String> tokens) {

try {

if (userName != null) {

if (tokens.size() != 2) { System.out .println("Incorrect number of parameters specified for getMessage. "); return; } String msgId = tokens.elementAt(1);

Message msg = server.getMessage(sessionId, mailbox.getId(), msgId, null);

System.out .println("Message " + msgId + " for user " + userName + " is from " + msg.getFromUserName() + " to user " + userName + " sent on " + msg.getReceivedOn() + " in state " + msg.getMessageState() + " with subject " + msg.getSubject() + " sent from actual number " + msg.getFromNumber());

} else { System.out.println("User not logged in"); } } catch (InvalidArgumentException e) { TODO Auto-generated catch blocke.printStackTrace();} catch (UnderlyingProtocolException e) { TODO Auto-generated catch block e.printStackTrace(); } catch (MessagingException e) { TODO Auto-generated catch blocke.printStackTrace();} catch (Exception e) {e.printStackTrace();}

} }}}

Output#

The user will see the following on the command line console -

Message 8 for user dpotter is from userb@m-cuckoo-ft-1.cisco.com to user dpotter sent on null in state READ with subject Forward sent from actual number null

Play Message#

----------------------------
Sample Unity Connection App (JAVA) ---------------------------- Usage: sendMessage <FileName> <Destination User> <Source User> deleteMessage <MsgId> forwardMessage <MsgId> <Destination User> <Source User> logout findMessages <constraint> getMessageCount isLoggedIn login <Username> <Password> <UserType> playMessage <MsgId> quit getMessage <MsgId> Cmd: playMessage 1 }}}

Play Message as the name suggests plays the voice data attached to the message. The user is expected to specify a valid message id. If the user specifies an invalid message id, the application will prompt user with a valid message id range. A good practice is to execute getMessage before playMessage. That way you will know the correct message id to specify. For example as seen in Get Message Output section (see above ), the message id are printed on the console.

e.g. Message 1 for user dpotter is from UserC <userc@m-cuckoo-ft-1.cisco.com> to user dpotter sent on 30-Jul-2008 12:44:54 in state READ with subject Message from UserC sent from actual number 100000

Code Snippet For Play Message#

	private void playMessage(Vector<String> tokens) {
try { if (userName != null) {

if (tokens.size() != 2) { System.out .println("Incorrect number of parameters specified for playMessage." + " Usage playMessage <msgId> "); return; } String msgId = tokens.elementAt(1);

String path = "." + System.getProperty("file.separator") + System.getProperty("file.separator") + msgId + ".wav"; System.out.println(" The path is " + path);

File f = new File(path); if (!f.exists()) { f.createNewFile(); }

FileOutputStream fos = new FileOutputStream(f); DataOutputStream dos = new DataOutputStream( new BufferedOutputStream(fos)); int transferBufferSize = 2048;

String transId = server.beginReadVoiceData(sessionId, mailbox.getId(), msgId); while (true) {

byte[] voiceData = server.readVoiceData(sessionId, mailbox.getId(), transId, transferBufferSize);

if ( voiceData != null ){ dos.write(voiceData); } if ( voiceData.length < transferBufferSize ) break; } dos.close(); fos.close(); if (dos.size() != 0) { AudioPlayer p = AudioPlayer.player; AudioStream as = new AudioStream(new FileInputStream("." + System.getProperty("file.separator") + System.getProperty("file.separator") + msgId + ".wav")); p.start(as); } else {

System.out .println(" There is no voice data attached to this message. It may have been forwarded"); } } else { System.out.println(" User is not logged in "); } } catch (Exception e) { e.printStackTrace(); } } }}}

Send Message#

As the name suggests, send message allows a user to send an audio file to an another user.

Below is an example

----------------------------
Sample Unity Connection App (JAVA) ---------------------------- Usage: sendMessage <FileName> <Destination User> <Source User> deleteMessage <MsgId> forwardMessage <MsgId> <Destination User> <Source User> logout findMessages <constraint> getMessageCount isLoggedIn login <Username> <Password> <UserType> playMessage <MsgId> quit getMessage <MsgId> Cmd:sendMessage c:\windows\media\ding.wav userb@m-cuckoo-ft-1.cisco.com dpotter@m-cuckoo-ft-1.cisco.com}}}

The user must specify the complete file path, destination address (userb@m-cuckoo-ft-1.cisco.com) and source address (dpotter@m-cuckoo-ft-1.cisco.com)

Code Snippet for Send Message#

Before a file can be sent to the Unity Connection server, it must be uploaded to the server. File is uploaded using uploadData API which returns back a file id. The file id is passed as a parameter in sendMessage API. Following code snippets depicts this -

private void sendMessage(Vector<String> tokens) {

try { if (userName != null) { if (tokens.size() != 4) { System.out .println("Incorrect number of parameters specified for sendMessage." + " Usage sendMessage <File> <destinationUser> <sourceUser> "); return; } String fileName = tokens.elementAt(1); String destUser = tokens.elementAt(2); String fromUser = tokens.elementAt(3);

File file = new File(fileName);

byte[] oData1 = new byte[(int) file.length()];

if (file.exists()) { FileInputStream fis = null; BufferedInputStream bis = null; DataInputStream dis = null;

fis = new FileInputStream(file);

bis = new BufferedInputStream(fis); dis = new DataInputStream(bis);

while (dis.available() != 0) { dis.read(oData1); } fis.close(); bis.close(); dis.close();

String oGlobFileID = uploadData(oData1);

server.sendMessage(sessionId, mailbox.getId(), destUser, fromUser, oGlobFileID); System.out.println("sent message");

} else { System.out.println("file does not exist "); } } else { System.out.println("User is not logged in"); }

} catch (FileNotFoundException e) { TODO Auto-generated catch blocke.printStackTrace();} catch (IOException e) { TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }

private String uploadData(byte[] oData) {

int nChunkSize = 1024; int nChunks = oData.length / nChunkSize; int nLastChunk = oData.length - (nChunks nChunkSize);

String oGlobFileID = null;

try { oGlobFileID = server.createVoiceData(sessionId, mailbox.getId()); } catch (MessagingException e) { TODO: handle exceptionSystem.out.println("Exception thrown while creating voicedata");e.printStackTrace();}

long nOffset = 0; for (int i = 0; i < nChunks; i++) { byte[] oChunkData = new byte[nChunkSize]; for (int j1 = 0; j1 < nChunkSize; j1++) { oChunkData[j1] = oData[(int) nOffset]; nOffset++; }

try { server.writeVoiceData(sessionId, mailbox.getId(), oGlobFileID, oChunkData); } catch (Exception e1) { System.out.println(e1.toString()); return null; } }

byte[] oChunkData1 = new byte[nLastChunk]; for (int i = 0; i < nLastChunk; i++) { oChunkData1[i] = oData[(int) nOffset]; nOffset++; } try { server.writeVoiceData(sessionId, mailbox.getId(), oGlobFileID, oChunkData1); } catch (Exception e1) { System.out.println(e1.toString()); return null; } try { server.closeVoiceData(sessionId, mailbox.getId(), oGlobFileID); } catch (MessagingException e) { TODO: handle exceptionSystem.out.println("Exception thrown while creating voicedata");e.printStackTrace();}

return oGlobFileID; } }}}

uploadData uploads data in chunks of 1024 bytes. This limitation is due to the maximum allowed packet size in Etch

Forward Message#

Forward Message forwards a message from one user to an another.

----------------------------
Sample Unity Connection App (JAVA) ---------------------------- Usage: sendMessage <FileName> <Destination User> <Source User> deleteMessage <MsgId> forwardMessage <MsgId> <Destination User> <Source User> logout findMessages <constraint> getMessageCount isLoggedIn login <Username> <Password> <UserType> playMessage <MsgId> quit getMessage <MsgId> Cmd:forwardMessage 1 userb@m-cuckoo-ft-1.cisco.com dpotter@m-cuckoo-ft-1.cisco.com }}}

The user must specify the messageId, destination address (userb@m-cuckoo-ft-1.cisco.com) and source address (dpotter@m-cuckoo-ft-1.cisco.com)

Code Snippet for Forward Message#

private void forwardMessage(Vector<String> tokens) {

try { if (userName != null) { if (tokens.size() != 4) { System.out .println("Incorrect number of parameters specified for forwardMessage." + " Usage forwardMessage <msgId> <destinationUser> <sourceUser> "); return; } String msgId = tokens.elementAt(1);

String destUser = tokens.elementAt(2); String fromUser = tokens.elementAt(3); server.forwardMessage(sessionId, mailbox.getId(), msgId, destUser, fromUser, null);

System.out.println("Message forwarded"); } else { System.out.println("User not logged in"); } } catch (NoSuchMessageException e) { TODO Auto-generated catch blocke.printStackTrace();} catch (UnderlyingProtocolException e) { TODO Auto-generated catch block e.printStackTrace(); } catch (MessagingException e) { TODO Auto-generated catch blocke.printStackTrace();} catch (Exception e) { TODO Auto-generated catch block e.printStackTrace(); }

} }}}

Delete Message#

Delete Message allows user to delete a message

----------------------------
Sample Unity Connection App (JAVA) ---------------------------- Usage: sendMessage <FileName> <Destination User> <Source User> deleteMessage <MsgId> forwardMessage <MsgId> <Destination User> <Source User> logout findMessages <constraint> getMessageCount isLoggedIn login <Username> <Password> <UserType> playMessage <MsgId> quit getMessage <MsgId> Cmd:deleteMessage 1 }}}

As seen in the above example, delete message requires message id to be specified.

Code Snippet for Delete Message#

private void deleteMessage(Vector<String> tokens) {

try { if (userName != null) { if (tokens.size() != 2) { System.out .println("Incorrect number of parameters specified for deleteMessage." + " Usage deleteMessage <msgId> "); return; } String messageId = tokens.elementAt(1);

server.deleteMessage(sessionId, mailbox.getId(), messageId); System.out.println("Message " + messageId + " deleted"); } else { System.out.println(" User not logged in"); } } catch (Exception e) { e.printStackTrace(); } } }}}

Logout#

Logout logs out the current logged in user.

----------------------------
Sample Unity Connection App (JAVA) ---------------------------- Usage: sendMessage <FileName> <Destination User> <Source User> deleteMessage <MsgId> forwardMessage <MsgId> <Destination User> <Source User> logout findMessages <constraint> getMessageCount isLoggedIn login <Username> <Password> <UserType> playMessage <MsgId> quit getMessage <MsgId> Cmd:logout }}}

Code Snippet for Logout#

private void logout(Vector<String> tokens) {
try { if (userName != null) { server.closeMailbox(sessionId, mailbox.getId());

System.out.println("User " + userName + " is logged out "); userName = null;

} else { System.out.println(" User not logged in"); } } catch (Exception e) { e.printStackTrace(); } } }}}

Before logging out the user, the mailbox associated with the user must be closed.

Get Message Count#

Get Message Count gets the number of messages

----------------------------
Sample Unity Connection App (JAVA) ---------------------------- Usage: sendMessage <FileName> <Destination User> <Source User> deleteMessage <MsgId> forwardMessage <MsgId> <Destination User> <Source User> logout findMessages <constraint> getMessageCount isLoggedIn login <Username> <Password> <UserType> playMessage <MsgId> quit getMessage <MsgId> Cmd:getMessageCount }}}

Code Snippet for Get Message Count#

private void getMessageCount(Vector<String> tokens) {

if (userName != null) { try { int msgCount = server.getMessageCount(sessionId, mailbox .getId(), "",null); System.out.println(" The number of messages are " + msgCount); } catch (Exception e) { e.printStackTrace(); } } else { System.out.println("User not logged in"); }

} }}}

IsLoggedIn#

isLoggedIn indicates to the user whether a user is logged in or not.

----------------------------
Sample Unity Connection App (JAVA) ---------------------------- Usage: sendMessage <FileName> <Destination User> <Source User> deleteMessage <MsgId> forwardMessage <MsgId> <Destination User> <Source User> logout findMessages <constraint> getMessageCount isLoggedIn login <Username> <Password> <UserType> playMessage <MsgId> quit getMessage <MsgId> Cmd:isLoggedIn }}}

Code Snippet for IsLoggedIn#

private void isLoggedIn(Vector<String> tokens) {
try { if (server.isLoggedInAndOpen(sessionId, mailbox.getId())) { System.out.println("User " + userName + " is logged in "); } else { System.out.println(" User is not logged in"); } } catch (MessagingException e) { TODO Auto-generated catch blocke.printStackTrace();}

} }}}

Find Messages#

FindMessages allows user to find message based on a constraint. Detailed information on the constraints supported are specified in the messaging.etch file. A constraint of null would ask the application to fetch all messages.

Following is an example -(for UnityConnection)

----------------------------
Sample Unity Connection App (JAVA) ---------------------------- Usage: sendMessage <FileName> <Destination User> <Source User> deleteMessage <MsgId> forwardMessage <MsgId> <Destination User> <Source User> logout findMessages <constraint> getMessageCount isLoggedIn login <Username> <Password> <UserType> playMessage <MsgId> quit getMessage <MsgId> Cmd:findMessages Message.receivedOn>14102008 }}}

In the above example, the user is trying to get all messages that were sent after 14 October 2008

Code Snippet for Find Messages#

private void findMessages(Vector<String> tokens) {
try { if (userName != null) { if (tokens.size() != 2) { System.out .println("Incorrect number of parameters specified for findMessages." + " Usage findMessage <constraint> "); return; } String constraint = tokens.elementAt(1); System.out.println("The constraint is " + constraint); if ( constraint.equalsIgnoreCase("null")) constraint = null;

Message[] msgs = server.findMessages(sessionId, mailbox.getId(), constraint, null, 0, 100, null);

if (msgs != null ) { for (int i = 0; i < msgs.length; i++) {

System.out.println("Message " + msgs[i].getId() + " for user " + userName + " is from " + msgs[i].getFromUserName() + " to user " + userName + " sent on " + msgs[i].getReceivedOn() + " in state " + msgs[i].getMessageState() + " with subject " + msgs[i].getSubject() + " sent from actual number " + msgs[i].getFromNumber());

} } else { System.out.println(" There are no messages to display"); } } else { System.out.println("User not logged in"); }

} catch (InvalidArgumentException e) { TODO Auto-generated catch blocke.printStackTrace();} catch (UnderlyingProtocolException e) { TODO Auto-generated catch block e.printStackTrace(); } catch (MessagingException e) { TODO Auto-generated catch blocke.printStackTrace();} catch (Exception e) {e.printStackTrace();}

} }}}

Output for Find Messages#

Message 4 for user dpotter is from userc@m-cuckoo-ft-1.cisco.com to user dpotter sent on Thu Sep 11 10:50:22 CDT 2008 in state READ with subject Message from UserC sent from actual number 100000
Message 5 for user dpotter is from userb@m-cuckoo-ft-1.cisco.com to user dpotter sent on null in state READ with subject Forward sent from actual number 100000 Message 6 for user dpotter is from userb@m-cuckoo-ft-1.cisco.com to user dpotter sent on Thu Oct 02 09:46:36 CDT 2008 in state READ with subject SendMessage sent from actual number 100000 }}}

Packaging The Test Application#

1. Execute a successful build request for your test application within your IDE.

2. To package the application, execute the "cuae package" command from a DOS command shell in the parent directory of the test application.

C:\MessagingApp\MessagingApp>cuae package
Created package file "C:\MessagingApp\MessagingApp\bin\MessagingApp.mca"}}}

The following files will be added to the "\bin" sub-directory:

  • MessagingApp.mca (application bundle to be uploaded into the application server)
  • INSTALLER.xml - (contains the config items in config.yaml)
  • MANIFEST.xml - (bundle details for the package comamnd)

Installing The Test Application#

  • To install the test application on a CUAE server, execute the cuae install command from a DOS command shell in test application parent directory of the test application. The cuae install command varies slightly between 2.5(1) Beta 1 and Beta 2.

2.5(1) Beta 2#

You are prompted to enter an IP address, username, and password (to view the help, run the cuae install -h command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

Note: You are also prompted for the communications protocol (TCP or TLS). Select the protocol that is set on the Management Service. TLS is the default supported protocol. If you want to use TCP, follow the instructions in Management Service Transport Layer Security (TLS) to change the default URI of the Management Service before running these commands.

C:\MessagingApp\MessagingApp>cuae package
Created package file "C:\MessagingApp\MessagingApp\bin\MessagingApp.mca"

C:\MessagingApp\MessagingApp>cuae install Enter the hostname or IP address of the management service (for example: localhost, 1.1.1.1): localhost Protocol: tls Generated mgmt-service uri: tls://localhost:9001?TlsConnection.authReqd=false Enter management service login username: Entermanagement service login password: Save the amanagement settings with the project? [yes or no] n Application : C:\MessagingApp\MessagingApp\bin\MessagingApp.mca Uploading : ===========================> 100% Application has been installed successfully}}}

2.5(1) Beta 1#

You are prompted to enter an IP address, username, and password (to view the help, run the cuae install -h command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

C:\MessagingApp\MessagingApp>cuae package
Created package file "C:\MessagingApp\MessagingApp\bin\MessagingApp.mca"

C:\MessagingApp\MessagingApp>cuae install Enter management service uri or host/IP <for example: localhost, tcp://1.1.1.1.:4001>: Enter management service login username: Entermanagement service login password: Save the amanagement settings with the project? [YyNn] n Application : C:\MessagingApp\MessagingApp\bin\MessagingApp.mca Uploading : ===========================> 100% Application ahas been installed successfully}}}

Running the Application#

1. Run the class messagingapp.MainMessagingAppClient to register the application.

At this point the application will remain registered and running until either you stop your application or the application loses connectivity to the Unified Application server.

2. Running the application will display the command line console shown in Section 5.2.

0 Attachments
329 Views
Average (0 Votes)
The average rating is 0.0 stars out of 5.
Comments
No comments yet. Be the first.