Tuscany SCA assembles various services at run time, and reads assembly information from SCDL and other format files, based on the definition of SCA elements in XML format.
First, the assembly process
It is divided into three main steps:
1. The load phase generates an in-memory model after reading the configuration information from the SCDL.
2. The Create (build) stage evaluates the model and composes the model as a separate component element, such as service,reference,component.
3. Connect (connect) stage reference to the corresponding service.
Second, the assembly process is initiated by the deployment, in order to gradually implement.
Three steps are included in the deployment, initiated by the deployment.
This is the fragment of the code:.
.
.
Load the Model
Load (parent, componentdefinition, Deploymentcontext);
Resolve Autowires
Resolver.resolve (null, componentdefinition);
Build runtime Artifacts
Build (parent, componentdefinition, Deploymentcontext);
Collection < Component > Components = deploymentcontext.getcomponents (). values ();
Connector.connect (componentdefinition);
.
.
.
Thirdly, loader is realized by loader interface.
There are two types of Loader:componenttypeloader and Staxelementtypeloader, which are implemented by loader interfaces to load two types of Loaer.
1, Componenttypeloader type Loader is responsible for loading and running environment-related information, that is, the implementation of the system environment
2. Staxelementloader type loader responsible for loading information related to applications running in the system environment
A) loader inheritance diagram:
B) Componenttypeloader inheritance diagram:
C) Staxelementloader inheritance diagram:
D) The relevant code snippet is as follows://Register component type Loaders
Loaderregistry.registerloader (Systemimplementation class, New Systemcomponenttypeloader (Introspector));
Loaderregistry.registerloader (Systemcompositeimplementation. Class,
New Systemcompositecomponenttypeloader (Loaderregistry));
Register Element Loaders
Registerloader (Loaderregistry, New Componentloader (Loaderregistry, propertyfactory));
Registerloader (Loaderregistry, New Componenttypeelementloader (Loaderregistry));
Registerloader (Loaderregistry, New Compositeloader (loaderregistry, null));
Iv. guidance of the host environment
SCA is guided in a host environment, the so-called hosting environment is the system environment in which the SCA environment is guided.
The default boot process is implemented in Defaultbootstrapper, with the following procedure:
The corresponding code fragment:
1. Create Runtime Component//Creating Standaloneruntimeimpl instance
Standaloneruntime runtime = (standaloneruntime) directoryhelper.createruntime (runtimeinfo);
Tuscanyruntime Inheritance diagram:
2, Create Bootstrap Deployer.
.
.
Bootstrapper Bootstrapper = Createbootstrapper ();
.
.
.
Bootstrapper.createdeployer ()
.
.
.
Inheritance diagram for bootstrapper:
3. Locate system Assembly and deploy system Assembly
This is the load, build, and connect processing that was mentioned earlier, which has been said earlier and is not repeated.
4. Locate application assemblies, Deploy application assembly and start Server
The version that is downloaded from the current CVS, this part is a temporary implementation. There may also be changes in the later development process.
.
.
int status = Runtime.deployandrun (Applicationscdlurl, Applicationclassloader, Appargs);
.
.
.
After the actual example is gradually refined.