JEUS WebT Copyright 2004 Tmax Soft Co, Ltd All Rights Reserved
Copyright Notice Copyright 2004 Tmax Soft Co, Ltd All Rights Reserved Tmax Soft Co, Ltd 946-1 18 )135-708 Restricted Rights Legend This software and documents are made available only under the terms of the Tmax Soft License A greement and may be used or copied only in accordance with the terms of this agreement No part of this document may be reproduced, transmitted, or translated in any form or by any means, electr onic, mechanical, manual, or optical, without the prior written permission of Tmax Soft Co, Ltd TmaxSoft,, TmaxSoft Co, Ltd,,,,, Trademarks Tmax, WebtoB, WebT, and JEUS are registered trademarks of Tmax Soft Co, Ltd All other product names may be trademarks of the respective companies with which they are assoc iated Tmax, WebtoB, WebT, JEUS TmaxSoft Co, Ltd Document info Document name: JEUS WebT Document date: 2004-5-20 Manual release version: 2 Software Version: JEUS 42 2 Tmax Soft
JEUS WebT JEUS 1 2 15 WebT 17 21 17 22 WebT 17 23 WebT 18 24 WebT Java API 18 25 WebT-Server System 18 26 18 3 WebT 19 31 19 32 webtproperties 19 33 webtproperties 24 34 25 4 WebT API 27 41 27 42 WebtConnection 27 43 WebtConnectionGroup 27 44 WebtConnectionPool 27 45 WebtRemoteService 28 46 WebtDialogueService 29 47 WebtEventConnection 29 48 WebtEventHandler 31 49 WebtTransaction 31 410 WebtConnectionInfo 31 411 31 Tmax Soft 3
JEUS JEUS WebT 5 WebT 33 51 (Synchronous Communication) 33 511 33 512 34 513 make 34 514 35 52 (Asynchronous Communication) 36 521 36 522 37 523 make 38 524 39 53 (Conversational Communication) 40 531 40 532 41 533 make 42 534 44 54 Unsolicited Message Service 44 541 44 542 48 543 49 544 51 55 51 551 52 552 54 553 make 55 554 57 56 JSP 58 4 Tmax Soft
JEUS WebT JEUS 561 58 562 59 563 make 60 564 61 57 Servlet 62 571 62 572 65 573 make 67 574 69 58 Applet 69 581 70 582 71 583 make 73 584 74 59 EJB 75 591 75 592 78 593 make 79 594 83 510 RQ 84 5101 84 5102 85 5103 make 86 5104 87 511 (Asynchronous Event Service) 88 5111 88 5112 89 Tmax Soft 5
JEUS JEUS WebT 5113 make 90 5114 92 6 WebT-Server System 93 61 93 62 WebT-Server System 94 63 WebT Server 94 631 WebT-Server Binary 95 632 EJB 95 633 jtmax Startup/Shutdown 95 634 jtmax Operation Environment Configuration 96 635 FieldKey 97 64 JEUSGW 98 641 WebT-Server 98 642 Tmax 98 643 JEUS 100 65 WebT-Server 101 651 101 652 102 653 106 654 111 7 A 113 WebT API Reference 115 A1 115 A2 Package [tmaxwebt] 115 class WebtAttribute 115 abstract class WebtBuffer 120 class WebtConnection 131 class WebtConnectionGroup 137 6 Tmax Soft
JEUS WebT JEUS class WebtConnectionInfo 139 class WebtConnectionPool 141 class WebtRemoteService 151 class WebtRQService 159 class WebtEventConnection 168 Interface WebtEventHandler 175 class WebtDialogueService 176 class WebtTransaction 179 class WebtSystem 183 class WebtFDLKeyTable 185 class WebtField 187 Interface WebtFieldElement 201 class WebtFieldSet 205 class WebtException 226 class WebtDialogueException 230 class WebtTXException 232 234 Tmax Soft 7
JEUS JEUS WebT Java WebT Tmax Server Tmax server Client/Server program JEUS Web Application JEUS WebContainer manual Tmax Application program manual 7 1 1 : WebT 2 WebT : WebT 3 WebT : WebT 4 WebT : WebT 5 WebT : WebT Web 6 WebT Server System: WebT Server 7 A WebT API Reference 8 Tmax Soft
JEUS WebT JEUS J2EE 13 Specification Servlet 23 Specification JSP 12 Specification JEUS Web Container WebT18 Application Guide Tmax Application Guide Tmax RQ Application Guide CTRL+C public class myclass { Java <SystemConfig> XML / Configuration GUI jeusadmin nodename [] Tmax Soft 9
JEUS JEUS WebT OR?, +, * XML,,,, XML 1 Asynchronous communication A B B C forward, Web 10 Tmax Soft
JEUS WebT JEUS FDL Field Definition Language FDL (Field Buffer) C FDL JEUS Tmax Soft Co, Ltd JAVA Enterprise User Solution JEUS JeusGW Tmax JEUS (JeusGW) (Gateway) jtmax jtmax WebT-Server, Tmax JEUS EJB JEUS, JEUS Tmax RQ Reliable Queue,,, Tmax RQ RQ Tmax Soft 11
JEUS JEUS WebT Synchronous communication, Tmax TP TP-monitor Tmax Soft Co, Ltd TP monitor Transaction Processing Monitor,, TP - Client/Server TP -,, - Unsolicited message, 12 Tmax Soft
JEUS WebT JEUS WebT WebT Web Transaction, Java Tmax JEUS WebT-Server WebT-Server Tmax JEUS WebT Java Tmax, WebT-Server Tmax JEUS EJB Tmax Soft 13
JEUS JEUS WebT Korea Tmax Soft Co, Ltd 18F Glass Tower, 946-1, Daechi-Dong, Kangnam-Gu, Seoul 135-708 South Korea Tel: 82-2-6288-2114 Fax: 82-2-6288-2115 Email: info@tmaxcokr Web (Korean): http://wwwtmaxcokr USA Tmax Soft, Inc 560 Sylvan Ave, Englewood Cliffs NJ 07632 USA Tel: 1-201-567-8266 FAX: 1-201-567-7339 Email: info@tmaxsoftcom Web (English): http://wwwtmaxsoftcom Japan Tmax Soft Japan Co, Ltd 6-7 Sanbancho, Chiyoda-ku, Tokyo 102-0075 Japan Tel: 81-3-5210-9270 FAX: 81-3-5210-9277 Email: info@tmaxsoftcojp Web (Japanese): http://wwwtmaxsoftcojp China Beijing Silver Tower, RM 1507, 2# North Rd Dong San Huan, Chaoyang District, Beijing, China, 100027 Tel: 86-10-6410-6148 Fax: 86-10-6410-6144 E-mail : info@tmaxchinacomcn Web (Chinese): http://wwwtmaxchinacomcn 14 Tmax Soft
JEUS WebT JEUS 1 WebT Web Transaction C/S Tmax Web WAS(Web Application Server) JEUS WWW WWW CGI, JSP, Servlet, Applet, PHP,, WWW, TP Monitor TP Monitor, TP Monitor (Load balancing) WWW,, WebT Tmax Tmax Soft 15
JEUS JEUS WebT 16 Tmax Soft
JEUS WebT JEUS 2 WebT 21 WebT WebT WebT WebT Java API WebT-Server system 22 WebT 1 WebT Tmax Soft 17
JEUS JEUS WebT 23 WebT WebT webtproperties WebT logging, Tmax server WebT 3 24 WebT Java API WebT Tmax(TP -Monitor) WAS WAS, WAS Java C TP- Monitor WebT Java Applet, Servlet Tmax(TP -Monitor) WebT Java API 5 6 B WebT API WebT 25 WebT-Server System WebT-Server system JEUS Web Application Server Tmax Gateway WebT Java client Tmax service WebT-Server Tmax JEUS EJB service WebT-Server system 6 26 WebT, Web container-hosted WebT connection pool, WebT WebT-Server system 18 Tmax Soft
JEUS WebT JEUS 3 WebT 31 webtproperties WebT WebT, WebtSystem API webtproperties 32 webtproperties webtproperties # # logging related parameters ############################ # set log level valid values are none, info, debug default is #none loglevel=none # set directory in which the log file places if not set, log is # printed to standard out logdir=/tmp # set the name of the log file default is webtlog logfile=webtlog # set log buffering size default is 0 #logbufsize=1024 # # FDL related parameters ######################## # set the fdl file #fdlfile=/east/hope/prod/jeus/system/tmaxfdl # # pipe related paramters ######################## Tmax Soft 19
JEUS JEUS WebT # enable/disable pipe default is disable(false) #pipe=false # # input/output buffer size parameter # set input buffer size default is 4096 minimum is 1024 #inbufsize=4096 # set output buffer size default is 4096 minimum is 1024 #outbufsize=4096 # set application wide default character set default is system #default defaultcharset=euc-kr # Tmax 311x extended Header size #extendedheader=true # # monioring related parameter ################################### # enable/disable alive check default is disable(false) # monitoringpoolcheckalive=true # enable/disable idle check default is disable(false) # monitoringpoolcheckidle=true # set monitoring interval default is 60sec # monitoringpoolinterval=5 # set monitoring log file valid-daysdefault is -1 # monitoringlogvaliddays=1 # enable/disable webtproperties modify Default is #disable(false) # enablemodify=false # connection pool realted paramter ################################### # enable/disable connection pool default is disable(false) #enableconnectionpool=true # WebtConnectionGroup name list #connectionpoolgroups=tmax1 # set connection group type valid values are shared, non-shared, # non-shared2 default is shared #connectionpooltmax1type=shared # set Tmax Server Address #connectionpooltmax1hostaddr=127001 20 Tmax Soft
JEUS WebT JEUS # set Tmax Server Port #connectionpooltmax1hostport=8889 # set Backup Tmax Server Address #connectionpooltmax1hostbackupaddr=127001 # set Backup Tmax Server Port #connectionpooltmax1hostbackupport=8889 # set default user name for security #connectionpooltmax1username=tmax # set default user passward for security #connectionpooltmax1userpasswd=1234 # set default domain name for security #connectionpooltmax1domainname=choco # set default domain passward for security #connectionpooltmax1domainpasswd=1234 # set initial pool size default is 10 #connectionpooltmax1initcapacity=1 # set max pool size default is 20 #connectionpooltmax1maxcapacity=10 # set increment step size default is 5 #connectionpooltmax1incrementrate=2 # set connection idle time default is 60sec #connectionpooltmax1maxidletime=60 # set tptimeout #connectionpooltmax1tptimeout=40 # set txtimeout #connectionpooltmax1txtimeout=10 # set connection timeout #connectionpooltmax1connecttimeout=10 # enable to event service #connectionpooltmax1enableevent=true # set event service Type #connectionpooltmax1eventsvctype=acall # set event handler object #connectionpooltmax1eventhandler=eventgenericeventhandler loglevel (default:none) : WebT log level none info debug loglevel info monitoring thread Tmax Soft 21
JEUS JEUS WebT WebT log webt connection pool logdir(default:stdout) : WebT log file Windows \ \\ logfile(default:webtlog) : WebT log file name logbufsize(default:1024) : log file buffering size fdlfile : fdl file pipe(default:false) : WebT Tmax server inbufsize(default:4096) : Tmax outbufsize(default:4096) : Tmax defaultcharset(default: system default charset) : WebtSystemsetDefaultCharset(javalangString charset) extendedheader(default:false) : Tmax Header 311x monitoringpoolcheckalive(default:false) : ConnectionPool connection monitoringpool checkidle(default:false) : ConnectionPool connection idle Monitoringpool interval(default:60sec) : ConnectionPool connection MonitoringpoolvalidDays : webt log file 0 enableconnectionpool: run-time webtproperties loglevel true webtproperties loglevel connectionpoolgroups(default:false) : WebtConnectionPool connectionpoolgroups : WebtConnectionPool WebtConnectionPoolGroup name list 22 Tmax Soft
JEUS WebT JEUS connectionpool<groups>type : WebtConnectionPoolGroup shared non-shared non-shared2 shared non-shared non-shared2 JEUS Engine <groups> connectionpoolgroups connectionpool<groups>hostaddr : WebtConnectionPoolGroup connection Tmax server host address connectionpool<groups>hostport : WebtConnectionPoolGroup connection Tmax server connectionpool<groups>hostbackupaddr : WebtConnectionPoolGroup connection Main Tmax server Backup Tmax server connection Backup Tmax server host address connectionpool<groups>hostbackupport : WebtConnectionPoolGroup connection Main Tmax server Backup Tmax server connection Backup Tmax server connectionpool<groups>username : Tmax server Tmax server connectionpool<groups>userpasswd : Tmax server Tmax server connectionpool<groups>domainname : Tmax server Tmax server domain domain name connectionpool<groups>domainpasswd : Tmax server Tmax server domain domain password connectionpool<groups>initcapacity : WebtConnectionPoolGroup connection connection connectionpool<groups>maxcapacity : WebtConnectionPoolGroup connection connectionpool<groups>incrementrate : WebtConnectionPoolGroup connection thread connectionpool<groups>maxidletime : connection pool maxidletime idle connection connection connection pool inicapacity Tmax Soft 23
JEUS JEUS WebT connectionpool<groups>tptimeout : Tmax Server service :sec connectionpool<groups>txtimeout : Tmax Server :sec connectionpool<groups>connecttimeout : Tmax Server connection connection timeout connection close :sec connectionpool<groups>enableevent : WebtEventConnection pooling service connectionpool<groups>eventsvctype : WebtConnectionPool connection WebtEventConnection event service type broadcast, acall, notify, sendtocli, all Tppost connectionpool<groups>eventhandler : WebtConnectionPool WebtEventConnection WebtEventHandler implement handler object : # 33 webtproperties 1 classpath webtproperties ( : ClassLoadergetResourceAsStream( webtproperties ) ) JEUS, webtproperties Webt JEUS classpath $JEUS_HOME/lib/application JEUS webtproperties : JEUS, 1 webtproperties default $JEUS_HOME/config/<nodename>/<nodename>_s ervlet_<engine>/ webtproperties 24 Tmax Soft
JEUS WebT JEUS 2 JEUSMainxml <command-option> Dwebtproperties= webt properties properties 3 1, 2 webtproperties 4 Applet Service Applet webtproperties, webtproperties applet tag codebase 5 Applet webtproperties fdl fdl codebase fdlfile / WebT webtproperties fdlfile / 6 Applet, Servlet Java fdl 34 webtproperties WebT WebT API Tmax Soft 25
JEUS JEUS WebT 26 Tmax Soft
JEUS WebT JEUS 4 WebT API 41 WebT Class 42 WebtConnection WebtConnection Tmax Server WebT communication Tmax Server service WebtConnection 43 WebtConnectionGroup WebtConnection / WebtConnection, WebtConnectionPool creategroup() 44 WebtConnectionPool WebtConnectionPool WebtConnectionManager connection pool WebtConnectionPool tmax WebtConnection WebtConnectionPool Tmax WebtConnection, WebtConnection, Tmax / WebtConnectionPool 1 tmax connection pool 2 connection pool monitoring idle Tmax Soft 27
JEUS JEUS WebT 2 tmax (1921681281:8889, 1921681282:8889) connection pool WebtConnectionPool WebtConnectionPoolcreateGroup("tmax1","1921681281",8889,2,10, 2); WebtConnectionPoolcreateGroup("tmax2","1921681282",8889,4,10, 1); WebtConnectionPool WebtConnection WebtConnectionPoolcreateGroup groupname WebtConnection try { // tmax1 group (1921681281:8889) // WebtConnection WebtConnection con = WebtConnectionPoolgetConnection("tmax1"); catch (WebtIOException wioe) { Systemoutprintln( "fail to get WebtConnection of tmax1" ); return; WebtRemoteService service = new WebtRemoteService("MYSVC", con); // WebtConnection WebtConnectionPoolputConnection(con); 45 WebtRemoteService WebtConnection Tmax Service API Tmax service WebtService 28 Tmax Soft
JEUS WebT JEUS 46 WebtDialogueService tmax WebtConnection connection = WebtConnectionPoolgetConnection("tmax1"); WebtDialogueService dialogue = new WebtDialogueService("CONVTEST", connection ); try { dialoguetpconnect(false); int count = 1; WebtBuffer sndbuf = dialoguecreatestringbuffer(); WebtBuffer rcvbuf = null; while(true) { sndbufsetstring("client msg " + count); dialoguetpsend(sndbuf, true); rcvbuf = dialoguetprecv(); Systemoutprintln("tprecv ok : " + rcvbufgetstring()); if (!dialogueissendnext()) break; //server tpreturn() rcvbuf = dialoguetprecv(); Systemoutprintln("conv end : " + rcvbufgetstring()); catch (WebtDialogueException de) { deprintstacktrace(); catch (WebtServiceFailException se) { seprintstacktrace(); catch (WebtException e) { eprintstacktrace(); finally { connectionclose(); 47 WebtEventConnection Tmax Server (tppost/tpnotify/tpsendtocli/tpbroadcast/tpacall) WebtConnection Tmax Server WebtEventConnection Tmax Server callback WebtEventHandler seteventhandler(webteventhandler) Tmax Soft 29
JEUS JEUS WebT tppost import tmaxwebt*; public class EventSample implements WebtEventHandler { private WebtEventConnection connection; public EventSample(WebtEventConnection connection) { thisconnection = connection; // tpbroadcast event mask connectionseteventmask(webteventconnectionevent_post); // event handler connectionseteventhandler(this); // event connectiontpsubscribe("posttest"); public void destroy() { connectiontpunsubscribe("posttest"); connectionclose(); // WebtEventHandler event message // callback public void handleevent(int type, WebtBuffer buf, int len, int flags) { Systemoutprintln("event received type = " + type + ", buffer type = " + bufgetbuffertype()); Systemoutprintln("event msg : " + bufgetstring()); // WebtEventHandler WebT event Exception // callback WebtIOException // Tmax Server connection // reconnect public void handleerror(webtexception e) { Systemerrprintln("event error occured"); eprintstacktrace(); if (e instanceof WebtIOException) { if (egettperror() == WebtExceptionTPECLOSE) { connectionclose(); connectionconnect(); 30 Tmax Soft
JEUS WebT JEUS 48 WebtEventHandler tmax server tpsendtocli, tpbroadcast, tpnotify, tppost 49 WebtTransaction Service, API, 410 WebtConnectionInfo WebtConnectionInfo WebtConnection WebtConnection WebtConnectionInfo info = new WebtConnectionInfo(); // set tmax host address as 127001 infosetattribute(infotmax_address, "127001"); // set tmax host port as 8889 infosetattribute(infotmax_port, 8889); // set socket connect timeout as 30 sec infosetattribute(infoconnect_timeout, 30); // constructs WebtConnection WebtConnection connection = new WebtConnection(info); 411 WebT webtproperties WebT API Tmax Soft 31
JEUS JEUS WebT 32 Tmax Soft
JEUS WebT JEUS 5 WebT WebT, WebT 51 (Synchronous Communication) Timeout 511 String, : STRING : import tmaxwebt*; <<SyncTestjava>> public class SyncTest { public static void main(string[] argv) { WebtConnection connection = new WebtConnection("127001", 8889); WebtRemoteService service = new WebtRemoteService("STR_TOUPPERSTR", connection); WebtBuffer buffer = servicecreatestringbuffer(); buffersetstring( Synchronous communication Test ); try { WebtBuffer rcvbuf = servicetpcall(buffer); Systemoutprintln(" : " + rcvbufgetstring()); catch (WebtServiceFailException se) { seprintstacktrace(); catch (WebtException e) { eprintstacktrace(); finally { connectionclose(); Tmax Soft 33
JEUS JEUS WebT 512 : STRING : #include <stdioh> #include <usrinc/atmih> <<SyncTestc>> STR_TOUPPERSTR(TPSVCINFO *msg) { int i, len; char *instr = (char *)msg->data; len = strlen(instr); for(i=0; i<len; i++) instr[i] = toupper(instr[i]); tpreturn(tpsuccess, 0, (char *)instr, 0, 0); 513 make *DOMAIN tmax *NODE tmax *SVRGROUP svg1 *SERVER SyncTest <<samplem>> SHMKEY = 77990, MAXUSER = 256, TPORTNO=8889 TMAXDIR = /home/tmax, APPDIR = /home/tmax/appbin, PATHDIR = /home/tmax/path, TLOGDIR = /home/tmax/log/tlog, ULOGDIR = /home/tmax/log/slog, SLOGDIR = /home/tmax/log/ulog NODENAME = tmax SVGNAME = svg1, MIN = 1, MAX = 5, CLOPT = e $(SVR)err o $(SVR)out 34 Tmax Soft
JEUS WebT JEUS *SERVICE STR_TOUPPERSTR SVRNAME = SyncTest # Server makefile <<Makefilec>> TARGET APOBJS = $(COMP_TARGET) = $(TARGET)o #Not use Db LIBS = -lsvr -lnodb OBJS = $(APOBJS) $(SVCTOBJ) NSDLOBJ = $(TMAXDIR)/lib/sdlo SVCTOBJ = $(TARGET)_svctabo CFLAGS = -O -I$(TMAXDIR) APPDIR = $(TMAXDIR)/appbin SVCTDIR = $(TMAXDIR)/svct LIBDIR = $(TMAXDIR)/lib # SUFFIXES : c co: $(CC) $(CFLAGS) -c $< # server compile $(TARGET): $(OBJS) $(CC) $(CFLAGS) -L$(LIBDIR) -o $(TARGET) $(OBJS) $(LIBS) $(NSDLOBJ) mv $(TARGET) $(APPDIR)/ rm -f $(OBJS) $(APOBJS): $(TARGET)c $(CC) $(CFLAGS) -c $(TARGET)c $(SVCTOBJ): touch $(SVCTDIR)/$(TARGET)_svctabc $(CC) $(CFLAGS) -c $(SVCTDIR)/$(TARGET)_svctabc # clean: -rm -f *o core $(TARGET) 514 ( $ $TMAXDIR TMAX $JEUS_HOME JEUS ) Tmax Soft 35
JEUS JEUS WebT 1 $ cp samplem $TMAXDIR/config 2 $ cfl i samplem 3 $ gst 4 $ export COMP_TARGET=SyncTest 5 $ make f Makefilec SyncTest 6 $ javac classpath $JEUS_HOME/lib/system/webt30jar: SyncTestjava 7 $ tmboot 8 $ java classpath $JEUS_HOME/lib/system/webt30jar: SyncTest 52 (Asynchronous Communication) 521 Field : Field : TPBLOCK : import tmaxwebt*; <<AsyncTestjava>> public class AsyncTest { public static void main(string[] argv) throws WebtException { WebtConnection connection = new WebtConnection("127001", 8889); connectionsettptimeout(15); WebtRemoteService service = new WebtRemoteService("NO_SUCH_SVC", connection); WebtAttribute attribute = new WebtAttribute(); attributesettpblock(true); WebtBuffer sndbuf = servicecreatefieldbuffer(); WebtField sndfld = sndbufcreatefield( TINT ); 36 Tmax Soft
JEUS WebT JEUS int sint = 10; sndfldadd(sint); int cd = 0; long t1 = SystemcurrentTimeMillis(); try { cd = servicetpacall(sndbuf, attribute); catch (WebtException e) { if (egettperror() == WebtExceptionTPENOENT) ; // do something else { eprintstacktrace(); long t2 = SystemcurrentTimeMillis(); Systemoutprintln("[t2-t1] : " + (t2-t1) + "ms"); try { WebtBuffer rcvbuf = servicetpgetrply(cd, attribute); long t3 = SystemcurrentTimeMillis(); Systemoutprintln("[t3-t1] : " + (t3-t1) + "ms"); WebtField rfield = rcvbufgetfield("tint"); WebtFieldElement e = rfieldget(); int rint = eintvalue(); if (rint!= sint) throw new WebtException("[Exception]"); Systemoutprintln("[requested delay] : " + rint); catch (WebtException e) { eprintstacktrace(); Systemoutprintln("tpgetrply error!!!"); finally { connectionclose(); 522 Sleep #include <stdioh> #include <unistdh> #include <usrinc/atmih> #include <usrinc/fbufh> #include "demo_fdlh" <<AsyncTestc>> Tmax Soft 37
JEUS JEUS WebT #include <sys/timebh> NO_SUCH_SVC(TPSVCINFO *msg) { int i, len, n; FBUF *rcvbuf = (FBUF *)msg->data; FBUF *sndbuf; int tint; int fldlen; len = msg->len; tint = 0; sndbuf = (FBUF *)tpalloc("field", NULL, 1024); n = fbget(rcvbuf, TINT, (char *)&tint, &fldlen); printf("requested delay : %d\n", tint); n= sleep(tint*1000); fbput(sndbuf, TINT, (char *)&tint, 0); tpreturn(tpsuccess, 0, (char *)sndbuf, 0, 0); <<demof>> # name number type flags comments TINT 1103 int - - 523 make <<samplem >> *DOMAIN tmax SHMKEY = 77990, MAXUSER = 256, TPORTNO = 8889 *NODE tmax *SVRGROUP svg1 TMAXDIR = /home/tmax, APPDIR = /home/tmax/appbin, PATHDIR = /home/tmax/path, TLOGDIR = /home/tmax/log/tlog, ULOGDIR = /home/tmax/log/slog, SLOGDIR = /home/tmax/log/ulog NODENAME = tmax *SERVER AsyncTest SVGNAME = svg1, MIN = 1, MAX = 5, CLOPT = e $(SVR)err o $(SVR)out *SERVICE NO_SUCH_SVC SVRNAME = AsyncTest <<webtproperties>> fdlfile=/home/tmax/sample/fdl/tmaxfdl 38 Tmax Soft
JEUS WebT JEUS # Server makefile <<Makefilec>> TARGET APOBJS = $(COMP_TARGET) = $(TARGET)o #Not use Db LIBS = -lsvr -lnodb OBJS = $(APOBJS) $(SVCTOBJ) NSDLOBJ = $(TMAXDIR)/lib/sdlo SVCTOBJ = $(TARGET)_svctabo CFLAGS = -O -I$(TMAXDIR) APPDIR = $(TMAXDIR)/appbin SVCTDIR = $(TMAXDIR)/svct LIBDIR = $(TMAXDIR)/lib # SUFFIXES : c co: $(CC) $(CFLAGS) -c $< # server compile $(TARGET): $(OBJS) $(CC) $(CFLAGS) -L$(LIBDIR) -o $(TARGET) $(OBJS) $(LIBS) $(NSDLOBJ) mv $(TARGET) $(APPDIR)/ rm -f $(OBJS) $(APOBJS): $(TARGET)c $(CC) $(CFLAGS) -c $(TARGET)c $(SVCTOBJ): touch $(SVCTDIR)/$(TARGET)_svctabc $(CC) $(CFLAGS) -c $(SVCTDIR)/$(TARGET)_svctabc # clean: -rm -f *o core $(TARGET) 524 ( $ $TMAXDIR TMAX $JEUS_HOME JEUS ) 1 $ cp samplem $TMAXDIR/config Tmax Soft 39
JEUS JEUS WebT 2 $ cfl i samplem 3 $ gst 4 $ fdlc c i demof 5 $ export COMP_TARGET=AsyncTest 6 $ make f Makefilec AsyncTest 7 $ javac classpath $JEUS_HOME/lib/system/webt30jar AsyncTestjava 8 $ export FDLFILE=/home/tmax/sample/fdl/tmaxfdl 9 webtproperties 10 $ tmboot 11 $ java classpath $JEUS_HOME/lib/system/webt30jar: AsyncTest 53 (Conversational Communication) / 531 String : STRING : import tmaxwebt*; <<ConvTestjava>> public class ConvTest { public static void main(string[] argv) { WebtConnection connection = new WebtConnection("127001", 8889); WebtDialogueService dialogue = new WebtDialogueService("CONVTEST", connection); try { dialoguetpconnect(false); int count = 1; WebtBuffer sndbuf = dialoguecreatestringbuffer(); 40 Tmax Soft
JEUS WebT JEUS WebtBuffer rcvbuf = null; while(true) { sndbufsetstring("client msg " + count); dialoguetpsend(sndbuf, true); rcvbuf = dialoguetprecv(); Systemoutprintln("tprecv ok : " + rcvbufgetstring()); if (!dialogueissendnext()) break; rcvbuf = dialoguetprecv(); Systemoutprintln("conv end : " + rcvbufgetstring()); catch (WebtDialogueException de) { deprintstacktrace(); catch (WebtServiceFailException se) { seprintstacktrace(); catch (WebtException e) { eprintstacktrace(); finally { connectionclose(); 532 #include <stdioh> #include <unistdh> #include <usrinc/atmih> #include <usrinc/fbufh> #include <sys/timebh> <<convtestc>> CONVTEST(TPSVCINFO *msg) { char *rcvbuf; char *sndbuf; int ret; long revent, rcvlen, flag, count; rcvbuf = tpalloc("string", NULL, 1024); sndbuf = tpalloc("string", NULL, 1024); printf("convtest start msg from client : %s\n", msg->data); flag = 0; Tmax Soft 41
JEUS JEUS WebT count = 1; while(1) { ret = tprecv(msg->cd, (char **)&rcvbuf, &rcvlen, TPNOTIME, &revent); if (ret < 0 ) { printf("tprecv ret = %d\n", ret); fprintf(stderr, "tprecv fail errno = %d\n", tperrno); if (revent!= TPEV_SENDONLY) { printf("tprecv fail revent = 0x%08x\n", revent); tpreturn(tpfail, -1, (char *)rcvbuf, 0, TPNOFLAGS); printf("tprecv ok! : %s\n", rcvbuf); if (count == 10) { flag = TPNOTIME; else { flag = TPRECVONLY; sprintf(sndbuf, "server msg %d", count); ret = tpsend(msg->cd, (char *)sndbuf, strlen(sndbuf), flag, &revent); if (ret < 0) { printf("tpsend fail revent = 0x%08x\n", revent); fprintf(stderr, "tpsend fail errno = %d\n", tperrno); tpreturn(tpfail, -1, (char *)NULL, 0, TPNOFLAGS); printf("tpsend ok! count = %d\n", count); if (count == 10) break; count++; strcpy(sndbuf, "conv mode successfully terminated"); tpreturn (TPSUCCESS, 1, (char *)sndbuf, strlen(sndbuf), TPNOFLAGS); 533 make <<samplem>> *DOMAIN tmax SHMKEY = 77990, MAXUSER = 256, TPORTNO = 8889 *NODE 42 Tmax Soft
JEUS WebT JEUS tmax *SVRGROUP svg1 *SERVER convtest *SERVICE CONVTEST TMAXDIR = /home/tmax, APPDIR = /home/tmax/appbin, PATHDIR = /home/tmax/path, TLOGDIR = /home/tmax/log/tlog, ULOGDIR = /home/tmax/log/slog, SLOGDIR = /home/tmax/log/ulog NODENAME = tmax SVGNAME = svg1, CONV = Y MIN = 1, MAX = 5, CLOPT = e $(SVR)err o $(SVR)out SVRNAME = convtest <<webtproperties>> fdlfile=/home/tmax/sample/fdl/tmaxfdl7 # Server makefile <<Makefilec>> TARGET APOBJS NSDLOBJ = $(COMP_TARGET) = $(TARGET)o = $(TMAXDIR)/lib/sdlo #Not use Db LIBS = -lsvr -lnodb OBJS = $(APOBJS) $(SVCTOBJ) SVCTOBJ = $(TARGET)_svctabo CFLAGS = -O -I$(TMAXDIR) APPDIR = $(TMAXDIR)/appbin SVCTDIR = $(TMAXDIR)/svct LIBDIR = $(TMAXDIR)/lib # SUFFIXES : c co: $(CC) $(CFLAGS) -c $< # server compile $(TARGET): $(OBJS) $(CC) $(CFLAGS) -L$(LIBDIR) -o $(TARGET) $(OBJS) $(LIBS) $(NSDLOBJ) Tmax Soft 43
JEUS JEUS WebT mv $(TARGET) $(APPDIR)/ rm -f $(OBJS) $(APOBJS): $(TARGET)c $(CC) $(CFLAGS) -c $(TARGET)c $(SVCTOBJ): touch $(SVCTDIR)/$(TARGET)_svctabc $(CC) $(CFLAGS) -c $(SVCTDIR)/$(TARGET)_svctabc # clean: -rm -f *o core $(TARGET) 534 ( $ $TMAXDIR TMAX $JEUS_HOME JEUS ) 1 $ cp samplem $TMAXDIR/config 2 $ cfl i samplem 3 $ gst 4 $ export COMP_TARGET=ConvTest 5 $ make f Makefilec ConvTest 6 $ javac classpath $JEUS_HOME/lib/system/webt30jar ConvTestjava 7 webtproperties 8 $ tmboot 9 $ java classpath $JEUS_HOME/lib/system/webt30jar: ConvTest 54 Unsolicited Message Service Unsolicited Message 541 44 Tmax Soft
JEUS WebT JEUS : STRING : TPBLOCK, TPNOREPLY : import tmaxwebt*; <<TppostSamplejava>> public class TppostSample implements WebtEventHandler { private WebtEventConnection conn; private WebtRemoteService service; private String eventname1 = "SITE"; private String eventname2 = "SUB"; private String eventname = "SEQNO"; private String id = "ID"; private String message = "MSG"; public TppostSample(WebtEventConnection conn) { thisconn = conn; connseteventmask(webteventconnectionevent_post); connseteventhandler(this); conntpsubscribe(eventname1); conntpsubscribe(eventname2); public static void main(string[] argv) throws javaioioexception { try { WebtSystemcreateDefaultFieldKeyTable("/home/tmax/fdl /tmaxfdl"); WebtSysteminitLogger(WebtSystemLOG_DEBUG, null, 0); catch (WebtException e){ Systemoutprintln("error: " + e); WebtEventConnection conn = new WebtEventConnection("127001", 8889); TppostSample sample = new TppostSample(conn); int cd = 0; WebtAttribute attribute = new WebtAttribute(); attributesettpblock(true); attributesettpnoreply(true); WebtRemoteService service = new WebtRemoteService("ECHO",conn); WebtBuffer sndbuf = servicecreatestringbuffer(); int acallcount = 0; while(true) { Tmax Soft 45
JEUS JEUS WebT try { sndbufsetstring("event_post Flag Test" + acallcount++); cd = servicetpacall(sndbuf, attribute); Threadsleep(1000); catch (Exception e ) { Systemoutprintln( "exception to tppost with TPNOREPLY/TPBLOCK"); eprintstacktrace(); if (e instanceof tmaxwebtwebtexception) { Throwable r = ((WebtException)e)getRootCause(); rprintstacktrace(); public void destroy() { conntpunsubscribe(eventname1); conntpunsubscribe(eventname2); connclose(); public void handleevent(int type, WebtBuffer buf, int len, int flags) { WebtFieldSet bufset = new WebtFieldSet(buf); Systemoutprintln("################################"); Systemoutprintln("event received type = " + type + " buffer type = " + bufgetbuffertype()); Systemoutprintln("event name : " + bufsetgetstring(eventname)); Systemoutprintln("event id : " + bufsetgetint(id)); Systemoutprintln("[event msg] : " + bufsetgetstring(message)); Systemoutprintln("################################"); public void handleerror(webtexception e) { Systemerrprintln("Event error occured"); eprintstacktrace(); if (e instanceof tmaxwebtwebtexception) { Throwable r = ((WebtException)e)getRootCause(); rprintstacktrace(); if( e instanceof WebtIOException) { if(egettperror() == WebtExceptionTPECLOSE) { connclose(); connconnect(); 46 Tmax Soft
JEUS WebT JEUS #include <stdioh> #include <stdlibh> #include <usrinc/atmih> <<tpcallc>> main() { int char long n, ret; *sndbuf, *rcvbuf; sndlen, rcvlen; if ((ret = tmaxreadenv("tmaxenv","tmax")) == -1) { printf( "tmax read env failed\n" ); exit(1); if ( tpstart((tpstart_t *)NULL) == -1 ){ printf( "tpstart failed[%s]\n",tpstrerror(tperrno)); exit(1); if ((sndbuf = tpalloc("carray",null,1024)) == NULL) { printf( "sndbuf tpalloc failed[%s]\n", tpstrerror(tperrno)); tpend(); exit(1); if ((rcvbuf = tpalloc("carray",null,1024)) == NULL){ printf( "rcvbuf tpalloc failed[%s]\n", tpstrerror(tperrno)); tpfree((char *)sndbuf); tpend(); exit(1); sndlen = 1000; if (tpcall("postfdltest", (char *)sndbuf, sndlen, (char **)&rcvbuf, &rcvlen, 0 ) < 0){ printf( "tpcall SITETEST failed[%s]\n", tpstrerror(tperrno)); return -1; printf("tpcall success, len = %d\n", rcvlen); tpfree((char *)sndbuf); tpfree((char *)rcvbuf); tpend(); Tmax Soft 47
JEUS JEUS WebT 542 #include <stdioh> #include <stdlibh> #include <usrinc/atmih> #include <usrinc/fbufh> #include demo_fdlh << TppostSamplec>> POSTFDLTEST(TPSVCINFO *rqst) { FBUF *sndbuf1, *sndbuf2; int i=0; int id1; int id2; char pwdstring[50]="tppost TEST"; char eventname1[20]= SITE ; char eventname2[20]= SUB ; id1=++i; id2=++i; sndbuf1 = fballoc(100,100); sndbuf2 = fballoc(100,100); printf("[tppost FIELD TYPE TEST count=%d\n", i); fbput(sndbuf1, ID,(char *)&id1,0); fbput(sndbuf1, MSG,pwdString,0); fbput(sndbuf1, SEQNO,eventName1,0); printf("[id] %d [MSG] %s [SEQNO] %s\n", id1, pwdstring, eventname1); fbput(sndbuf2, ID,(char *)&id2,0); fbput(sndbuf2, MSG,pwdString,0); fbput(sndbuf2, SEQNO,eventName2,0); printf("[id] %d [MSG] %s [SEQNO] %s\n", id2, pwdstring, eventname2); tppost(eventname1, (char *)sndbuf1, 0, TPNOFLAGS); tppost(eventname2,(char *)sndbuf2, 0, TPNOFLAGS); tpfree((char*)sndbuf1); tpfree((char*)sndbuf2); tpreturn(tpsuccess, 0, NULL, 0, 0); ECHO(TPSVCINFO *msg) { printf("client message : %s\n ", msg->data); tpreturn(tpsuccess, 0, msg->data,0,0); 48 Tmax Soft
JEUS WebT JEUS <<demof>> ID 101 int - - MSG 102 string - - SEQNO 103 string - - 543 <<samplem>> *DOMAIN tmax SHMKEY = 77990, MAXUSER = 256, TPORTNO = 8889 *NODE tmax *SVRGROUP svg1 TMAXDIR = /home/tmax, APPDIR = /home/tmax/appbin, PATHDIR = /home/tmax/path, TLOGDIR = /home/tmax/log/tlog, ULOGDIR = /home/tmax/log/slog, SLOGDIR = /home/tmax/log/ulog NODENAME = tmax *SERVER TppostSample SVGNAME = svg1 MIN = 1, MAX = 5, CLOPT = e $(SVR)err o $(SVR)out *SERVICE POSTFDLTEST ECHO SVRNAME = TppostSample SVRNAME = TppostSample <<tmaxenv>> [TMAX] TMAX_HOST_ADDR=127001 TAMX_HOST_PORT=8889 FDLFILE=/home/tmax/sample/fdl/tmaxfdl TMAX_CONNECT_TIMEOUT=5 <<webtproperties>> fdlfile=/home/tmax/sample/fdl/tmaxfdl <<Makefilec>> # Server makefile TARGET APOBJS = $(COMP_TARGET) = $(TARGET)o #Not use Db LIBS = -lsvr -lsocket -lnsl -lnodb Tmax Soft 49
JEUS JEUS WebT OBJS = $(APOBJS) $(SVCTOBJ) NSDLOBJ = $(TMAXDIR)/lib/sdlo SVCTOBJ = $(TARGET)_svctabo CFLAGS = -O -I$(TMAXDIR) I/ APPDIR = $(TMAXDIR)/appbin SVCTDIR = $(TMAXDIR)/svct LIBDIR = $(TMAXDIR)/lib # SUFFIXES : c co: $(CC) $(CFLAGS) -c $< # server compile $(TARGET): $(OBJS) $(CC) $(CFLAGS) -L$(LIBDIR) -o $(TARGET) $(OBJS) $(LIBS) $(NSDLOBJ) mv $(TARGET) $(APPDIR)/ rm -f $(OBJS) $(APOBJS): $(TARGET)c $(CC) $(CFLAGS) -c $(TARGET)c $(SVCTOBJ): touch $(SVCTDIR)/$(TARGET)_svctabc $(CC) $(CFLAGS) -c $(SVCTDIR)/$(TARGET)_svctabc # clean: -rm -f *o core $(TARGET) <<Makefilecc>> # Tmax client makefile TARGET = $(COMP_TARGET) APOBJS = $(TARGET)o TMAXLIBD= $(TMAXDIR)/lib TMAXLIBS= -lcli -lnsl -lsocket CFLAGS = -O -I$(TMAXDIR) # SUFFIXES : c co: $(CC) $(CFLAGS) -c $< # 50 Tmax Soft
JEUS WebT JEUS # client compile # $(TARGET): $(APOBJS) $(CC) $(CFLAGS) -L$(TMAXLIBD) -o $(TARGET) $(APOBJS) $(TMAXLIBS) # clean: -rm -f *o core $(TARGET) 544 ( $ $TMAXDIR TMAX $JEUS_HOME JEUS ) 1 $ cp samplem $TMAXDIR/config 2 $ cfl i samplem 3 $ gst 4 $ fdlc c i demof 5 $ export COMP_TARGET=TppostSample 6 $ make f Makefilec TppostSample 7 $ export COMP_TARGET=tpcall 8 $ make f Makefilecc tpcall 9 $ javac classpath $JEUS_HOME/lib/system/webt30jar TppostSamplejava 10 $ export FDLFILE=/home/tmax/sample/fdl/tmaxfdl 11 webtproperties 12 $ tmboot 13 $ java classpath $JEUS_HOME/lib/system/webt30jar: TppostSample 14 $ tpcall # 55 ACID Tmax Soft 51
JEUS JEUS WebT Local Transaction : (DB) Global Transaction : 551 DB tpacall commit() : Field : import tmaxwebt*; <<TxTestjava>> public class TxTest { public static void main(string args[]) throws WebtException { WebtConnectionPoolcreateGroup("tmax1", "127001", 8889, 4, 10, 2); WebtConnection connection = null; try { connection = WebtConnectionPoolgetConnection("tmax1"); catch (WebtIOException wioe) { Systemoutprintln("fail to get WebtConnection of tmax1"); return; WebtAttribute attribute = new WebtAttribute(); WebtTransaction tx = new WebtTransaction(connection); WebtRemoteService service = new WebtRemoteService("FDLINS", connection); // first call WebtFieldSet sndset = new WebtFieldSet(servicecreateFieldBuffer()); sndsetadd("empno", 1234); sndsetadd("ename", "WebT"); sndsetadd("job", "Tmax"); sndsetadd("mgr", 1010); sndsetadd("sal", 10000); sndsetadd("comm", 10); sndsetadd("deptno", 12); int cd1 = 0; int cd2 = 0; txbegin(); 52 Tmax Soft
JEUS WebT JEUS try { Systemoutprintln("tpacall first!!!"); cd1 = servicetpacall(sndsetgetfieldbuffer(), attribute); catch (WebtException e) { txrollback(); eprintstacktrace(); throw new WebtException( "exception at tpacall with TPNOTRAN"); try { WebtBuffer rcvbuf = servicetpgetrply(cd1, attribute); //do something catch (WebtException e) { eprintstacktrace(); Systemoutprintln("tpgetrply error!!!"); // second call WebtFieldSet sndset1 = new WebtFieldSet(servicecreateFieldBuffer()); sndset1add("empno", 4321); sndset1add("ename", "JEUS"); sndset1add("job", "Tmax"); sndset1add("mgr", 1110); sndset1add("sal", 20000); sndset1add("comm", 20); sndset1add("deptno", 24); try { Systemoutprintln("tpacall second!!!"); cd2 = servicetpacall(sndset1getfieldbuffer(), attribute); catch (WebtException e) { txrollback(); eprintstacktrace(); throw new WebtException( "exception at tpacall with TPNOTRAN"); try { WebtBuffer rcvbuf1 = servicetpgetrply(cd2, attribute); //do something catch (WebtException e) { eprintstacktrace(); Systemoutprintln("tpgetrply error!!!"); txcommit(); connectionclose(); Tmax Soft 53
JEUS JEUS WebT 552 Field DB #include <stdioh> #include <ctypeh> #include <usrinc/atmih> #include <usrinc/fbufh> #include demo_fdlh" <TxTestpc>> EXEC SQL INCLUDE SQLCA; EXEC SQL begin declare section; int h_empno; char h_ename[11]; char h_job[10]; int h_mgr; float h_sal; float h_comm; int h_deptno; EXEC SQL end declare section; FDLINS( TPSVCINFO *msg ) { FBUF *sndbuf; int tint=0; sndbuf = (FBUF *)msg->data; h_empno = h_mgr = h_sal = h_comm = h_deptno = 0; memset( h_ename, 0x00, sizeof( h_ename ) ); memset( h_job, 0x00, sizeof( h_job ) ); fbget( sndbuf, EMPNO, (char *)&h_empno, 0 ); fbget( sndbuf, MGR, (char *)&h_mgr, 0 ); fbget( sndbuf, SAL, (char *)&h_sal, 0 ); fbget( sndbuf, COMM, (char *)&h_comm, 0 ); fbget( sndbuf, DEPTNO,(char *)&h_deptno, 0 ); fbget( sndbuf, ENAME, (char *)h_ename, 0 ); fbget( sndbuf, JOB, (char *)h_job, 0 ); fbget( sndbuf, TINT, (char *)&tint, 0 ); printf("requested delay : %d\n", tint); sleep(tint); printf("recive data %d\n", h_empno); printf(" recive data %s\n", h_ename); printf(" recive data %s\n", h_job); printf(" recive data %d\n", h_mgr); printf(" recive data %f\n", h_sal); 54 Tmax Soft
JEUS WebT JEUS printf(" recive data %f\n", h_comm); printf(" recive data %d\n", h_deptno); EXEC SQL INSERT INTO emp( empno, ename, job, mgr, sal,comm,deptno) VALUES ( :h_empno, :h_ename, :h_job, :h_mgr, :h_sal, :h_comm, :h_deptno ); if ( sqlcasqlcode!= 0 ){ printf( "insert failed sqlcode = %d\n",sqlcasqlcode ); tpreturn( TPFAIL, sqlcasqlcode, NULL, 0, 0 ); printf("return\n"); tpreturn( TPSUCCESS, 0, NULL, 0, 0 ); <<demof>> # name number type flags comments TINT 101 int - - EMPNO 102 int - - ENAME 103 string - - JOB 104 string - - MGR 105 int - - SAL 106 float - - COMM 107 float - - DEPTNO 108 int - - 553 make <<samplem>> *DOMAIN tmax SHMKEY = 77990, MAXUSER = 256, TPORTNO = 8889 *NODE tmax *SVRGROUP svg1 TMAXDIR = /home/tmax, APPDIR = /home/tmax/appbin, PATHDIR = /home/tmax/path, TLOGDIR = /home/tmax/log/tlog, ULOGDIR = /home/tmax/log/slog, SLOGDIR = /home/tmax/log/ulog NODENAME = tmax, DBNAME = ORACLE, Tmax Soft 55
JEUS JEUS WebT OPENINFO = "Oracle_XA+Acc=P/scott/tiger+SesTm=60+LogDir=/home/tmax/log/trace log", TMSNAME = tms_ora *SERVER TxTest *SERVICE FDLINS SVGNAME = svg1, MIN = 1, MAX = 5, CLOPT = e $(SVR)err o $(SVR)out SVRNAME = TxTest <<webtproperties>> fdlfile=/home/tmax/sample/fdl/tmaxfdl # Server Pro*C makefile <<Makefilepc>> include $(ORACLE_HOME)/precomp/lib/env_precompmk ORALIBDIR = $(LIBHOME) ORALIB = $(PROLDLIBS) TARGET APOBJS NSDLOBJ = $(COMP_TARGET) = $(TARGET)o = $(TMAXDIR)/lib/sdlo #Oracle LIBS = -lsvr -lsocket -lnsl -loras #Informix #LIBS = -lsvr -lsocket -lnsl -linfs #Db2 #LIBS = -lsvr -lsocket -lnsl -ldb2s #Sybase #LIBS = -lsvr -lsocket -lnsl -lsybs OBJS = $(APOBJS) $(SVCTOBJ) SVCTOBJ = $(TARGET)_svctabo CFLAGS = -O -I$(TMAXDIR) APPDIR = $(TMAXDIR)/appbin SVCTDIR = $(TMAXDIR)/svct TMAXLIBDIR = $(TMAXDIR)/lib # SUFFIXES : c co: $(CC) $(CFLAGS) -c $< # # server compile # 56 Tmax Soft
JEUS WebT JEUS all: $(TARGET) $(TARGET): $(OBJS) $(CC) $(CFLAGS) -L$(TMAXLIBDIR) -o $(TARGET) -L$(ORALIBDIR) $(ORALIB) $(OBJS) $(LIBS) $(NSDLOBJ) mv $(TARGET) $(APPDIR)/ rm -f $(OBJS) $(APOBJS): $(TARGET)pc proc iname=$(target) include=$(tmaxdir) $(CC) $(CFLAGS) -c $(TARGET)c $(SVCTOBJ): touch $(SVCTDIR)/$(TARGET)_svctabc $(CC) $(CFLAGS) -c $(SVCTDIR)/$(TARGET)_svctabc # clean: -rm -f *o core $(TARGET) $(TARGET)lis TARGET = tms_ora APOBJ = dumyo <<tms_oramk>> APPDIR = $(TMAXDIR)/appbin TMAXLIBD= $(TMAXDIR)/lib all: $(TARGET) include $(ORACLE_HOME)/precomp/lib/env_precompmk ORALIBDIR = $(LIBHOME) ORALIB = $(PROLDLIBS) TMAXLIBS = -ltms -loras $(TARGET): $(APOBJ) $(CC) -L$(TMAXLIBD) -o $(TARGET) -L$(ORALIBDIR) $(ORALIB) $(APOBJ) $(TMA XLIBS) mv $(TARGET) $(APPDIR) $(APOBJ): $(CC) -c dumyc # clean: -rm -f *o core $(APPDIR)/$(TARGET) 554 ( $ $TMAXDIR TMAX $JEUS_HOME JEUS ) Tmax Soft 57
JEUS JEUS WebT 1 $ cp samplem $TMAXDIR/config 2 $ cfl i samplem 3 $ gst 4 $ fdlc c i demof 5 $ export COMP_TARGET=TxTest 6 $ make f Makefilepc TxTest 7 $ touch dumyc #tms_oramk 8 $ make f tms_oramk 9 $ javac classpath $JEUS_HOME/lib/system/webt30jar: TxTestjava 10 $ export FDLFILE=/home/tmax/fdl/tmaxfdl 11 webtproperties 12 $ tmboot 13 $ java classpath $JEUS_HOME/lib/system/webt30jar: TxTest 56 JSP JSP(Java Server Page) 561 : STRING : <<toupperjsp>> <%@ page import="javaio*" %> <%@ page import="javautil*" %> <%@ page import="tmaxwebt*" %> <% WebtConnection connection = null; WebtConnection conn = null; WebtRemoteService service = null; WebtBuffer sndbuf = null; WebtBuffer rcvbuf = null; 58 Tmax Soft
JEUS WebT JEUS WebtSystemsetDefaultCharset("euc-kr"); try { connection = WebtConnectionPoolgetConnection("tmax1"); service = new WebtRemoteService("STR_TOUPPER", connection); sndbuf = servicecreatestringbuffer(2084); String sndstr = "Welcome to Korea"; sndbufsetstring(sndstr); rcvbuf = servicetpcall(sndbuf); outprintln("<html><body>"); outprintln("<big> + rcvbufgetstring() + "(" + rcvbufgetdatalength() + ")</BIG><P>"); outprintln("<big> [tmax1 rcvbuf data] " + rcvbuf +"</BIG><P>"); outprintln("</body></html>"); catch (WebtException wie) { wieprintstacktrace(systemout); Throwable t = wiegetrootcause(); if (t!= null) tprintstacktrace(systemout); %> connectionclose(); Systemexit(1); finally { connectionclose(); 562 #include <stdioh> #include <ctypeh> #include <usrinc/atmih> << toupperc>> STR_TOUPPER(TPSVCINFO *msg) { int i, len; char *instr = (char *)msg->data; len = strlen(instr); for(i=0; i<len; i++) instr[i] = toupper(instr[i]); tpreturn(tpsuccess, 0, (char *)instr, 0, 0); Tmax Soft 59
JEUS JEUS WebT 563 make <<webtproperties>> enablemodify=false enableconnectionpool=true connectionpoolgroups=tmax1 connectionpooltmaxtype=shared connectionpooltmax1hostaddr=127001 connectionpooltmax1hostport=8889 connectionpooltmax1initcapacity=1 connectionpooltmax1maxcapacity=10 connectionpooltmax1incrementrate=2 connectionpooltmax1maxidletime=60 connectionpooltmax1tptimeout=40 connectionpooltmax1txtimeout=60 connectionpooltmax1connecttimeout=10 <<samplem >> *DOMAIN tmax SHMKEY = 77990, MAXUSER = 256, TPORTNO = 8889 *NODE tmax *SVRGROUP svg1 *SERVER toupper *SERVICE STR_TOUPPER TMAXDIR = /home/tmax, APPDIR = /home/tmax/appbin, PATHDIR = /home/tmax/path, TLOGDIR = /home/tmax/log/tlog, ULOGDIR = /home/tmax/log/slog, SLOGDIR = /home/tmax/log/ulog NODENAME = tmax SVGNAME = svg1 MIN = 1, MAX = 5, CLOPT = e $(SVR)err o $(SVR)out SVRNAME = toupper # Server makefile <<Makefilec>> TARGET APOBJS = $(COMP_TARGET) = $(TARGET)o #Not use Db LIBS = -lsvr -lsocket -lnsl lnodb OBJS = $(APOBJS) $(SVCTOBJ) NSDLOBJ = $(TMAXDIR)/lib/sdlo 60 Tmax Soft
JEUS WebT JEUS SVCTOBJ = $(TARGET)_svctabo CFLAGS = -O -I$(TMAXDIR) APPDIR = $(TMAXDIR)/appbin SVCTDIR = $(TMAXDIR)/svct LIBDIR = $(TMAXDIR)/lib # SUFFIXES : c co: $(CC) $(CFLAGS) -c $< # server compile $(TARGET): $(OBJS) $(CC) $(CFLAGS) -L$(LIBDIR) -o $(TARGET) $(OBJS) $(LIBS) $(NSDLOBJ) mv $(TARGET) $(APPDIR)/ rm -f $(OBJS) $(APOBJS): $(TARGET)c $(CC) $(CFLAGS) -c $(TARGET)c $(SVCTOBJ): touch $(SVCTDIR)/$(TARGET)_svctabc $(CC) $(CFLAGS) -c $(SVCTDIR)/$(TARGET)_svctabc # clean: -rm -f *o core $(TARGET) 564 ( $ $TMAXDIR TMAX $JEUS_HOME JEUS ) 1 $ cp samplem $TMAXDIR/config 2 $ cfl i samplem 3 $ gst 4 $ export COMP_TARGET=toupper 5 $ make f Makefilec toupper 6 $ tmboot 7 $ cp webtproperties $JEUS_HOME/lib/application 8 $ cp toupperjsp $SERVLET_HOME/webapps/examples/tmax Tmax Soft 61
JEUS JEUS WebT 9 $ jeus -xml Uusername -Ppassward 10 : http://localhost:8088/examples/tmax/toupperjsp 57 Servlet Servlet 571 Carray Field Echo : Carray, Field : <<PoolTestjava>> import javaio*; import javautil*; import javaxservlet*; import javaxservlethttp*; import tmaxwebt*; public class PoolTest extends HttpServlet { public void doget(httpservletrequest request, HttpServletResponse response) throws IOException, ServletException { responsesetcontenttype("text/html"); PrintWriter out = responsegetwriter(); outprintln("<html>"); outprintln("<head>"); String title = "Request Information APIs"; outprintln("<title>" + title + "</title>"); outprintln("</head>"); outprintln("<body bgcolor=\"white\">"); WebtConnection connection = null; WebtRemoteService service = null; WebtBuffer sndbuf = null; WebtBuffer rcvbuf = null; try { WebtConnectionPoolcreateGroup("tmax1", "127001", 8889, 4, 10, 2); long t1 = SystemcurrentTimeMillis(); connection = WebtConnectionPoolgetConnection("tmax1"); Systemoutprintln("After getconnection"); connectionsettptimeout(15); service = new WebtRemoteService("CAR_ECHO", connection); 62 Tmax Soft
JEUS WebT JEUS Systemoutprintln(">>>>>> StringBuffer Test <<<<<<<<<"); sndbuf = servicecreatestringbuffer(2048); String sndstr = "[STRING] connection pool test start"; sndbufsetstring(sndstr); Systemoutprintln("\tsend string : " + sndstr + "(" + sndbufgetdatalength() + ")"); rcvbuf = servicetpcall(sndbuf); Systemoutprintln("\t tmax1 recv string : " + rcvbufgetstring() + "(" + rcvbufgetdatalength() + ")"); Systemoutprintln("\t tmax1 rcv data : " + rcvbuf); Systemoutprintln(">>>>>> CarrayBuffer Test <<<<<<<<<"); servicesetservicename("car_echo"); sndbuf = servicecreatecarraybuffer(2048); sndstr = "[CARRAY] start"; sndbufsetstring(sndstr); Systemoutprintln("\tsend string : " + sndstr + "(" + sndbufgetdatalength() + ")"); rcvbuf = servicetpcall(sndbuf); Systemoutprintln("\trecv string : " + rcvbufgetstring() + "(" + rcvbufgetdatalength() + ")"); Systemoutprintln(rcvbuf); Systemoutprintln(">>>>>> FieldBuffer Test <<<<<<<<<"); long t2 = SystemcurrentTimeMillis(); servicesetservicename("field_echo"); sndbuf = servicecreatefieldbuffer(1024); WebtField shortfield = sndbufcreatefield("tshort"); for (int i=0; i<5; i++) shortfieldadd(i); WebtField intfield = sndbufcreatefield("tint"); for (int i=0; i<5; i++) intfieldadd(i); WebtField longfield = sndbufcreatefield("tlong"); for (int i=0; i<5; i++) longfieldadd(i); WebtField floatfield = sndbufcreatefield("tfloat"); for (int i=0; i<5; i++) floatfieldadd(i); WebtField doublefield = sndbufcreatefield("tdouble"); for (int i=0; i<5; i++) doublefieldadd(i); WebtField carrayfield = sndbufcreatefield("tcarray"); String cdata = "CARRAY FIELD "; String cdata1 = "CARRAY FIELD "; for (int i=0; i<5; i++) { carrayfieldadd(cdata + i); cdata = cdata + cdata1; Tmax Soft 63
JEUS JEUS WebT WebtField stringfield = sndbufcreatefield("tstring"); String sdata = "STRING FIELD "; for (int i=0; i<5; i++) { sdata += "X"; stringfieldadd(sdata + i); long t3 = SystemcurrentTimeMillis(); rcvbuf = servicetpcall(sndbuf); Vector fieldlist = rcvbufgetfields(); for(enumeration e = fieldlistelements(); ehasmoreelements(); ) { WebtField fields = (WebtField)enextElement(); Systemoutprintln("[Field Key] : " + fieldsgetfieldkey()); int fieldtype = fieldsgetfieldtype(); Vector elements = fieldsgetfieldvector(); for(int j=1 ; j < elementssize(); j++) { switch(fieldtype) { case WebtFieldFB_CARRAY: Systemoutprintln("[Value"+j+"] : " + new String(fieldsget(j)bytesValue())); break; case WebtFieldFB_DOUBLE: Systemoutprintln("[Value"+j+"] : " + fieldsget(j)doublevalue()); break; case WebtFieldFB_FLOAT: Systemoutprintln("[Value"+j+"] : " + fieldsget(j)floatvalue()); break; case WebtFieldFB_INT: Systemoutprintln("[Value"+j+"] : " + fieldsget(j)intvalue()); break; long t4 = SystemcurrentTimeMillis(); Systemoutprintln("etime = " + (t4-t1)); Systemoutprintln("field make = " + (t3-t2)); Systemoutprintln("field recv = " + (t4-t3)); outprintln("</body>"); outprintln("</html>"); catch (WebtException wie) { wieprintstacktrace(systemout); Throwable t = wiegetrootcause(); if (t!= null) 64 Tmax Soft
JEUS WebT JEUS tprintstacktrace(systemout); connectionclose(); connectionclose(); 572 echo #include <stdioh> #include <unistdh> #include <usrinc/atmih> #include <usrinc/fbufh> #include "demo_fdlh" #include <sys/timebh> <PoolTestc>> CAR_ECHO(TPSVCINFO *msg) { int i, len; char *instr = (char *)msg->data; char *outstr; len = msg->len; outstr = tpalloc("carray", NULL, len); for(i=0; i<len; i++) outstr[i] = instr[i]; tpreturn(tpsuccess, 0, (char *)outstr, len, 0); FIELD_ECHO(TPSVCINFO *msg) { int i, len, n; FBUF *rcvbuf = (FBUF *)msg->data; FBUF *sndbuf; char tchar; short tshort; int tint; long tlong; float tfloat; double tdouble; char tcarray[102400]; char tstring[102400]; int fldlen; struct timeb startt; struct timeb endt; time_t sec; int msec; int count = 0; int pos = 0; Tmax Soft 65
JEUS JEUS WebT ftime(&startt); len = msg->len; printf("[field_echo] datalen = %d\n", len); sndbuf = (FBUF *)tpalloc("field", NULL, len); count = 0; pos = 0; while (1) { n = fbgetf(rcvbuf, TINT, (char *)&tint, &fldlen, &pos); if (n < 0) break; fbinsert(sndbuf, TINT, count, (char *)&tint, fldlen); count++; printf("[field_echo] TINT count = %d\n", count); count = 0; pos = 0; while (1) { n = fbgetf(rcvbuf, TLONG, (char *)&tlong, &fldlen, &pos); if (n < 0) break; fbinsert(sndbuf, TLONG, count, (char *)&tlong, fldlen); count++; printf("[field_echo] TLONG count = %d\n", count); count = 0; pos = 0; while (1) { n = fbgetf(rcvbuf, TFLOAT, (char *)&tfloat, &fldlen, &pos); if (n < 0) break; fbinsert(sndbuf, TFLOAT, count, (char *)&tfloat, fldlen); count++; printf("[field_echo] TFLOAT count = %d\n", count); count = 0; pos = 0; while (1) { n = fbgetf(rcvbuf, TDOUBLE, (char *)&tdouble, &fldlen, &pos); if (n < 0) break; fbinsert(sndbuf, TDOUBLE, count, (char *)&tdouble, fldlen); count++; printf("[field_echo] TDOUBLE count = %d\n", count); count = 0; pos = 0; while (1) { 66 Tmax Soft
JEUS WebT JEUS n = fbgetf(rcvbuf, TSTRING, (char *)tstring, &fldlen, &pos); if (n < 0) break; fbinsert(sndbuf, TSTRING, count, (char *)tstring, fldlen); count++; printf("[field_echo] TSTRING count = %d\n", count); ftime(&endt); sec = endttime - startttime; msec = endtmillitm - starttmillitm; if (msec < 0) { --sec; msec += 1000; printf("[field_echo] processing time = %d sec %d msec\n", sec, msec); tpreturn(tpsuccess, 0, (char *)sndbuf, 0, 0); <<demof>> # name number type flags comments TSHORT 100 short - -: TINT 101 int - - TLONG 102 long - - TFLOAT 103 float - - TDOUBLE 104 double - - TSTRING 105 string - - 573 make <<webtproperties>> fdlfile=/home/tmax/sample/fdl/tmaxfdl <<webxml>> <servlet> <servlet-name>pooltest</servlet-name> <servlet-class>pooltest</servlet-class> </servlet> <servlet-mapping> <servlet-name>pooltest</servlet-name> <url-pattern>/pool</url-pattern> </servlet-mapping> <<samplem >> *DOMAIN tmax SHMKEY = 77990, MAXUSER = 256, TPORTNO = 8889 *NODE Tmax Soft 67
JEUS JEUS WebT tmax *SVRGROUP svg1 *SERVER PoolTest TMAXDIR = /home/tmax, APPDIR = /home/tmax/appbin, PATHDIR = /home/tmax/path, TLOGDIR = /home/tmax/log/tlog, ULOGDIR = /home/tmax/log/slog, SLOGDIR = /home/tmax/log/ulog NODENAME = tmax SVGNAME = svg1 MIN = 1, MAX = 5, CLOPT = e $(SVR)err o $(SVR)out *SERVICE CAR_ECHO SVRNAME = PoolTest FIELD_ECHO SVRNAME = PoolTest # Server makefile <<Makefilec>> TARGET APOBJS = $(COMP_TARGET) = $(TARGET)o #Not use Db LIBS = -lsvr -lnodb OBJS = $(APOBJS) $(SVCTOBJ) NSDLOBJ = $(TMAXDIR)/lib/sdlo SVCTOBJ = $(TARGET)_svctabo CFLAGS = -O -I$(TMAXDIR) I/ APPDIR = $(TMAXDIR)/appbin SVCTDIR = $(TMAXDIR)/svct LIBDIR = $(TMAXDIR)/lib # SUFFIXES : c co: $(CC) $(CFLAGS) -c $< # server compile $(TARGET): $(OBJS) $(CC) $(CFLAGS) -L$(LIBDIR) -o $(TARGET) $(OBJS) $(LIBS) $(NSDLOBJ) mv $(TARGET) $(APPDIR)/ rm -f $(OBJS) $(APOBJS): $(TARGET)c $(CC) $(CFLAGS) -c $(TARGET)c 68 Tmax Soft