fmod CSPTK0-CLASS is
  inc CSPTK-IFACE .
  inc SPTK-CLASS .
  inc SP-CLASS .
  op CSPTK0 : -> Cid .
endfm


mod CSPTK0 is
  inc CSPTK0-CLASS .

 rl[csptk.findServiceReq]:
  < O:Oid : CSPTK0 | lookup(L:Oid), clientId(id:String),  idle >
  msg(O:Oid, A:Oid, findServiceReq(sn:String)) 
  =>
  < O:Oid : CSPTK0 | lookup(L:Oid), clientId(id:String),  
                  waitfor(L:Oid, A:Oid, findServiceReq(sn:String)) >
  msg(L:Oid, O:Oid, lookupReq(sn:String)) 
 .

 rl[csptk.lookupFail]:
  < O:Oid : CSPTK0 | lookup(L:Oid), clientId(id:String),  
                    waitfor(L:Oid, A:Oid, findServiceReq(sn:String)) >
  msg(O:Oid, L:Oid, lookupFail(sn:String) )
  =>
  < O:Oid : CSPTK0 | lookup(L:Oid), clientId(id:String), idle >
  msg(A:Oid, O:Oid, findServiceFailed(sn:String) )
 .

 rl[csptk.lookupOk]:
  < O:Oid : CSPTK0 | lookup(L:Oid), clientId(id:String),  
                 waitfor(L:Oid, A:Oid, findServiceReq(sn:String)) >
  msg(O:Oid, L:Oid, lookupOk(sn:String, pd:Data))
  =>
  < O:Oid : CSPTK0 | lookup(L:Oid), pxd(pd:Data), clientId(id:String),
                waitfor(myJVM,A:Oid, findServiceReq(sn:String)) >
    msg(myJVM, O:Oid, newIdReq)
 .

 rl[csptk.newidreply]:
  < O:Oid : CSPTK0 | lookup(L:Oid), clientId(id:String),  
                    pxd(proxyD(cl:Cid, atts:AttributeSet)), 
                 waitfor(myJVM, A:Oid, findServiceReq(sn:String)) >
    msg(O:Oid, myJVM, newIdReply(N:Oid))
  =>
  < O:Oid : CSPTK0 | lookup(L:Oid), clientId(id:String),  idle >
  < N:Oid : cl:Cid | atts:AttributeSet, clientId(id:String), idle >
  msg(A:Oid, O:Oid, findServiceOk(sn:String, N:Oid)) 
 .

endm
