HelloImpl.jcs Sample

This topic inludes the source code for the HelloImpl.jcs Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebServices/localControls/basics/

Sample Source Code


01 package localControls.basics; 
02 
03 /**
04  * This control offers a simple "Hello, World!" response. It illustrates
05  * a Java control at its most basic.
06  
07  * Java controls you create, like this one, will include at least
08  * two files that contain source code. One, a JCS file such as this
09  * one, contains the control's implementation code; this defines what
10  * the control's methods do. The other file, a control interface file such
11  * as Hello.java, contains the control's public interface; it defines 
12  * the list of methods and callbacks the control exposes. The control
13  * implementation file "implements" the interface, putting meaningful
14  * logic behind the interface.
15  
16  * When you are designing and building a Java control, you will likely
17  * never need to manually edit the interface file. If you keep the 
18  * code-gen annotation's control-interface attribute (below) set to
19  * "true", WebLogic Workshop will keep the interface in sync with the
20  * implementation as you edit the JCS file.
21  
22  * Another interface a Java control implements, ControlSource, enables
23  * the control to be serializable. This is essential for a class
24  * that contains data that should be preserved throughout a 
25  * conversation, and allows a Java control to be used by conversational
26  * web services.
27  
28  * Other annotations at the top of the source code specify the
29  * group under which the control should appear in WebLogic 
30  * Workshop menus, the description that should appear in the 
31  * Property Editor, its name in the IDE, and so on. 
32  
33  * @jcs:jc-jar 
34  *  label="Hello Control"
35  *  palette-priority="3" 
36  *  group-name="SampleControls"  
37  *  version="1.0" 
38  *  description='A simple Java control with a "Hello World" message.' 
39  * @editor-info:code-gen control-interface="true"
40  */
41 public class HelloImpl implements Hello, com.bea.control.ControlSource
42 
43     /**
44      * Test the Hello control using the LocalControlTest web service.
45      
46      * @common:operation
47      */
48     public String sayHello()
49     {
50         return "Hello, World!";
51     }
52