Functional assembly based on many tenants pattern and method for customizing
Technical field
The present invention relates to SaaS application, a kind of functional assembly based on many tenants pattern and customization side
Method and system.
Background technology
SaaS pattern is the current a kind of software application pattern innovated completely risen, and SaaS the most truly should
Configurable and the requirement of high-performance multi-tenant architecture should be met, effectively to reduce hardware cost and the maintenance of SaaS application with framework
Cost.Configurability makes SaaS application more generally applicable, and client only need to can meet the personalization of self by simple configuration
Demand.In enterprise's SaaS environment, tenant may correspond to certain particular organization, organizes and uses service by custom application, no
It is the owner of application program;Weave connection is the user of SaaS application program to a group member work user, employee user.Tenant
According to the on-demand order of configurable characteristic of SaaS application, obtain the software service that SaaS application provides;And SaaS is each tenant
The copy of a application program, the data of isolation tenant are provided.That SaaS application is more broadly is tool SaaS, such as video council
The main SaaS application such as view is rented, enterprise's mailbox.
Summary of the invention
The problem to be solved in the present invention, is to propose a kind of functional assembly based on many tenants pattern and method for customizing, should
Method is applicable to the product expecting to be converted into SaaS many tenants application.The present invention proposes functional assembly specification based on XML, root
According to the systemic-function of specification decomposition goal application, combination atomic function is functional packet, and is packaged as functional packet facilitating tenant fixed
The sale bag of system.After tenant's on-demand customization function, according to self needing to be again assigned to function the employee user of specific role.
The invention also discloses a kind of functional assembly based on many tenants pattern and custom-built system.
The concrete technical scheme of the present invention is: a kind of functional assembly based on many tenants pattern and method for customizing, described
Method include metadata configurations end, application management platform, tenant's end and user side, it comprises the following steps:
S1: the allomeric function of intended application is split as atomic function by metadata configurations end, and is configured to by atomic function
Functional packet and the sale bag including one or more functional packet;And by menu metadata, page elements metadata, atomic function,
Relatedness, functional packet and sale between atomic function and menu metadata and page elements metadata are wrapped and are reached application management
Platform;
The data being uploaded to application management platform in S1 are resolved by S2: application management platform;
S3: tenant's end is sold bag by application management platform building, is distributed one or more functional packet to user;
S4: user side obtains menu metadata and the page elements metadata of the current request page from application management platform,
And show menu and the page elements of functional packet Atom function association that user side is distributed to be obtained.
In above-mentioned functional assembly based on many tenants pattern with method for customizing, described S1 specifically includes:
S11: at metadata configurations end, the allomeric function of intended application is split as atomic function, and identifies dish unit number
According to page elements metadata;
S12: between metadata configurations end definition atomic function, atomic function and menu metadata, atomic function and page
Relatedness between surface element metadata;
S13: atomic function is configured to functional packet and the sale including one or more functional packet at metadata configurations end
Bag;And by the atomic function in S11, menu metadata and page elements metadata, the relatedness in S12, the functional packet in S13
Wrap with sale and reach application management platform.
In above-mentioned functional assembly based on many tenants pattern with method for customizing, described S4 specifically includes:
After S41: user side login intended application, transmission authentication connection request is to application management platform, from application management
Platform is verified;
S42: obtain from application management platform after being verified and access token;
S43: according to accessing the token menu metadata from the application management platform acquisition current request page and page elements
Metadata;
S44: when intended application often represents a page, the menu associated by atomic function that display tenant's end is distributed
And page elements, hide and do not have related menu and page elements.
In above-mentioned functional assembly based on many tenants pattern with method for customizing, described menu metadata, the page are first
Primitive element data, functional packet, sale Bao Jun are with metadata specification document definition.
In above-mentioned functional assembly based on many tenants pattern with method for customizing, user side distributes the functional packet institute obtained
Menu and the metadata of page elements associated by the atomic function comprised and this atomic function are all labeled as having customized, and bag
Contain the keyword of the atomic function of association.
In above-mentioned functional assembly based on many tenants pattern with method for customizing, described menu metadata includes menu
Id, pad name, menu path, menu identification symbol, menu identification identifier value, parent menu id;
Described page elements metadata includes: page elements id, page elements title, page elements path, page unit
Element identifier, page elements identifier value, built-in pad name, built-in menu path, built-in menu identification symbol, built-in menu mark
Note identifier value;
Relatedness between atomic function refers to the dependence between atomic function.
The invention also discloses a kind of for realizing above-mentioned functional assembly based on many tenants pattern and customization side simultaneously
The system of method, including metadata configurations end, application management platform, tenant's end and user side;
Metadata configurations end is used for, for configuration person, the allomeric function of intended application is split as atomic function, and by atom merit
Functional packet can be configured to and include the sale bag of one or more functional packet;And by menu metadata, page elements metadata, former
Relatedness, functional packet and sale between subfunction, atomic function and menu metadata and page elements metadata are wrapped and are reached
Application management platform;
Described application management platform is for resolving the data that metadata configurations end is uploaded;
Described tenant's end is for being sold bag by application management platform building, distributed one or more function to user
Bag;
Described user side for obtaining menu metadata and the page elements of the current request page from application management platform
Metadata, and show menu and the page elements of functional packet Atom function association that user side is distributed to be obtained.
In above-mentioned functional assembly based on many tenants pattern with custom-built system, described application management platform includes:
Metadata analyzing sub-module, for resolving the data being uploaded to application management platform;
Customizing functions and distribution sub module, for selling bag for the customization of tenant's end, and distribute one for tenant's end to user side
Individual or multiple functional packet;
Metadata Service submodule, for the access token according to user side by corresponding menu metadata and page unit
Primitive element data send to user side.
In above-mentioned functional assembly based on many tenants pattern with custom-built system, described user side includes following submodule
Block:
Checking submodule, for sending authentication connection request after intended application to application management platform logging in, from
Application management platform is verified, authentication connection request obtains the data of passback after being verified, and is access token;
Metadata obtains submodule, for according to accessing the token dish from the application management platform acquisition current request page
Cell data and page elements metadata;
Display sub-module, for when intended application often represents a page, shows the atomic function that tenant's end is distributed
Associated menu and page elements, hide and do not have related menu and page elements.
In above-mentioned functional assembly based on many tenants pattern with custom-built system, described application management platform also wraps
Include:
Data isolation submodule, for isolating the data of tenant customization;
Application management submodule: be used for registering tenant, registration application.
Compared with prior art, the beneficial effects of the present invention is:
Versatility;Functional assembly specification, application management platform are applicable to the application of different language exploitation.
Reduce intended application transformation complexity, thus reduce improvement cost and reduce the transformation time cycle.
Data isolation, the tenant data isolation of mainly application data and each application.
Loose coupling;Mainly intended application and metadata parsing, customizing functions and distribution, tenant customization data isolation, rent
The modules such as family management, Metadata Service are individually present, if the binding of intended application expansion module, then can revert to non-SaaS should
With.
Accompanying drawing explanation
Fig. 1 is the flow chart of the embodiment of the present invention 1 and 2;
Fig. 2 is the flow chart of the embodiment of the present invention 2;
Fig. 3 is the flow chart of the embodiment of the present invention 2;
Fig. 4 is the block diagram of the embodiment of the present invention 3;
Fig. 5 is the block diagram of the embodiment of the present invention 4;
Fig. 6 is the flow chart of the embodiment of the present invention 4;
Fig. 7 is the flow chart of the embodiment of the present invention 4;
Fig. 8 is the schematic diagram of the embodiment of the present invention 4.
Detailed description of the invention
Below in conjunction with detailed description of the invention, technical scheme is described in further detail, but do not constitute right
Any restriction of the present invention.
Embodiment 1
As it is shown in figure 1, a kind of functional assembly based on many tenants pattern and method for customizing, described method includes metadata
Configuring end, application management platform, tenant's end and user side, it comprises the following steps:
S1: the allomeric function of intended application is split as atomic function by metadata configurations end, and is configured to by atomic function
Functional packet and the sale bag including one or more functional packet;And by menu metadata, page elements metadata, atomic function,
Relatedness, functional packet and sale between atomic function and menu metadata and page elements metadata are wrapped and are reached application management
Platform;
The data being uploaded to application management platform in S1 are resolved by S2: application management platform;
S3: tenant's end is sold bag by application management platform building, is distributed one or more functional packet to user;
S4: user side obtains menu metadata and the page elements metadata of the current request page from application management platform,
And show menu and the page elements of functional packet Atom function association that user side is distributed to be obtained.
By above-mentioned steps, tenant can be made freely to customize function, reduce user's transformation difficulty for intended application, merit
Can assemble specification, application management platform is applicable to the application that different language is developed.
Embodiment 2:
As shown in Figures 1 to 3, a kind of functional assembly based on many tenants pattern and method for customizing, described method includes unit
Data configuration end, application management platform, tenant's end and user side, it comprises the following steps:
The allomeric function of intended application is split as atomic function at metadata configurations end by S1: configuration person, and by atom merit
Functional packet can be configured to and include the sale bag of one or more functional packet;And by menu metadata, page elements metadata, former
Relatedness, functional packet and sale between subfunction, atomic function and menu metadata and page elements metadata are wrapped and are reached
Application management platform;
Specifically, as in figure 2 it is shown, described step S1 includes following sub-step:
S11: at metadata configurations end, the allomeric function of intended application is split as atomic function, and identifies dish unit number
According to page elements metadata;Metadata configurations end can be the automatic configuration system that a whole set of is complete, it is also possible to be artificial
Intended application is split.
Described menu metadata include menu id, pad name, menu path, menu identification symbol, menu identification identifier value,
Parent menu id.The target of menu metadata assembling Specification Design is that intended application run duration uniquely can be identified by metadata
Go out the menu object of correspondence.
Described page elements metadata includes: page elements id, page elements title, page elements path, page unit
Element identifier, page elements identifier value, built-in pad name, built-in menu path, built-in menu identification symbol, built-in menu mark
Note identifier value.The target of page elements metadata assembling Specification Design is that intended application run duration uniquely can be identified by metadata
Go out the page elements object of correspondence.
By metadata specification file, menu and page elements being defined both sides purpose, one is according to menu
With menu and the page that page elements metadata can identify intended application, two is that menu and page elements metadata definition can
To be associated with atomic function.Metadata referred to herein is the data obtained by metadata specification document definition.
S12: between metadata configurations end definition atomic function, atomic function and menu metadata, atomic function and page
Relatedness between surface element metadata;
Specifically, before each new page of intended application represents, menu and page elements that meeting accession page is corresponding are first
Data, are wherein logged the menu associated by the atomic function that user is assigned to and page elements metadata can be marked as "
Customization ".Page elements metadata assembling specification is to the effect that: menu id associated by page id, page path, the page,
Page elements id associated by the page.
The design concept of atomic function is " user's value driving ", only encapsulates function significant to user.Atomic function
Between independently of one another, the set of atomic function is the repertoire of intended application.Atomic function metadata assembles the main of specification
Content is: function id, function title, function declaration, function keyword, associated menu id, association page id, relied on function
id.One function may rely on one or one group of function, it is also possible to does not rely on other functions.
S13: atomic function is configured to functional packet and the sale including one or more functional packet at metadata configurations end
Bag;And by the atomic function in S11, menu metadata and page elements metadata, the relatedness in S12, the functional packet in S13
Wrap with sale and reach application management platform.
The mentality of designing of functional packet mainly considers three aspects: customer service, possesses the atomic function of dependency, possess and depend on
The atomic function of the relation of relying.Selling bag is the further encapsulation to functional packet, and object-oriented is tenant.Functional packet/sale Bao Yuan
Data assemble specification to the effect that: the atomic function that functional packet id, functional packet title, functional packet describe, functional packet comprises
Functional packet id that id, functional packet comprise.After tenant customization sells bag, can be distributed to certain by selling the functional packet comprised
Role, and allocation result is performed the dependency inspection of atomic function.
The data being uploaded to application management platform in S1 are resolved by S2: application management platform;
Specifically, application management platform provides special parsing class for each type of metadata, in order to resolve rule
The data of model essay part.
S3: tenant's end is sold bag by application management platform building, is distributed one or more functional packet to user;
Specifically, tenant can customize user role, on-demand point of the functional packet set sale of customization comprised
Join certain role.After role is assigned part or all of functional packet authority, this role can perform functional check, function is examined
Look into and the functional packet being assigned to is disassembled into atomic function set, and analyze the dependence between atomic function, as A depends on B;
If finding that some atomic function that there is dependence is not assigned to, inform examiner.Tenant is use by user's management
Affiliated role is specified at family, then this user has the functional packet authority that this role is assigned to.Application management platform uses data stock
Store up atomic function or the id of functional packet and type.
S4: user side obtains menu metadata and the page elements metadata of the current request page from application management platform,
And show menu and the page elements of functional packet Atom function association that user side is distributed to be obtained.
Specifically, as it is shown on figure 3, described S4 includes following sub-step:
After S41: user side login intended application, transmission authentication connection request is to application management platform, from application management
Platform is verified;
S42: obtain from application management platform after being verified and access token;
S43: according to accessing the token menu metadata from the application management platform acquisition current request page and page elements
Metadata;
S44: when intended application often represents a page, the menu associated by atomic function that display tenant's end is distributed
And page elements, hide and do not have related menu and page elements.
In actual applications, the data access of Metadata Service is encapsulated as http request by application management platform, it is provided that
The access stencil of restful style.When user logs in intended application, intended application sends http request and connects application management platform
Metadata Service module carry out authentication, obtain after good authentication access token.Hereafter intended application uses token to obtain
Take login user spendable atomic function collective data, in order to check corresponding to the menu in the page and the built-in menu of the page
Atomic function availability.Before each webpage representation, intended application sends http request according to token and page path and carries out page
Face request of data accesses, and Metadata Service module is according to the atomic function of database purchase or functional packet information and metadata literary composition
The analysis result of part, parses menu and the page elements of target pages association, and parses user and can use atomic function collection
Menu associated by conjunction and page elements, the data that both labellings occur simultaneously are for " customizing " and return all menus and page elements
Data.Disabled (not being customized) menu and page elements are hidden by intended application, and menu is carried out click event
Binding and the binding of corresponding atomic function keyword.When menu is clicked, the most permissible according to keyword query atomic function
Using, if unavailable, prompting user does not has operating right.
By aforesaid operations, specification is to menu, page elements, the page, atomic function, functional packet (pin in a unified format
Sell bag) it is defined;Meanwhile, application management platform is developed: application management platform is unified is responsible for metadata parsing module, function
Customization and distribution module, tenant customization data isolation module, tenant manage module and Metadata Service module etc.;Wherein, unit's number
It is responsible for the http request that object-oriented application package metadata accesses according to service module.Intended application expansion is service data
Isolation module, page parsing module, event intercept module, functional verification module, request proxy module, and these modules can be packed
For the library file that application is relevant, can be introduced directly into library file with the application of type language development and be extended, retrofit work is more
Lightweight.
Solving in conventional art to an application be converted into SaaS many tenants application, needing again to transform on a large scale
Original application, and on original application foundation, develop metadata parsing module, customizing functions and distribution module, tenant customization number
Manage module according to isolation module, tenant, Metadata Service module, service data isolation module, page parsing module, event are intercepted
Module, functional verification module, request proxy module etc., the problem of produced substantial amounts of workload.
Embodiment 3
Present embodiment illustrates the system corresponding to embodiment 1 and 2, specifically: as shown in Figure 4, join including metadata
Put end 1, application management platform 2, tenant's end 3 and user side 4;
Metadata configurations end 1 is used for, for configuration person, the allomeric function of intended application is split as atomic function, and by atom
Functional configuration is functional packet and the sale bag including one or more functional packet;And by menu metadata, page elements metadata,
Biography is wrapped in relatedness, functional packet and sale between atomic function, atomic function and menu metadata and page elements metadata
To application management platform 2;
Described application management platform 2 is for resolving the data that metadata configurations end 1 is uploaded;
Described application management platform 2 includes:
Metadata analyzing sub-module 21, for resolving the data being uploaded to application management platform 2;It is joined each
Put unit and all devise the parsing class of correspondence, according to configuration unit cannonical format design class object to preserve analysis result, provide simultaneously
Access interface, calls to obtain document analysis result for other module.Analysis result is cached by metadata parsing module.
Customizing functions and distribution sub module 22, for selling bag for tenant's end 3 customization, and for tenant's end 3 to user side 4 points
Join one or more functional packet;Its tenant being logged on being substantially carried out carries out customizing functions, Role Management, user's management, angle
The work such as the distribution of color function and functional check.Wherein, the function that user has is the function that role belonging to it is assigned to.
Metadata Service submodule 23, for the access token according to user side 4 by corresponding menu metadata and the page
Element metadata sends to user side 4;It is responsible for visiting user login validation, atomic function data access, page request data
The http request being encapsulated as restful style such as ask, call for intended application.When the user of intended application logs in, carry login
Person's information sends http request, and user identity is verified by Metadata Service module, and if good authentication, passback accesses token
To intended application, and by token write into Databasce, caches user information simultaneously.Intended application is passed through when sending subsequent request
Token carries out data access, if token lost efficacy, Metadata Service module first reads user's letter according to token from data base
Breath.
Data isolation submodule 24, for isolating the data of tenant customization;It is mainly responsible for application data isolation
With tenant customization data isolation, the application of each registration can use the module service of application management platform 2, it is therefore desirable to right
The data that each application relates to are isolated, it is ensured that the data of each application do not interfere with each other, the tenant data under certain application
It is also required to independently of one another.The data-selected scheme that this application management platform 2 uses is " shared data bank, shared data framework ".
Application management submodule 25: be used for registering tenant, registration application.One can be obtained uniquely after successful registration application
appid.The application of each registration can use the module service of application management platform 2.Application configuration person registers on after application
Passing configuration meta file, application management module air exercise is wrapped the metadata specification file of biography and is decompressed.Can obtain according to appid
Take the meta data file content under this application.Each application can design a tenant manager, in order to manage the tenant of this application.
Tenant manages module 26, mainly tenant manager and is responsible for all tenants of application-specific, mainly includes note
Volume tenant and the work of deletion tenant.
Described tenant's end 3 is for being sold bag by application management platform 2 customization, distributed one or more function to user
Bag;
Described user side 4 for obtaining menu metadata and the page unit of the current request page from application management platform 2
Primitive element data, and show menu and the page of functional packet Atom function association that user side 4 is distributed to be obtained.
Described user side 4 includes following submodule:
Checking submodule 41, for transmission authentication connection request after logging in intended application to application management platform 2,
Verifying from application management platform 2, authentication connection request obtains the data of passback after being verified, be access
token;
Metadata obtains submodule 42, for obtaining the current request page according to access token from application management platform 2
Menu metadata and page elements metadata;
Display sub-module 43, for when intended application often represents a page, shows the atom merit that tenant's end 3 is distributed
Menu associated by energy and page elements, hide and do not have related menu and page elements.
Native system has the advantage that
Versatility;Functional assembly specification, application management platform 2 are applicable to the application of different language exploitation.
Reduce intended application transformation complexity, thus reduce improvement cost and reduce the transformation time cycle.
Data isolation, the tenant data isolation of mainly application data and each application.
Loose coupling;Mainly intended application and metadata parsing, customizing functions and distribution, tenant customization data isolation, rent
The modules such as family management, Metadata Service are individually present, if the binding of intended application expansion module, then can revert to non-SaaS should
With.
Embodiment 4
Such as Fig. 5-8, a video conferencing system based on flex exploitation, with it as example, to the cooperation between each module
Work relationship is described as follows, such as Fig. 5: 1, video conferencing system configuration person according to the allomeric function of video conferencing system, write dish
List, the page, the page, atomic function, functional packet metadata specification file.2, video conferencing system configuration person is in application management module
Registration application, obtains application appid.3, video conferencing system configuration person enters the administration interface of above-mentioned application, metadata is advised
The packing of model essay part is uploaded, and registers a tenant manager, in order to manage the tenant of this application.4, tenant manager logs in tenant
Management module, registers tenant's information of this application.5, the customization of registered tenant's login feature and distribution module, carry out function fixed
The work such as system, Role Management, user's management, role function distribution, wherein customizing functions, role function distribution can pass through metadata
Parsing module acquires metadata analysis result.6, the tenant data under the data of each application, each application passes through data isolation
Module isolated storage.7, the http request that Metadata Service module accesses towards intended application package metadata, passes through metadata
Parsing module acquires metadata analysis result.
Functional assembly flow process such as Fig. 6, configuration unit Normalization rule xml document is described, and different assembling objects are at specification lattice
Keep consistent in formula, resolve it is thus possible to design consistent data structure and safeguard, and read conveniently.Make a concrete analysis of as follows:
Assembling menu: menu and page elements are inherently the elements of the page.In order to distinguish, click event can be triggered
Element is here classified as menu, and such as the element such as panel, list is classified as page elements.It is possible that you wish also to have in list editor
Button, so: page elements also can have the element that can trigger click event, we term it built-in menu.Menu metadata
Assemble specification to the effect that: menu id, pad name, menu path, menu identification symbol, menu identification identifier value, parent dish
Single id;The target of menu metadata assembling Specification Design is that intended application run duration can uniquely identify correspondence by metadata
Menu object.
Assembling page elements: page elements metadata assembles specification to the effect that: page elements id, page elements name
Title, page elements path, page elements identifier, page elements identifier value, built-in pad name, built-in menu path, interior
Put menu identification symbol, built-in menu mark identifier value.The target of page elements metadata assembling Specification Design is that intended application is run
Period can uniquely identify the page elements object of correspondence by metadata.
The assembling page: before each new page of intended application represents, menu and page elements that meeting accession page is corresponding are first
Data, are wherein logged the menu associated by the atomic function that user is assigned to and page elements metadata can be marked as "
Customization ".Page elements metadata assembling specification is to the effect that: menu id associated by page id, page path, the page,
Page elements id associated by the page.
Assembling atomic function: the design concept of atomic function is " user's value driving ", only encapsulation is significant to user
Function.Between atomic function independently of one another, the set of atomic function is the repertoire of intended application.Atomic function metadata fills
Join specification to the effect that: function id, function title, function declaration, function keyword, associated menu id, the association page are first
Element id, the id of relied on function.One function may rely on one or one group of function, it is also possible to does not rely on other functions.
Assembling function bag and sell bag: the mentality of designing of functional packet mainly considers three aspects: customer service, possess relevant
The atomic function of property, possesses the atomic function of dependence.Selling bag is the further encapsulation to functional packet, and object-oriented is to rent
Family.Functional packet/sale bag metadata assembles specification to the effect that: functional packet id, functional packet title, functional packet describe, merit
Can functional packet id that comprises of the atomic function id that comprise, functional packet.After tenant customization sells bag, can be comprised selling
Functional packet distribute to certain role, and allocation result is performed the dependency inspection of atomic function.
Tenant's customizing functions and function allocation flow such as Fig. 7, after application configuration person uploads assembling file, the tenant of application steps on
Record is obtained by metadata parsing module sell bag related content to customizing functions and distribution module, the latter, and tenant is the most customizable
Sell bag.Data isolation module ensures the data of each tenant of physical isolation so that it is do not interfere with each other.
Intended application is converted into operational process such as Fig. 8 after SaaS many tenants application, and the intended application that the present invention takes is base
In flex exploitation video conferencing system, extend request proxy module, page parsing module, event intercepts module, function is tested
Card module and tenant's service data isolation module.User logs in video conferencing system according to tenant's information and userspersonal information
Time, request proxy module sends the Metadata Service module of http request access application management platform and carries out authentication, passback
Access token.Before each webpage representation, page parsing module relies on request proxy module and sends page request, request agency
Module is called rest api according to token and page path and is carried out page data request access, return requests for page menu and
Page elements data;Wherein, user is assigned to the leaf menu corresponding to atomic function and page elements have been bound
Atomic function keyword, can be used for functional check.Disabled menu and page elements are hidden by page parsing module, and
Transfer all leaf menus to event intercept module carry out event binding corresponding with menu atomic function keyword binding.Menu
Time clicked, whether can use function according to keyword to functional verification module polls, functional verification module is then according to keyword
Whether can use with useful life's query function, unavailable, prompting user does not has operating right and stopping successor detectaphone to hold
OK.Intended application will carry out data isolation from the angle of tenant to user data at program run duration.
Above-described be only presently preferred embodiments of the present invention, all made in the range of the spirit and principles in the present invention appoint
What amendment, equivalent and improvement etc., should be included within the scope of the present invention.