E-Speak integration in Together

 

    Introduction.

E-Speak integration in Together enables creating E-Speak interfaces, preparing stub and message registry, creating and testing Service provider and client classes. It is also possible to create E-Speak interfaces based on the existing interfaces. To use E-Speak integration, you should have E-Speak installed in your computer. Together installer automatically finds E-Speak and sets appropriate variables.

E-Speak integration in Together consists of E-Speak integration activation module, E-Speak classes generation module, Client and Service provider generation patterns and client and service provider starter modules. All these elements are described below.

1. E-Speak Integration Activation Module

E-speak integration activation module is intended to activate/deactivate E-Speak integration in Together. To activate this module, select All Modules/Early Access/HP E-speak/HP E-Speak Integration on the Modules tab of the Explorer.

Behavior of the module depends on the current state of E-Speak integration. Briefly, this module activates E-Speak integration if it is activated and vise versa. When the module is activated, it enables HP E-Speak Integration command on the Tools menu, that displays the following dialog:

Message line above the buttons displays the current state of E-Speak integration.

"HP-ES Integration State" section is used to select whether to activate E-Speak integration or just change properties, using this dialog.

If you want to use Together to test your client or service provider, you can start E-Speak core from Together, checking "launch HP-ES core" checkbox in the "E-Speak core section" .

In the "HP ES integration properties" section you can set path to E-Speak installation and E-Speak repository. These values are set up by installation and in most cases should not be changed.

In the typical scenario you can just press "OK" in this dialog. After that E-Speak activation integration is activated. Visible indications of this are:

If the core has already been launched, the same command shows the following dialog:

Typically "HP-ES Integration" section only is used. You can deactivate E-Speak support or restart the core. Visible indications of this are opposite to activation. It is recommended to deactivate E-Speak integration before you quit Together, if you had activated it with E-Speak Core.

When HP-ES Integration activates, additional tab page is added to Together message pane, that displays all HP-ES related messages:

    2. Using Together for E-Speak Modeling

    When E-Speak integration is activated, Together can be used for E-Speak modeling. In the diagram toolbar you can see a "chess icon" that allows to create an empty E-Speak interface:

    Having created an interface, you can add methods as usual. The difference is that when you add methods to E-Speak interface, the necessary throws statement is generated.

    You can also use your existing interfaces as the prototypes for ESpeak interfaces. This process is described in the next section.

    3. Generate HP-ES Classes

After activation of E-Speak support "HP-ES support/Generate HP-ES classes" command is added to the interface speedmenu. This command is used for three main purposes:

Refactoring is used of you invoke this module on a non-ESpeak interface. In this case, your interface is not changed but is used as the base for generating an ESpeak interface. For example, consider the following interface:

public interface Interface1 {

void operation1();

}

Refactoring produces a new interface:

public interface EInterface1 extends ESService {

void operation1() throws ESInvocationException ;

void test() throws ESInvocationException ;

}

Stub and message registry is generated same way as in the standard E-Speak tool.

Default implementation is generated if there is no other implementation of this interface. In this example the following code will be generated:

public class Einterface1Impl implements EInterface1 {

public void operation1() throws ESInvokationException {

javax.swing.JOptionPane.showMessageDialog(null, "method 'operation1'

invoked in Serviceimplementation", "Service Implementation", javax.swing.JOptionPane.INFORMATION_MESSAGE);

return;

}

public void test() throws ESInvokationException {

javax.swing.JOptionPane.showMessageDialog(null, "method ‘test’ invoked

in Service implementation", "Service Implementation", javax.swing.JOptionPane.INFORMATION_MESSAGE);

return;

}

}

Call to JOptionPane (simple message box invocation) & test() method is automatically generated and will be used further in pattern-generated Client & Service Provider classes.

The following screenshot shows Together diagram after generating HP-ES Classes for a default HP-ES Interface :

 

    4. Generate and Test an ESpeak Service Provider

After generating ESpeak interfaces and all the necessary auxiliary classes, you can pass to the generation of a Service Provider class. For this purposes Together pattern mechanism is used. Choose "Class by pattern" button on the diagram toolbar. Select HP E Speak/Service Provider pattern and press "Finish" button. You will see the following dialog:

When you press Finish , a service provider class is generated. You can test this class with ESpeak core, if it is launched by the activation module. First, compile all the necessary classes. To do this, i nvoke speedmenu and select Make or use Tools | Make command on the main menu. Then invoke speedmenu for the service provider class and select HP-ES Integration | Register HP-ES service in core . Service will be registered in the core, and an appropriate message will be displayed in HP-ES Integration page of the message pane. The following screenshot shows Together diagram and message pane state, after registration of the Service in HP-ES Core:

    5. Generate and Test an ESpeak Client

Now, having your Service Provider up and running, you can test how it works. For that create and run the Client class,  using Together. Select HP E Speak/Client using Class by Pattern button on the diagram toolbar and press Finish:

When you press Finish button, a Client class is generated. You can compile the generated class, using Make command on the speedmenu, or Tools | Make on the maon menu. After compilation, the generated class can be tested (if HP-ES Core was launched & HP-ES Integration activated). To test the class, invoke HP-ES Integration | Test HP-ES Client menu command on the Client class. Screenshot below represents Together diagram & message pane state after generating & testing of the Client class :

When the Client class is being tested, a MessageBox shows up to indicate that the Service side implementation has received the Client message through HP-ES Core :