IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
Service Behavior Consistency Service Behavior Consistency in the OSGi Platformin the OSGi Platform
AuthorsAuthors
Y.Qin, H.Hao,L.Jun , G.Jidong and L.JianY.Qin, H.Hao,L.Jun , G.Jidong and L.Jian
Proceedings of 12th Asia-Pacific Software Engineering Conference (APSEC’05)
(acceptance rate ~= 29%)
ReporterReporter
C.F.Liao (C.F.Liao ( 廖峻鋒廖峻鋒 ))
Feb 15,2007Feb 15,2007
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
2/30
OutlineOutline
PreliminariesPreliminaries Behavior Inconsistency Behavior Inconsistency ProblemProblem The Proposed The Proposed SolutionsSolutions
Service Behavior Modeling Verification of Service Behavior Consistency
Implementation Implementation skippedskipped ConclusionConclusion
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
3/30
220 V
110V
Reusable Component
Structural Consistent
Structural Consistent but Behavioral Inconsistent!
What this Paper is Talking About?What this Paper is Talking About?
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
4/30
Making Software ReusableMaking Software Reusable
openTV(), X.10
Invoker
openTV(),UPnP
Invoker
When you modify service X,You have to rewrite all of it’s invokers!
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
5/30
Interface As Service SpecificationInterface As Service Specification
Spec of openTV()(Interface)
Invoker
X.10 Implementation of openTV()
UPnP Implementation of openTV()
The developers can substitute the service implementations without affecting the invoker.
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
6/30
Substitutable ComponentsSubstitutable Components
We can substitute Service A with Service B without affect overall system behavior iff
Service A is Structural Consistent with Service B w.r.t. a common interface I
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
7/30
Term DefinitionsTerm Definitions
Service Client / Service Invoker
Service Specification / Interface
Service Implementation / Component / Service
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
8/30
Formal Definitions of Interfaces and Formal Definitions of Interfaces and ServicesServices
Service Specification (interface)Service Specification (interface)
Service ImplementationService Implementation
),( IFIF MIIF
A set of exported methods of IFUnique id of IF
),( SS MIS
Unique id of S A set of exported methods of S
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
9/30
Structural ConsistencyStructural Consistency
SASA is is
Structural ConsistentStructural Consistent with with
SB SB
w.r.t w.r.t An InterfaceAn Interface IFIF
if and only ifif and only if
SAIF MM SBIF MM and
LogService
LogService
SA
SB
log
log
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
10/30
Structural Consistency – An ExampleStructural Consistency – An Example
},,,{
},,{
},,{
finalizelogDBloginitM
finalizeloginitM
finalizeloginitM
ceDBLogServi
ServiceConsoleLog
LogService
ceDBLogServiLogService MM ServiceConsoleLogLogService MM
log finalizeinit
LogService
log finalizeinit
logfinalizeinit logDB
Given
We can obtain that
So ConsoleLogService is Structural Consistence with DBLogService w.r.t.LogService
ConsoleLogService
DBLogService
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
11/30
Enhanced Structural Consistency in OSGiEnhanced Structural Consistency in OSGi
OSGi enhances structural consistency by specifOSGi enhances structural consistency by specifying “Properties” of components.ying “Properties” of components.
Format:Format: RFC 1960: ”A String Representation of LDAP search f
ilters”
Example:Example:
&(DeviceName=TV2) (Size=21)&(DeviceName=TV2) (Size=21)
|(vendor~=HP)(!(dpi<=300))(type=printer)|(vendor~=HP)(!(dpi<=300))(type=printer)
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
12/30
OSGi ServicesOSGi Services
),,( SSS MPIS
Unique id of S A set of exported methods of S
A set of properties of S
We can revise the previous definition of a Serviceto the following form:
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
13/30
Behavioral ConsistencyBehavioral Consistency
Proposed by Proposed by B.Liskov and N.Belkhatir at 1994 in the ACM Trans on PLS. The interface mechanism in traditional OOP only guar
antees Structural Consistency The implementations may have unexpected behavio
r even if they are Structural Consistent.
Behavior A matter of call sequences from the Service Client!
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
14/30
220 V
The Problem of Structural ConsistencyThe Problem of Structural Consistency
Structural Consistency only guarantees the Structural Consistency only guarantees the service implementations are service implementations are structurally structurally compatiblecompatible with each other. with each other.
The The underlying behaviorunderlying behavior of methods may of methods may different.different.
What if the 110V and 220V have the same socket shape?What if the 110V and 220V have the same socket shape?
110V
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
15/30
Behavior Consistency – An Example(1)Behavior Consistency – An Example(1)
log finalizeinit
LogService
init
log
finalize
ConsoleLogService
log finalizeinit
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
16/30
Behavior Consistency – An Example(2)Behavior Consistency – An Example(2)
log finalizeinit
LogService
init
log
finalize
logDB
logfinalizeinit logDB
DBLogService
The expected call sequences of LogService is different from that of DBLogService !
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
17/30
Ensuring the Behavior ConsistencyEnsuring the Behavior Consistency
Behavior ModelingBehavior Modeling Workflow Net an extension of Petri Net to model th
e workflow management systems. Proposed by W.M.P. van der Aalst in ATPN 1997.
Consistency ValidationConsistency Validation Observation / Invocation Behavior Consistency Theor
y Proposed by J.Ebert and G. Engels in 1994.
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
18/30
Behavior Model (BM)Behavior Model (BM)
),,,,,( TMoiFTPBM
)()( PTTPF
BM is essentially a Workflow Net except TM is redefined.BM is essentially a Workflow Net except TM is redefined.
Places
Transitions
Directed Arcs
Input place / output place
A function that assigns each transition to a method
}){(: SMTTM
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
19/30
Summary: Revised Definition of ServiceSummary: Revised Definition of Service
),,,( SSSS BMMPIS
),,,,,( SSSSSSS TMoiFTPBM
}){(: SSS MTTM
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
20/30
Invocation ConsistencyInvocation Consistency
Service S1’s Behavior ModelService S1’s Behavior Model
is is invocation consistentinvocation consistent with S2’s Behavior Model with S2’s Behavior Model
ifif
S1BM
S2BM
12 SS BMBM LMSLMS
What is LMS ?
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
21/30
Legal Method Sequence (LMS)Legal Method Sequence (LMS)
Can be derived by depth-first traversal on a Can be derived by depth-first traversal on a Reachability GReachability Graphraph of a Petri Net. of a Petri Net.
Depth-First Traversal
}
{
finalize)logFile,logDB,(init,,
finalize)logDB,logFile,(init,
logFile),logDB,(init,logDB),logFile,(init,
logDB),(init,logFile),(init,init,LMS ceDBLogServi
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
22/30
Invocation Consistency - ExampleInvocation Consistency - Example
}{ finalize)log,(init,log),(init,init,LMSLogService
}
{
finalize)log,logDB,(init,,
finalize)logDB,log,(init,
log),logDB,(init,logDB),log,(init,
logDB),(init,log),(init,init,LMS ceDBLogServi init
log
finalize
LogService
init
log
finalize
logDB
DBLogService
ceDBLogServiLogService LMSLMS
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
23/30
init
logDB
finalize
LogService
Invocation Consistency isn’t Enough !Invocation Consistency isn’t Enough !
}
{
finalize)logDB,(init,
logDB),(init,init,LMSLogServiceBM
}
,
{
finalize)logDBEnc,(init,
finalize)logDB,(init,
logDBEnc)(init,logDB),(init,init,
LMSceDBLogServiBM
init
logDB
finalize
logDBEnc
DBLogService
ceDBLogServiLogService LMSLMS
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
24/30
Method ProjectionMethod Projection
}{ finalize)log,(init,log),(init,init,LMSLogServiceBM
}
{
finalize)log,logDB,(init,,
finalize)logDB,log,(init,
log),logDB,(init,logDB),log,(init,
logDB),(init,log),(init,init,LMSceDBLogServiBM
)}{)( finalizelog,(init,log),(init,init,LMSceDBLogServiLogService BMM
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
25/30
Observation ConsistencyObservation Consistency
Service S1’s Behavior ModelService S1’s Behavior Model
is is observation consistentobservation consistent with S2’s Behavior Model with S2’s Behavior Model
ifif
S1BM
S2BM
212)(
SSS BMBMM LMSLMS LogService
DBLogService
log
init
logDB
finalize
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
26/30
Observation Consistency - ExampleObservation Consistency - Example
init
log
finalize
LogService
init
log
finalize
logDB
DBLogService)},(
,
{
)(
finalizeinit
finalize)log,(init,
log),(init,init,
LMSceDBLogServiLogService BMM
LogServiceceDBLogServiLogService BMBMM LMSLMS )(
}
{
finalize)log,(init,
log),(init,init,LMSLogServiceBM
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
27/30
Verifying Behavioral ConsistencyVerifying Behavioral Consistency
The Service Implementation The Service Implementation SS is is Behavioral ConsistentBehavioral Consistent wit with Service Specification h Service Specification II iff : iff :
ISI BMBMM LMSLMS )(SI BMBM LMSLMS (S is (S is invocation consistentinvocation consistent with I) with I)
(S is (S is observation consistentobservation consistent with I) with I)
(The proof of this theory is in [J.Ebert and G. Engels 94])
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
28/30
Summary (1)Summary (1)
Structural Consistency(Traditional OOP Reuse)
Enhanced Structural Consistency(OSGi Service Reuse) Behavioral Consistency
[Liskov et al.94]
Modeling: UMLVerification: Language Mechanism
Modeling: UMLVerification: OSGi Platform
Modeling: Workflow NetVerification: IC / OC theorems
SAIF MM SBIF MM and
Key=value
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
29/30
Summary (2)Summary (2)
Behavioral Consistency[Liskov et al.94]
Modeling: Workflow NetVerification: IC / OC theorems
Behavioral Subtyping[Liskov et al.94]
MotivationProblem Modeling
Workflow Net[W.M.P. van der Aalst 97]
OSGi Component Model
Problem DomainReachability Graph/ LMS
Methodology Integration / Mapping
IC / OC Theorems[J.Ebert et al.94]
Solution Prototype
Multi-Service CoordinationBehavioral Consistency
Extension
SOBECA
Implementation
IntelligentIntelligent SSpacepace國立台灣大學資訊工程研究所 智慧型空間實驗室國立台灣大學資訊工程研究所 智慧型空間實驗室
30/30
CommentsComments
This paper provides formal modeling methods of This paper provides formal modeling methods of reusable components.reusable components. However, many errors in this paper.
Petri Net modeling will be more valuable if used Petri Net modeling will be more valuable if used to model distributed / concurrent components.to model distributed / concurrent components.
Stateful is considered harmful in service design, Stateful is considered harmful in service design, does the behavior consistency really matter?does the behavior consistency really matter?
Top Related