Components

Document Sample
Components Powered By Docstoc
					Architectural Modeling with
UML2 Composite Structures
      and Components

        Jacques Robin




                         Ontologies
                         Reasoning
                         Components
                         Agents
                         Simulations
                           Outline

 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
          UML2 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
   UML2 Structured Classifier
        Compartments

     Name

   Attributes
                    Nested Classes, Components, Interfaces &
   Operations       Associations linking their attributes,
                    Realizations, Usages & Generalizations
NestedClassifiers   Encapsulated within containing Kernel::Class

     Parts          Classes, Components, Interfaces &
                    Connectors linking them as parts
                    or elements connected to parts in
                    context of containing
                    CompositeStructures::Class
          Composed Class x Structured Class

Composition:
context independent
whole-part relationship
                                                                                  StructuredClass/
                                                                Connector:        ClassConnectedToPart:
                                                                relationship      relationship
                                      StructuredClass/Part:     dependent of      dependent of
                                      context-dependent         containing        containing
                                      whole-part relationship   StructuredClass   StructuredClass




                                                                      Parts Compartment

                Association:
                context independent
                relationship
                  Structured Class: Meta-Model


                              0..1 type
                     Type                                                  TypedElement          Feature           MultiplicityElement




                                                            Structural
                                                             Feature
                 Classifier
                                 0..1 attribute *
                                                                                                                                   role      /role
                                                                         ConnectableElement



                                 0..1 ownedAttribute *                       /definingEnd
Kernel::Class    Structured
                                                         Property
                 Classifier
                                          0..1 /part *                       0..1 partWithPort

                                                                                redfinedConnector
      Encapsulated                                                                          *      *
        Classifier                                          0..1 ownedConnector *                           2..*                         *
                                                                                                Connector            ConnectorEnd

                                                                           Association
EncapsulatedClassifiers::                                                                   type
         Class
                   Class x Composite Structure
                  Diagrams: Link to Meta-Model
K::Class.ownedAttribute.isComposite = true
    K::Class.ownedAttribute.association = Association                               CS::Class.ownedConnector.ConnectorEnd.role = Property

                                                  K::Class.name       CS::Class.ownedConnector.ConnectorEnd = ConnectorEnd

                                                                     CS::Class.part = Property                                       CS::Class
                                                                                                 CS::Class.name



                        K::Class




                                   K::Class.ownedAttribute.upper
                                                                                CS::Class.role.upper              CS::Class.part.type = K::Class
                                   = K::Class.ownedAttribute.lower
  K::Class.name                                                                 = CS::Class.role.lower
                                                                                = Integer
                                                                                                                   CS::Class.ownedConnector
 K::Class.ownedAttribute.association = Association
                                                                       CS::Class.ownedConnector.name               = Connector
 K::Class.ownedAttribute.association.name
                                                                             CS::Class.ownedConnector.type.name

   K::Class.ownedAttribute.name                                           CS::Class.role = Property
Composite Structure Diagram: Classes
    Composite Structure Diagram: Objects
                                                                                     0..1
   PackageableElement          Element            TypedElement
                                                                                  Expression              LiteralUnlimitedNatural
                                         StructuralFeature
                                                                                  OpaqueExpression        LiteralInteger
                                                                         *
                           *
                                Slot
   InstanceSpecification                                     ValueSpecification    LiteralSpecification   LiteralString
                                           0..1    *
      0..*                                                    0..1
                                                                                  InstanceValue           LiteralBoolean
Classifier



  Class
      Composite Structure Diagram: Objects
                                                                                                   0..1
     PackageableElement                Element          TypedElement
                                                                                                Expression                    LiteralUnlimitedNatural
                      NamedElement                 StructuralFeature
                                                                                                OpaqueExpression               LiteralInteger
                                                                                     *
                                   *
                                        Slot
     InstanceSpecification                                        ValueSpecification            LiteralSpecification          LiteralString
                                                 0..1         *
        0..*                                                           0..1
                                                                                               InstanceValue                  LiteralBoolean
  Classifier

                                               InstanceSpecification.classifier.parts.role.name InstanceSpecification.classifier.name
    Class




                                                                              InstanceSpecification.classifier.ownedConnector.name

InstanceSpecification.classifier.parts.name
            UML2 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.
                                UML2 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
      UML2 Encapsulated Classifier
            Compartments

     Name
                           Ports
   Attributes
                    Nested Classes, Generalizations, Ports,
   Operations       Associations linking their attributes,
                    Encapsulated within containing Kernel::Class
NestedClassifiers

     Parts          Classes, Connectors linking them through
                    their Ports as parts or elements connected to parts
                    in context of containing CompositeStructures::Class
                Encapsulated Class: Meta-Model
                              0..1 type
                    Type                                                               TypedElement         Feature             MultiplicityElement




                                                                 Structural
                                                                  Feature
                 Classifier
                                  0..1 attribute *
                                                                                                                                                role       /role
                                                                                     ConnectableElement



                                  0..1 ownedAttribute *                                  /definingEnd
Kernel::Class    Structured
                                                             Property
                 Classifier
                                          0..1 /part *                        0..1 partWithPort

                                                                                     redfinedConnector *      *
                                        0..1 ownedConnector *                                                           2..*                          *
                                                                                                           Connector              ConnectorEnd
                                                                                                                         type
                                                                                                                                  Association


                   redfinedPort                                                           StateMachine                                      Relationship
                                  *
Encapsulated ownedPort                                                                                     specificMachine conformance
                                          * /required *
  Classifier 0..1      *        Port                                  0..1    0..1
                                                          Interface                   ProtocolStateMachine                         *   ProtocolConformance
                                                                      protocol
                                          * /provided *
EncapsulatedClassifiers::                                                                                         generalMachine *
         Class                        * protocol 0..1
          Composite Structure Diagram with
       Encapsulated Classes: Link to Meta-Model

                                                                                   Class.ownedConnector.ConnectorEnd.partWithPort.name

  Class.ownedPort.providedInterface
                                                            Class                    Class.name
          Class.ownedPort.providedInterface.name
           Class.ownedPort.name                                                      Class.ownedConnector.name

                                 Class.name                         Class.part                                       Class.part



                                                              Class.role                                         Class.part.type = Class
                                      Class          Class.ownedConnector.ConnectorEnd.upper = Class.ownedConnector.ConnectorEnd.lower

                                                            Class                    Class.name
              Class.ownedPort
                Class.ownedPort.requiredInterface.name
                                                                                        Class.ownedConnector
 Class.ownedPort.requiredInterface
                                                                    Class.part                                      Class.part
CS::Class.ownedPort.type
= CS::Class.ownedPort.providedInterface
-> union(CS::class.ownedPort.requiredInterface)
                                                                           Class.ownedConnector.ConnectorEnd

                                                                                        Class.ownedConnector.ConnectorEnd.partWithPort
   Composite 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 C’s part
    compartment
                     UML2 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
                   UML2 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
   UML2 Component Compartments

<<component>>
    Name                   Ports

   Attributes       Nested Classes, Components, Ports, Interfaces
                    & Associations linking their attributes,
   Operations       Realizations, Usages & Generalizations
                    Encapsulated within containing Kernel::Class
NestedClassifiers
                    Classes, Components, Interfaces &
     Parts          Connectors linking them through
                    their Ports as parts or elements
                    connected to parts in context of
                    containing CompositeStructures::Class
     UML2 Component: Meta-Model

    Structured                 0..1 ownedConnector *
                                                                                      CS::Connector
    Classifier

                         redfinedPort

                                          *
   Encapsulated ownedPort
                                                  * /required *
     Classifier 0..1           *      Port
                                                                      Interface
                                                  * /provided *
                                                                         *    *
                                                          /required
   EncapsulatedClassifiers::
                                          Component
            Class
                                                          /provided
                                   0..1           0..1                                                    <<enumeration>>
                                                                                  Components::Connector
                                                                                                           ConnectorKind
packagedElement
                                                         0..1 /ownedConnector *    kind:ConnectorKind
                  *                           *                                                              assembly
                                                                                    contract   *             delegate
      PackageableElement       ComponentRealization
                                                                                              *
                                                                                        Behavior

                                          Realization
     Component Diagram without Interface
       Operations: Link to Meta-Model


                                                        Component.requiredInterface.name
Component.providedInterface.name

         Component.providedInterface          Component                                Component.requiredInterface

  Component.providedInterface.name
                                            Component.name
         Component.providedInterface                                                   Component.requiredInterface




                                                                         Component.requiredInterface.name


                                       Component.requiredInterface
        Component Diagram with Interface
         Operations: Link to Meta-Model



  Component.providedInterface                                                                  Component.requiredInterface

                                   Interface              Component
                                   Realization

Component.providedInterface.name                                                     Usage   Component.requiredInterface.name
                                                       Component.name


                                             Component.providedInterface.operation
      Component Diagram Nested Classifiers
        Compartment: Link to Meta-Model

                                                              Component.nestedClassifier.ownedAttribute.upper
                                                              = Component.nestedClassfier.ownedAttribute.lower
                      Component


                                                Component.name

                          Component.nestedClassifier                                NestedClassifiersCompartment
 Component.               = Class                                                   Component.
 providedInterface.                                                                 nestedClassifier.name
 name                      Component.
                           nestedClassifier.                                                                          Component.
                           ownedAttribute.                                                                            requiredInterface
                           isComposite = true
Component.
providedInterface                                                                   Component.nestedClassifier
                           Component.                                               = Association                  Component.
                           nestedClassifier.                                                                       requiredInterface.
                           ownedAttribute.                                          Component.                     name
                           name                                                     nestedClassifier.name


                                                       Component.nestedClassifier
                                                       = Class
    Component Diagram Parts Compartment:
             Link to Meta-Model
                     Component.   Component.ownedConnector                            Component.ownedConnector.ConnectorEnd.type
                     ownedPort        Component.ownedConnector.kind = #delegate
                                                                                                                   Component
Component.
providedInterface.                                  Component.name
name
                                   Component.part.type = Component                       Component.part.type = Component


Component.
providedInterface                       Component.part.type.name                             Component.part.type.name



                                                              Component.
                     Component.                               ownedConnector.                                                    Component.
                     ownedConnector.                          kind = #assembly                                                   ownedPort
                     ConnectorEnd.
                     type                                  Component.ownedConnector


                                                                                  Component.ownedConnector.kind = #delegate
                                        Component.part.type.name

                                                                                                            Component.
                                   Component.part.type = Component                                          requiredInterface.
                                                                                                            name
                     PartsCompartment

                                                                                                                           Component.
                                                                                                                           requiredInterface

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:3
posted:10/12/2011
language:English
pages:24