8.5 Subcomponent Access
Subcomponents can be made accessible outside their containment hierarchy. Components can declare that they require access to externally declared subcomponents. Components may provide access to their subcomponents. Provided subcomponent access is  a feature of a component.
A required subcomponent access declaration in the component type of the subcomponent indicates that a subcomponent requires access to a data component declared external to the component.  Required subcomponent accesses are resolved to actual data subcomponents as part of a subcomponent declaration.  Different forms of required access, such as read-only access, are specified by a Required_Access property.
A provides subcomponent access declaration in the component type of the subcomponent indicates that a subcomponent provides access to a data component contained in the component. Provided subcomponent accesses can be used to resolve required subcomponent access. Different forms of provided access, such as read-only access, are specified by a Provided_Access property.
A subcomponent that is accessed by more than one subcomponent is shared.  The actual (shared) subcomponent may be declared within the same component implementation as the one(s) requiring access or it may be declared higher in the component containment hierarchy. Alternatively, it may be declared within a subcomponent at the current level (of the ones requiring access) or higher. In this case, the containing subcomponent will specify that it provides access to the shared subcomponent. 
This is illustrated in Figure 10.  Data D is a data component contained in the process implementation of process subcomponent A.  The process type of A makes it accessible through its provides data access feature declaration.  It is being accessed by thread Q, which is contained as subcomponent of the process implementation for process B.  Both the process type of process B and the thread type of thread Q indicate the need to access a data component through a requires data access feature declaration.  In the system implementation of system Simple the provides data access feature of process A is connected to the requires data access feature of process B through a data access connection.  The textual AADL model of this specification is given as an example later in this section.
graphic
Figure 10 Containment Hierarchy and Shared Access
Syntax
-- The requires and provides subcomponent access subclause
subcomponent_access ::=
    defining_subcomponent_access_identifier : 
       subcomponent_access_classifier
        [ { { access_property_association }+  } ] ;

subcomponent_access_refinement ::=
    defining_subcomponent_access_identifier : refined to
        subcomponent_access_classifier      
        [ { { access_property_association }+  } ] ;

subcomponent_access_classifier ::=
        ( provides requires ) ( data | bus ) access
        [ unique_component_type_identifier
                         [ . component_implementation_name ] ]
Naming Rules
The defining identifier of a provides or requires subcomponent access declaration must be unique within the interface namespace of the component type where the subcomponent access is declared. 
The defining identifier of a provides or requires subcomponent refinement must exist as a defining identifier of a required subcomponent in the interface namespace of the associated component type or one of its ancestors.
The component type identifier or component implementation name of a subcomponent access classifier reference must exist in the specified (package or anonymous) namespace. 
Legality Rules
The category of the subcomponent access declaration must be identical to the category of the component type (and of the component implementation) in the referenced subcomponent classifier.
Standard Properties
Required_Access : access enumeration (read_only, write_only, read_write,
                                      by_method) => read_write 
Provided_Access : access enumeration (read_only, write_only, read_write,
                                      by_method) => read_write
Semantics
The requires subcomponent access declaration indicates that the component requires access to a subcomponent not contained in any of the implementations of the component type with the requires subcomponent access declaration.  The Required_Access property specifies how a component of a given component type accesses a required subcomponent component that may be shared by multiple subcomponents.  The reference to a required subcomponent is resolved, i.e., bound to a subcomponent, when a subcomponent of the component type requiring access is declared.  When required subcomponent references of two different subcomponents are bound to the same subcomponent, the subcomponent is shared by them.
The provided subcomponent access declaration indicates that a subcomponent contained in the component implementations is made accessible outside the component. The Provided_Access property indicates how the shared data component may be accessed. 
Examples
system implementation simple.impl
subcomponents
   A: process pp.i;
   B: process qq.i;
connections
   data access A.dataset -> B.reqdataset;
end simple.impl;

process pp
features
   Dataset: provides data access dataset_type;
end pp;

process implementation pp.i
subcomponents
   Share1: data dataset_type;
   -- other subcomponent declarations
connections
   data access Share1 -> Dataset;
end pp.i;

process qq
features
   Reqdataset: requires data access dataset_type;
end qq;

process implementation qq.i
subcomponents
   Q: thread rr;
connections
   data access Reqdataset -> Q.req1;
end qq.i;

thread rr
features
   Req1: requires data access dataset_type;
end rr;