Embodiment
In order to be better understood from above-mentioned technical proposal, below by accompanying drawing and specific embodiment to this specification embodiment
Technical scheme be described in detail, it should be understood that the specific features in this specification embodiment and embodiment are to this explanation
The detailed description of book embodiment technical scheme, rather than the restriction to this specification technical scheme, in the case where not conflicting,
Technical characteristic in this specification embodiment and embodiment can be mutually combined.
Exploitation for all kinds of APP, each APP are combined by component one by one, and APP development teams need
A set of framework manages the component of oneself.Because each component is element independent one by one in itself, it is between each element
It is uncoupled, so when being combined into an application, it is necessary to which framework manages the data and service logic relation between them, mesh
Preceding more modes using succession are managed, so as to which each component is associated.For example, " model-view-controller "
The development frame of (Model View Controller, MVC) pattern, MVC frameworks can make business and show separation, can make
The APP of exploitation has powerful modular functionality, abundant configuration information and gorgeous visual effect.
In APP development fields, the use for data model in client never has specific use pattern and fixation
Method, the request to data is needed on stream, is locally stored, data variation detection, responded according to data variation
(interface refreshes or other linkages) carry out complicated processing and operation, relatively more efficient refinement and unified processing side
Method, this specification embodiment mainly solve the problems, such as client data model general procedure in this respect, there is provided data renewal, deposit
Storage, a series of general-purpose capabilities such as notice of data variation.
It is this specification embodiment client-side APP development system configuration diagrams referring to Fig. 1.The system includes business
Device 11, data, services provide device 12, client storage 13 and network request device 14.Wherein, data, services provide
Device 12 can be understood as the data middleware of client-side APP exploitations, and by taking MVC frameworks as an example, the data, services provide dress
Put 12 and essentially consist in M (model) layer, there is provided client data service, including but not limited to the following aspects:Data storage with
Caching, data variation notice, the network request to data are packaged, data preload, various data Layers optimize.The data take
Business provides the data-centered docking upper-layer service device 11 of device 12 (the business interface of native/JS/DOM descriptions) and presented,
Unified data, services are provided;The optimization of data constantly can strengthen in this aspect, not influence interface presentation.It is upwards business
Device 11 provides data-related services, simplifies business development, shields Internet and accumulation layer details, reduce operation layer to storage and
The dependence of network details.Downwards with Storage Middleware Applying (client storage 13) and Internet middleware (network request device
14) and docked, by the flow chart of data processing of unified standardization, improve the stability of a system, stream compression efficiency, enhancing
Scalability and monitoring property.
In a first aspect, this specification embodiment, which provides a kind of data, services, provides device, Fig. 2 is refer to, is taken for the data
Business provides apparatus structure schematic diagram.
Lead to as it was previously stated, the data, services provide device with service apparatus, client storage and network request device
Letter, specifically, the data, services, which provide device, includes Logic control module 201, storage adaptation module 202 and network adaptation module
203。
Logic control module 201 is the kernel control module that data, services provide device, is responsible for whole data, services and provides
The processing logic of data in device.Specifically, at least one data are taken out according to data traffic attributes and data manipulation method
Model;According to the data processing command of service apparatus, corresponding data model is run, wherein, storage adaptation module is called, to visitor
Family end data is controlled, and/or, network adaptation module is called, network data is controlled.
Adaptation module 202 is stored, for providing the memory interface to be communicated with client storage.Store adaptation module
202 have unified storage relevant interface, are docked with the storage device (being locally stored) of lower floor, can dock different types of lower floor
Storage system.
Network adaptation module 203, for providing the network interface to be communicated with network request device.Network adaptation module 203
It is the relevant interface that network request is uniformly processed, is docked with network SDK (SDK).
In an optional mode, data, services provide device also include event center module 204, be responsible for processing data with
The functions such as the registrations of network related events, notice.For example, for providing event notice registration interface to service apparatus, and be industry
Device registration event of being engaged in notice;When data change event or network change event occurs, data variation is sent to service apparatus
Notice or network change notice.
In an optional mode, data, services, which provide device, also includes configuration management module 205, for managing each number
According to the configuration information in model;And metadata management module 206, for managing the metadata in each data model.Its
In, the configuration information in data mould includes the parameters of model, such as model size parameter and organizational structure parameter;Metadata
(Metadata) refer to the information for describing data attribute, be used to refer to storage location, historical data, resource lookup, file record
Deng.
In an optional mode, data, services, which provide device, also includes data preloaded components 207, in data wash with watercolours
Before contaminating client end interface, client data is carried out pre-loaded.Data preloaded components 207 are that data, services provide dress
The data of client are preloaded, using it by a relatively independent auxiliary function module by way of configuring in putting
The effect that the APP interfaces second opens can be reached in many scenes afterwards.
In this specification embodiment, data model (is referred to as business model) in MVC frameworks, is data traffic attributes and number
According to the set of operating method.In data, services provide device, abstracted by the behavior related to Model, with service
The CRUD (increase (Create), read inquiry (Retrieve), renewal (Update) and delete (Delete)) at end is similar, specifically
Scene with reference to client is again different, in a specific example, specifically takes out following seven kinds of data models:
Data model (RemoteGet Model) is obtained from service end:From service end acquisition/renewal (Get/Update) number
According to;
Data model (RemoteSet Model) is provided to service end:(Set/ is preserved to service end setting/modification
Commit) data;
Data model (RemoteDelete Model) is deleted from service end:Data are deleted from service end;
Data model (LocalGet Model) is obtained from client:Data are read from client (local);
To clients providing data model (LocalSet Model):Data are stored in client (local);
Data model (LocalDelete Model) is deleted from client:Client (local) deletes data;
Memory resident data scrubbing model (MemoryClear Model):To the Model of client runtime terminate-and-stay-resident
Data are cleared up.
As it was previously stated, data processing command of the Logic control module 201 according to service apparatus, runs corresponding data mould
Type.Specifically, Logic control module 201 calls storage adaptation module 202, data are provided, from client to client storage
Hold storage device to obtain data or delete data from client storage;And network adaptation module 203 is called, to clothes
Business end provides data, data are obtained from service end or deletes data from the service end.For example, when service apparatus is initiated locally
When data acquisition (LocalGet) is ordered, Logic control module 201 performs corresponding LocalGet Model, is stored from client
Device obtains data.For another example, when service apparatus initiates internal storage data cleaning (MemoryClear) order, Logic control module
The Model data of client runtime terminate-and-stay-resident are cleared up by 201 operation MemoryClear Model.
It is illustrative to data processing sequential in two typical data models below with instantiation.
Referring to Fig. 3, provided for the data, services that this specification embodiment first aspect provides in device example from client
Obtain the processing timing diagram of data model.In " obtaining data model from client " shown in Fig. 3, only relate to data, services and carry
For the Logic control module in device, storage adaptation module.Therefore other modules are not shown.
S301:Service apparatus initiates Local Get requests to Logic control module;
S302:Logic control module searches Local Get Model data in own cache, if found, performs;
If do not found, S304 and subsequent step are performed;
S303:Logic control module returns data to service apparatus;
S304:Logic control module to storage adaptation module searching data;
S305:Storage adaptation module loads data from storage device;
S306:Storage device to storage adaptation module returned data;
S307:Adaptation module is stored to Logic control module returned data;
S308:Logic control module returns data to service apparatus.
Referring to Fig. 4, provided for the data, services that this specification embodiment first aspect provides in device example from service end
Obtain the processing timing diagram of data model.In " obtaining data model from service end " shown in Fig. 4, it is related to data, services offer
Logic control module, storage adaptation module, network adaptation module and event center module in device.
S401:Service apparatus notifies to event center Module registers data variation notice and network change;
S402:Service apparatus initiates RemoteGet requests to Logic control module;
S403:Logic control module initiates RemoteGet requests to network adaptation module;
S404:Network adaptation module initiates RemoteGet requests to network request device;
S405:Network request device returns to RemoteGet Model data (network data) concurrently to Logic control module
Play LocalSet operations;
S406:Logic control module initiates LocalSet requests to storage adaptation module;
S407:Network data storage is arrived storage device by storage adaptation module;
S408:Network adaptation module notifies according to network state change triggers event center;
S409:Event center module sends network Notification of Changes to service apparatus;
S410:Adaptation module is stored according to data variation trigger event center notice;
S411:Event center module sends data Notification of Changes to service apparatus;
S412:Service apparatus response to network Notification of Changes or data Notification of Changes, are updated to interface.
The data, services realization device provided using this specification embodiment, for request of data, storage, data acquisition etc.
Behavior, which has, compares More General Form, and most conventional application model is as shown in Figure 5:
S501:Service apparatus notifies to data, services realization device log-on data and network change;
S502:According to the order of service apparatus, data, services realization device reads local number by localGet Model
According to progress interface renders;
S503:According to the order of service apparatus, data, services realization device initiates RemoteGet and obtains network data;
S504:When data and network change, data, services realization device notice service apparatus carries out interface state renewal.
It can be seen that the data, services provided by this specification embodiment provide device, according to data traffic attributes and data
Operating method takes out multiple data models, and runs corresponding data model according to data processing command, and this mode is advance
General data model is taken out, sharing for data model in all kinds of APP development processes can be facilitated, opened without each APP
In hair or escalation process, request and storage to data etc. carry out complicated processing and operation.This specification embodiment is led to
The flow chart of data processing of unified standardization is crossed, the stability of a system, stream compression efficiency, enhancing scalability is improved and can monitor
Property.
Second aspect, based on same inventive concept, this specification embodiment provides a kind of data, services implementation method, the party
Method is used to interact so as to provide data, services with service apparatus, client storage and network request device.It refer to
Fig. 6, this method include:
S601:At least one data model is taken out according to data traffic attributes and data manipulation method.
Data model includes but is not limited to:Data model is obtained from service end, data model is provided to service end, from service
Data model is deleted, data model is obtained from client, deletes data mould to clients providing data model, from client in end
Type, memory resident data scrubbing model.
S602:According to the data processing command of service apparatus, corresponding data model is run, wherein, calling and client
The communication interface of storage device, is controlled to client data, and/or, the communication interface with network request device is called, it is right
Network data is controlled.
In an optional mode, the communication interface of the calling and the client storage, to number clients
According to being controlled, including:Call with the communication interface of the client storage, to client storage provide data,
Data are obtained from client storage or delete data from the client storage;The calling please with the network
The communication interface of device is sought, network data is controlled, including:The communication interface with the network request device is called, to
Service end provides data, data are obtained from service end or deletes data from the service end.
In an optional mode, the above method also includes:The data that internal memory is resided in during being run to client are entered
Row cleaning.
In an optional mode, the above method also includes:Event notice registration interface is provided to the service apparatus, and
For the service apparatus registration event notification;When data change event or network change event occurs, to the service apparatus
Send data variation notice or network change notice.
In an optional mode, in addition to:Before data render to client end interface, client data is carried out pre-
First load.
This specification is with reference to the method, equipment (system) and computer program product according to this specification embodiment
Flow chart and/or block diagram describe.It should be understood that can be by every in computer program instructions implementation process figure and/or block diagram
One flow and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computers can be provided
Processor of the programmed instruction to all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices
To produce a machine so that produce use by the instruction of computer or the computing device of other programmable data processing devices
In setting for the function that realization is specified in one flow of flow chart or multiple flows and/or one square frame of block diagram or multiple square frames
It is standby.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to
Make the manufacture of equipment, the commander equipment realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or
The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted
Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, so as in computer or
The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one
The step of function of being specified in individual square frame or multiple square frames.
Although having been described for the preferred embodiment of this specification, those skilled in the art once know basic wound
The property made concept, then other change and modification can be made to these embodiments.So appended claims are intended to be construed to include
Preferred embodiment and fall into having altered and changing for this specification scope.
Obviously, those skilled in the art can carry out various changes and modification without departing from this specification to this specification
Spirit and scope.So, if these modifications and variations of this specification belong to this specification claim and its equivalent skill
Within the scope of art, then this specification is also intended to comprising including these changes and modification.