Presentation is loading. Please wait.

Presentation is loading. Please wait.

ARCH-3: Context Management in the OpenEdge® Reference Architecture John Sadd Engineering Fellow and OpenEdge Evangelist.

Similar presentations


Presentation on theme: "ARCH-3: Context Management in the OpenEdge® Reference Architecture John Sadd Engineering Fellow and OpenEdge Evangelist."— Presentation transcript:

1 ARCH-3: Context Management in the OpenEdge® Reference Architecture John Sadd Engineering Fellow and OpenEdge Evangelist

2 © 2006 Progress Software Corporation2 ARCH-3 Context Management in the OERA Agenda  Client to Database – a brief history  AppServer™ modes and issues  Thinking about procedures and context  Maintaining context on the client  Maintaining context on the server  Conclusions

3 © 2006 Progress Software Corporation3 ARCH-3 Context Management in the OERA The good (very) old days: host-based FIND FIRST Customer FIND NEXT Customer /* Process Customer 1 */ /* Process Customer 2 */ Everything on one box

4 © 2006 Progress Software Corporation4 ARCH-3 Context Management in the OERA The good (not so) old days: client/server FIND FIRST Customer FIND NEXT Customer /* Process Customer 1 */ /* Process Customer 2 */ Client networking Client PC Server

5 © 2006 Progress Software Corporation5 ARCH-3 Context Management in the OERA Client/server limitations: Performance FIND FIRST Customer FIND NEXT Customer /* Process Customer 1 */ /* Process Customer 2 */ Client networking Client PC All code executes on the client Server

6 © 2006 Progress Software Corporation6 ARCH-3 Context Management in the OERA Client/server limitations: OpenEdge client platform only FIND FIRST Customer FIND NEXT Customer /* Process Customer 1 */ /* Process Customer 2 */ Client networking Server

7 © 2006 Progress Software Corporation7 ARCH-3 Context Management in the OERA What to do, what to do… Host-based Client/Server AppServer

8 © 2006 Progress Software Corporation8 ARCH-3 Context Management in the OERA OpenEdge AppServer PO ProDataSet™ The Bigger Picture – Today and Tomorrow Purchase Order Business Logic Header Data Detail Data Other Data Purchase Order Proxy.NET™ User Interface Jonas Grumby 110 Desert Isle Path Minnow, HI OK Cancel C# OpenEdge.NET Interface  Flexibility for client platforms and integration needs ABL or WebSpeed™ Interface WebClient™ / HTML User Interface Jonas Grumby 110 Desert Isle Path Minnow, HI OK Cancel OpenEdge ABL Interface ABL OpenEdge Web Services Interface

9 © 2006 Progress Software Corporation9 ARCH-3 Context Management in the OERA Agenda  Client to Database – a brief history  AppServer modes and issues  Thinking about procedures and context  Maintaining context on the client  Maintaining context on the server  Conclusions

10 © 2006 Progress Software Corporation10 ARCH-3 Context Management in the OERA Improving network performance with the AppServer RUN CustProc.p ON hAppServ (“FIRST”, OUTPUT ttCust) CustProc.p Client AppServer Business logic code executes on the server

11 © 2006 Progress Software Corporation11 ARCH-3 Context Management in the OERA Using a bound AppServer session in “state-aware” mode RUN FindCust IN hCust (“FIRST”, OUTPUT ttCust) RUN FindCust IN hCust (“NEXT”, OUTPUT ttCust) /* Process Customer 1 */ /* Process Customer 2 */ RUN CustProc.p ON hAppServer PERSISTENT set hCust. CustProc.p Client AppServer

12 © 2006 Progress Software Corporation12 ARCH-3 Context Management in the OERA Scalability and bound AppServers client AppServer session

13 © 2006 Progress Software Corporation13 ARCH-3 Context Management in the OERA Using the AppServer in “stateless” mode AppServer session AppServer broker All client requests

14 © 2006 Progress Software Corporation14 ARCH-3 Context Management in the OERA Using the AppServer in “stateless” mode– FIND FIRST AppServer session 1 AppServer session AppServer broker RUN CustProc.p ON hAS (“FIRST”, OUTPUT ttCust)

15 © 2006 Progress Software Corporation15 ARCH-3 Context Management in the OERA Using the AppServer in “stateless” mode – FIND NEXT AppServer session AppServer session 2 NEXT What?? AppServer session AppServer broker RUN CustProc.p ON hAS (“NEXT”, OUTPUT ttCust)

16 © 2006 Progress Software Corporation16 ARCH-3 Context Management in the OERA Advantages to using stateless mode  Allows sharing of server resources by many clients  Promotes scalability  Allows for load balancing and other optimizations  Allows AppServer access from other platforms

17 © 2006 Progress Software Corporation17 ARCH-3 Context Management in the OERA Challenges using stateless mode  Can’t run procedures PERSISTENT without binding the AppServer session Server procedure won’t keep track of you Can’t run internal procedures  Can’t get a procedure handle for non-persistent procedures  Can’t maintain client-specific context within an AppServer session

18 © 2006 Progress Software Corporation18 ARCH-3 Context Management in the OERA Unmanaged “state-free” mode  Not even a persistent CONNECTION-ID for the AppServer broker  Recommended for use with Web services or other connectionless environment Service-Oriented Application on the bus  Issues are essentially the same as with stateless

19 © 2006 Progress Software Corporation19 ARCH-3 Context Management in the OERA Agenda  Client to Database – a brief history  AppServer modes and issues  Thinking about procedures and context  Maintaining context on the client  Maintaining context on the server  Conclusions

20 © 2006 Progress Software Corporation20 ARCH-3 Context Management in the OERA Context Management Basics  Target environment is client to stateless or statefree AppServer  Each interaction is independent  Maintain context between related interactions

21 © 2006 Progress Software Corporation21 ARCH-3 Context Management in the OERA Dealing with context in a stateless world: binding for the duration of a task  Run a procedure PERSISTENT on a stateless AppServer session This binds the session for the life of the procedure Supports multiple calls that are part of a single ‘task’ The session is unbound when the procedure instance is deleted

22 © 2006 Progress Software Corporation22 ARCH-3 Context Management in the OERA Managing context for a task Agreement Validate Customer if ? then Context Enter Order if ? then Confirm Inventory if ? then Calculate Price if ? then Agreement Order Entry Task Agreement Customer Entity Order Entity Inventory Entity Pricing Entity

23 © 2006 Progress Software Corporation23 ARCH-3 Context Management in the OERA Managing a task by binding a stateless AppServer Agreement Validate Customer if ? Context Enter Order if ? Confirm Inventory if ? Calculate Price if ? Agreement Task Agreement Client RUN PERSISTENT DELETE PROCEDURE AppServer  This method is strongly discouraged! Uncontrolled binding to client Not suitable for SOA direction

24 © 2006 Progress Software Corporation24 ARCH-3 Context Management in the OERA Accessing shared procedure instances  Pre-start commonly used PERSISTENT procedures as part of AppServer start-up  Use a ‘gateway’ (Service Interface) procedure to route client requests  Or: Have the Service Interface start procedures the first time they are needed  Session manager on the server

25 © 2006 Progress Software Corporation25 ARCH-3 Context Management in the OERA Using a Service Interface procedure and session manager ClientServer UI Procedure DATASET dsOrder Business Entity DATASET dsOrder Data-Access Object DATASET dsOrder RUN fetchOrder IN hdsOrder (..., OUTPUT DATASET dsOrder BY-REFERENCE) RUN FetchWhere IN hEntity (..., OUTPUT DATASET phFetchDataSet BY-REFERENCE) fetchWhere: FILL ATTACH Client Proxy Service Interface Session Manager

26 © 2006 Progress Software Corporation26 ARCH-3 Context Management in the OERA Using a Session Manager DEFINE TEMP-TABLE ttEntity FIELD EntityName AS CHARACTER FIELD EntityHandle AS HANDLE FIELD DAOHandle AS HANDLE INDEX EntityName EntityName. FUNCTION getEntityHandle RETURNS HANDLE (INPUT pcEntityName AS CHARACTER): DEFINE VARIABLE hEntity AS HANDLE. FIND FIRST ttEntity WHERE ttEntity.EntityName = pcEntityName NO-ERROR. IF NOT AVAILABLE (ttEntity) THEN hEntity = startEntity(pcEntityName). ELSE hEntity = ttEntity.EntityHandle. RETURN hEntity. END FUNCTION. /* getEntityHandle */

27 © 2006 Progress Software Corporation27 ARCH-3 Context Management in the OERA Using a Session Manager - 2 FUNCTION startEntity RETURNS HANDLE (INPUT pcEntityName AS CHARACTER): DEFINE VARIABLE hEntity AS HANDLE. DEFINE VARIABLE hAccess AS HANDLE. RUN VALUE("be" + pcEntityName + ".p") PERSISTENT SET hEntity NO-ERROR. IF VALID-HANDLE(hEntity) THEN DO: CREATE ttEntity. ASSIGN ttEntity.EntityName = pcEntityName ttEntity.EntityHandle = hEntity. END. RETURN hEntity. END FUNCTION. /* startEntity */

28 © 2006 Progress Software Corporation28 ARCH-3 Context Management in the OERA Alternatives for maintaining context  Pass context information back and forth between client and server The context is held on the client  Store context between client requests in a shared data store All AppServer sessions can read and write it The context is held on the server

29 © 2006 Progress Software Corporation29 ARCH-3 Context Management in the OERA Using the AppServer in “stateless” mode AppServer session AppServer broker All client requests

30 © 2006 Progress Software Corporation30 ARCH-3 Context Management in the OERA Agenda  Client to Database – a brief history  AppServer modes and issues  Thinking about procedures and context  Maintaining context on the client  Maintaining context on the server  Conclusions

31 © 2006 Progress Software Corporation31 ARCH-3 Context Management in the OERA Passing Context between Client and Server  Context/Parameter temp-table passes context back and forth  Name & Value fields allow flexibility  Or just use a delimited list in a CHAR param  Context is maintained on the client  Useful for moderate amounts of data Also for context used on the client And for context modified on the client

32 © 2006 Progress Software Corporation32 ARCH-3 Context Management in the OERA context/parameter temp-table Context Between Client and Server -- Batching Client Server UI Procedure DATASET dsOrder Business Entity DATASET dsOrder RUN fetchOrder IN hdsOrder (..., OUTPUT DATASET dsOrder BY-REFERENCE) RUN FetchWhere IN hEntity (..., OUTPUT DATASET phFetchDataSet BY-REFERENCE) Client Proxy Procedure Server Gateway Procedure WhereString = “…” NextRowid = 63524

33 © 2006 Progress Software Corporation33 ARCH-3 Context Management in the OERA Using a context temp-table FIND ttContext WHERE ttContext.ContextName = "WhereString" NO-ERROR. IF NOT AVAILABLE(ttContext) THEN DO: CREATE ttContext. ttContext.ContextName = "WhereString". END. ttContext.ContextValue = "OrderNum = " + STRING(iOrderNum). /* …and the same for NextRowid */  Useful for any flexible set of parameters or context values in a single interface

34 © 2006 Progress Software Corporation34 ARCH-3 Context Management in the OERA Agenda  Client to Database – a brief history  AppServer modes and issues  Thinking about procedures and context  Maintaining context on the client  Maintaining context on the server  Conclusions

35 © 2006 Progress Software Corporation35 ARCH-3 Context Management in the OERA Context Maintained on the Server  Hold context in a shared server-side data store Typically a database table  Useful for context not to pass back and forth Session context such as language, authorization that does not change Also useful for large amounts of context data  Storing context on the server can be the best universal approach

36 © 2006 Progress Software Corporation36 ARCH-3 Context Management in the OERA Built-in support for UUIDs and GUIDs in 10.1A  Requires a Context ID passed from the client  GENERATE-UUID Universal Unique IDentifier Returns a 16-byte RAW (binary) value Guaranteed unique across all space and time  GUID ( ) Global Unique IDentifier Converts a UUID into a 36-character GUID –XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX  SUBSTRING(BASE64-ENCODE(GENERATE-UUID),1,22) Yields a more compact 22-character string

37 © 2006 Progress Software Corporation37 ARCH-3 Context Management in the OERA Context ID parameter Context Stored on the Server Client Server UI Procedure DATASET dsOrder Business Entity DATASET dsOrder RUN fetchOrder IN hdsOrder (..., OUTPUT DATASET dsOrder BY-REFERENCE) RUN FetchWhere IN hEntity (..., OUTPUT DATASET phFetchDataSet BY-REFERENCE) Client Proxy Procedure Server Gateway Procedure ContextID = 95847 Context 95847 English Auth …

38 © 2006 Progress Software Corporation38 ARCH-3 Context Management in the OERA ProDataSet and Temp-Table Context  Store retrieved data in a context table For WebSpeed or other clients with no ProDataSet support RAW fields and BLOBs for generic storage Or store as XML in CHARACTER format  Store successive updates before commit Allows partial validation on the server Final update ProDataSet rebuilt from context

39 © 2006 Progress Software Corporation39 ARCH-3 Context Management in the OERA ProDataSet or Temp-Table Data as Context Client Server Web browser Business Entity DATASET dsOrder Browser code RUN FetchWhere IN hEntity (..., OUTPUT DATASET phFetchDataSet BY-REFERENCE) Server Gateway Procedure ContextID = 95847 Context 95847 Order 1 Line 1 95847 Order 1 Line 2 95847 Order 1 Line 1 “OrderNum = 1” 95847 Ord 1 L 1 Q 20 Application

40 © 2006 Progress Software Corporation40 ARCH-3 Context Management in the OERA Defining a context management table  SessionID – identify a client session  ContextID – identify a specific task or transaction within a session  ContextName – Table name or other tag (like ‘WhereString’)  ContextValue – Primary key value for a table, or string value for another tag  isBeforeRow – flag for ProDataSet rows  RowSequence – for ordering table rows  TimeStamp – when the row was created or last updated (also a DeleteTime for cleanup)  RawData – temp-table row data

41 © 2006 Progress Software Corporation41 ARCH-3 Context Management in the OERA Creating a context row phBuffer:RAW-TRANSFER(TRUE, /* from buffer to RAW */ BUFFER ContextStore:BUFFER-FIELD("RawData")). ASSIGN ContextStore.TimeStamp = NOW ContextStore.DeleteTime = DATETIME-TZ( DATE(NOW) + 1, MTIME (NOW), TIMEZONE(NOW)). CREATE ContextStore. ASSIGN ContextStore.ContextID = pcContextID ContextStore.ContextName = phBuffer:Name ContextStore.ContextValue = cKeyValues ContextStore.RowSequence = piSequence ContextStore.isBeforeRow = FALSE.

42 © 2006 Progress Software Corporation42 ARCH-3 Context Management in the OERA ContextStore rows wxyzeOrder271FALSEabcdraw buffer wxyzeOline27 11FALSEabcdraw buffer wxyzeOline27 22FALSEabcdraw buffer SessionIDContextIDContextNameContextValueRowSequenceisBeforeRowRawData

43 © 2006 Progress Software Corporation43 ARCH-3 Context Management in the OERA RAW-TRANSFER limitations  Low-level – does not recognize fields or other buffer specifics  Temp-table definitions must match exactly  Use for short-term storage

44 © 2006 Progress Software Corporation44 ARCH-3 Context Management in the OERA Agenda  Client to Database – a brief history  AppServer modes and issues  Thinking about procedures and context  Maintaining context on the client  Maintaining context on the server  Conclusions

45 © 2006 Progress Software Corporation45 ARCH-3 Context Management in the OERA Design for the OpenEdge AppServer  AppServer lets you locate business logic where it belongs to improve performance  AppServer is the basis for all Open Client access,.NET support, Web services, etc.  Stateless or statefree mode gives you the greatest flexibility and scalability  Avoid binding the AppServer to a client session

46 © 2006 Progress Software Corporation46 ARCH-3 Context Management in the OERA Design context management into your application as a “feature”  Store small amounts of context on client  Store larger amounts of data on server  Design general solutions into your application architecture  Consider needs of platforms like WebSpeed and Web services for SOA

47 © 2006 Progress Software Corporation47 ARCH-3 Context Management in the OERA Design for the future  Prepare your application for future requirements WebSpeed for a browser-based UI.NET, PDA, or other new UI platforms Access as Web Services Service Oriented Architecture

48 © 2006 Progress Software Corporation48 ARCH-3 Context Management in the OERA PSDN white papers on Implementing the OpenEdge Reference Architecture -- The Service Interface Layer -- Context Management

49 © 2006 Progress Software Corporation49 ARCH-3 Context Management in the OERA Questions?

50 © 2006 Progress Software Corporation50 ARCH-3 Context Management in the OERA Thank you for your time

51 © 2006 Progress Software Corporation51 ARCH-3 Context Management in the OERA


Download ppt "ARCH-3: Context Management in the OpenEdge® Reference Architecture John Sadd Engineering Fellow and OpenEdge Evangelist."

Similar presentations


Ads by Google