e.g. :
Set_Custom_Property( 'BL.BEAN', 1, 'INIT_SERVER', '4450' ) ;
The event received from the Bean
SENDMSG
this event tells Forms that a message is sent by the Java Bean.
You can get it in a WHEN-CUSTOM-ITEM-EVENT event:
DECLARE
eventName varchar2(30) := :system.custom_item_event;
eventValues ParamList;
eventValueType number;
LC$Msg varchar2(32000);
LC$Value varchar2(256);
BEGIN
IF (eventName='SENDMSG') THEN
eventValues := get_parameter_list(:system.custom_item_event_parameters);
get_parameter_attr(eventValues,'MESSAGEVALUE',eventValueType, LC$Msg);
-- Socket Server OK --
If LC$Msg = '[SocketServerOK]' Then
Set_Item_Property( 'BL.START', LABEL, 'Disconnect' ) ;
:BL.STATUS := 'Connected on port ' || :BL.PORT || CHR(10) || :BL.STATUS;
Pkg_Chat.Open_Connexion( :BL.IP, :BL.PORT, :BL.NAME);
-- new connexion --
ElsIf Instr( LC$Msg, '[conn]' ) > 0 Then
bell ;
Query_Users ;
:BL.STATUS := 'Connection of ' || Replace(LC$Msg,'[conn]','' ) || CHR(10) || :BL.STATUS;
-- Deconnexion --
ElsIf Instr( LC$Msg, '[deconn]' ) > 0 Then
bell ;
:BL.STATUS := 'Disconnection of ' || Replace(LC$Msg,'[deconn]','' ) || CHR(10) || :BL.STATUS;
Query_Users ;
-- Standard message --
Else
Add_Text( Replace(LC$Msg,'^',CHR(10)) ) ;
End if ;
Synchronize ;
END IF;
END;
The sample dialog
. Download the socketserver.zip file
. Unzip the file
. run the chat.sql script on your database (The user must have access to the UTL_TCP package)
. copy the chat.jar file in the <ORACLE_HOME>/forms/java directory
. Edit your /forms/server/formsweb.cfg file
. Open the CHAT.fmb module (Oracle Forms 9.0.2)
. Compile all and run the module
the jar file must be signed.
the jar file provided in this article is already signed.