PowerBuilder Foundation Class - PowerPoint PPT Presentation

1 / 60
About This Presentation
Title:

PowerBuilder Foundation Class

Description:

Functionality is encapsulated in service classes ... Enable the requestor to customise the service. Protected instance variables ... – PowerPoint PPT presentation

Number of Views:469
Avg rating:5.0/5.0
Slides: 61
Provided by: Harg151
Category:

less

Transcript and Presenter's Notes

Title: PowerBuilder Foundation Class


1
PowerBuilder Foundation Class
  • Sea Bass Software Limited
  • www.seabass.co.uk

2
Introduction
  • David Hargreaves
  • david.hargreaves_at_seabass.co.uk
  • Sea Bass Software Limited
  • www.seabass.co.uk

3
Topics for Discussion
  • Using PFC Services
  • Adding Additional Services
  • Debugging an Application
  • PFC Security

4
Using PFC Services
  • Service Orientated Framework
  • Service Classes
  • Requestor Classes
  • Creating Services
  • Delegating Work to Services

5
Service Orientated Framework
  • Functionality is encapsulated in service classes
  • Requestor classes delegate work to service
    classes
  • Uses the Client/Server model

6
Service Orientated Framework
Services
Requestor
Base
Sort
Filter
7
Service Classes
  • Perform work specific to the service
  • Maintains a link to the requestor object

8
Service Classes
n_cst_dwsrv_sort
u_dw idw_requestor ...
of_SetRequestor(u_dw adw_requestor) idw_requestor
adw_requestor ...
pfc_clicked(xpos, ypos, row, dwo) This.of_Sort()
...
of_Sort() idw_requestor.Sort() ...
9
Requestor Classes
  • Owns service objects
  • Create service objects required
  • Maintains a link to the service object
  • Delegates work to the service object
  • Destroys the service object

10
Requestor Classes
u_dw
n_cst_dwsrv_sort inv_sort ...
of_SetSort(boolean ab_switch) inv_sort Create
n_cst_dwsrv_sort inv_sort.of_SetRequestor(This)
...
clicked(xpos, ypos, row, dwo) IF IsValid
(inv_Sort) THEN inv_Sort.Event pfc_clicked
( xpos, ypos, row, dwo ) END IF ...
11
Creating Services
  • Requestor object owns the service object
  • Requestor object creates the service (two way
    link)
  • Requestor contains pre-defined instance variables
    to point to service
  • Pre-defined requestor functions allowing the
    service to be created

12
Creating Services
u_dw (requestor)
n_cst_dwsrv_sort inv_sort
... of_SetSort(TRUE) inv_sort Create
n_cst_dwsvr_sort inv_sort.of_SetRequestor(This)
...
n_cst_dwsvr_sort (service)
u_dw idw_requestor
... idw_requestor adw_requestor ...
13
Demonstration
  • Create application error service
  • Create window status bar service

14
Delegating Work to Services
  • Work is delegated using pre-defined methods in
    Requestor and Service objects
  • Delegation Types
  • Pre-defined delegation
  • User-defined delegation

15
Pre-defined Delegation
  • Requestor Pre-coded events
  • PowerBuilder events
  • PFC events called from menu
  • Service Pre-coded events
  • Re-directed from requestor

16
Pre-defined Delegation
u_dw (requestor)
n_cst_dwsrv_sort inv_sort
IF IsValid (inv_Sort) THEN inv_Sort.Event
pfc_clicked ( xpos, ypos, row, dwo ) END IF
n_cst_dwsvr_sort (service)
u_dw idw_requestor
... idw_Requestor.Sort() ...
17
User-defined Delegation
  • Service pre-coded functions
  • Requestor delegates work to service
  • Functions used to change the state of a service

18
User-defined Delegation
u_dw (requestor)
n_cst_dwsrv_sort inv_sort
This.of_SetSort(TRUE) IF IsValid(inv_Sort)
THEN inv_Sort.of_SetStyle(inv_sort.dragdrop) END
IF
n_cst_dwsvr_sort (service)
integer ii_style
... ii_style ai_style ... Return 1
19
Demonstration
  • Determine the error service attributes
  • Database
  • Log File
  • Severity
  • Determine the status bar attributes
  • Time
  • User/Database
  • Progress bar

20
Using PFC Services Summary
  • Service Classes encapsulate functionality
  • Requestor Classes call required services
  • Pre-defined delegation has been coded into the
    PFC
  • User-defined delegation changes the default style
    of the service

21
Adding Additional Services
  • Create Additional Service Objects
  • Create Service Object
  • Instance variables
  • Functions
  • Events
  • Add New Service to Requestor
  • Instance variable
  • Create/Destroy function
  • Re-direct calls to service

22
Create Additional Service Objects
pfc_w_master
pfc_n_base
w_master
n_base
pfc_w_response
pfc_n_cst_dwsrv
w_response
n_cst_dwsrv
w_column_dragdrop
n_cst_dwsrv_column
23
Demonstration
  • Create a DataWindow service to allow columns to
    be moved during runtime
  • Create a column service object
  • Create a column service attribute object
  • Create a column drag and drop window

24
Create Service Functions
  • Encapsulate functionality
  • Protected instance variables
  • Protected functions
  • Enable the requestor to customise the service
  • Protected instance variables
  • Public functions to change variables

25
Create Service Functions
n_cst_dwsrv_column (Extension Layer)
string is_excludecolumns
Public of_setexclude (string as_excludecols) of
_getexclude (ref string as_excludecols) Protect
ed of_buildcolumnattrib ( ref
n_cst_columnattrib anv_columnattrib) ...
26
Demonstration
  • Create the column service functionality
  • Create the required instance variables
  • Create the public interface, such as get/set
    functions
  • Create the column functionality

27
Create Service Events
  • Create user events for requestor redirection
  • Process service functionality
  • Call additional service objects
  • Ensure a return code is provided

28
Create Service Events
n_cst_dwsrv_column (Extension Layer)
event pfc_column()
... IF NOT IsValid(idw_requestor) THEN li_rc
-1 ELSE li_rc This.of_SetColumn() END
IF RETURN li_rc
29
Demonstration
  • Create the column service events
  • Create a pfc_columndlg event to call the
    drag-drop window

30
Add New Service to Requestor
  • Add instance variable for service
  • Add of_Set() function to enable service
  • Re-direct events to service

31
Add New Service to Requestor
u_dw (Extension Layer)
n_cst_dwsrv_column inv_column ...
Public of_setcolumn(boolean ab_switch)
pfc_columndlg event IF IsValid(inv_column)
THEN inv_column.Event pfc_columndlg() END IF ...
32
Demonstration
  • Create the requestor service calls
  • Create service instance variable
  • Create function to turn service on/off
  • Create a pfc_columndlg event to call the column
    service

33
Creating Services
  • Requestor object owns the service object
  • Requestor object creates the service (two way
    link)
  • Requestor contains pre-defined instance variables
    to point to service
  • Pre-defined requestor functions allowing the
    service to be created

34
Creating Services
u_dw (requestor)
n_cst_dwsrv_column inv_column
... of_SetColumn(TRUE) inv_column Create
n_cst_dwsvr_column inv_column.of_SetRequestor(Thi
s) ...
n_cst_dwsvr_column (service)
u_dw idw_requestor
... idw_requestor adw_requestor ...
35
Demonstration
  • Create the column service to allow columns to be
    moved during runtime
  • Add a menu item to call the service

36
Adding Additional Services Summary
  • Create new service objects
  • Create events for redirection and functions to
    encapsulate functionality
  • Create requestor links to service object
  • Instance variable
  • Create/Destroy function
  • Re-direct functionality

37
Debugging an Application
  • Application Debugging
  • SQL Debugging

38
Application Debugging
  • Creating the debug service
  • Display debug messages
  • Debug service using the registry

39
Creating the Debug Service
  • Requestor creates the service (two way
    link)
  • Requestor contains pre-defined instance variables
    to point to service
  • Pre-defined requestor functions allowing the
    service to be created
  • Requestor user delegation
  • Delegates work to service
  • Functions used to change the state of a service

40
Creating the Debug Service
n_cst_appmanager (requestor)
n_cst_appmanager inv_debug
... of_SetDebug(TRUE) inv_debug Create
n_cst_error inv_debug.of_OpenLog(TRUE) inv_debug.o
f_SetAlwaysOnTop(TRUE)
41
Demonstration
  • Create the debug service
  • Determine the debug service attributes
  • Open log window
  • Window state

42
Display Debug Messages
  • Create a standard debug message function
  • Define a method for storing debug messages
  • Default message a part of header script

43
Standard Debug Message Function
n_cst_appmanager
of_debug(as_Object, as_Event, as_Description)
... IF IsValid(gnv_app.inv_debug) THEN IF
gnv_app.inv_debug.of_IsLogOpen() THEN
ls_Message "Object " as_Object "
ls_Message "Evt/Fun " as_Event " "
ls_Message as_Description
gnv_app.inv_debug.of_Message(ls_Message) END
IF END IF
44
Default Header Script
n_cst_appmanager
pfc_open event
... gnv_app.of_Debug(This.ClassName(),
"pfc_open") ...
45
Debug Service using the Registry
  • Create the registry settings
  • Allows service to be used in development
  • Allows service to be used in live application
  • Modify the creation settings

46
Debug Service using the Registry
n_cst_appmanager (requestor)
n_cst_appmanager inv_debug
... RegistryGet(...\Debug', 'Application',
RegString!, ls_Debug) IF Lower(ls_Debug)
'on' THEN This.of_SetDebug(TRUE) ...
inv_debug.of_SetAlwaysOnTop(TRUE) ...
inv_debug.of_OpenLog(TRUE) END IF ...
47
Demonstration
  • Add service registry settings
  • Turn the service on
  • Make the debug window always appear on top
  • Change error and status bar options

48
Debugging an Application Summary
  • Start the debug service
  • User-defined delegation changes the default style
    of the service
  • Start the SQL debug service
  • Owned by the debug service
  • User-defined delegation changes the default style
    of the service

49
PFC Security Utility
  • Set Up the Security Application
  • PFC Application Security Service
  • Using the Security Application

50
Set Up the Security Application
  • Create the Security database tables
  • SQL Scripts (pfcorax.sql, pfcsyx.sql)
  • PFC Database (pfc.db)
  • Create the Security scanner application
    executable (pfcsecsc.exe)
  • All objects must be in the EXE because it changes
    its library list
  • Create Security application executable

51
Demonstration
  • Create security database tables
  • Create security scanner executable

52
PFC Application Security Service
  • Create the Application objects security service
  • Start the service (of_SetSecurity)
  • Initialise the service (of_InitSecurity)
  • Register the relevant windows with the security
    service (pfc_preopen event)

53
Demonstration
  • Add the security settings to the registry
  • Start the security service on the application
    object
  • Start the security service on a PFC window

54
Using the Security Application
  • Create Security Groups and Users
  • Scan a PFC Application
  • Assign permissions to PFC objects for Groups or
    Application Users

55
Creating Groups and Users
  • Groups
  • Groups of Users
  • Users
  • Individual user logons

56
Scan a PFC Application
  • Select a PFC application
  • All windows and DataWindows are selected
  • Highlight objects to be scanned

57
Assigning Permissions
  • Select application window or DataWindow
  • Select Group or User
  • Assign permissions to objects on window or
    DataWindow
  • Not Set
  • Invisible
  • Disabled
  • Enabled

58
Demonstration
  • Scan a PFC application
  • Create ADMIN and USER groups
  • Create Users and add them to the groups
  • Assign permissions to application objects

59
PFC Security Utility Summary
  • Set Up Security application
  • Create Security options in the PFC application
  • Scan the PFC application
  • Create groups and users
  • Assign permissions to application objects

60
Questions and Answers
  • David Hargreaves
  • david.hargreaves_at_seabass.co.uk
  • Sarah Bell - Business Manager
  • sarah.bell_at_seabass.co.uk
  • (01491) 682585
  • Web Site
  • www.seabass.co.uk
Write a Comment
User Comments (0)
About PowerShow.com