Background technology
Comprehensive integration is that at present various large-scale, complicated software systems are built a generally basic fundamental route of employing of institute, it not only can make challenge be simplified, be easy to realize, and can in integrated, make rising to of systemic-function and performance, obtain bigger application benefit; Simultaneously, comprehensive integration has also been opened up new creation thought to the exploitation of software systems, the reusing of software, the basic demand that applied in any combination has become present research of software as required.Yet, comprehensive integration is not simply piecing together and bundling of correlation function assembly or system, but to make each integrated functional module or system constitute organically contact each other, make the system that obtains after integrated really become an organic whole, given play to the effect of " 1+1>2 ", reach this purpose, key is that each integrated assembly or the data message between the system are mutual.
At present, for the more existing achievements of the data interaction Study on Problems between each integrated functional module of integrated system inside, as regular dynamic base (DLL), MFC extended dynamic storehouse (DLL), com component, Web service etc., all design or adopted certain corresponding data interactive method, realize the information interaction problem between integrated package.Yet, fast development of computer technology, in the development while that greatly promotes and drive social all trades and professions, also new demand for development has been proposed for computer utility itself, its scale becomes increasingly complex, huge, often need the common collaborative development of how tame unit, industry particularly, merge and the field development, need original, the software systems of each self-separation are transformed (modularization) on demand, integrated, and these all relate to the problem that organically blends between each integrated package in the system integration, the more important thing is simultaneously and will solve functional module or the system data interaction problem in integrated that adopts different programming tool exploitations, make system can possess good adaptive faculty, it is integrated to satisfy various different systems, expand the ability that needs.This reality at software system development needs, existing at present many researchs, and some solutions are feasible, but integrated for the assembly of distinct program language development or system, these methods remain in certain limitation or use some complexity.
The one, the conversion existing problems of data type.Usually, different programming languages, standard that it is followed and the data type that is had are not quite similar, therefore in system integration data interaction, need carry out the corresponding data types conversion, can normally move with each ingredient of assurance system, and some present solutions still can not well be supported this demand.The 2nd, the dirigibility of solution is good inadequately.For a software application system, the adaptability of himself, expansibility and dirigibility have contact closely to the application benefit of system, the quality of data interaction solution then directly affects the lifting of system performance index, particularly to the plug and play of integrated package or system, flexibly, easy integrated etc. direct influence is arranged, it is desirable not enough that this solves at present popular data interactive method.
The present invention is just at above problem and demand, by concrete practice, research summary one cover resolution system integrated in the method for data interaction between each integrated package.
Summary of the invention
(1) goal of the invention
The method that the purpose of this invention is to provide a kind of software system build-in component data interaction, this method has solved the problems referred to above.
(2) summary of the invention
A kind of interaction method of software system build-in component data, this method are to set up a common data interactive agent on the integrated framework of software systems, and the data interaction between the described assembly is finished by the interface that described agency and assembly provide, and comprises step:
S101: the request msg assembly sends request according to the data interaction agreement to the agency;
S102: the described data interaction agreement of proxy resolution, locking has the assembly of data;
S103: the agency is according to system interaction data registration table, secondary data request to create control data piece RCB (RequestControl Block) in the common data buffer zone self opened up of agency alternately for this reason, and the RCB object handle returned to the request msg assembly;
S104: the agency obtains this module data storage portions and data instance sum by the interface call back function that data have assembly and provide;
S105: the agency obtains its data according to the interface that has data package and provide, and to its requirement according to the request msg assembly filter, conversion process, with the deposit data after handling in the data block that RCB identified;
S106: the RCB object handle that the request msg assembly obtains when filing a request, directly reading of data from act on behalf of the corresponding RCB object of buffer zone;
S107: the agency judges whether data in addition according to the interaction data instance objects sum that obtains, and then continues to read if having, if there is not then end data reciprocal process;
S108: the release function that request msg assembly readjustment agency provides discharges the RCB object.
Wherein, also comprise step:
S201: send the DSR that data package will need to transmit issue, and send request to the agency according to the data interaction agreement;
S202: the described data interaction agreement of proxy resolution, according to system interaction data registration table, press protocol requirement in the data buffer of self and distribute the corresponding RCB object of establishment, and the RCB object handle is returned to the transmission data package;
S203: the agency obtains this module data storage portions and data instance sum by the interface call back function that the transmission data package provides;
S204: the agency obtains its data according to sending the interface that data package provided, and to its according to the requirement that receives data package filter, conversion process, with the deposit data after handling in the data block that RCB identified;
S205: the agency will send the message that receives data to receiving data package, and the RCB object handle is offered the reception data package by receiving the interface function that data package provides to the agency;
S206: receive data package under the triggering of this message, by the RCB object handle reading of data that is provided is provided;
S207: the agency judges whether data in addition according to the interaction data instance objects sum that obtains, and then continues to read if having, if there is not then end data reciprocal process;
S208: the release function that sending data package readjustment agency provides discharges the RCB object.
Wherein, comprise also that before described step S101 and S201 assembly registers the step of its data in the mutual registration table of the system data that the agency provides.
Wherein, the mutual registration table of described system data comprises: data class and attribute thereof that the title of the assembly of log-on data, the unit of providing and people, type, filename, this assembly externally provide.
Wherein, described interaction protocol comprises: request msg have receiving unit that assembly or data transmit, request of data type, specifically request or the data item that sends.
System based on described interaction method of software system build-in component data comprises:
Be used for the request msg assembly sends request to the agency according to the data interaction agreement module;
Be used for the described data interaction agreement of proxy resolution, locking has the module of the assembly of data;
Be used for the agency according to system interaction data registration table, secondary data is created RCB alternately in the common data buffer zone self opened up of agency for this reason, and the RCB object handle is returned module to the request msg assembly;
Be used to act on behalf of the module that the interface call back function that has assembly and provide by data obtains this module data storage portions and data instance sum;
Be used to act on behalf of according to the interface that has data package and provide and obtain its data, and to its requirement according to the request msg assembly filter, conversion process, with the module of deposit data in the data block that RCB identified after handling;
Be used for the RCB object handle that the request msg assembly obtains when filing a request, directly the module of reading of data from act on behalf of the corresponding RCB object of buffer zone;
Be used to act on behalf of according to the interaction data instance objects sum that obtains and judge whether data in addition, then continue to read if having, if there is not the then module of end data reciprocal process;
The release function that being used for request msg assembly readjustment agency provides discharges the module of RCB object.
Wherein, this system also comprises:
Be used to send the DSR that data package will need to transmit issue, and send the module of request according to the data interaction agreement to the agency;
Be used for the described data interaction agreement of proxy resolution,, press protocol requirement in the data buffer of self and distribute the corresponding RCB object of establishment, and the RCB object handle is returned to the module that sends data package according to system interaction data registration table;
Be used to act on behalf of the module that the interface call back function that provides by the transmission data package obtains this module data storage portions and data instance sum;
Be used to act on behalf of according to sending the interface that data package provided and obtain its data, and to its according to the requirement that receives data package filter, conversion process, with the module of deposit data in the data block that RCB identified after handling;
Be used to act on behalf of and send the message that receives data to receiving data package, and the RCB object handle is offered the module that receives data package by receiving the interface function that data package provides to the agency;
Be used to receive data package under the triggering of this message, by the module of the RCB object handle reading of data that is provided is provided;
Be used to act on behalf of according to the interaction data instance objects sum that obtains and judge whether data in addition, then continue to read if having, if there is not the then module of end data reciprocal process;
The release function that being used to send data package readjustment agency provides discharges the module of RCB object.
(3) beneficial effect
The present invention has following beneficial effect:
1, reduced the consumption of data interaction, improved the entire system operational efficiency system resource;
2, avoid the degree of association of assembly exploitation, strengthened the dirigibility and the adaptability of the system integration;
3, simplify assembly exploitation and integrated difficulty, helped the integrated standardization and normalization of system.
Embodiment
The interaction method of software system build-in component data that the present invention proposes is described as follows in conjunction with the accompanying drawings and embodiments.
The present invention proposes a kind of interaction method of software system build-in component data.Its basic ideas are: set up a common data interactive agent (hereinafter to be referred as " agency ") on the integrated framework of system, data resource between each assembly is all finished by this agency alternately, and do not set up direct contact between each assembly, data interaction adopts masters monolateral two-way " request " and " response " mechanism to realize, that is: the mutual masters of initiating based on data interaction all the time of data, both can also can initiatively provide relevant data message to other assembly by agent data to other components request desired data by the agency.
As Fig. 1, Fig. 2 and shown in Figure 3, data requester is assembly a.When assembly a request obtained data, assembly b was for having data package, and this data interaction is " forward " data interaction, and assembly a proposes request of data completing steps S101; Data interaction agreement when the inner protocol resolver resolution component a of agency proposes request of data, the request that the data structure adaptation proposes according to assembly a, obtain the attribute information of corresponding data in the data structure registration table according to protocol-identifier, type, structure and the corresponding data length etc. that comprise data, and obtain having the assembly b of data, completing steps S102 by the person of being requested of appointment in the agreement; The agency will distribute the corresponding RCB object of establishment according to these information in the data buffer, and the RCB object handle is returned to assembly a, completing steps S103, and the data structure adaptation also has the misarrangement function simultaneously; The interface call back function that the agency provides by assembly b obtains this module data storage portions and data instance sum, completing steps S104; The agency obtains its data according to the interface that assembly b is provided, and to its according to the requirement of assembly a by data filter and data type converter filter, conversion process, with the deposit data after handling in the data block that RCB identified, completing steps S105; The RCB object handle that assembly a obtains when filing a request, direct reading of data from act on behalf of the corresponding RCB object of buffer zone, completing steps S106; Thereafter execution in step S107, the agency will judge whether data in addition according to the interaction data instance objects sum that obtains, and then continue reading of data if having, repeating step S105, S106, then end data is mutual if do not have; After data interaction was finished, the release function that assembly a readjustment agency provides discharged RCB object, i.e. step S108.When assembly a request sent data, assembly b was for receiving data package, and this data interaction be " oppositely " data interaction, assembly a proposition transmission request of data, and be ready to the data that will send, completing steps S201; Agreement when the inner protocol resolver resolution component a of agency proposes request of data, the request that the data structure adaptation proposes according to assembly a, obtain the attribute information of corresponding data in the data structure registration table according to protocol-identifier, type, structure and the corresponding data length etc. that comprise data, the agency will distribute the corresponding RCB object of establishment according to these information in the data buffer, and the RCB object handle returned to assembly a, completing steps S202; The interface call back function that the agency provides by assembly a obtains this module data storage portions and data instance sum, i.e. step S203; The agency obtains its data according to the interface that assembly a is provided, and to its according to the requirement of assembly b by data type converter and data filter change, filtration treatment, with the deposit data after handling in the data block that RCB identified, the agency receives data package b, completing steps S204 according to the object locking that is requested of appointment in the agreement; The agency sends the reception data-message to assembly b after the S204, and the RCB object handle is offered assembly b, completing steps S205; Assembly b is under this message trigger, by the RCB object handle reading of data from buffer zone that obtains, completing steps S206; Thereafter execution in step S207, the agency will judge whether data in addition according to the interaction data instance objects sum that obtains, and then continue reading of data if having, repeating step S204, S205, S206, then end data is mutual if do not have; After data interaction was finished, the release function that assembly a readjustment agency provides discharged RCB object, i.e. step S208.
Above-mentioned data interaction agreement comprises: request msg have receiving unit (during " oppositely " data interaction) that assembly (during " forward " data interaction) or data transmit, request of data type, specifically request or the data item that sends etc., the request of data type comprises: request obtains two kinds of data and request transmission data.Before the beginning data interaction, each assembly is registered its data in the mutual registration table of the system data that the agency provides, and these data comprise: data class and attribute thereof that the title of assembly, the unit of providing and people, type, filename, this assembly externally provide.
Data type converter in the said process adopts the BYTE type as conversion intermediary.During for solution " forward " data interaction, each integrated package registration, registration is used for and extraneous mutual data item (single argument or structure) in the matched data registration table, and with include the requestor (assembly a) data item of desired data for requiring, obtain the data of owner (assembly b), by acting on behalf of according to the concrete needs of requestor, the data that obtain are screened, and (assembly a) is specified the data of needs to filter out the requestor; During for " oppositely " data interaction, the agency then is by data filter, and (assembly is the data modification recipient's (assembly b) of issue corresponding data item initiatively a), notifies it to receive data after finishing, and upgrades the data of self with the requestor of data interaction.
The module of finishing above process comprises: be used for the request msg assembly sends request to the agency according to the data interaction agreement module; Be used for the described data interaction agreement of proxy resolution, locking has the module of the assembly of data; Be used for the agency according to system interaction data registration table, secondary data is created RCB alternately in the common data buffer zone self opened up of agency for this reason, and the RCB object handle is returned module to the request msg assembly; Be used to act on behalf of the module that the interface call back function that has assembly and provide by data obtains this module data storage portions and data instance sum; Be used to act on behalf of according to the interface that has data package and provide and obtain its data, and to its requirement according to the request msg assembly filter, conversion process, with the module of deposit data in the data block that RCB identified after handling; Be used for the RCB object handle that the request msg assembly obtains when filing a request, directly the module of reading of data from act on behalf of the corresponding RCB object of buffer zone; Be used to act on behalf of according to the interaction data instance objects sum that obtains and judge whether data in addition, then continue to read if having, if there is not the then module of end data reciprocal process; The release function that being used for request msg assembly readjustment agency provides discharges the module of RCB object.Also comprise: be used to send the DSR that data package will need to transmit issue, and send the module of request according to the data interaction agreement to the agency; Be used for the described data interaction agreement of proxy resolution,, press protocol requirement in the data buffer of self and distribute the corresponding RCB object of establishment, and the RCB object handle is returned to the module that sends data package according to system interaction data registration table; Be used to act on behalf of the module that the interface call back function that provides by the transmission data package obtains this module data storage portions and data instance sum; Be used to act on behalf of according to sending the interface that data package provided and obtain its data, and to its according to the requirement that receives data package filter, conversion process, with the module of deposit data in the data block that RCB identified after handling; Be used to act on behalf of and send the message that receives data to receiving data package, and the RCB object handle is offered the module that receives data package by receiving the interface function that data package provides to the agency; Be used to receive data package under the triggering of this message, by the module of the RCB object handle reading of data that is provided is provided; Be used to act on behalf of according to the interaction data instance objects sum that obtains and judge whether data in addition, then continue to read if having, if there is not the then module of end data reciprocal process; The release function that being used to send data package readjustment agency provides discharges the module of RCB object.
In the present embodiment, when interacting activity has only the interface function that provides to assembly by the agency when masters to file a request, offer the data exchange process of agency's interface function triggering Requested Party by assembly by the agency, after interacting activity finishes, the both sides of data interaction are decoupling at once, continue the task of execution itself separately, the agency is also corresponding simultaneously quits work and is released to this mutual memory source that distributes.So can reduce the inter-module data interaction greatly to the occupying of system operation time and resource, thereby improve the operational efficiency of total system; The mentality of designing that directly is not related between each assembly reduces the degree of association between assembly and the assembly greatly, has both guaranteed the independence of assembly self and complete, is convenient to exploitation and integrated, and the while has also strengthened the degree of flexibility and the adaptive faculty of the system integration.
Embodiment 1
The present invention adopts VC++ to realize, the data type definition is not quite similar causes the data can't directly mutual problem for solving different programming languages, the corresponding data type conversion method that provides is provided, simultaneously the structure of various functional modules is done following regulation: the functional module of the non-VC++ language of all uses (as Delphi, C++Builder etc.) exploitation, adopt the form exploitation of com component without exception, and the Interface (data and method interface) of respective standard is provided on request; If adopt the VC++ developer component, then can integrated system can be integrated various kit forms (as: general DLL, MFC Extension DLL, COM, etc.) make up.
The foundation of data interaction between the assembly is to set up automatically by the exploitation guide that the integrated system framework is provided, and guide can be that the assembly exploitation generates corresponding program frame by determined assembly development specifications.Based on this framework, secondary development person can finish the development of function corresponding assembly.When by guide formation component Development Framework, (can make by oneself by filename with automatic header file in the assembly engineering for guide, at this with " commv.h " name) in the class declaration (IDataGetAgent{ }) of the corresponding common data interactive agent of adding, and in integrated system project file " ProjectFile.cpp ", stated the common data interactive agent pointer (IDataGetAgent*m_pDataGetAgent=NULL of an overall situation; // interactive agent interface intelligent pointer), each functional module can by this pointer set up with act on behalf of between getting in touch, the various interface function that directly calls the agency and provided is realized the data interaction between the different assemblies.Concrete call method is shown below:
m_pDataGetAgent->FunctionName(P
1,P
2,......P
n);
P
1, P
2... P
nBe the function call parameter, can specifically determine its number and type according to the practical situations needs.
For realizing data interaction between the different assemblies, the agency provides one group of corresponding interactive interface to each functional module, the method interface that also requires each functional module to provide external module to visit its data resource to " agency " on request simultaneously.
In actual application, common data resource that is had for integrated system itself and application surface are wide, mutual frequent and inter-module data resource that adopt same programming tool to realize is mutual, exploitation also can be taked the method treated with a certain discrimination, one group of directly method interface of visit is provided in the agency, can directly call respective function by acting on behalf of pointer during use, to obtain desired data.
Below will provide agency and assembly set up get in touch after, method interface function and parameter declaration example that the agency should provide to assembly, how assembly reaches mutual method and step by the agency during with the explanation data interaction.
RequestGetData(P
1,P
2,......P
n)
The interactive request that this at first proposes for the data interaction initiator mainly is a value from certain data type (some attribute satisfies certain condition) that certain assembly has to proxy requests that obtain.The agency is by this power function, interface protocol according to the rules, finishing the data interaction request that the requestor is proposed explains, and call its Data Matching device, create the request control data piece handle RCBHandle that is used for this data interaction in the data buffer, and this handle is offered the request assembly as return parameters.Instantiation is as follows:
long?RequestGetData(
Long hWnd, // need this parameter outside component type is process the time,
Be defaulted as 0
BSTR ClassName, // provide data the class title (=module name. class name)
Long AttributeListHandle, // the attribute handle collection of data class, current use be provided
0, the value of all properties is obtained in expression
Long RegionHandle, // condition field, current is used 0
BSTR Tag, the bells and whistles that // data provider needs, for example data
Derive from file, current is used NULL
BSTR ModuleName); // request of data side self module title
If be reluctant to use object class, also can take the method for direct storage allocation, and the internal memory pointer that distributes is returned to the request assembly.
GetAttributeData(P
1,P
2,......P
n)
The request control block handle RCBHandle that the requesting party returns according to RequestGetData obtains the value of certain attribute to the agency, and the agency will obtain and filtering data from Requested Party by requestor's requirement, and call data converter, and data-switching is become BYTE; Deposit the data buffer after the processing in, whether successful the rreturn value of function be to obtain data sign, represent successfully and the number of the record object that fetches data greater than 0, otherwise expression failed.Function parameters is looked concrete condition for fixed, and instantiation is as follows:
long?GetAttributeData(
Long hWnd, // outside component type is process the time, need this parameter
Long RCBHandle, // request control block handle, RequestGetData returns
Value
BSTR AttributeName, // Property Name of data, this parameter are provided is NULL
The time, round the data content of object, only be fixing
The class of length just can be used like this
BYTE*pValue); // return data content
MoveNext(P
1)
The requesting party obtains next object instance data among the RCB to proxy requests, and parameter is the handle of this RCB, is obtained by RequestGetData, and whether successful its rreturn value be operation sign, and common 1 represent successfully, and 0 represents to fail.Instantiation is as follows:
long?MoveNext(long?RCBHandle);
Release(P
1)
When data interaction was finished, the requestor should call this function, acted on behalf of the mutual RCB that distributes that created of secondary data for this reason with release, this operation must with the supporting use of RequestGetData (), whether successful its rreturn value be operation sign, and common 1 represent successfully, and 0 represents to fail.Instantiation is as follows:
long?Release(long?RCBHanlde);
Below be the interface that assembly offers the agency:
GetDataBlockHandle(P
1)
The agency will obtain data provider's data-storing district by this function, and with this as the basis that obtains data, its rreturn value is the storage piece handle BlockHandle of data provider real data.Instantiation is as follows:
Long GetDataBlockHandle (BSTR Tag); // request of data side offers the provider
Bells and whistles
GetTotalObject(P
1,P
2,......P
n)
The agency obtains the object instance sum of specified class ClassName to the data provider, so that control when subsequent reads is fetched data, its rreturn value is the object instance sum.Instantiation is as follows:
long?GetTotalObject(
Long BlockHandle, // storage piece the handle that acquires by GetDataBlockHandle
BSTR ClassName); // provide data the class title (=module name. class name)
GetObjectData(P
1,P
2,......P
n)
To data provider acquisition request data value, its rreturn value is for operating successfully sign by this function for the agency, and 1 represents successfully, 0 expression failure.Instantiation is as follows:
long?GetObjectData(
Long hWnd, // need this parameter outside component type is process the time, be defaulted as 0
Long BlockHandle, // storage piece the handle that acquires by GetDataBlockHandle
BSTR ClassName, // provide data the class title (=module name. class name)
Long ObjectIndex, // need obtain data and be in the sum which
BYTE*pValue); // return data content
Above embodiment only is used to illustrate the present invention; and be not limitation of the present invention; the those of ordinary skill in relevant technologies field; under the situation that does not break away from the spirit and scope of the present invention; can also make various variations and modification; therefore all technical schemes that are equal to also belong to category of the present invention, and scope of patent protection of the present invention should be defined by the claims.