Title: Architectural Modeling with UML2 Composite Structures and Components
1Architectural Modeling withUML2 Composite
Structures and Components
2Outline
- UML2 Structured Classifiers
- Key Concepts
- Concrete Visual Syntax and Examples
- Meta-Model
- Link between Meta-Model and Visual Syntax
- UML2 Encapsulated Classifiers
- Key Concepts
- Concrete Visual Syntax and Examples
- Meta-Model
- Link between Meta-Model and Visual Syntax
- UML2 Components
- Key Concepts
- Concrete Visual Syntax and Examples
- Meta-Model
- Link between Meta-Model and Visual Syntax
3UML2 Structured Classifiers
- New to UML2
- A UML2 structured classifier C can have special
properties called parts that can be connected
within the containing context of C to realize one
of its behaviors - The part-whole relationship between a part and
its containing structured classifier is distinct
but derived from the composition relationship
between a class and its composite containing
class - Whereas a composition property of a kernel
classes represents a context-independent
relationship from the kernel whole class to the
part class, - the part property of a structured classifier
represents a context-dependent relationship from
a structured whole class to the part class - Similarly, the connection relationship between
two parts of a containing structured classifier
is distinct but derived from the association
relationship between two classes - Whereas an association represents a
context-independent relationships between two
classes, - the connection between two classes that are
parts of a containing structured classifier is
valid only within the context of this container
4UML2 Structured Classifier Compartments
Name Attributes Operations NestedClassifiers
Parts
Nested Classes, Components, Interfaces
Associations linking their attributes, Realizati
ons, Usages Generalizations Encapsulated within
containing KernelClass
Classes, Components, Interfaces Connectors
linking them as partsor elements connected to
parts in context of containing CompositeStructures
Class
5Composed Class x Structured Class
Composition context independentwhole-part
relationship
StructuredClass/ ClassConnectedToPart
relationship dependent of containing StructuredCl
ass
Connector relationship dependent
of containing StructuredClass
StructuredClass/Part context-dependent whole-par
t relationship
Parts Compartment
Association context independentrelationship
6Structured Class Meta-Model
0..1 type
TypedElement
Type
MultiplicityElement
Feature
Structural Feature
Classifier
0..1 attribute
/role
role
ConnectableElement
0..1 ownedAttribute
/definingEnd
StructuredClassifier
KernelClass
Property
0..1 partWithPort
0..1 /part
redfinedConnector
Encapsulated Classifier
2..
0..1 ownedConnector
Connector
ConnectorEnd
Association
type
EncapsulatedClassifiersClass
7Class x Composite StructureDiagrams Link to
Meta-Model
8Composite Structure Diagram Classes
9Composite Structure Diagram Objects
0..1
PackageableElement
Element
TypedElement
LiteralUnlimitedNatural
Expression
StructuralFeature
OpaqueExpression
LiteralInteger
Slot
InstanceSpecification
ValueSpecification
LiteralSpecification
LiteralString
0..1
0..1
0..
InstanceValue
LiteralBoolean
Classifier
Class
10Composite Structure Diagram Objects
0..1
PackageableElement
Element
TypedElement
LiteralUnlimitedNatural
Expression
StructuralFeature
NamedElement
OpaqueExpression
LiteralInteger
Slot
InstanceSpecification
ValueSpecification
LiteralSpecification
LiteralString
0..1
0..1
0..
InstanceValue
LiteralBoolean
Classifier
Class
11UML2 Encapsulated Class
- New to UML2
- Specializes Structured Classifier
- An instances of an encapsulated class
(encapsulated object) interacts with its
environment and its internal parts only through
typed interaction points called ports - A port is an interaction point specification used
by an encapsulated class to either - Provide a service to its environment specified
by a provided interface that types the port - Request a service from its environment specified
by a requested interface that types the port - Ports provide a second level encapsulation
indirection beyond the first one provided by
interfaces - Encapsulated parts are connected indirectly
through their ports, - whereas simple parts are connected directly.
12UML2 Ports
- Ports allow run-time assembly of encapsulated
classes into a containing class to compose a
complex service from simpler ones - Instantiation of an encapsulated class with
internal parts which are recursively encapsulated
class is a complex process that involves - Instantiating each nested encapsulated class
- Instantiating each of their ports into an
interaction point - Instantiating each of their associations into a
connector between two such interaction points - In this internal assembly process, two ports can
only be connected only if the provided interface
of one is conformant to the requested interface
of the other - This conformance can be
- Simple, merely in terms of matching interface
types - More complex in terms of pre and post-condition
constraints on each operation of the ports
respective interfaces - Even more complex in terms of protocol state
machines associated to either the ports or their
interfaces - A protocol state machine describes a precise,
constrained sequence of externally visible states
through which the encapsulated class can go
through - It specifies for each state in the sequence the
restricted subset of operations that can be
invoked by the encapsulated class environment
through the provided port - It also specifies the next state resulting from
the invocation of a given operation in a given
state
13UML2 Encapsulated Classifier Compartments
Name Attributes Operations NestedClassifiers
Parts
Ports
Nested Classes, Generalizations, Ports,
Associations linking their attributes,
Encapsulated within containing KernelClass
Classes, Connectors linking them through their
Ports as parts or elements connected to parts in
context of containing CompositeStructuresClass
14Encapsulated Class Meta-Model
0..1 type
TypedElement
Type
MultiplicityElement
Feature
Structural Feature
Classifier
0..1 attribute
/role
role
ConnectableElement
0..1 ownedAttribute
/definingEnd
StructuredClassifier
KernelClass
Property
0..1 partWithPort
0..1 /part
redfinedConnector
2..
0..1 ownedConnector
Connector
ConnectorEnd
type
Association
redfinedPort
StateMachine
Relationship
ownedPort
Encapsulated Classifier
Port
specificMachine
conformance
/required
0..1
0..1
ProtocolStateMachine
ProtocolConformance
0..1
Interface
protocol
/provided
generalMachine
EncapsulatedClassifiersClass
protocol 0..1
15Composite Structure Diagram with Encapsulated
Classes Link to Meta-Model
CSClass.ownedPort.type CSClass.ownedPort.pro
videdInterface-gt union(CSclass.ownedPort.requir
edInterface)
16Composite Structure Diagram with Encapsulated
Classes More Examples
- Part multiplicity can also appear in the top
right corner of the part rectangle - The type of a port can also appear after its name
and - The multiplicity of a port can also appear after
its name or type between - The service provided by an encapsulated class C
by connecting to one of its port can be realized
either - By one (or several) part(s) of C
- By C itself, in this case the port square is
linked by a line to a state appearing inside Cs
part compartment
17UML2 Components
- New to UML2 for all lifecycle stages except
deployment - Specialize encapsulated classes
- The behaviors that it provides to its environment
are only accessible through its provided
interface(s) - The behaviors that it expects its environment to
provide to it are only accessible through its
required interface(s) - Through these associated interfaces, a UML2
component defines an abstract behavioral type
independent of its realization - The interfaces of a UML2 component can be either
- Directly associated to it, or
- Indirectly associated to it through its ports.
- The abstract behavior type specified by a UML2
component can be realized either - Directly by the component itself
- Indirectly by the assembly of its internal
parts - Indirectly by a set of external classifiers.
- A UML2 packageable component specializes a UML2
component by grouping all the artifacts involved
in the component specification or realization
into a package
18UML2 Components
- A UML2 component may
- Delegate part of the realization of a service
that it provides to its environment to one of its
internal parts - Delegate a service request from one of its part
to its environment. - Component connectors specialize encapsulated
class connectors by - Being associated to a behavior designed by
contract - i.e., it guarantees to its environment that all
post-conditions of all its provided operations
will be satisfied whenever they are called in a
way that satisfies all their pre-conditions - i.e., its environment guarantees that all
post-condition of all its requested operations
will be satisfied whenever it calls these
operations in a way that satisfies all their
pre-conditions - Sub-categorizing into
- Delegation connector between a containing
component and its parts - Assembly connector between two parts of an
containing component
19UML2 Component Compartments
ltltcomponentgtgt Name Attributes Operations Nested
Classifiers Parts
Ports
Nested Classes, Components, Ports, Interfaces
Associations linking their attributes, Realization
s, Usages Generalizations Encapsulated within
containing KernelClass
Classes, Components, Interfaces Connectors
linking them through their Ports as parts or
elementsconnected to parts in context
ofcontaining CompositeStructuresClass
20UML2 Component Meta-Model
0..1 ownedConnector
StructuredClassifier
CSConnector
redfinedPort
ownedPort
Encapsulated Classifier
Port
/required
0..1
Interface
/provided
/required
EncapsulatedClassifiersClass
Component
/provided
0..1
0..1
packagedElement
0..1 /ownedConnector
ComponentRealization
PackageableElement
contract
Behavior
Realization
21Component Diagram without Interface Operations
Link to Meta-Model
22Component Diagram with Interface Operations Link
to Meta-Model
Component.providedInterface
Component.requiredInterface
Component
InterfaceRealization
Usage
Component.requiredInterface.name
Component.providedInterface.name
Component.name
Component.providedInterface.operation
23Component Diagram Nested Classifiers Compartment
Link to Meta-Model
NestedClassifiersCompartment
24Component Diagram Parts Compartment Link to
Meta-Model
PartsCompartment