writing applications with strakt's capsmanagement systems (rdbms). when talking about an rdbms...
TRANSCRIPT
© 2004 AB Strakt 1
STRAKT
Writing Applications with Strakt's CAPS
Alex Martelli
© 2004 AB Strakt 2
STRAKT
This talk's audience...:
"fair" to "excellent" grasp of Python and OO development
"fair" to "excellent" grasp of business application development and deployment
wants to learn more about: Python for business applications, CAPS
© 2004 AB Strakt 3
STRAKT
This talk doesn't cover...: all the details...!
→ Come ask at Strakt's booth
© 2004 AB Strakt 4
STRAKT
Neither does it cover...: Strakt's business-model
→see www.strakt.com
→ask at Strakt's booth
© 2004 AB Strakt 5
STRAKT
CAPS Collaborative Approach to Problem Solving focuses on real-time business applications
characterized by collaboration among knowledge workers and the handling of workflow issues• management of projects and/or resources• relationships with suppliers, customers, employees• help-desk case-tracking and handling• coordination of R & D activities
© 2004 AB Strakt 6
STRAKT
A warning about "workflow"...
search Goemail •••••••• Login
365583 members! Sign up to stay informed.
TheServerSide.com | TheServerSide.NET | MiddlewareRESEARCH.com | middleware-company.com
May 2004 Discuss this Article
Introduction
If database systems are like a respected, wise man telling a clear story, then workflow must be a buch of
spoiled brats shouting their own truth at each other. With this statement I would like to point out that
workflow management systems are at the very initial phase of the technology hype curve. We are heading
for some exciting times in this area. To illustrate this, we can make the comparison with relational database
management systems (RDBMS). When talking about an RDBMS in a software development team most
people will get the picture and shake their heads slightly up and down confirming they understand what
you're saying. When using workflow terminology, the same crowds will shake their heads similarly but this
time, every person will have a very different picture.
Figure 1 : Workflow positioned in the hype-curve
One of the observations that form the basis of this statement is the overwhelming number of concepts used.
None of the numerous specs and tools in this area is similar. Of course, they tend to overlap but it usually
takes a dictionary and an extended concept mapper to compare any 2 of those.
A topic that certainly deserves to be included in an introduction about workflow is the relation between
workflow and business process management (BPM). The term workflow is used to denote a series of
related interactions between people and a computer system. Workflow is more often heard in developer
communities. Sometimes, the meaning of workflow is restricted to the different screens of a user interface.
Business process management (BPM) has a broader scope. Where workflow is more often used in a
technical context, BPM has a broader scope. It implies also the non-technical issues like analysis,
organizational impact, from the viewpoint of a manager.
First I start with explaining what workflow management systems are. Then, the advantages of business
process management are covered. Next is an explanation of why the workflow market looks confusing at
first sight. The main conclusion will be that selecting a workflow management system is the hardest task
companies have to face. To give you a solid basis for this task, the core section of this article defines the
four layers of a process definition. It describes the common workflow & BPM concepts in a neutral
language. At the end, a guided tour along the specs and tools is added.
Register for an E.piphanyOpen Source & CRMwebinar
Sponsored Links
© 2004 AB Strakt 7
STRAKT
Application-frameworks like a library, a framework includes
substantial amounts of reusable code a framework also structures the
applications that you develop with it:• embodies architectural and design expertise• may be oriented to specific application areas• may include special-purpose mini-languages, code
generation, integration with other technologies, and other programming-in-the-large architecture-patterns
© 2004 AB Strakt 8
STRAKT
CAPS' strengths: mile-high view centers on collaboration through the
sharing of information (not just data) real-time updates, event-driven (threads
and processes used "behind the scenes", seamlessly, when and where needed)
multiple front-ends (GUI, scripts, web, mail, ...) operate on a shared information-base
N-tier flexibility eases integration, scaling, deployment
© 2004 AB Strakt 9
STRAKT
base
CAPS layers
mailGUI Web scripts ...4.front-ends
Business Logic
report cases 3.BL modules
2.middleware
1.back-end
0.database
Infinite Filing Cabinet
enterprise-level RDBMS
...
© 2004 AB Strakt 10
STRAKT
!
!
!
!
!
"!#$$%!&'!()*&+)!!
!
!
!
#!
!
!
!
!
!"! #$%&'()**+,-(./-),'-,01.2/1+(/+13'
',&-(.! /01234! 56! #! 078! 9! :;<<=7>:0?2! 42:=32/1! 0<;7@! ?A2<42/B24! C>?A! ?A2! ((D! E(2:=32!
(;:F2?4! D0123G! H3;?;:;/6! 04! ><H/2<27?28! I1! ?A2! JH27((D! />I3031K! ! -1?A;7.4! >7?23L0:2! ?;!
JH27((D6!F7;C7!04!-1JH27((D6!C04!82B2/;H28!I1!(?30F?!078!32/20428!=7823!?A2!MNO!D24423!
M27230/! -=I/>:! D>:2742! EDM-DGK! ! PD0123! %! 3=74! C>?A>7! ?A2! 40<2! H3;:244! 04! D0123! #6! 078!
?A232L;32! >7?3>74>:0//1! :;<<=7>:0?24! C>?A! >?! 42:=32/1! 078! 30H>8/1! I1! ?1H>:0/! >7?30QH3;:244!
<2:A07>4<4!4=:A!04!L=7:?>;7!:0//4!078!:0//I0:F4RK!
!
((D!3=74!;7!?;H!;L!),-ST-K!!)A232L;326!?A2!H3;:24424!?A0?!3=7!?A2!H3;@30<4!:;<H;4>7@!,&-(.!
/01234!56!#!078!9!:07!E0786!>7!L0:?6!@27230//1!8;G!3=7!;7!<=/?>H/2!A;4?4!>7!?A2!40<2!D&NK!!)A>4!
41),/53,62'
7#8-3,/29'
U3;7?Q278!D;@>:!
!!!!!!V7:31H?>;7!(23B23!,;<<=7>:0?>;7!
W0?0I042!
*2X=24?4
!*24=/?!!
Y078/>7@
!JIZ2:?!
OH80?24!
JIZ2:?!
!D0123!
,/>27?!,;<<=7>:0?>;7!
''V7:31H?>;7!&=?A27?>:0?>;7
'=4KD;@>:!
[;8=/2!
E'D[G!
!!!'042!
'=4>7244!!
!!D;@>:!
![;8=/2!
:+2-,322'
';)<-('
=,0-,-/3'4-8-,<''
#.>-,3/'
'7=4#?9'
VB27?!
[@<?K!
@A:B&
\V'!
'
D
[
2<0>/!MOT!:/>27?4 E\>76!(;/03>46!D>7=]G!
4-<+13'CD!,&-(!/012328!03:A>?2:?=32
© 2004 AB Strakt 11
STRAKT
Communication between layers BL and BLMs are only logically separate:
the BL loads the BLMs (from the IFC) into the same process (so, 2↔3 is "intrinsic")
0↔1: SQL via... (depends on the RDBMS)
1↔2, 2↔4, 3↔4: SSL (secure, distributed) no other communication between layers
• though each layer may further communicate with external systems (mostly, parts of layer 4 do), e.g. w/SMTP, HTTP, XML, ....
© 2004 AB Strakt 12
STRAKT
!
!
!
!
!
"!#$$%!&'!()*&+)!!
!
!
!
%!
,-./01.223! 456/1570/84,! .19:5/89/018! 8.686! /:8! 48;2<3=8-/! <>! 69.2.728! 636/8=6?!@5/:! <;/5<-.2!
2<.4!6:.15-A!.-4!1840-4.-93B!
!
(89018!9<==0-59./5<-!.=<-A!C&D(! 2.3816!E?!#!.-4!F! 56!.26<!G05/8! >8.65728!<H81!I&J6?!.-4!
5-4884! 8H8-! <H81! /:8! K-/81-8/B! ! L<@8H81?! ;81><1=.-98! 566086! 182./84! /<! -8/@<1M! /1.>>59!
N7.-4@54/:! .-4! 482.3O! -884! /<! 78! 9.18>0223! .6686684! 5-! <1481! /<! =.M8! 609:! 48;2<3=8-/6!
;1.9/59.2B! !&6!.! 1028!<>! /:0=7?!=<6/! >1<-/P8-4!N2.381!FO!;1<A1.=6!=.3!<>/8-!78!6099866>0223!
48;2<384!./! 2<9./5<-6!18=</8!>1<=!0;6/18.=! 2.3816B!Q8;2<3=8-/!<>!681H81P2.381!;1<A1.=6!./!
2<9./5<-6!18=</8! >1<=!8.9:!</:81?!<-! /:8!</:81!:.-4?!-<1=.223! 18G05186! 1825.728?!:5A:P6;884!
9<--89/5<-6B!
!
C&D(R!9<==0-59./5<-!@5/:!</:81!636/8=6!8=;2<36!H.15<06!.;;1<;15./8!;1</<9<26!.-4!><1=./6B!!
C&D(!0686!(ST!N.-4!=<40286!9<=;25.-/!@5/:!D3/:<-R6!Q'U&DK!6;895>59./5<-6O! /<! 5-/81<;81./8!
@5/:! 182./5<-.2! 4./.7.68! 636/8=6! N5-92045-A! /:8! ,2.381! $,! 4./.7.68OB! ! (V)D! .-4! *WC! #X##!
><1=./6! N.6! 5=;28=8-/84! 73! D3/:<-! 2571.1586! .-4! 8Y/8-65<-6O! 28/! C&D(! 5-/81<;81./8!@5/:! 8P
=.52! 636/8=6B! ! Z/:81! 6/.-4.14! ><1=./6! .-4! ;1</<9<26?! 609:! .6! L))D?! L)VT?! .-4! [VT?!
65=52.123!.22<@!C&D(!/<!5-/81<;81./8!@5/:!I87!681H816!.-4!71<@6816?!I87!681H5986?!.-4!</:81!
.;;259./5<-6!38/B!
!
&22! <>! /:8! 9<==0-59./5<-6P182./84! 9<=;<-8-/6! @5/:5-! C&D(! 068! .! :5A:23! 69.2.728! .-4!
186;<-65H8! .63-9:1<-<06! .19:5/89/018B! ):56! .19:5/89/018! 8=;2<36! 7</:! 8H8-/P415H8-!
;1<98665-A! .-4!=02/5P/:18.45-A?! .-4! 56! 5=;28=8-/84! <-! /<;! <>! /:8! ,)@56/84!V./15Y,! D3/:<-!
9<==0-59./5<-6!>1.=8@<1MB!
!
"#$
%&'()*+,('!
-()(.(/&!
012!
3$4!
!
3$
15+,)!6,7/
4(*'!
863!
35+9/&5!
"4:;!<4$!
=::;>
""$
""$
1*?@5&!A>!C&D(!9<==0-59./5<-6!
© 2004 AB Strakt 13
STRAKT
RDBMSs for CAPS applications PostgreSQL Oracle Microsoft SQL Server ...any enterprise-level (full-function)
RDBMS, i.e one w/all standard features:• transactions• views• outer joins• ...
© 2004 AB Strakt 14
STRAKT
CAPS apps in the RDBMS CAPS uses its own schema...:
!
!
!
!
!
"!#$$%!&'!()*&+)!!
!
!
!
,!
!"! #$%&'()*+,'-.'/0+'1)/)2)3+'
'-&.(! /01234! $/5! 6789:;3! 6<! -&.(! =46=345! >1?! @3! 1?2! 3?834=4:93AB3C3B! *D'E(! F*3B18:6?1B!
D181@193! E1?1G3H3?8! (2983HIJ! ! )K3! *D'E(L9! <7?>8:6?1B:82! H798! :?>B7;3! 97>K! <3187439! 19!
841?91>8:6?95! C:3M95! 67834! N6:?95! 1?;! 8K3! B:O3J! ! 01234! $! :9! 1B96! :?<64H1BB2! O?6M?! 19! 8K3!
/;181@193!B1234/J!
!
)K3! ;3C3B6=H3?8! 6<! -&.(! K19! 81O3?! =B1>3! 79:?G! .698G43(P0! FM:8K! 96H3! 9=3>:<:>! 1883?8:6?!
1B96!G:C3?! 86!Q41>B3I5!M:8K678!3R=B6:8:?G!9=3>:1B5!?6?A=6481@B3! <3187439! <67?;! :?!.698G43(P0!
6?B2J! !(=3>:1B! <3187439!1?;!S7:4O9!9=3>:<:>! 86!31>K!G:C3?!*D'E(!>1?!@3!3?>1=97B183;! :?86!1!
8K:?5! M3BB! 9=3>:<:3;! /=6481@:B:82! B1234/J! ! &9! 1! >6?93S73?>35! <78743! 1;;:8:6?! 6<! 68K34! *D'E(!
3?G:?39!6<!>6H=141@B3!<7?>8:6?1B:825! :<!1?;!MK3?!&'!(841O8L9!=148?349!1?;!>7986H349!43S7:43!
:85!M:BB!@3!<319:@B3J!!
!
T6M3C345! =B3193! ?683! 8K18! -&.(! ;3<:?39! :89! 6M?!D'! 9>K3H1J! ! U?83G418:?G! -&.(!M:8K! 68K34!
3R:98:?G! 1==B:>18:6?9! 8K18! 793! 8K3! 91H3! D'! 3?G:?35! @78! M:8K! 8K3:4! 6M?! 9>K3H195! :9! 1! 819O!
9:H:B14!86!8K18!6<!68K34!:?83G418:6?9!@38M33?!-&.(!1?;!3R:98:?G!1==B:>18:6?9J!!)K343!:9!?6!M12!
86!H1O3!-&.(!N798!793!1!=43A3R:98:?G!43B18:6?1B!D'!9>K3H1J!!)K343<6435!?64H1BB25!?6!9=3>:1B!
1;C1?81G3! :9! G1:?3;! @2! K1C:?G! -&.(! 01234! $! 9K143! 1! =148:>7B14! D'! 3?G:?3! M:8K! 68K34!
1==B:>18:6?9J!!E1?2!6<!8K3!@3?3<:>:1B!92983H!>K141>834:98:>9!M3!9K1BB!3R1H:?3!:?!8K3!<6BB6M:?G!
;3=3?;!6?!8K3!>47>:1B!;39:G?!>K6:>3!6<!K1C:?G!-&.(!;3<:?3!1?;!793!:89!6M?!D'!9>K3H1J!
!
!
!
!
!
!
!
!
!
4567,+'8.!-&.(!D181@193!9>K3H1!
!
'
DQ!
)Q-!
'0E! V&EW!)X.0W!
UV()&V-W!)X.0W!
)X.0WY&0XW!UV)
Z0Q&)
'0Q'
()*UV[
!
© 2004 AB Strakt 15
STRAKT
Infinite Filing Cabinet (IFC) real-time, transactional OODB built on top of the level-0 RDBMS "infinite" because by design the IFC does
not remove "old, superseded" information• marks deleted/updated info as "deprecated"• ensures perfect audit trail• supports future data-mining, reporting, ...• obliteration (e.g. for legal requirements... or very
tightfisted, myopic customers:-) via other admin itf
© 2004 AB Strakt 16
STRAKT
IFC: Query vs Request "Query": give me the set of objects
satisfying condition ... [[as numeric IDs]] "Request": for this set of objects [[as
numeric IDs]] give me the values of these attributes ... [[lists of approp. datatypes]]
each can be transient or subscription• upon subscription, IFC sends update packets
(asynchronously, as needed) until canceled
© 2004 AB Strakt 17
STRAKT
IFC: Events "normal": send alert when certain specified
attributes change...• ..."to" given values, or...• ..."away from" given values, or...• ...from given "entry" values to given "exit" values
"timed": if certain attributes have specified values at a specified time
"rule-based": when objects are created or modified and satisfy certain conditions
© 2004 AB Strakt 18
STRAKT
The Business Logic the BL middleware subsystem builds full-
fledged business objects on top of the IFC's fundamental OODB facilities• objects that respect "business rules" and have all the
appropriate behavior
the BL mediates all communication to and from all of the front-end subsystems• thus, front-ends always deal with business objects,
never with the "raw" underlying ones
© 2004 AB Strakt 19
STRAKT
BL: access privileges the IFC trusts the BL (once properly
connected and authenticated) and lets it perform all kinds of accesses and updates
the BL (in the "base" module) implements "users" and "groups", and grants highly selective access privileges accordingly
BL↔IFC needed trust level is thus high, while BL↔FE trust level can be quite low
© 2004 AB Strakt 20
STRAKT
1 IFC ↔ multiple BLs ...not currently supported, but... ...architecturally OK:
• BL caches can be refreshed or invalidated upon a BL receiving subscription updates (from others' changes)
DBIFC
BL BL BL BL
© 2004 AB Strakt 21
STRAKT
!
!
!
!
!
"!#$$%!&'!()*&+)!!
!
!
!
,!
!
!
!"! #$%&'()*+,'-.'/0123+11'(4526'74809+1':/(71;'
')-.!/0.1234/5!/6!3-.!'7!89:8;83.<!48!-4=->;!</?9>21@!!A5!3/0!/6!3-.!'7!456128319B391.!01/0.1C!
D-4B-! B/5834393.8! 72;.1! #C! 2! 6913-.1! >/=4B2>! >2;.1! 1958! E28! 0213! /6! 3-.! 82<.! 01/B.88F! 25;!
59<:.1!/6!200>4B234/5!80.B464B!:9845.88G>/=4B!</?9>.8@!!)-.!'7!>/2?8!E61/<!3-.!?232:28.C!H42!
3-.! IJKF! 3-.! 8.3! /6! L'9845.88! 7/=4B! M/?9>.8L! E'7M8F! 3-23! ?.645.! 3-.! :9845.88! /:N.B38! 25?!
:9845.88!19>.8!/6!/5.!/1!</1.!200>4B234/58@!
!
'7M8! 21.! B/?.?! 45! 2! 84<0>.! :93! 0/D.169>! L?.B>21234H.L! >25=92=.C! 8;532B34B2>>;! 84<4>21! 3/!
O;3-/5@!!)-.!L'7M!>25=92=.L!>.38!3-.!200>4B234/5!01/=12<<.1!.P01.88!2>>!/6!3-.!695?2<.532>!
01/0.134.8!/6!3-.!200>4B234/5C!1.89>345=!61/<!Q5343;G*.>234/58-40!252>;848@!!)-.!'7M!>25=92=.R8!
64183GB>288! B/5B.038! 45B>9?.! 3-.! Q53434.8! 45H/>H.?! 45! 25! 200>4B234/5C! 3-.! &3314:93.8! /6! .2B-!
Q5343;C!25?!3-.!E:4521;F!*.>234/58!3-23!-/>?!:.3D..5!Q53434.8@!
!
)-.!'7M!>25=92=.!>.38!3-.!200>4B234/5!01/=12<<.1!?.B>21.!3-.!</83!4<0/13253!B-212B3.14834B8!
/6!3-.8.!-4=-G>.H.>!/:N.B38@!!J/1!.P2<0>.C!45!3-.!B28.!/6!2!*.>234/5C!3-.!01/=12<<.1!?.B>21.8!
3-.!LSG&143;L!/6!.2B-!L.5?L!/6!3-.!*.>234/5C!3-23!48C!D-.3-.1!43!48!/5.G3/G/5.C!/5.G3/G<25;C!/1!
.H.5!L/034/52>L! 6/1! 3-23!.5?!E25!SG2143;!/6! LT.1/!/1!/5.L!/5! 3-23!.5?!/6! 3-.!*.>234/5F@! !)-.!
'7M!>25=92=.! 438.>6!2>>/D8!?41.B3!?.B>21234/5!/6!<25;!3;04B2>! 1.89>38!/6!252>;848C!89B-!28!3-.!
);0.8!/6!&3314:93.8C!25?!2!H214.3;!/6!K/583124538!3-23!&3314:93.8!<983!1.80.B3!E/5.!84<0>.!U45?!
/6! '9845.88! *9>.8F@! ! Q53434.8! B25! 98.! E845=>.F! 45-.14325B.C! 25?! B25! :.! /1=254T.?! 2B1/88!
<9>340>.!M/?9>.8!25?!B/?.!74:1214.8C!D43-!<9>340>.G>.H.>.?!8319B391.?!EL02BU2=.G>4U.LF!52<.8@!
!
)-.!L01/B.?912>L!280.B38!/6!:9845.88!/:N.B38!25?!19>.8!21.!.P01.88.?!:;!.<:.??45=!O;3-/5!
8/91B.!B/?.!45!3-.!'7M!8/91B.8@!!(9B-!.<:.??.?!B/?.!48!.P.B93.?!.43-.1!D-.5!1.V9.83.?!:;!
<=#'
#4>>0326)?2431
@>)29!
/A&<B@&&'(CD<#
=,43?'@38''
#4>>0326)?2431'
E7('<FC'
/(7'()350)5+'
/0123+11'(4526'74809+1!
M/?9>.!WXYZ!
!!QS)I)X!)[M'7Q*Z!
!!!&))*I'[)Q!JAA!48!
!!!!!*Q\[K)IAS!W!
!!!&))*I'[)Q!'&*!48!
!!!!*Q\[K)IAS!X
&&('
&7G%'
&&('
<=#'=250,+'H.!'9845.88!7/=4B!72;.1!
© 2004 AB Strakt 22
STRAKT
Business Logic Modules BL loads from IFC and runs multiple BLMs the base BLM, always present, supplies:
• infrastructure: TOI, session, settings, event, ...• security model: user, UG, AC, OPE/PAE, BLAUTH, ...• auxiliary: macro, search, query, mailqueue, ...
auxiliary BLMs, plugin-like (reporting, ...) application BLMs: application information
model, business rules, specific actions, ...
© 2004 AB Strakt 23
STRAKT
The BLM Language blam each BLM is coded in CAPS' own "BLM
Language" (very unofficially blam ) declarative, corresponds to Entity-Relation
analysis of the information-model a rather Python-like syntax:
• significant indentation, uncluttered• comments, docstrings, a few parentheses• its own set of keywords
embeds Python code for procedural parts
© 2004 AB Strakt 24
STRAKT
BLM Language concepts toc ("class") and toi ("instance") ↔ Entity
• tocs form a single-inheritance tree
type: string, number, ...; can have further• restrictions (on quantity, changeability, ...)
tois (and whole BLMs) can have:• methods, may have parameters and results• attributes, stored or computed, may have on clauses,
restrictions pre, post, both, default values, ...• relations to/from other tois• on clauses (create/update of the whole toi)
© 2004 AB Strakt 25
STRAKT
blam blm, import, type
""" module docstring """blm name version "string" some Python code here%%import a_blm_named_foo as bar
type nameString is LimitedString """ docstring for the type """ restriction quantity(1)
© 2004 AB Strakt 26
STRAKT
code import time%%attribute now is Timestamp "The current time" restriction quantity(1) computation code return [ time.time() ] %%
blam code, attribute
© 2004 AB Strakt 27
STRAKT
blam method, restriction
method createFoo(bar) is ToiReference restriction quantity(1) restriction toiType(Foo) param bar is nameType code foo=services.new('Foo', b=bar) return [foo] %%
© 2004 AB Strakt 28
STRAKT
blam toc, on-clauses
toc Foo(Bar) """ an example toc """ attribute b is nameType on update code newinitial = value[0][0] existing = self.b[0][0] if newinitial != existing: raise BlmException('?!') %%
© 2004 AB Strakt 29
STRAKT
blam relations
relations are a first-class concept, w/constraints (e.g. arity) as restrictions:
toc Tree relation parent to Tree.children restriction quantity(1) relation children from Tree.parent there are also ToiReference attributes,
usable kinda like "2nd-class" relations
© 2004 AB Strakt 30
STRAKT
blam "2nd class relations"
toc Club attribute members is ToiReference restriction toiType(Person)toc Person attribute clubs is ToiReference restriction toiType(Club) computation code return services.findObjects(Club, members=self) %%
© 2004 AB Strakt 31
STRAKT
blam the 1st class equivalent
toc Person relation clubs from Club.members attribute name is nameTypetoc Club relation members to Person.clubs on update code for p in value: if p.name == [u'Groucho']: raise BlmException('no way!') %%
© 2004 AB Strakt 32
STRAKT
blam , ACID, multiwhatever
"real" transactions should always be:
• Atomic• Consistent• Isolated• Durable
for speed & scalability, CAPS is event-driven (with threads/processes behind the scenes)
...it might be challenging to code to this...
© 2004 AB Strakt 33
STRAKT
blam might be challenging...
...so you don't have to! (we're not quite there, but closing in...): transparent ACID
• "collision detection", automatic restarts, transactions
(we do have already, kinda...): transparent multiwhatevering
• code plainly and linearly (no locking/unlocking, no explicit "waits", callbacks, deferreds, ...)
• sequencing & synchronizing are implicit
© 2004 AB Strakt 34
STRAKT
blam & presentation issues
presentation-driving metadata are set by separate Presenter sub-modules
currently coded as plain Python classes• procedural, not declarative• mostly bunches of self.setThis, self.addThat calls• methods & constants supplied by Presenter baseclass• some Template-Method DP usage• currently only for GUI front-ends (e.g. web front-ends
currently use on-disk HTML template files)
...clearly space to grow here
© 2004 AB Strakt 35
STRAKT
An example Presenter subclassclass SessionPresenter(MyPresenter): def _addTocPresentation(self, toc): self.setViewList((self.vwList, self.vwPick, self.vwSearch, self.vwFull)) self.addListColumns(None, ('name', 'user_id', 'last_active'))
self._addToFullView(None, 'name', self.stdFullEdit) self._addToFullView(None, 'user_id', _defaultToiRef(toc['user_id'])) self._addToFullView(None, 'last_active', self.stdFullDateTime)
self.addToSearchView(None, 'name') self.addToSearchView(None, 'user_id') self.addToSearchView(None, 'last_active')
self.setPickView(('name', 'user_id', 'last_active'))
self.addListViewFunctions(None, (self.vfCreate,self.vfDelete,self.vfFind, self.vfPrint,self.vfOpen)) self.addFullViewFunctions(None, (self.vfSubm,self.vfRevert,self.vfEdit)) self.addSearchViewFunctions(None, (self.vfSearch,))
self.addToTocPresentation('defaultAttr', 'name') self.mkStdViewLists() self.mkStdViewInfo()
© 2004 AB Strakt 36
STRAKT
CAPS front-ends ("clients")
!
!
!
!
!
"!#$$%!&'!()*&+)!!
!
!
!
,!
-./0123456!1781912461:!.3!/;40!<4325=0!<.0-=2=.01!.<<73>!!?.3!4@56AB4:!1.64!5223=87241!.C!
50!402=29!<50!84!1A4<=C=4-!51!84=0D!E<.6A724-E>!!);4!F5B74!.C!17<;!50!5223=8724!=1!0.2!5<275BB9!
12.34-! =0! 2;4! -5258514G! 352;43:! 4684--4-! H92;.0! <.-4! 3701:! 50-! <.6A7241! 2;4! 5223=8724I1!
F5B74!.0!2;4!CB9:!.0!2;4!851=1!.C!.2;43!-525:!45<;!2=64!2;4!F5B74!=1!34J74124->!
!
K&H(! .A4352=.01! =0<B7-4! C7BB! 235015<2=.05B! E&KLME! D753502441! N&2.6=<=29:! K.01=1240<9:!
L1.B52=.0:!M7358=B=29O:!50-!=024305BB9!.A43524!=0!;=D;B9P5190<;3.0.71:!67B2=PA3.D35664-!/591>!!
Q./4F43:! 2;4! 'RS! R50D75D4! 17AAB=41! 5! B=83539! 2;52! 5AAB=<52=.0! A3.D3566431! <50! 714! 2.!
1237<2734! 2;4=3!<.-4! =0!.3-=0539:!14J7402=5B!/591:!/;=B4! 23501A53402B9!17AA.32=0D!17<;!67B2=P
A3.D3566=0D!50-!&KLM!D753502441>!
!
T5<;!'RS!<50!84!511.<=524-!/=2;!1421!.C!-41<3=A2=F4!-525:!E-4<.352=0DE!45<;!T02=29:!*4B52=.0:!
&223=8724:! 50-! 1.! .0:! /=2;! A34140252=.0P34B524-! 6425P=0C.3652=.0>! ! );4! K&H(! C3564/.3U!
<.641!/=2;!D40435BPA73A.14!C3.02P40-1!NE<B=4021EO>! !);4!EA34140252=.0!D7=-4B=041E!511.<=524-!
/=2;! 45<;! 'RS! B42! 2;4! 5AAB=<52=.0! A3.D356643! 451=B9! <712.6=V4! 2;414! <B=4021! 2.! A3.A43B9!
-=1AB59! 2;4! -525! 34B4F502! 2.! 45<;! D=F40! K&H(P8514-! 5AAB=<52=.0>! ! (=0<4! 14F435B! 17<;!
<712.6=V58B4! <B=4021! 4@=12:! 45<;! 'RS! <50! 84! 511.<=524-! /=2;! 14F435B! A535BB4B! 1421! .C!
EA34140252=.0!-525E:!45<;!25DD4-!/=2;!5!-=CC43402!1237<2734-!0564>!
!
!
!"! #$%&'()*+,'-.'/0+'1,23/4+35'6$7$'89:;+3/<8='
'H3.D3561!=0!R5943!W!.C!K&H(!=02435<2!/=2;!2;4!'71=0411!R.D=<!N50-:! =0-=34<2B9:!/=2;!2;4!'RS1!
3700=0D!=0!2;4!'RO>!!(7<;!C3.02P40-!A3.D3561!5B1.!=02435<2!/=2;!71431:!-=34<2B9!.3!2;3.7D;!942!
.2;43! EB59431E! B.<524-! 4F40! C732;43! -./0123456>! ! ?.3! 4@56AB4:! 29A=<5B! 4@56AB41! .C! R5943! W!
A3.D3561! /.7B-! 84! X48! 143F431:! /;=<;! <.7B-! C44-! EB4F4B! YE! X48! 83./1431! /;=<;! A341402!
-525!2.!71431>!!R5943!W!X48!143F431!<.7B-!5B1.!17AAB9!X48!143F=<41!NC.3!4@56AB4!2;3.7D;!2;4!
ZSRP*HK!A3.2.<.BO!/;=<;!=0!2730!534!<.01764-!89!C732;43!6=--B4/534PB5943!A3.D3561!942>!
!
!>;?@,+'A.!?3.02!40-1!
>:+B;C:+'DE'
FGH'9:;+3/'
&&(
I+CJ;/4C)<+5'
I+C'<+,K+,'
L2@,'1,23/4+35'
?2+<'0+,+M'
N
O)/90;3?')35'
&9,;P/;3?'
#@</2Q'FGH
>RSTE'UTV&
O$#7'UTV'6H>#WO(WO(X='
YEE%
© 2004 AB Strakt 37
STRAKT
CAPS front-ends handle all user-interaction:
• flexible Qt-based "generic" GUI client • it's feasible to write custom GUI clients• Twisted/Nevow - based web front-ends• it's feasible to use "curses" via Python scripts
can handle many integration tasks:• via Python scripting• by exposing webservices (XML-RPC, SOAP, ...) to
remote clients or (more typically) to other middleware
many further yet-untapped possibilities
© 2004 AB Strakt 38
STRAKT
© 2004 AB Strakt 39
STRAKT
CAPS' General GUI Client cross-platform Windows, Linux, Solaris,
(Mac), ..., w/Qt+Python+PyQt customized per-application/per-site by BLM
presentation data and plug-ins customized per-user by individual settings real-time operation macros ...
© 2004 AB Strakt 40
STRAKT
CAPS' web front-ends Tweb mini-framework to sit on top of, and
merge/integrate, CAPS, Twisted, Nevow all "logic" expressed in plain Python code
• "client-connection"; pages; forms; other resources
all "presentation" expressed in HTML templates (plus CSS, etc)• full-page/form templates; fragment-templates• standard Nevow data/render methods (sequence, ...)• additional data/render methods (attr, ...)
© 2004 AB Strakt 41
STRAKT
CAPS scripting front-end full Python interpreter
• interactive environment for exploration/debug/...• running top-level scripts for... whatever purpose!• (potentially) could be embedded in any application
services object (queries, toi-creation, transaction control [commit/rollback])
objects for blms, tocs, tois (implicit requests and updates via properties)
completely transparent synchronization
© 2004 AB Strakt 42
STRAKT
The CAPScase application helpdesk management
• easily adapted to similar case-management workflows
includes models for people & organizations• could be "hived off" to a library-BLM
centers on the Case toc• case-metadata (state, priority, dates & times, ...)• various relations to people (handlers, initiator, ...)• contains Actions, Messages, Notes, Documents...• automatic journaling of all meaningful changes
© 2004 AB Strakt 43
STRAKT
The CAPSpro application "generic" case-management
• variants are in use for software-development, manufactured-products delivery, ...
variant of CAPScase easiest to adapt to many kinds of case-management needs
© 2004 AB Strakt 44
STRAKT
The CAPSupphandling application structured procurement management
• per Sweden's public-sector regulations...• ...which generalize to other EU countries'• could be easily adapted to similar workflows
models for people, organizations & roles• pretty similar to CAPScase's
centers on the Procurement toc... ...and its rules-based, structured progress
along States (prereq's & conseq's)