Extension SDK for BEA WebLogic Network Gatekeeper
Creating an example network plug-in
The following section provides a description on how to create an example network protocol plug-in:
In this section, the example network plug-in is described.
The plug-in consists of two parts:
- a SLEE service part that executes as a SLEE service
- A Web Services part that executes as a Web Service
The SLEE service part of the example plug-in has the following properties:
- Package:
com.acompany.plugin.myplugintype
- Interface used by ESPA service capability:
MyPlugin
- Interface used by the network plug-in acting on the ESPA service capability:
MyPluginListener
- Method implemented by the plug-in, defined in the plug-in interface:
myMethodReq
myDeliverNetworkTriggeredEventMethodResult
myDeliverNetworkTriggeredEventMethodError
- Methods invoked from the plug-in:
MyMethodRes
MyMethodErr
myDeliverNetworkTriggeredEventMethod
- Type for the plug-in:
MYPLUGIN_TYPE
- Address format supported: E164
- Project names:
plugin_if
and plugin_impl
- Product names:
My_Plugin_IF
and My_Plugin_Impl
- Jar file names:
plugin_myplugin_if.jar
and b_plugin_myplugin.jar
The Web Services part of the example plug-in has the following properties:
- Package: com.acompany.wplugin.myplugintype
- Interface used by the SLEE Service part of the plug-in service capability:
MyPluginNetworkInterface
- Interface used by the Web Service network plug-in acting on the SLEE part of the plug-in: MyWPluginNetworkTriggeredEventResultListener
- Method implemented by the Web Services network plug-in, defined in the plug-in interface:
- my
MethodReq
myDeliverNetworkTriggeredEventMethodResult
myDeliverNetworkTriggeredEventMethodError
- Methods used by the plug-in, invoked from the plug-in:
MyMethodRes
MyMethodErr
myDeliverNetworkTriggeredEventMethod
- Project names:
wplugin_if
and wplugin_impl
- Product names:
wplugin_if
and wplugin_impl
- Jar file names:
wplugin_if.jar
and wplugin.war
General preparations for the SLEE part of the plug-in
- Make sure the files for the SLEE plug-in and SLEE plug-in interfaces are copied to the directory
exampleproj.
That is, all files and directories in module_templates\plugin_impl and module_templates\plugin_if
.
- Make sure the files for the Web Services part of the plug-in interfaces are copied to the directory
exampleproj.
That is, all files and directories in module_templates\wplugin_if
and module_templates\wplugin_impl
- Change directory to
bea\wlng21\esdk\exampleproj\build
and issue the command ant
Preparing the SLEE plug-in interface
Set up the build environment
- Edit the file
exampleproj\plugin_if\build.xml
.
Define the plug-in interface structure
- In the file
exampleproj\plugin_if\idl\my_plugin_if.idl
, change the plug-in interface structure to reflect the desired package structure. For example, the structure:
module com {
module acompany{
module myplugintype{
Will create the plug-in structure com.acompany.
myplugintype
Interfaces in the plug-in
These interfaces are defined:
MyPluginListener
, which will be implemented by the ESPA service capability implementation.
MyPlugin
, which will be implemented by the plug-in implementation.
MyPluginNetworkTriggeredEventListener
, which will be implemented by the ESPA service capability implementation.
MyPluginNetworkTriggeredEventResultListener,
which will be implemented by the plug-in implementation.
In the example two methods related to application-initiated request will be called from by the plug-in to the ESPA service capability, myMethodRes
and myMethodErr
. Both methods are responses to the operation exampleMethodReq
, invoked by the ESPA service capability and implemented by the plug-in.
myMethodRes
will be invoked if the operation myMethodReq
was successful
myMethodErr
will be invoked if the operation myMethodReq
failed.
assignmentID
is the ID that connects an invocation to myMethodReq
and the corresponding invocation of myMethodRes
or myMethodErr.
In the example one method related to network initiated request will be called from by the plug-in to the ESPA service capability, myDeliverNetworkTriggeredEventMethod
. This method is used to deliver network triggered events to the ESPA service capability. As a response to a network triggered event, the following methods will be invoked from the ESPA service capability:
myDeliverNetworkTriggeredEventMethodResult
will be invoked if the operation myDeliverNetworkTriggeredEventMethod
was successful
myDeliverNetworkTriggeredEventMethodError
will be invoked if the operation myDeliverNetworkTriggeredEventMethod
failed.
networkTransactionId is the ID that connects an invocation to myDeliverNetworkTriggeredEventMethod
and the corresponding invocation of myDeliverNetworkTriggeredEventMethodResult
or myDeliverNetworkTriggeredEventMethodError.
- Add or change additional methods to be used in the interface between the ESPA service capability and the plug-in. Use the definitions in
exampleproj\plugin_if\idl\my_plugin_if.idl
as templates.
Compilation of the SLEE plug-in interface
- Compile the Web Services plug-in interface by changing directory to
exampleproj\wplugin_if
and execute the command ant
This compiles the interface between the SLEE plug-in and the Web services part of the plug-in to be used by the SLEE plug-in implementation.
- Compile the SLEE plug-in interface by changing directory to
exampleproj\plugin_if
and execute the command ant
This compiles the SLEE plug-in interface, and generates Java and CORBA files to be used by the plug-in implementation.
Preparing the SLEE plug-in implementation
Set up the build environment
- Edit the file
exampleproj\plugin_impl\build.xml
.
Note: Always use a prefix in the jar name. The autostarted SLEE services are started in alphabetic order based on the jar name. All network plug-ins should have a prefix so they are started prior to the ESPA service capability modules.
Defining the plug-in OAM methods
- Edit the files
exampleproj\plugin_impl\idl\MyPluginOAM.idl.
Define any additional OAM methods.
Adapting the plug-in interface implementation
- Edit the file
MyPlugin_impl.java
in exampleproj\plugin_impl\src\com\acompany\plugin\myplugintype.
- If the name of the interface in the plug-in has changed, change the name of the POA the class extends to reflect the new name.
- If the methods in the plug-in interface has changed, also change the names of the implementing methods in this class.
- Edit the file
MyMethodReqTask.java
in exampleproj\plugin_impl\src\com\acompany\plugin\myplugintype
Adapt the methods so they use call-back methods defined in the plug-in interface as defined in Interfaces in the plug-in.
Plug-in type definition
Each plug-in has a type definition and information on supported address plans.
- Edit the file
MyPluginContext.java in exampleproj\plugin_impl\src\com\acompany\plugin\
and change the PLUGIN_TYPE
definition to the desired type.
Define which address plan(s) that is (are) supported in the TrAddressPlan[]
structure.
As default, the address plan is TrAddressPlan.R_ADDRESS_PLAN_E164
, see the JavaDoc for the ESPA service capability and plug-in interfaces for a list of address plans.
Compilation of the SLEE plug-in implementation
Compile the plug-in implementation by changing directory to exampleproj\plugin_impl
and execute the command ant
Installing the SLEE plug-in
This section describes how to install and deploy the plug-in that was created using the instructions in this section. For instructions on how to use the Management Tool and how to register a plug-in in more detail, see WebLogic Network Gatekeeper User's Guide.
- Make sure you have access (by ftp directly to the file system) to the SLEE the plug-in shall be installed in.
- Open the Management Tool and select the SLEE where to install the plug-in.
- In the management tool, select the Plugin_Manager service, and invoke the method
addType
. Use the type defined for the plug-in.
In the example, the plug-in type is MYPLUGIN_TYPE,
as defined in
step 18. in Plug-in type definition.
- In the SLEE_deployment service, select install. Enter the URL to the jar-file in the field ServiceJarURL and click Invoke.
In the example, the path is:
file:///<drive>/exampleproj/plugin_impl/lib
and the name was defined in the build file property local.jarName.
Note: Use three (3) slashes before the drive name on Windows systems.
- In the SLEE_deployment service, select start. Enter the SLEE name for the plug-in. Click Invoke.
The name was defined in the build file property local.deployName.
- In the SLEE_deployment service, select activate. Enter the SLEE name for the plug-in. Click Invoke.
Setting up a plug-in route
It is necessary to define a route, so the plug-in can be selected by the plug-in manager.
- In the management tool, select the Plugin_Manager service, and invoke the method getIdList. Do not define any parameters.
An ID for the plug-in is returned.
- In the management tool, choose the Plugin_Manager service, and invoke the method addRoute. In the Id field, enter the ID returned from the previous operation.
In the addressExpression field, enter ^.*
in order make the plug-in accept all destination address numbers, or other routing criteria that is desired.
General preparations for the Web Services part of the plug-in
- Make sure the files for the Web Service plug-in and plug-in interfaces are copied to the directory
exampleproj.
That is, all files and directories in module_templates\wplugin_impl and module_templates\wplugin_if
.
- Change directory to
bea\wlng21\esdk\build
and issue the command ant
Preparing the Web Services plug-in interface
Set up the build environment
- Edit the file
exampleproj\wplugin_if\build.xml
.
Interfaces in the plug-in
There are three interfaces defined:
MyWPluginNetworkInterface
, which will be implemented by the Web Services part of the plug-in and the request is passed on to the network.
MyWPluginNetworkTriggeredEventListener
, which will be implemented by the SLEE Service part of the plug-in implementation.
MyWPluginNetworkTriggeredEventResultListener
, which is implemented Web Services part of the plug-in.
In the example these methods will be called from the SLEE service part of the plug-in to Web Services part of the plug-in.
myNetworkMethod
will be invoked as a result of an application triggered request.
myDeliverNetworkTriggeredEventMethod
will be invoked on the SLEE part of the network plug-in as a result of a network triggered event.
myDeliverNetworkTriggeredEventMethodResult
or myDeliverNetworkTriggeredEventMethodError
will be invoked on the Web Services part of the plug-in by the SLEE part of the network plug-in as a result of a network triggered event.
- Add or change additional methods to be used in the interface between the SLEE service part of the network plug-in and the Web Services part of the plug-in. Use the definitions in
exampleproj\wplugin\myplugintype
as templates.
Compilation of the Web Services part of the plug-in interface
- Compile the plug-in interface by changing directory to
exampleproj\wplugin_if
and execute the command ant
This compiles the plug-in interface.
Preparing the Web Services part of the plug-in implementation
Set up the build environment
- Edit the file
exampleproj\plugin_impl\build.xml
.
Note: Always use a prefix in the jar name. The autostarted SLEE services are started in alphabetic order based on the jar name. All network plug-ins should have a prefix so they are started prior to the ESPA service capability modules.
Adapting the Web Services plug-in interface implementation
- Edit the file
NetworkInterfaceImpl.java, MyWPluginNetworkTriggeredEventResultListenerImpl.java
and MyWPluginServlet.java
in exampleproj\wplugin_impl\src\com\acompany\wplugin\myplugintype.
- If the names of the interfaces has changed, change the name of the names the classes implements to reflect the new name.
- If the methods in the interfaces has changed, also change the names of the implementing methods in this class.
Compilation of the Web Services plug-in implementation
Generate Java stubs from the WSDL file that describes the interface between the Web Services part of the plug-in and the network node, by changing directory to exampleproj\network_if
and execute the command ant
Compile the Web Services plug-in implementation by changing directory to exampleproj\wplugin_impl
and execute the command ant
Installing the Web Service plug-in
This section describes how to install and deploy the Web Services plug-in that was created using the instructions in this section. For instructions on how to use the Management Tool, see WebLogic Network Gatekeeper User's Guide.
- Make sure you have access (by ftp directly to the file system) to the SLEE the plug-in shall be installed in.
- Copy the generated war file to the
/<install dir>/slee/bin/autowar
directory in the Network Gatekeeper.
- Open the Management Tool and select the SLEE running on the server the file was copied to.
- In the Embedded_tomcat service, choose addContext. Enter the following parameter data:
Parameter
|
Description
|
contextPath
|
The context path to be used. For example: /exampleContext
The Web Service will be reached in the following URL:
http://<IP-address>:<port>/<contextPath>/services/<method>
|
docBase
|
Document root. Can be a war-file or a directory. Can be specified with an absolute or a relative path name or an URL. In the example the files are stored in: /usr/local/slee/bin/autowar/ <name of war file>.war
|
useCookies
|
Enable cookies (TRUE/FALSE) for session handling. Use FALSE.
|
autostart
|
Start this context during next service restart (TRUE/FALSE). Use TRUE.
|
The Web Service part of the plug-in is started.