The present invention relates to wireless communications and in particular to a method and system for generating safe and efficient component relationships in wireless applications.
The number and variety of wireless terminal devices, such as mobile telephones, personal computers and PDAs with wireless communication capabilities, self-service kiosks and two-way pagers are rapidly increasing. Software applications which run on these devices increase their utility. For example, a mobile phone may include an application which retrieves the weather for a range of cities, or a PDA may include an application that allows a user to shop for groceries. These software applications take advantage of wireless connectivity to a data network (such as the Internet) in order to provide timely and useful services to users.
Referring to
The AG 2 generally operates to mediate message flows between the terminal devices 8 and data services 10 accessible through the data network in the manner described in Applicant's co-pending U.S. Patent Publications Nos. 2004/0215700 and 2004/0220998, the contents of both of which are incorporated herein by reference.
In general, the terminal devices 8 can be any of a wide variety of software-controlled wireless devices including, but not limited to, mobile telephones, personal computers and PDAs with wireless communication capabilities, self-service kiosks and two-way pagers. As is well known in the art, such devices generally comprise a microprocessor which operates under software control to provide the functionality of the terminal device 8.
As described in Applicant's co-pending U.S. Patent Publications Nos. 2004/0215700 and 2004/0220998, operation of the AG 2 enables a wireless application executing in a terminal device 8 to communicate with Web services 10 offered through the data network 6. This operation may, for example, including accessing HTML content and downloading files from back-end data sources (not shown) connected to the data network 6. In order to reduce device resource requirements, each wireless application provides User Interface (UT) functionality (for both display and user input) appropriate to the capabilities of the particular terminal device 8. At least a portion of the application logic is executed on the AG 2, so that signalling between the AG 2 and the terminal device 8 is limited to downloading application data for local storage and display on the terminal device 8, and uploading user inputs. The application logic executing on the AG 2 communicates with a Web service 10 or back-end data source (not shown) on the data network 6, in response to the user input received from the terminal device 8, to provide the functionality of the wireless application. This arrangement enables a user of the terminal device 8 to access and use the Web service 10, but with reduced signalling traffic to/from the terminal device 8 to thereby limit wireless network bandwidth and device resource requirements.
As will be appreciated, instantiation of data components of an application during runtime is governed by relationships between different components, called “inheritance” (or “prototyping”) and “aggregation”. These are also known in the art as “is-a” and “has-a” relationships, respectively. The former refers to one component A being a specialization of another component B. The latter refers to one component C having as part of it another component D. When either relationship exists, the instantiation of one component invokes the instantiation of another component. Component A cannot be instantiated until component B has. Component C cannot be instantiated until component D has.
A malicious programmer may try to define these relationships in such a way that infinite loops are created when instantiating components on the device. Such infinite loops may cause device lock-ups, application crashes and saturation of resources such as memory, so they are undesirable. Furthermore, a programmer may inadvertently and without malice create such relationships and unknowingly deploy equally undesirable wireless applications.
In practice, two main types of relationships should be avoided. The first is a “direct” recursive loop such as that illustrated in
In languages like Java and C++, the above-described recursive relationship can be created dynamically in the following manner:
With this situation, creating an instance of any of classes A, B or C (during runtime) will cause the application to loop recursively, creating ever-deeper nesting of objects a, b and c until the host computer's stack overflows or memory runs out. Conventional compilers and runtime systems provide no mechanisms that prevent the programmer from creating these kinds of recursive loops.
The second relationship type is more subtle. Because data components allow inheritance, it is possible to create a situation where a recursive loop is created indirectly. Such an “indirect” recursive loop is illustrated in
Existing systems that allow initialization of data leave it to the programmer to avoid both of the above situations. However this arrangement is not acceptable on wireless devices, because a provider of wireless services may be held responsible for the behaviour of applications created by third-party application developers who are outside of the service provider's control.
Accordingly, methods and systems for enforcing safe component relationships in wireless applications remain highly desirable.
Accordingly, an object of the present invention is to provide methods and systems for generating safe component relationships in wireless applications.
This object is met by the features of the invention defined in the appended independent claims. Further optional features of the invention are defined in the appended dependent claims.
Thus, an aspect of the present invention provides a method of detecting recursive instantiation loops in a wireless application. A data model digraph is constructed including a respective node for each data component in the wireless application, and a respective edge for each relationship between a pair of data components. The data model digraph is searched to identify any cycles. For each identified cycle, each data component that participates in the cycle is identified.
Further features and advantages of the present invention will become apparent from the following detailed description, taken in combination with the appended drawings, in which:
a and 2b schematically illustrate respective types of recursive relationships;
a and 4b are flowcharts illustrating principal steps in a method of identifying cycles in accordance with a representative embodiment of the present invention; and
It will be noted that throughout the appended drawings, like features are identified by like reference numerals.
The present invention provides methods and systems for generating safe component relationships in wireless applications. A representative embodiment of the invention is described below, by way of example only.
As is well known in the art, application developers typically use an application development environment (ADE) to code, test, and debug application software. In accordance with the present invention, an ADE for developing wireless applications includes one or more components implementing an algorithm that can detect recursive loops in the instantiation of data components of a wireless application. In one embodiment, the algorithm is an improvement of the known “Depth First Search”, which is targeted to this type of problem.
To facilitate description of the present embodiment, it is useful to establish the following terminology.
A “graph” is a group of “nodes” and “edges”. Each edge defines a connection between two nodes. A path between two nodes A and B is a sequence of one or more edges that connect A to B. A path may traverse any number of nodes between the two nodes A and B. If there are two distinct paths between a pair of nodes A and B, the graph is said to have a “cycle”.
A “digraph” is a “directed” graph in which each edge has a direction; such edges are also known in the art as “directed edges.” Thus, for example, a node A may have an edge that connects it to node B, but node B may not have an edge that connects it back to node A. If there is an edge e from A to B then we say that A is the “source node” and B is the “destination node”.
A “DataModel” can be defined as a set D of n data components of a wireless application. Each data component, di, (1≦i≦n) has a set of fields F(di). Each field has a type, which may be either simple or complex. For any given data component di, let F′(di) represent the subset of fields of a type defined in D. This means that each field within F′(di) is of a type which is itself a data component. With this arrangement, F′(di) is the set of fields of the data component di that are “related to” other data components. In other words, F′(di) identifies the set of data components that are linked to the data component di via either explicit instantiation or inheritance.
Based on the foregoing, a “DataModelDigraph” can be defined as a digraph of a data model, in which each node corresponds to a data component di; and each edge with source node di corresponds to a link defined in the set F′(di). Thus, each node in a DataModelDigraph represents a data component, and each edge is a field of a data component which is also a data component. As such, each edge represents a relationship (either via instantiation or inheritance) between a pair of data components. By way of example,
In general, recursive instantiation loops within a wireless application can be detected by a process in which a data model digraph is constructed for the application, in which each data component is represented by a respective node, and each relationship (via either instantiation or inheritance) between a pair of data components is represented by a respective edge between the corresponding nodes. The data model digraph is then systematically searched to identify any cycles. Each cycle is then analyzed to detect each node (data component) that participates in the cycle. In a representative embodiment, each of these three steps can be accomplished using the algorithm described below:
Step 1: Constructing a DataModelDigraph from a DataModel
A Data Model can be constructed by analysing the source code of an application to identify the set D of data components di (1≦i≦n) that are defined in the application, and, for each data component di, its respective set of fields F(di). Once the data model has been constructed, the corresponding data model digraph can be generated using process outlined in
Following execution of the above process, the set N will contain each of the nodes of the Data Model Digraph, and E will contain its edges. Together, sets N and E constitute the Data Model Digraph.
Step 2: Detecting cycles
Detection of cycles within the Data Model Digraph generally involves systematically searching the sets N and E to identify closed loops of edges. In a representative embodiment, this can be accomplished using the methods illustrated in
Referring to
On the other hand, if the “VisitAllPaths” function returns a value of “CycleFound=true”, then the LIFO PathStack will contain all of the edges that define the cycle. In fact, the LIFO PathStack may contain more edges than actually participate in the cycle since the cycle may not have become part of the path until some (unknown) number of nodes had been explored. However the top-most edge in PathStack will be the last edge of the cycle. Accordingly, all of the edges that participate in the cycle can be isolated by POPing each edge from the PathStack (S22); checking to determine if the source node of that edge has already been added to the list of participants P (S24), and, if it has not, adding the edge's source node to the participants list P (at S26). When it is found (at S24) that the source node of the POPed edge is already in the participants list P, then it is determined that all of the participants in the cycle have been isolated, and information regarding the cycle (e.g. a cycleID and the list of participants P) can be saved (at S28) for later analysis. If any nodes remain in the set N which have not been checked (S18), the next node d is selected from the set N (steps S20 and S12), and tested in the above manner.
As described above, detection of a cycle is accomplished by way of a function call to the “VisitAllPaths” function. A representative “VisitAllPaths” function is illustrated in
Thus, at a first step (S30), the node d (passed as a parameter) is checked to 5 determine if it is already in the LIFO NodesVisited. If it is, then the function returns a CycleFound value of “true” (step S32). Otherwise, the node d is pushed to NodesVisited (S36), and a first edge with source node d selected from the set E of the Data Model Digraph (S38).
The selected edge is PUSHed to PathStack (S40), and the edge's destination node selected (S42) is used as a parameter of a call to the “VisitAllPaths” function (S44). As will be appreciated, this sets up recursive calls to the “VisitAllPaths” function, which enables cycles of any number of edges to be identified, thereby ensuring that any cycles in the Data Model Digraph will be found, regardless of their length.
Upon return of the “VisitAllPaths” function (S44), the value of CycleFound is checked (at S46). If “CycleFound=true”, then the function returns “CycleFound=true” (at S32). Because of the recursive nature of the function, this step has the effect of unwinding any nested function calls to “VisitAllPaths”. If, on the other hand, the returned value of CycleFound is “false”, then the edge is not part of a cycle. Accordingly, the edge is POPed from the PathStack (at S48). If there are any other edges with source node d which have not yet been checked (S50), a next edge is selected (at S52) and processed as described above starting at step S40. If it is determined (at S50) that all of the edges with source node d have been checked, then the node d can be POPed from the LIFO NodesVisited (at S54), and the function returns “CycleFound=false” (at S56).
Once each cycle has been detected and the respective set of participants identified for each cycle, the application development environment (ADE) can make this information available to the application developer. As a result, the application developer is made aware of a potentially deleterious operation state of the application, and can take appropriate steps to avoid that issue (e.g. by revising one or more data components to “break” any cycles). The ADE may also provide one or more utilities or wizards to assist the application developer in the task of eliminating cycles from the application.
In addition, a service provider of a wireless network can refuse to deploy a wireless application until the application developer demonstrates (e.g. by use of the above-described methods) that there are no unresolved cycles within the application. For example, when the application developer decides to release a version of an application for deployment on the network, the ADE can be used to test the “release” version as described above to verify that there are no cycles. Upon successful verification of the application, the ADE may automatically generate a certificate which indicates that the “release” version of the application is safe. In order to prevent fraud by the application developer, information in the certificate identifying the release version may be may be encrypted or hashed using methods known in the art. The certificate can then be sent to the network service provider, which then permits deployment of the release version of the application on the network.
The embodiment(s) of the invention described above is(are) intended to be representative only. The scope of the invention is therefore intended to be limited solely by the scope of the appended claims.
The present application is based on and claims benefit under 35 U.S.C. §119(e) of Applicant's U.S. Patent Application No. 60/672,008 filed Apr. 18, 2005.
Number | Name | Date | Kind |
---|---|---|---|
5481717 | Gaboury | Jan 1996 | A |
5963739 | Homeier | Oct 1999 | A |
6633863 | Sørensen Møller et al. | Oct 2003 | B1 |
6691207 | Litt et al. | Feb 2004 | B2 |
6918108 | Rajaram | Jul 2005 | B2 |
7006960 | Schaumont et al. | Feb 2006 | B2 |
7117395 | Opaterny | Oct 2006 | B2 |
7548935 | Pecherer | Jun 2009 | B2 |
7779393 | Manovit et al. | Aug 2010 | B1 |
7870541 | Deshpande | Jan 2011 | B1 |
20020013779 | Sridhar | Jan 2002 | A1 |
20020013934 | Xie et al. | Jan 2002 | A1 |
20020083314 | Uyttendaele et al. | Jun 2002 | A1 |
20030066064 | Rajaram | Apr 2003 | A1 |
20030191942 | Sinha et al. | Oct 2003 | A1 |
20040083222 | Pecherer | Apr 2004 | A1 |
20040154009 | Reynaud | Aug 2004 | A1 |
20050015752 | Alpern et al. | Jan 2005 | A1 |
20050044531 | Chawla et al. | Feb 2005 | A1 |
20060248515 | Qadeer et al. | Nov 2006 | A1 |
20060253571 | Bateman et al. | Nov 2006 | A1 |
20070113059 | Tran | May 2007 | A1 |
Number | Date | Country | |
---|---|---|---|
20060253571 A1 | Nov 2006 | US |
Number | Date | Country | |
---|---|---|---|
60672008 | Apr 2005 | US |