Skip Headers
Oracle® Communications Converged Application Server Developer's Guide
Release 5.1

Part Number E27707-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

3 Creating Applications with the Converged Application SCE Wizards

This chapter describes how to use the SCE wizards to create the starter code for your converged web and telecommunication applications. The classes generated by the wizards can serve as the starting point for your development.

About SCE Wizards

The SCE wizards eases the task of developing converged applications. Using the wizards, you can generate the initial code for various types of SIP services.

The SCE includes the following types of wizards:

Using the wizards, you can rapidly develop converged applications that provide services such as call control, conferencing, and other advanced communication services.

After running a wizard, you have compilable code that serves as the starting point for your development. In addition to source files for your application, the wizards produce project resources are artifacts, such as pre-populated deployment descriptor files.

About SIP Servlet Templates

When using the SIP servlet wizard, you can choose to a template on which to base your new SIP servlet. The templates correspond to the standards-defined roles for SIP servlets.

Templates are available for the following types of SIP servlet classes:

  • SIP Proxy creates a class that performs the SIP proxy functions, including providing routing capabilities and performing user authentication, accounting, registration, and security. Note that, by default, the record route flag in the generated SIP proxy class is enabled, so that the application is included in the message path for the requests sent within a dialog.

  • B2BUA creates a class that acts as a back-to-back user agent. A back-to-back user agent can act as both a user agent client and server. The class uses the helper class, javax.servlet.sip.B2buaHelper, which provides methods required by back to back user agents.

  • Subscribe UAS creates a class that subscribes to a User Agent Server (UAS).

  • Invite UAS creates a class that initiates communication sessions between UA peers.

When you choose to create the servlet based on a template, the wizard populates the new class with the stub methods appropriate for the type of SIP servlet you chose. For example, a class created with the Invite UAS template contains an empty doInvite method. After using a template, you only need to supplement the stub methods with the custom code required for your specific application requirements.

Alternatively, you can create a new SIP servlet with the wizard and choose which method stubs to include from a list of methods defined by the SIP specification.

For servlets based on any of the template types, you can add these common methods:

  • Session Key: adds the session key annotation and getKey method to the class. The session key mechanism allows incoming SIP requests of various dialogs to be correlated to an existing application session instance, so that multiple user interactions can be linked together more easily, such as for a conference call.

  • WlssAction: adds a method that implements the WlssAction API. WlssAction defines a transaction boundary to execute a series of updates in a synchronous manner.

  • WlssAsynchronousAction: represents the work to be done on a SIP application session object in an asynchronous manner. This API is useful for accessing the SIP application session from Web or EJB modules in a converged application.

The code comments included with the common methods provide more information on how to implement and use the methods. features.

Using the SIP Servlet Wizard

The Create SIP Servlet Wizard generates starter code for SIP servlets based on the options you specify in the wizard. When using the wizard, you can specify the methods in the class yourself or have the wizard populate the class with the methods based on a particular template type.

The following sections provide information about each method for creating SIP servlets with the wizard. See "About SCE Wizards" for more general information about the SIP Servlet templates.

Creating a SIP Servlet

The SIP servlet wizard can populate the methods in the starter class based on the template you choose, or by allowing you to manually select the methods to be used to populate the generated class.

This section describes how to manually select the constituent methods in the generated class. See "Creating a SIP Servlet Based on a Template" for information on creating a SIP servlet based on a template.

To create a SIP servlet:

  1. From the Eclipse main menu, choose File, New, and then Other.

    The Select a wizard dialog opens.

  2. From the list of available wizards, expand the Oracle node and then the OCCAS Application node.

  3. From the OCCAS application wizards, choose SIP Servlet and click Next.

    The first screen of the Create SIP Servlet wizard appears.

  4. In the Create SIP Servlet dialog, provide the following values:

    • Project: Choose the name of the project to which you want to add the new SIP Servlet class.

    • Source folder: The folder where the new class source file will be located. By default, this is default source code folder for the project selected.

    • Java Package: The optional name of the package to which the new class belongs.

    • Class name: The name of the new SIP servlet class.

    • Superclass name: The name of the class the new SIP servlet is extending. By default, this is javax.servlet.sip.SipServlet. You do not need to modify this value in most cases.

    The other options in the dialog can remain disabled, as they are by default.

  5. Click Next.

  6. Optionally, enter deployment descriptor parameters for the class.

    The deployment descriptor mechanism controls application selection and initialization properties. The values you add in this screen will appear in the sip.xml file for the project.

  7. Click Next.

  8. Optionally, add an interface to be implemented by the new class by clicking the Add button and choosing the interface.

  9. Choose the method stubs to be included in the class by selecting the check boxes next to the desired methods.

  10. Click Finish.

    The SIP Servlet wizard generates the Java source file based and sip.xml content based on your configuration.

You can now add your custom logic to the generated SIP servlet class. The generated source file includes TODO markers that indicate places in the code that require further development or customization.

To view a combined view of the TODO markers, open the Marker view tab and expand the Java Task node. The lists of TODO marker comments in the current file appear under the node.

Creating a SIP Servlet Based on a Template

As an alternative to selecting methods in the generated class manually, you can use templates to automatically populate the SIP servlet with the methods appropriate for the role of the SIP servlet.

To create a SIP servlet based on a template:

  1. From the Eclipse main menu, choose File, New, and then Other.

    The Select a wizard dialog opens.

  2. From the list of available wizards, expand the Oracle node and then the OCCAS Application node.

  3. From the OCCAS application wizards, choose SIP Servlet and click Next.

    The first screen of the Create SIP Servlet wizard appears.

  4. In the Create SIP Servlet dialog, specify values for the following fields:

    • Project: Choose the name of the project to which you want to add the new SIP Servlet class.

    • Source folder: The folder where the new class source file will be located. By default, this is source code folder specified for the selected project.

    • Java Package: The optional name of the package to which the new class belongs.

    • Class name: The name of the new SIP servlet class.

    • Superclass name: The name of the class the new SIP servlet is extending. By default, this is javax.servlet.sip.SipServlet. You do not need to modify this value in most cases.

  5. To have the servlet pre-configured for a specific SIP servlet role (SIP proxy, back-to-back user agent, subscribe UAS, or invite UAS) enable the Use Servlet templates option and click Next.

  6. If you chose to use a template for the new servlet, select the type of template to apply from these options:

    • Proxy, for a SIP proxy class.

    • B2BUA, for a back-to-back user agent class.

    • SUBSCRIBE UAS, for a user agent server that subscribes to INVITE events.

    • INVITE UAS, for a user agent server that generates INVITE events.

    Optionally choose the common methods to be added to the class from Session Key, WlssAction, or WlssAsynchronousAction. Note that these methods supplement those that are added based on the template type you chose. See "About SCE Wizards" for more information about the template types and common methods.

  7. Click Next.

  8. Optionally, enter a description and deployment descriptor parameters for the class.

    The deployment descriptor mechanism controls application selection and initialization parameters. The values you add in this screen will appear in the sip.xml file for the project.

  9. Click Finish.

    The SIP Servlet wizard generates the Java source file based and sip.xml content based on your configuration.

You can now customize the generated SIP servlet class with your own business logic.

The generated class includes TODO markers that indicate places in the code that require customization. The Marker view tab presents these markers as a task list. To view the list, open the Marker view tab and expand the Java Task node. The TODO markers in the current source code file appear below the node.

Using the SIP Listener Wizard

The SCE SIP listener wizard makes it easy to create SIP listener applications. A SIP listener application listens for certain types of SIP-specific events, and typically performs some processing action in response to the event.

To create a SIP listener:

  1. From the Eclipse main menu, choose File, New, and then Other.

    The Select a wizard dialog opens.

  2. From the list of available wizards, expand the Oracle node and then the OCCAS Application node.

  3. From the OCCAS application wizards, choose SIP Listener and click Next.

    The first screen of the Create SIP Listener wizard appears.

  4. In the Create SIP Listener dialog, specify values for the following fields:

    • Project: Choose the name of the project to which you want to add the new SIP Servlet class.

    • Source folder: The folder where the new class source file will be located. By default, this is default source code folder for the project selected.

    • Java Package: The optional name of the package to which the new class belongs.

    • Class name: The name of the new SIP servlet class.

    • Superclass name: Optionally, the name of the class the new SIP listener is extending.

  5. Click Next.

  6. Select at least one application event to listen for. Optionally, click the Select All button to choose all events, or Deselect All to reset your event selection.

    The available events are standard SIP-specified events, and include application events, session events, errors, timer events, and initialization events.

  7. Click Next.

  8. Optionally, specify additional interfaces to be implemented by the class. By default, the listener implements the interfaces appropriate for your event selection. You can add other interfaces in the modifier page.

    If you add an interface, specify whether it should be a public, abstract, or final interface. Also, the last panel in the wizard defines the interfaces and methods to use with the SIP Listener. Stubs are automatically created in the servlet class. You implement the servlet by developing the code for the stubs.

  9. Click Finish to create the SIP Listener.

    The SIP Servlet wizard generates the Java source file based and updates sip.xml based on your configuration.

You can now customize the generated SIP listener class with your own business logic.

The generated class includes TODO markers that indicate places in the code that require customization. The Marker view tab presents these markers as a task list. To view the list, open the Marker view tab and expand the Java Task node. The TODO markers in the current source code file appear below the node.

Using the SFT Communication Bean Wizard

A CommunicationBean is a Java class that performs the functions of a SIP or HTTP servlet while hiding the complexities of SIP and communication protocol programming.

CommunicationBeans use annotations to encapsulate common functions or roles fulfilled by communication applications. Instead of specifying the code that performs the function, you simply add the annotation to the source file. The SFT framework expands the annotation to the appropriate code.

Annotations take the form of @annotation_name, where annotation_name identifies the annotation. Some annotations take arguments, which you specify alongside the annotation. For example:

@EventOrchestration(priority = 100)

See Chapter 17, "Introduction to the Service Foundation Toolkit," for more information on CommunicationBean classes and annotations.

You can use the SCE wizard to generate CommunicationBean classes.

To create a Communication Bean with the SCE wizard:

  1. From the Eclipse main menu, choose File, New, and then Other.

    The Select a wizard dialog opens.

  2. From the list of available wizards, expand the Oracle node and then the OCCAS Application node.

  3. From the OCCAS application wizards, choose SFT CommunicationBean and click Next.

    The first screen of the Communication Bean wizard appears.

  4. In the Create SFT CommunicationBean page, specify general attributes of the CommunicationBean class, from these attributes:

    • Project: The Converged Application project in which to create the CommunicationBean class.

    • Source Folder: The project folder in which to create the source file for the class.

    • Package: The Java package to which the class will belong.

    • Class Name: The name for the new CommunicationBean class.

  5. Click Next.

    The SFT CommunicationBean Information Page appears.

  6. From the Communication Type menu, choose the SFT interface the class will extend.

    This interface determines the type of communication the new class implements, such as conferencing, conversation, IM conferencing, and so on. See Chapter 17, "Introduction to the Service Foundation Toolkit," for complete information on SFT interfaces and communication types.

  7. From the Service Attribute list, choose the annotations that you want to add to the CommunicationBean class.

    In SFT, annotations encapsulate features and characteristics provided by the communication bean. See "SFT Annotations" in Chapter 17, "Introduction to the Service Foundation Toolkit,"for information about the SFT service attributes.

  8. From the Context Member options, choose the type of communication context in which this bean will participate. Options include communication sessions, communication context, and communication service.

    See "About Communication Context Types" in Chapter 17, "Introduction to the Service Foundation Toolkit," for complete information on SFT communication context types.

  9. Click Next.

    The SFT Event Selection Wizard Page appears.

  10. Add methods to your communication bean that listen for specific events as follows:

    1. From the Event Type list, choose the event category from these options: CommunicationEvent, ParticipantEvent, or ProtocolEvent.

    2. From the Event menu, choose the specific event on which you want the method to listen. The options vary depending on the event type. For instance, for ProtocolEvent, you can choose from these specific events: REQUESTRECEIVED, REQUESTSENT, RESPONSERECEIVED, or RESPONSESENT.

    3. Optionally, modify the default priority for the method, 100.

    4. In the Method Name field, enter a name for the new method.

    5. Click Add.

      The method appears in the Event Type list.

    6. Repeat steps a through e for each method you want to add. Note that you can only create one method per event type or communication type.

  11. Click Finish to create the SIP Listener.

    The SIP Servlet wizard generates the Java source file based and updates sip.xml based on your configuration.

You can now supplement the initial code with your own custom business logic. In addition, you can use the SCE simulators and testing tools to develop and refine your application.