APAM/Scope

From Wiki Adele Team
Jump to: navigation, search

Protection: Sharing, Scope and Visibility control.

All first class APAM object (Specification, Implementation, Instance, including Composite type and Composite) can have any number of associated properties; a property being a tuple <String, Object>, the string is the name of the property (unique for an object), and the Object is the value. The properties and are primarily intended for the constraints and preferences mentioned in the resolution. However, some properties are predefined and interpreted by APAM to enforce of component protection. These attributes are the following.

  • --Instances (and Composites)--

-Shared = true | false- False indicates that the instance can be destination of zero or one wire; better say it cannot be shared by different clients. True by default.

  • --Implementations (and Composite Types)—

-Instantiable = true | false- An implementation is instantiable if it is possible to create an instance (calling method “createInstance” of APAM API). Typically, implementations which are driving devices are not instantiable (instantiating the implementation does not create the device).

  • --Composite Types—

The goal of composite types is to control their content. This control is performed through the value of attribute “visible”, set on the implementations it contains, and the value of attribute “scope” associated to the instances contained in its Composite instances. Let us first define the semantics of these attributes.

-Visible = global | composite | local- If an implementation is visible, then it is possible to instantiate it (if instantiable != false). Visibility control is performed when a wire resolution requires to instantiate the implementation.

Suppose that a wire needs to be created from a client instance “c” pertaining to Composite “Cc”, to an instance of Implementation “Im” pertaining to Composite-Type “CIm”. If no instance of “Im” is currently available in APAM, an “Im” instance must be created, but this requires that “c” can see “Im”. “c” sees “Im” if :

  • Im.visible == local, and (Cc == CIm)
  • Im.visible == composite and (Cc == CIm or Cc.import == CIm)
  • Im.visible == global

In other words, a “local” implementation is visible only in the composites types it pertains; a “global” implementation is visible from everywhere. A “composite” implementation is visible from the same composite type (CIm), and from all composite types that have declared a relationship “import” toward CIm. By default, an implementation is “global”.


-Scope = global | appli | composite | local- If an instance “s” is inside the scope of instance “c”, then it is possible to create a wire from “c” to “s”.

Suppose that a wire needs to be created from a client instance “c” pertaining to Composite “Cc”, to an instance “s” pertaining to Composite “Cs”. “c” is inside the scope of “s” if :

  • s.scope == local, and (Cc == Cs)
  • s.scope == composite and (Cc == Cs or Cc.depend == Cs)
  • s.scope == appli and (Cc.appli == Cs.appli)
  • s.scope == global

In other words, a “local” instance can be used only by the instances pertaining to the same composite, a “global” instance can be used from everywhere. An “appli” instance can be used by any instance pertaining to the same application, i.e. by instances pertaining to the same composite hierarchy (called an application). Finally, a “composite” instance can be used from the same composites and from all composite that have declared a relationship “depend” toward Cs. By default, an instance is “global”.

The value of attributes “visible” and “scope” associated to a composite type are defined either in the xml definition of the composite type (see Composite description ) or directly setting at any time the following attributes, associated to the composite type.

-LocalVisible = <implementationSetDefinition>- -CompositeVisible = <implementationSetDefinition>-

<implementationSetDefinition> = “{“ {SpecRegEx,} } | SpecRegEx With “SpecRegEx” a regular expression that match the name of the specification the target Implementation implements. For example, to set “visible=local” to the Implementation “S2Impl” of Specification “S2”, the attribute “localVisible” can have value “S2” or “S.” or “S.*”, or “.*”. The implementations matched by no expression are set to “global”.

-LocalScope = <instanceSetDefinition>- -compositeScope = <instanceSetDefinition>- -appliScope = <instanceSetDefinition>-

<instanceSetDefinition> “{“ {SpecRegEx,} } | SpecRegEx

The syntax is the same as for the visibility attribute.