Tuscany SCA guidance and assembly process

Source: Internet
Author: User
Tags sca

Tuscany SCA assembles various services during running, and reads assembly information from scdl and other files according to the definition of SCA elements in XML format.

I. Assembly Process

There are three steps:

1. After reading configuration information from scdl in the load stage, a model in memory is generated.

2. Create (build) stage evaluation model and make the model a separate component element, such as service, reference, and component.

3. Connect the reference to the corresponding service.

 

2. The assembly process is initiated by deployment and executed in sequence.

The three steps are included in the deployment and initiated by the deployment.

Here is the code snippet:

.
.
.
// 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 );
.
.
.

 

3. loader is implemented through the loader interface.

There are two types of loaders: componenttypeloader and staxelementtypeloader. The loader interface is used to load the two types of loaer.

1. The componenttypeloader type loader is responsible for loading and running environment information, that is, the implementation of the system environment.

2. The staxelementloader type loader is responsible for loading information related to applications running in the system environment.

A) inheritance relationship diagram of Loader:

B) inheritance relationship diagram of componenttypeloader:

C) inheritance relationship diagram of staxelementloader:

D) The related code snippets are 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. host environment Guidance

SCA is guided in the host environment. The so-called host environment is the system environment where the SCA environment is located.

The default boot process is implemented in defaultbootstrapper. The process is as follows:

 

Corresponding code snippets:

1. Create runtime component

// Create a standaloneruntimeimpl instance
Standaloneruntime runtime = (standaloneruntime) directoryhelper. createruntime (runtimeinfo );

Tuscanyruntime inheritance relationship diagram:

2. Create Bootstrap deployer

.
.
.
Bootstrapper = createbootstrapper ();
.
.
.
Bootstrapper. createdeployer ()
.
.
.

Inheritance relationship diagram of bootstrapper:

3. Locate system assembly and deploy system assembly

It is the load, build, and connect process mentioned above. This part has been mentioned before and will not be repeated.

4. Locate application assemblies, deploy application assembly, and start server

The version downloaded from the current cvs. This part is a temporary implementation. There may be changes in the subsequent development process.

.
.
.
Int status = runtime. deployandrun (applicationscdlurl, applicationclassloader, appargs );
.
.
.

The following is a detailed example.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.